Browse Source

renderer.data > renderer.info

Mr.doob 14 years ago
parent
commit
0a60ac30a7

+ 224 - 221
build/Three.js

@@ -27,8 +27,8 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12,
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12,
-H=c.n13,M=c.n14,R=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,S=c.n33,U=c.n34,da=c.n41,Q=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*R+h*W+m*da;this.n12=e*G+f*J+h*D+m*Q;this.n13=e*H+f*I+h*S+m*o;this.n14=e*M+f*K+h*U+m*pa;this.n21=k*E+n*R+t*W+u*da;this.n22=k*G+n*J+t*D+u*Q;this.n23=k*H+n*I+t*S+u*o;this.n24=k*M+n*K+t*U+u*pa;this.n31=w*E+v*R+x*W+p*da;this.n32=w*G+v*J+x*D+p*Q;this.n33=w*H+v*I+x*S+p*o;this.n34=w*M+v*K+x*U+p*pa;this.n41=y*E+z*R+A*W+C*da;this.n42=y*G+z*J+A*D+C*Q;this.n43=y*H+z*I+A*S+C*o;this.n44=
-y*M+z*K+A*U+C*pa;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*=
+H=c.n13,M=c.n14,Q=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,R=c.n33,T=c.n34,V=c.n41,X=c.n42,o=c.n43,ha=c.n44;this.n11=e*E+f*Q+h*W+m*V;this.n12=e*G+f*J+h*D+m*X;this.n13=e*H+f*I+h*R+m*o;this.n14=e*M+f*K+h*T+m*ha;this.n21=k*E+n*Q+t*W+u*V;this.n22=k*G+n*J+t*D+u*X;this.n23=k*H+n*I+t*R+u*o;this.n24=k*M+n*K+t*T+u*ha;this.n31=w*E+v*Q+x*W+p*V;this.n32=w*G+v*J+x*D+p*X;this.n33=w*H+v*I+x*R+p*o;this.n34=w*M+v*K+x*T+p*ha;this.n41=y*E+z*Q+A*W+C*V;this.n42=y*G+z*J+A*D+C*X;this.n43=y*H+z*I+A*R+C*o;this.n44=y*
+M+z*K+A*T+C*ha;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,t=this.n31,u=this.n32,w=this.n33,v=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*u*x-e*n*u*x-f*m*w*x+c*n*w*x+e*m*v*x-c*k*v*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*v*p+b*k*v*p+f*m*t*y-c*n*t*y-f*h*u*y+b*n*u*y+c*h*v*y-b*m*v*y-e*m*t*z+c*k*t*z+e*h*u*z-b*k*u*z-c*h*
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,t=this.n31,u=this.n32,w=this.n33,v=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*u*x-e*n*u*x-f*m*w*x+c*n*w*x+e*m*v*x-c*k*v*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*v*p+b*k*v*p+f*m*t*y-c*n*t*y-f*h*u*y+b*n*u*y+c*h*v*y-b*m*v*y-e*m*t*z+c*k*t*z+e*h*u*z-b*k*u*z-c*h*
 w*z+b*m*w*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 w*z+b*m*w*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
@@ -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=t[n]=t[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,t=[],u,w,v=[],x,p=[],y,z,A=[],C,E,G=[],H=[],M=[],R=new THREE.Vector4,J=new THREE.Vector4,
-I=new THREE.Matrix4,K=new THREE.Matrix4,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=H.length=0;
-o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var v=n.matrixWorld,t=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=W[u].x*v.n14+W[u].y*v.n24+W[u].z*v.n34+W[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=m[h]=m[h]||new THREE.RenderableObject,h++,f=p,R.copy(n.position),I.multiplyVector3(R),f.object=n,f.z=R.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
-function(f,h,m){var o=h.near,H=h.far,R,ma,ca,na,ja,la,ga,Z,V,$,ea,ka,ta,N,fa,ra,ua;E=z=x=w=M.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);W[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);W[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);W[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);W[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);W[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
-W[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(R=0;R<6;R++)V=W[R],V.divideScalar(Math.sqrt(V.x*V.x+V.y*V.y+V.z*V.z));V=this.projectObjects(f,h,!0);f=0;for(R=V.length;f<R;f++)if($=V[f].object,$.visible)if(ea=$.matrixWorld,ka=$.matrixRotationWorld,ta=$.materials,N=$.overdraw,n=0,$ instanceof THREE.Mesh){fa=$.geometry;na=fa.vertices;ra=fa.faces;fa=fa.faceVertexUvs;ma=0;for(ca=na.length;ma<ca;ma++)k=b(),k.positionWorld.copy(na[ma].position),ea.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
-I.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<H;na=0;for(ma=ra.length;na<ma;na++){ca=ra[na];if(ca instanceof THREE.Face3)if(ja=t[ca.a],la=t[ca.b],ga=t[ca.c],ja.visible&&la.visible&&ga.visible&&($.doubleSided||$.flipSided!=(ga.positionScreen.x-ja.positionScreen.x)*(la.positionScreen.y-ja.positionScreen.y)-(ga.positionScreen.y-ja.positionScreen.y)*(la.positionScreen.x-ja.positionScreen.x)<
-0))Z=v[w]=v[w]||new THREE.RenderableFace3,w++,u=Z,u.v1.copy(ja),u.v2.copy(la),u.v3.copy(ga);else continue;else if(ca instanceof THREE.Face4)if(ja=t[ca.a],la=t[ca.b],ga=t[ca.c],Z=t[ca.d],ja.visible&&la.visible&&ga.visible&&Z.visible&&($.doubleSided||$.flipSided!=((Z.positionScreen.x-ja.positionScreen.x)*(la.positionScreen.y-ja.positionScreen.y)-(Z.positionScreen.y-ja.positionScreen.y)*(la.positionScreen.x-ja.positionScreen.x)<0||(la.positionScreen.x-ga.positionScreen.x)*(Z.positionScreen.y-ga.positionScreen.y)-
-(la.positionScreen.y-ga.positionScreen.y)*(Z.positionScreen.x-ga.positionScreen.x)<0)))ua=p[x]=p[x]||new THREE.RenderableFace4,x++,u=ua,u.v1.copy(ja),u.v2.copy(la),u.v3.copy(ga),u.v4.copy(Z);else continue;u.normalWorld.copy(ca.normal);ka.multiplyVector3(u.normalWorld);u.centroidWorld.copy(ca.centroid);ea.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);I.multiplyVector3(u.centroidScreen);ga=ca.vertexNormals;ja=0;for(la=ga.length;ja<la;ja++)Z=u.vertexNormalsWorld[ja],Z.copy(ga[ja]),
-ka.multiplyVector3(Z);ja=0;for(la=fa.length;ja<la;ja++)if(ua=fa[ja][na]){ga=0;for(Z=ua.length;ga<Z;ga++)u.uvs[ja][ga]=ua[ga]}u.meshMaterials=ta;u.faceMaterials=ca.materials;u.overdraw=N;u.z=u.centroidScreen.z;M.push(u)}}else if($ instanceof THREE.Line){K.multiply(I,ea);na=$.geometry.vertices;ja=b();ja.positionScreen.copy(na[0].position);K.multiplyVector4(ja.positionScreen);ma=1;for(ca=na.length;ma<ca;ma++)if(ja=b(),ja.positionScreen.copy(na[ma].position),K.multiplyVector4(ja.positionScreen),la=t[n-
-2],D.copy(ja.positionScreen),S.copy(la.positionScreen),e(D,S))D.multiplyScalar(1/D.w),S.multiplyScalar(1/S.w),ea=A[z]=A[z]||new THREE.RenderableLine,z++,y=ea,y.v1.positionScreen.copy(D),y.v2.positionScreen.copy(S),y.z=Math.max(D.z,S.z),y.materials=$.materials,M.push(y)}else if($ instanceof THREE.Particle&&(J.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34,1),I.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ea=G[E]=G[E]||new THREE.RenderableParticle,E++,C=ea,C.x=J.x/J.w,C.y=J.y/J.w,C.z=J.z,C.rotation=
-$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};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=t[n]=t[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,t=[],u,w,v=[],x,p=[],y,z,A=[],C,E,G=[],H=[],M=[],Q=new THREE.Vector4,J=new THREE.Vector4,
+I=new THREE.Matrix4,K=new THREE.Matrix4,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=H.length=0;
+o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var v=n.matrixWorld,t=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=W[u].x*v.n14+W[u].y*v.n24+W[u].z*v.n34+W[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=m[h]=m[h]||new THREE.RenderableObject,h++,f=p,Q.copy(n.position),I.multiplyVector3(Q),f.object=n,f.z=Q.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
+function(f,h,m){var o=h.near,H=h.far,Q,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa,N,ea,qa,ua;E=z=x=w=M.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);W[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);W[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);W[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);W[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);W[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
+W[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(Q=0;Q<6;Q++)U=W[Q],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(Q=U.length;f<Q;f++)if($=U[f].object,$.visible)if(da=$.matrixWorld,ja=$.matrixRotationWorld,sa=$.materials,N=$.overdraw,n=0,$ instanceof THREE.Mesh){ea=$.geometry;ra=ea.vertices;qa=ea.faces;ea=ea.faceVertexUvs;ma=0;for(ca=ra.length;ma<ca;ma++)k=b(),k.positionWorld.copy(ra[ma].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
+I.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<H;ra=0;for(ma=qa.length;ra<ma;ra++){ca=qa[ra];if(ca instanceof THREE.Face3)if(la=t[ca.a],pa=t[ca.b],fa=t[ca.c],la.visible&&pa.visible&&fa.visible&&($.doubleSided||$.flipSided!=(fa.positionScreen.x-la.positionScreen.x)*(pa.positionScreen.y-la.positionScreen.y)-(fa.positionScreen.y-la.positionScreen.y)*(pa.positionScreen.x-la.positionScreen.x)<
+0))ia=v[w]=v[w]||new THREE.RenderableFace3,w++,u=ia,u.v1.copy(la),u.v2.copy(pa),u.v3.copy(fa);else continue;else if(ca instanceof THREE.Face4)if(la=t[ca.a],pa=t[ca.b],fa=t[ca.c],ia=t[ca.d],la.visible&&pa.visible&&fa.visible&&ia.visible&&($.doubleSided||$.flipSided!=((ia.positionScreen.x-la.positionScreen.x)*(pa.positionScreen.y-la.positionScreen.y)-(ia.positionScreen.y-la.positionScreen.y)*(pa.positionScreen.x-la.positionScreen.x)<0||(pa.positionScreen.x-fa.positionScreen.x)*(ia.positionScreen.y-
+fa.positionScreen.y)-(pa.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x)<0)))ua=p[x]=p[x]||new THREE.RenderableFace4,x++,u=ua,u.v1.copy(la),u.v2.copy(pa),u.v3.copy(fa),u.v4.copy(ia);else continue;u.normalWorld.copy(ca.normal);ja.multiplyVector3(u.normalWorld);u.centroidWorld.copy(ca.centroid);da.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);I.multiplyVector3(u.centroidScreen);fa=ca.vertexNormals;la=0;for(pa=fa.length;la<pa;la++)ia=u.vertexNormalsWorld[la],
+ia.copy(fa[la]),ja.multiplyVector3(ia);la=0;for(pa=ea.length;la<pa;la++)if(ua=ea[la][ra]){fa=0;for(ia=ua.length;fa<ia;fa++)u.uvs[la][fa]=ua[fa]}u.meshMaterials=sa;u.faceMaterials=ca.materials;u.overdraw=N;u.z=u.centroidScreen.z;M.push(u)}}else if($ instanceof THREE.Line){K.multiply(I,da);ra=$.geometry.vertices;la=b();la.positionScreen.copy(ra[0].position);K.multiplyVector4(la.positionScreen);ma=1;for(ca=ra.length;ma<ca;ma++)if(la=b(),la.positionScreen.copy(ra[ma].position),K.multiplyVector4(la.positionScreen),
+pa=t[n-2],D.copy(la.positionScreen),R.copy(pa.positionScreen),e(D,R))D.multiplyScalar(1/D.w),R.multiplyScalar(1/R.w),da=A[z]=A[z]||new THREE.RenderableLine,z++,y=da,y.v1.positionScreen.copy(D),y.v2.positionScreen.copy(R),y.z=Math.max(D.z,R.z),y.materials=$.materials,M.push(y)}else if($ instanceof THREE.Particle&&(J.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34,1),I.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))da=G[E]=G[E]||new THREE.RenderableParticle,E++,C=da,C.x=J.x/J.w,C.y=J.y/J.w,C.z=
+J.z,C.rotation=$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};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,t=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),t.sub(c.position,e.position),n.crossSelf(t);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,t=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),t.sub(c.position,e.position),n.crossSelf(t);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;t=b.vertices[c].position;u=b.vertices[f].position;w=k[h];v=k[m];x=k[o];p=t.x-n.x;y=u.x-n.x;z=t.y-n.y;A=u.y-n.y;C=t.z-n.z;E=u.z-n.z;G=v.u-w.u;H=x.u-w.u;M=v.v-w.v;R=x.v-w.v;J=1/(G*R-H*M);D.set((R*p-M*y)*J,(R*z-M*A)*J,(R*C-M*E)*J);S.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(S);
-W[c].addSelf(S);W[f].addSelf(S)}var c,e,f,h,m,k,n,t,u,w,v,x,p,y,z,A,C,E,G,H,M,R,J,I,K=[],W=[],D=new THREE.Vector3,S=new THREE.Vector3,U=new THREE.Vector3,da=new THREE.Vector3,Q=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,W[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++)Q.copy(m.vertexNormals[f]),h=m[o[f]],I=K[h],U.copy(I),U.subSelf(Q.multiplyScalar(Q.dot(I))).normalize(),da.cross(m.vertexNormals[f],I),h=da.dot(W[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(U.x,U.y,U.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;t=b.vertices[c].position;u=b.vertices[f].position;w=k[h];v=k[m];x=k[o];p=t.x-n.x;y=u.x-n.x;z=t.y-n.y;A=u.y-n.y;C=t.z-n.z;E=u.z-n.z;G=v.u-w.u;H=x.u-w.u;M=v.v-w.v;Q=x.v-w.v;J=1/(G*Q-H*M);D.set((Q*p-M*y)*J,(Q*z-M*A)*J,(Q*C-M*E)*J);R.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(R);
+W[c].addSelf(R);W[f].addSelf(R)}var c,e,f,h,m,k,n,t,u,w,v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K=[],W=[],D=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,V=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
+"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)X.copy(m.vertexNormals[f]),h=m[o[f]],I=K[h],T.copy(I),T.subSelf(X.multiplyScalar(X.dot(I))).normalize(),V.cross(m.vertexNormals[f],I),h=V.dot(W[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(T.x,T.y,T.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
@@ -149,46 +149,47 @@ THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addO
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var t,u,w,v,x,p,y,z;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*m+m;w=0;for(v=x.material.length;w<v;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=z+"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 t,u,w,v,x,p,y,z;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*m+m;w=0;for(v=x.material.length;w<v;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=z+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)p.globalAlpha=A=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(G!=b)p.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)p.globalAlpha=A=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(G!=b)p.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-u,w,v,x,p=t.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,M=null,R=null,J,I,K,W,D=new THREE.RenderableVertex,S=new THREE.RenderableVertex,U,da,Q,o,pa,T,ma,ca,na,ja,la,ga,Z=new THREE.Color(0),V=new THREE.Color(0),$=new THREE.Color(0),ea=new THREE.Color(0),ka=new THREE.Color(0),ta=[],N,fa,ra,ua,sa,xa,Ca,za,Aa,Ea,L=new THREE.Rectangle,O=new THREE.Rectangle,ha=new THREE.Rectangle,aa=!1,ia=new THREE.Color,qa=new THREE.Color,ya=new THREE.Color,va=new THREE.Color,oa=new THREE.Vector3,
-Fa,Y,Ba,X,Va,Wa,b=16;Fa=document.createElement("canvas");Fa.width=Fa.height=2;Y=Fa.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);Ba=Y.getImageData(0,0,2,2);X=Ba.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=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){u=b;w=e;v=Math.floor(u/2);x=Math.floor(w/2);t.width=u;t.height=w;
-L.set(-v,-x,v,x);O.set(-v,-x,v,x);A=1;C=0;R=M=H=G=E=null};this.setClearColor=function(b,e){y.copy(b);z=e;O.set(-v,-x,v,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;O.set(-v,-x,v,x)};this.clear=function(){p.setTransform(1,0,0,-1,v,x);O.isEmpty()||(O.minSelf(L),O.inflate(2),z<1&&p.clearRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
-255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(qa.r+=f.r,qa.g+=f.g,qa.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(va.r+=f.r,va.g+=f.g,va.b+=f.b)}function w(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 y(b,k,m){c(m.opacity);e(m.blending);var o,n,u,X,t,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)X=
-m.map.image,t=X.width>>1,w=X.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ha.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ha)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(X,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ha.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ha)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p),
-p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(R!=b)p.lineJoin=R=b;f(m.color.getContextStyle());p.stroke();ha.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,X,p,t){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending);U=b.positionScreen.x;
-da=b.positionScreen.y;Q=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,da,Q,o,pa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=X.uvs[0],$a(U,da,Q,o,pa,T,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(X.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(X.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(X.vertexNormalsWorld[2]),Aa=(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(U,da,Q,o,pa,T,sa,xa,Ca,za,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
-THREE.UVMapping&&(ua=X.uvs[0],$a(U,da,Q,o,pa,T,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3?(V.r=$.r=ea.r=qa.r,V.g=$.g=ea.g=qa.g,V.b=$.b=ea.b=qa.b,w(t,X.v1.positionWorld,X.vertexNormalsWorld[0],V),w(t,X.v2.positionWorld,X.vertexNormalsWorld[1],$),w(t,X.v3.positionWorld,X.vertexNormalsWorld[2],ea),V.r=Math.max(0,Math.min(p.color.r*V.r,1)),V.g=Math.max(0,Math.min(p.color.g*V.g,1)),
-V.b=Math.max(0,Math.min(p.color.b*V.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),ka.r=($.r+ea.r)*0.5,ka.g=($.g+ea.g)*0.5,ka.b=($.b+ea.b)*0.5,ra=Xa(V,$,ea,ka),Sa(U,da,Q,o,pa,T,0,0,1,0,0,1,ra)):(ia.r=qa.r,ia.g=qa.g,ia.b=qa.b,w(t,X.centroidWorld,X.normalWorld,ia),Z.r=Math.max(0,Math.min(p.color.r*
-ia.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ia.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ia.b,1)),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,fa=u.far,V.r=V.g=V.b=1-Na(b.positionScreen.z,N,fa),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,fa),ea.r=ea.g=ea.b=1-Na(k.positionScreen.z,N,fa),ka.r=($.r+ea.r)*0.5,ka.g=($.g+ea.g)*
-0.5,ka.b=($.b+ea.b)*0.5,ra=Xa(V,$,ea,ka),Sa(U,da,Q,o,pa,T,0,0,1,0,0,1,ra);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(X.normalWorld.x),Z.g=Ta(X.normalWorld.y),Z.b=Ta(X.normalWorld.z),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)}function C(b,f,k,h,n,p,v,X,t){m.data.vertices+=4;m.data.faces++;c(X.opacity);e(X.blending);if(X.map||X.envMap)A(b,f,h,0,1,3,v,X,t),A(n,k,p,1,2,3,v,X,t);else if(U=b.positionScreen.x,da=b.positionScreen.y,Q=f.positionScreen.x,o=
-f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,la=p.positionScreen.x,ga=p.positionScreen.y,X instanceof THREE.MeshBasicMaterial)G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(X.color);else if(X instanceof THREE.MeshLambertMaterial)aa?!X.wireframe&&X.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(V.r=$.r=ea.r=ka.r=qa.r,
-V.g=$.g=ea.g=ka.g=qa.g,V.b=$.b=ea.b=ka.b=qa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],V),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],ea),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ka),V.r=Math.max(0,Math.min(X.color.r*V.r,1)),V.g=Math.max(0,Math.min(X.color.g*V.g,1)),V.b=Math.max(0,Math.min(X.color.b*V.b,1)),$.r=Math.max(0,Math.min(X.color.r*$.r,1)),$.g=Math.max(0,Math.min(X.color.g*$.g,1)),$.b=Math.max(0,Math.min(X.color.b*$.b,1)),ea.r=
-Math.max(0,Math.min(X.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(X.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(X.color.b*ea.b,1)),ka.r=Math.max(0,Math.min(X.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(X.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(X.color.b*ka.b,1)),ra=Xa(V,$,ea,ka),E(U,da,Q,o,ma,ca),Sa(U,da,Q,o,ma,ca,0,0,1,0,0,1,ra),E(na,ja,pa,T,la,ga),Sa(na,ja,pa,T,la,ga,1,0,1,1,0,1,ra)):(ia.r=qa.r,ia.g=qa.g,ia.b=qa.b,w(t,v.centroidWorld,v.normalWorld,ia),Z.r=Math.max(0,Math.min(X.color.r*ia.r,1)),Z.g=
-Math.max(0,Math.min(X.color.g*ia.g,1)),Z.b=Math.max(0,Math.min(X.color.b*ia.b,1)),G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(Z,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(Z)):(G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(X.color));else if(X instanceof THREE.MeshNormalMaterial)Z.r=Ta(v.normalWorld.x),Z.g=Ta(v.normalWorld.y),Z.b=Ta(v.normalWorld.z),G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(Z,X.wireframeLinewidth,X.wireframeLinecap,
-X.wireframeLinejoin):Ja(Z);else if(X instanceof THREE.MeshDepthMaterial)N=u.near,fa=u.far,V.r=V.g=V.b=1-Na(b.positionScreen.z,N,fa),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,fa),ea.r=ea.g=ea.b=1-Na(h.positionScreen.z,N,fa),ka.r=ka.g=ka.b=1-Na(k.positionScreen.z,N,fa),ra=Xa(V,$,ea,ka),E(U,da,Q,o,ma,ca),Sa(U,da,Q,o,ma,ca,0,0,1,0,0,1,ra),E(na,ja,pa,T,la,ga),Sa(na,ja,pa,T,la,ga,1,0,1,1,0,1,ra)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function G(b,
-e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(R!=k)p.lineJoin=R=k;f(b.getContextStyle());p.stroke();ha.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,X,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;ta[w.id]=p.createPattern(w.image,
-x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,X=(X+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;X-=o;v-=n;u-=o;t-=n;x=1/(X*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(X*k-u*c)*x;f=(X*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e,c,f,k,h,m,o,n,X,v,u,t){var w,
-x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;X*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;X-=o;v-=m;u-=o;x=1/(n*u-v*X);w=(u*c-X*k)*x;X=(u*f-X*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-X*m-f*o;p.save();p.transform(w,X,c,f,b,e);p.clip();p.drawImage(t,0,0);p.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),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);X[0]=k<0?0:k>255?255:k;X[1]=h<0?0:h>255?255:
-h;X[2]=b<0?0:b>255?255:b;X[4]=m<0?0:m>255?255:m;X[5]=o<0?0:o>255?255:o;X[6]=e<0?0:e>255?255:e;X[8]=n<0?0:n>255?255:n;X[9]=v<0?0:v>255?255:v;X[10]=c<0?0:c>255?255:c;X[12]=p<0?0:p>255?255:p;X[13]=u<0?0:u>255?255:u;X[14]=f<0?0:f>255?255:f;Y.putImageData(Ba,0,0);Wa.drawImage(Fa,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,cb,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,v,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(b);Ya=0;for(cb=k.length;Ya<cb;Ya++){wa=k[Ya];ha.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=v;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=wa.v1,I=wa.v2,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=
-v,I.positionScreen.y*=x,ha.addPoint(J.positionScreen.x,J.positionScreen.y),ha.addPoint(I.positionScreen.x,I.positionScreen.y),L.intersects(ha)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&z(J,I,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,I=wa.v2,K=wa.v3,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,wa.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,
-K.positionScreen),Ka(K.positionScreen,J.positionScreen)),ha.add3Points(J.positionScreen.x,J.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(ha)){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,I,K,0,1,2,wa,F,b)}else F.opacity!=0&&A(J,I,K,0,1,2,wa,F,b)}}else if(wa instanceof THREE.RenderableFace4&&
-(J=wa.v1,I=wa.v2,K=wa.v3,W=wa.v4,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,W.positionScreen.x*=v,W.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),S.positionScreen.copy(W.positionScreen),wa.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,W.positionScreen),Ka(W.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,S.positionScreen)),ha.addPoint(J.positionScreen.x,
-J.positionScreen.y),ha.addPoint(I.positionScreen.x,I.positionScreen.y),ha.addPoint(K.positionScreen.x,K.positionScreen.y),ha.addPoint(W.positionScreen.x,W.positionScreen.y),L.intersects(ha))){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&&C(J,I,K,W,D,S,wa,F,b)}else F.opacity!=0&&C(J,I,K,W,D,S,wa,F,b)}O.addRectangle(ha)}p.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&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*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,v){m.data.vertices+=3;m.data.faces++;U=f(da++);U.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?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=R.r,M.g=R.g,M.b=R.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),
-H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(U)}function e(e,c,k,o,n,v,p){m.data.vertices+=4;m.data.faces++;
-U=f(da++);U.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");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=R.r,M.g=R.g,M.b=R.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))):H.copy(v.color):v instanceof
-THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+
-v.opacity);t.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),R=new THREE.Color(0),J=new THREE.Color(0),
-I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],S=[],U,da,Q,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=
-function(b,f){var h,u,w,H,M,D,K,V;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);Q=da=0;if(G=b.lights.length>0){K=b.lights;R.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h<u;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(R.r+=H.r,R.g+=H.g,R.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(u=k.length;h<u;h++)if(K=k[h],E.empty(),
-K instanceof THREE.RenderableParticle){p=K;p.x*=v;p.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(p=K.v1,y=K.v2,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((V=K.materials[w++])&&V.opacity!=0){M=p;D=y;var $=Q++;S[$]==null&&(S[$]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),o==0&&S[$].setAttribute("shape-rendering","crispEdges"));U=S[$];U.setAttribute("x1",M.positionScreen.x);U.setAttribute("y1",M.positionScreen.y);U.setAttribute("x2",D.positionScreen.x);U.setAttribute("y2",D.positionScreen.y);V instanceof THREE.LineBasicMaterial&&(U.setAttribute("style","fill: none; stroke: "+V.color.getContextStyle()+"; stroke-width: "+V.linewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.linecap+"; stroke-linejoin: "+V.linejoin),t.appendChild(U))}}}else if(K instanceof
-THREE.RenderableFace3){if(p=K.v1,y=K.v2,z=K.v3,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(H=K.meshMaterials.length;w<H;)if(V=K.meshMaterials[w++],V instanceof THREE.MeshFaceMaterial){M=0;for(D=K.faceMaterials.length;M<D;)(V=K.faceMaterials[M++])&&
-V.opacity!=0&&c(p,y,z,K,V,b)}else V&&V.opacity!=0&&c(p,y,z,K,V,b)}}else if(K instanceof THREE.RenderableFace4&&(p=K.v1,y=K.v2,z=K.v3,A=K.v4,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,A.positionScreen.x*=v,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),
-C.intersects(E))){w=0;for(H=K.meshMaterials.length;w<H;)if(V=K.meshMaterials[w++],V instanceof THREE.MeshFaceMaterial){M=0;for(D=K.faceMaterials.length;M<D;)(V=K.faceMaterials[M++])&&V.opacity!=0&&e(p,y,z,A,K,V,b)}else V&&V.opacity!=0&&e(p,y,z,A,K,V,b)}}};
+u,w,v,x,p=t.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,M=null,Q=null,J,I,K,W,D=new THREE.RenderableVertex,R=new THREE.RenderableVertex,T,V,X,o,ha,S,ma,ca,ra,la,pa,fa,ia=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),da=new THREE.Color(0),ja=new THREE.Color(0),sa=[],N,ea,qa,ua,ta,Ba,Ca,va,Aa,Ea,L=new THREE.Rectangle,O=new THREE.Rectangle,ga=new THREE.Rectangle,aa=!1,ka=new THREE.Color,oa=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,na=new THREE.Vector3,
+ya,Z,Fa,Y,Va,Wa,b=16;ya=document.createElement("canvas");ya.width=ya.height=2;Z=ya.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Fa=Z.getImageData(0,0,2,2);Y=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=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){u=b;w=e;v=Math.floor(u/2);x=Math.floor(w/2);t.width=u;t.height=
+w;L.set(-v,-x,v,x);O.set(-v,-x,v,x);A=1;C=0;Q=M=H=G=E=null};this.setClearColor=function(b,e){y.copy(b);z=e;O.set(-v,-x,v,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;O.set(-v,-x,v,x)};this.clear=function(){p.setTransform(1,0,0,-1,v,x);O.isEmpty()||(O.minSelf(L),O.inflate(2),z<1&&p.clearRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
+255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;oa.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?(oa.r+=f.r,oa.g+=f.g,oa.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 w(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(na.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 y(b,k,m){c(m.opacity);e(m.blending);var o,n,u,Y,t,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)Y=
+m.map.image,t=Y.width>>1,w=Y.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(Y,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p),
+p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(Q!=b)p.lineJoin=Q=b;f(m.color.getContextStyle());p.stroke();ga.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,Y,p,t){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
+T=b.positionScreen.x;V=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ha=k.positionScreen.x;S=k.positionScreen.y;E(T,V,X,o,ha,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,na.copy(Y.vertexNormalsWorld[0]),ta=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,
+Ba=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[1]),Ca=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[2]),Aa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(T,V,X,o,ha,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
+(p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=$.r=da.r=oa.r,U.g=$.g=da.g=oa.g,U.b=$.b=da.b=oa.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],$),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),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)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,Y.centroidWorld,Y.normalWorld,
+ka),ia.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ka.b,1)),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(k.positionScreen.z,
+N,ea),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ia.r=Ta(Y.normalWorld.x),ia.g=Ta(Y.normalWorld.y),ia.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)}function C(b,f,k,h,n,p,v,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,v,Y,t),A(n,k,p,1,2,3,v,Y,t);else if(T=b.positionScreen.x,
+V=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ha=k.positionScreen.x,S=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,ra=n.positionScreen.x,la=n.positionScreen.y,pa=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)aa?!Y.wireframe&&Y.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
+4?(U.r=$.r=da.r=ja.r=oa.r,U.g=$.g=da.g=ja.g=oa.g,U.b=$.b=da.b=ja.b=oa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],da),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),$.r=Math.max(0,Math.min(Y.color.r*$.r,1)),$.g=Math.max(0,Math.min(Y.color.g*$.g,1)),$.b=Math.max(0,Math.min(Y.color.b*
+$.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ja.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,v.centroidWorld,v.normalWorld,ka),ia.r=Math.max(0,Math.min(Y.color.r*ka.r,
+1)),ia.g=Math.max(0,Math.min(Y.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ka.b,1)),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia)):(G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ia.r=Ta(v.normalWorld.x),ia.g=Ta(v.normalWorld.y),ia.b=Ta(v.normalWorld.z),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,
+Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia);else if(Y instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,N,ea),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,N,ea),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);
+p.closePath()}function G(b,e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(Q!=k)p.lineJoin=Q=k;f(b.getContextStyle());p.stroke();ga.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,Y,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]=
+p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,Y=(Y+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;Y-=o;v-=n;u-=o;t-=n;x=1/(Y*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(Y*k-u*c)*x;f=(Y*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e,
+c,f,k,h,m,o,n,Y,v,u,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;Y-=o;v-=m;u-=o;x=1/(n*u-v*Y);w=(u*c-Y*k)*x;Y=(u*f-Y*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-Y*m-f*o;p.save();p.transform(w,Y,c,f,b,e);p.clip();p.drawImage(t,0,0);p.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),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Y[0]=k<0?0:k>255?
+255:k;Y[1]=h<0?0:h>255?255:h;Y[2]=b<0?0:b>255?255:b;Y[4]=m<0?0:m>255?255:m;Y[5]=o<0?0:o>255?255:o;Y[6]=e<0?0:e>255?255:e;Y[8]=n<0?0:n>255?255:n;Y[9]=v<0?0:v>255?255:v;Y[10]=c<0?0:c>255?255:c;Y[12]=p<0?0:p>255?255:p;Y[13]=u<0?0:u>255?255:u;Y[14]=f<0?0:f>255?255:f;Z.putImageData(Fa,0,0);Wa.drawImage(ya,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():p.setTransform(1,0,0,-1,v,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];ga.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=v;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=wa.v1,I=wa.v2,J.positionScreen.x*=
+v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,ga.addPoint(J.positionScreen.x,J.positionScreen.y),ga.addPoint(I.positionScreen.x,I.positionScreen.y),L.intersects(ga)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&z(J,I,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,I=wa.v2,K=wa.v3,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,wa.overdraw&&(Ka(J.positionScreen,
+I.positionScreen),Ka(I.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),ga.add3Points(J.positionScreen.x,J.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(ga)){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,I,K,0,1,2,wa,F,b)}else F.opacity!=0&&A(J,I,K,0,1,2,wa,F,b)}}else if(wa instanceof
+THREE.RenderableFace4&&(J=wa.v1,I=wa.v2,K=wa.v3,W=wa.v4,J.positionScreen.x*=v,J.positionScreen.y*=x,I.positionScreen.x*=v,I.positionScreen.y*=x,K.positionScreen.x*=v,K.positionScreen.y*=x,W.positionScreen.x*=v,W.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),R.positionScreen.copy(W.positionScreen),wa.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,W.positionScreen),Ka(W.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,R.positionScreen)),
+ga.addPoint(J.positionScreen.x,J.positionScreen.y),ga.addPoint(I.positionScreen.x,I.positionScreen.y),ga.addPoint(K.positionScreen.x,K.positionScreen.y),ga.addPoint(W.positionScreen.x,W.positionScreen.y),L.intersects(ga))){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&&C(J,I,K,W,D,R,wa,F,b)}else F.opacity!=0&&C(J,I,K,W,D,R,wa,F,b)}O.addRectangle(ga)}p.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&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*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,v){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++);
+T.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?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
+o.z*n.__farMinusNear),H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(T)}function e(e,c,k,o,n,v,p){m.info.render.vertices+=
+4;m.info.render.faces++;T=f(V++);T.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");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))):
+H.copy(v.color):v instanceof THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+
+"; fill-opacity: "+v.opacity);t.appendChild(T)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0),
+J=new THREE.Color(0),I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],R=[],T,V,X,o=1;this.domElement=t;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){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
+this.render=function(b,f){var h,u,w,H,M,D,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=V=0;if(G=b.lights.length>0){K=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h<u;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(Q.r+=H.r,Q.g+=H.g,Q.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(u=k.length;h<
+u;h++)if(K=k[h],E.empty(),K instanceof THREE.RenderableParticle){p=K;p.x*=v;p.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(p=K.v1,y=K.v2,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((U=K.materials[w++])&&U.opacity!=0){M=p;D=y;var $=X++;R[$]==null&&(R[$]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),o==0&&R[$].setAttribute("shape-rendering","crispEdges"));T=R[$];T.setAttribute("x1",M.positionScreen.x);T.setAttribute("y1",M.positionScreen.y);T.setAttribute("x2",D.positionScreen.x);T.setAttribute("y2",D.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(T.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),t.appendChild(T))}}}else if(K instanceof
+THREE.RenderableFace3){if(p=K.v1,y=K.v2,z=K.v3,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(H=K.meshMaterials.length;w<H;)if(U=K.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){M=0;for(D=K.faceMaterials.length;M<D;)(U=K.faceMaterials[M++])&&
+U.opacity!=0&&c(p,y,z,K,U,b)}else U&&U.opacity!=0&&c(p,y,z,K,U,b)}}else if(K instanceof THREE.RenderableFace4&&(p=K.v1,y=K.v2,z=K.v3,A=K.v4,p.positionScreen.x*=v,p.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,z.positionScreen.x*=v,z.positionScreen.y*=-x,A.positionScreen.x*=v,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),
+C.intersects(E))){w=0;for(H=K.meshMaterials.length;w<H;)if(U=K.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){M=0;for(D=K.faceMaterials.length;M<D;)(U=K.faceMaterials[M++])&&U.opacity!=0&&e(p,y,z,A,K,U,b)}else U&&U.opacity!=0&&e(p,y,z,A,K,U,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -224,118 +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,v=b.colors,p=v.length,u=b.__vertexArray,t=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,ha,O;if(y)for(ha in y)y[ha].offset=0;if(c.sortParticles){ra.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,xa.copy(k),ra.multiplyVector3(xa),w[f]=[xa.z,f];w.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=
-k.z;for(f=0;f<p;f++)h=f*3,color=v[w[f][1]],t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ha in y){f=y[ha];v=f.value.length;for(h=0;h<v;h++){index=w[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")O=f.value[index];f.size===2?(f.array[p]=O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=
-O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.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=v[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ha in y)if(f=y[ha],f.__original.needsUpdate){v=f.value.length;for(h=0;h<v;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")O=f.value[h];f.size===2?(f.array[p]=
-O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.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,t,e);if(y)for(ha in y)if(f=y[ha],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||Q.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets);for(var h=0,m=Q.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=T&&(o.useProgram(h),T=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,v,u,t=0,w=0,x=0,L,y,ha,O=Ca,z=O.directional.colors,A=O.directional.positions,C=O.point.colors,E=O.point.positions,G=O.point.distances,H=0,aa=0,c=v=ha=0;for(p=e.length;c<p;c++)if(v=e[c],u=v.color,L=v.position,y=v.intensity,ha=v.distance,v instanceof THREE.AmbientLight)t+=u.r,w+=u.g,x+=u.b;else if(v instanceof THREE.DirectionalLight)ha=
-H*3,z[ha]=u.r*y,z[ha+1]=u.g*y,z[ha+2]=u.b*y,A[ha]=L.x,A[ha+1]=L.y,A[ha+2]=L.z,H+=1;else if(v instanceof THREE.SpotLight)ha=H*3,z[ha]=u.r*y,z[ha+1]=u.g*y,z[ha+2]=u.b*y,u=1/L.length(),A[ha]=L.x*u,A[ha+1]=L.y*u,A[ha+2]=L.z*u,H+=1;else if(v instanceof THREE.PointLight)v=aa*3,C[v]=u.r*y,C[v+1]=u.g*y,C[v+2]=u.b*y,E[v]=L.x,E[v+1]=L.y,E[v+2]=L.z,G[aa]=ha,aa+=1;for(c=H*3;c<z.length;c++)z[c]=0;for(c=aa*3;c<C.length;c++)C[c]=0;O.point.length=aa;O.directional.length=H;O.ambient[0]=t;O.ambient[1]=w;O.ambient[2]=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,v=b.colors,p=v.length,u=b.__vertexArray,t=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,ga,O;if(y)for(ga in y)y[ga].offset=0;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ba.copy(k),qa.multiplyVector3(Ba),w[f]=[Ba.z,f];w.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=
+k.z;for(f=0;f<p;f++)h=f*3,color=v[w[f][1]],t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ga in y){f=y[ga];v=f.value.length;for(h=0;h<v;h++){index=w[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")O=f.value[index];f.size===2?(f.array[p]=O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=
+O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.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=v[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(y)for(ga in y)if(f=y[ga],f.__original.needsUpdate){v=f.value.length;for(h=0;h<v;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")O=f.value[h];f.size===2?(f.array[p]=
+O.x,f.array[p+1]=O.y):f.size===3?f.type==="c"?(f.array[p]=O.r,f.array[p+1]=O.g,f.array[p+2]=O.b):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z):(f.array[p]=O.x,f.array[p+1]=O.y,f.array[p+2]=O.z,f.array[p+3]=O.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,t,e);if(y)for(ga in y)if(f=y[ga],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||X.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(X.maxMorphTargets);for(var h=0,m=X.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var 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,v,u,t=0,w=0,x=0,L,y,ga,O=Ca,z=O.directional.colors,A=O.directional.positions,C=O.point.colors,E=O.point.positions,G=O.point.distances,H=0,aa=0,c=v=ga=0;for(p=e.length;c<p;c++)if(v=e[c],u=v.color,L=v.position,y=v.intensity,ga=v.distance,v instanceof THREE.AmbientLight)t+=u.r,w+=u.g,x+=u.b;else if(v instanceof THREE.DirectionalLight)ga=
+H*3,z[ga]=u.r*y,z[ga+1]=u.g*y,z[ga+2]=u.b*y,A[ga]=L.x,A[ga+1]=L.y,A[ga+2]=L.z,H+=1;else if(v instanceof THREE.SpotLight)ga=H*3,z[ga]=u.r*y,z[ga+1]=u.g*y,z[ga+2]=u.b*y,u=1/L.length(),A[ga]=L.x*u,A[ga+1]=L.y*u,A[ga+2]=L.z*u,H+=1;else if(v instanceof THREE.PointLight)v=aa*3,C[v]=u.r*y,C[v+1]=u.g*y,C[v+2]=u.b*y,E[v]=L.x,E[v+1]=L.y,E[v+2]=L.z,G[aa]=ga,aa+=1;for(c=H*3;c<z.length;c++)z[c]=0;for(c=aa*3;c<C.length;c++)C[c]=0;O.point.length=aa;O.directional.length=H;O.ambient[0]=t;O.ambient[1]=w;O.ambient[2]=
 x;e=Ca;n.enableLighting.value=e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,
 x;e=Ca;n.enableLighting.value=e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,
 (n.map.texture=f.map)&&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=
 (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=f.opacity,n.size.value=f.size,n.scale.value=za.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<ia.length;e++)n.shadowMatrix.value[e]=
-ia[e],n.shadowMap.texture[e]=Q.shadowMap[e];n.shadowDarkness.value=Q.shadowMapDarkness;n.shadowBias.value=Q.shadowMapBias}for(var N in n)if(p=h.uniforms[N])if(c=n[N],t=c.type,e=c.value,t=="i")o.uniform1i(p,e);else if(t=="f")o.uniform1f(p,e);else if(t=="v2")o.uniform2f(p,e.x,e.y);else if(t=="v3")o.uniform3f(p,e.x,e.y,e.z);else if(t=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(t=="c")o.uniform3f(p,e.r,e.g,e.b);else if(t=="fv1")o.uniform1fv(p,e);else if(t=="fv")o.uniform3fv(p,e);else if(t=="v3v"){if(!c._array)c._array=
+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<ka.length;e++)n.shadowMatrix.value[e]=
+ka[e],n.shadowMap.texture[e]=X.shadowMap[e];n.shadowDarkness.value=X.shadowMapDarkness;n.shadowBias.value=X.shadowMapBias}for(var N in n)if(p=h.uniforms[N])if(c=n[N],t=c.type,e=c.value,t=="i")o.uniform1i(p,e);else if(t=="f")o.uniform1f(p,e);else if(t=="v2")o.uniform2f(p,e.x,e.y);else if(t=="v3")o.uniform3f(p,e.x,e.y,e.z);else if(t=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(t=="c")o.uniform3f(p,e.r,e.g,e.b);else if(t=="fv1")o.uniform1fv(p,e);else if(t=="fv")o.uniform3fv(p,e);else if(t=="v3v"){if(!c._array)c._array=
 new Float32Array(3*e.length);t=0;for(w=e.length;t<w;t++)x=t*3,c._array[x]=e[t].x,c._array[x+1]=e[t].y,c._array[x+2]=e[t].z;o.uniform3fv(p,c._array)}else if(t=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);t=0;for(w=e.length;t<w;t++)e[t].flattenToArrayOffset(c._array,t*16);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="t"){if(o.uniform1i(p,e),p=c.texture)if(p.image instanceof
 new Float32Array(3*e.length);t=0;for(w=e.length;t<w;t++)x=t*3,c._array[x]=e[t].x,c._array[x+1]=e[t].y,c._array[x+2]=e[t].z;o.uniform3fv(p,c._array)}else if(t=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);t=0;for(w=e.length;t<w;t++)e[t].flattenToArrayOffset(c._array,t*16);o.uniformMatrix4fv(p,!1,c._array)}else if(t=="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]);I(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
 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]);I(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)):K(p,e)}else if(t=="tv"){if(!c._array){c._array=[];t=0;for(w=c.texture.length;t<w;t++)c._array[t]=e+t}o.uniform1iv(p,c._array);t=0;for(w=c.texture.length;t<w;t++)(p=c.texture[t])&&K(p,c._array[t])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||
 THREE.WebGLRenderTargetCube?(c=p,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(p,e)}else if(t=="tv"){if(!c._array){c._array=[];t=0;for(w=c.texture.length;t<w;t++)c._array[t]=e+t}o.uniform1iv(p,c._array);t=0;for(w=c.texture.length;t<w;t++)(p=c.texture[t])&&K(p,c._array[t])}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&&
+f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ta);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,
+!1,ta),o.uniformMatrix4fv(m.boneGlobalMatrices,!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,p=m.morphTargetForcedOrder,v=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]=v[p[f]],f++;else{var p=[],t=-1,u=0,v=m.morphTargetInfluences,w,x=v.length,f=0;for(m.morphTargetBase!==
 (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,p=m.morphTargetForcedOrder,v=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]=v[p[f]],f++;else{var p=[],t=-1,u=0,v=m.morphTargetInfluences,w,x=v.length,f=0;for(m.morphTargetBase!==
 -1&&(p[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(w=0;w<x;w++)!p[w]&&v[w]>t&&(u=w,t=v[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[u]=1;t=-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],
 -1&&(p[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(w=0;w<x;w++)!p[w]&&v[w]>t&&(u=w,t=v[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[u]=1;t=-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.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)):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,
 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,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.__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,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),Q.data.vertices+=h.__webglFaceCount,Q.data.faces+=h.__webglFaceCount/3,Q.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),Q.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),Q.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),
-Q.data.drawCalls++)}}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,v,t,u,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],p=c[w+4],t=c[w+5],n=c[w+6],v=c[w+7],u=c[w+8],f=(f+m+n)/3,h=(h+p+v)/3,k=(k+t+u)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+6]=f,c[w+7]=h,c[w+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(ca!=b.doubleSided)b.doubleSided?
-o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ca=b.doubleSided;if(na!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),na=b.flipSided}function k(b){la!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),la=b)}function n(b){ga!=b&&(o.depthMask(b),ga=b)}function t(b,e,c){Z!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),Z=b);if(b&&(V!=e||$!=c))o.polygonOffset(e,c),V=e,$=c}function u(b){fa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);fa[1].set(b.n41+b.n11,
-b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);fa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);fa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);fa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);fa[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=fa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(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=fa[f].x*
-e.n14+fa[f].y*e.n24+fa[f].z*e.n34+fa[f].w,b<=c)return!1;return!0}function v(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?v(k,c):v(h,c)}function p(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?v(o,h):v(n,h))}else(h=e)&&(h.transparent?v(o,h):v(n,h))}function y(b,e){return e.z-b.z}function z(b,c){var n,p,v,t=0,x,L,y,z,A=b.lights;aa||(aa=new THREE.Camera(Q.shadowCameraFov,c.aspect,Q.shadowCameraNear,Q.shadowCameraFar));n=0;for(p=A.length;n<p;n++)if(v=A[n],v instanceof THREE.SpotLight&&v.castShadow){Q.shadowMap[t]||(Q.shadowMap[t]=new THREE.WebGLRenderTarget(Q.shadowMapWidth,Q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-ia[t]||(ia[t]=new THREE.Matrix4);x=Q.shadowMap[t];L=ia[t];aa.position.copy(v.position);aa.target.position.copy(v.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);L.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);L.multiplySelf(aa.projectionMatrix);L.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(sa);aa.projectionMatrix.flattenToArray(ua);ra.multiply(aa.projectionMatrix,aa.matrixWorldInverse);u(ra);Q.initWebGLObjects(b);W(x);o.clearColor(1,1,1,1);Q.clear();o.clearColor(O.r,
-O.g,O.b,ha);L=b.__webglObjects.length;v=b.__webglObjectsImmediate.length;for(x=0;x<L;x++)y=b.__webglObjects[x],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);J(THREE.NormalBlending);for(x=0;x<L;x++)if(y=b.__webglObjects[x],y.render)z=y.object,buffer=y.buffer,m(z),y=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?va:ya,f(aa,A,null,
-y,buffer,z);for(x=0;x<v;x++)y=b.__webglObjectsImmediate[x],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),m(z),program=e(aa,A,null,ya,z),z.render(function(b){h(b,program,ya.shading)}));t++}}function A(b,e){var c,f,h;c=Y.attributes;var k=Y.uniforms,m=N/ta,n,p=[],v=ta*0.5,t=N*0.5,u=!0;o.useProgram(Y.program);T=Y.program;la=ja=-1;Ba||(o.enableVertexAttribArray(Y.attributes.position),o.enableVertexAttribArray(Y.attributes.uv),Ba=
-!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.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,
+0,h.__webglVertexCount),X.info.render.calls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==
+THREE.FlatShading){var f,h,k,m,n,p,v,t,u,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],p=c[w+4],t=c[w+5],n=c[w+6],v=c[w+7],u=c[w+8],f=(f+m+n)/3,h=(h+p+v)/3,k=(k+t+u)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+6]=f,c[w+7]=h,c[w+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(ca!=
+b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ca=b.doubleSided;if(ra!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ra=b.flipSided}function k(b){pa!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),pa=b)}function n(b){fa!=b&&(o.depthMask(b),fa=b)}function t(b,e,c){ia!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ia=b);if(b&&(U!=e||$!=c))o.polygonOffset(e,c),U=e,$=c}function u(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
+b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ea[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ea[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=ea[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(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=ea[f].x*e.n14+ea[f].y*e.n24+ea[f].z*e.n34+ea[f].w,b<=c)return!1;return!0}function v(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?v(k,c):v(h,c)}function p(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?v(o,h):v(n,h))}else(h=e)&&(h.transparent?v(o,h):v(n,h))}function y(b,e){return e.z-b.z}function z(b,c){var n,p,v,t=0,x,L,y,z,A=b.lights;aa||(aa=new THREE.Camera(X.shadowCameraFov,c.aspect,X.shadowCameraNear,X.shadowCameraFar));n=0;for(p=A.length;n<p;n++)if(v=A[n],v instanceof THREE.SpotLight&&v.castShadow){X.shadowMap[t]||(X.shadowMap[t]=new THREE.WebGLRenderTarget(X.shadowMapWidth,X.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}));ka[t]||(ka[t]=new THREE.Matrix4);x=X.shadowMap[t];L=ka[t];aa.position.copy(v.position);aa.target.position.copy(v.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);L.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);L.multiplySelf(aa.projectionMatrix);L.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(ta);aa.projectionMatrix.flattenToArray(ua);qa.multiply(aa.projectionMatrix,aa.matrixWorldInverse);u(qa);X.initWebGLObjects(b);W(x);o.clearColor(1,
+1,1,1);X.clear();o.clearColor(O.r,O.g,O.b,ga);L=b.__webglObjects.length;v=b.__webglObjectsImmediate.length;for(x=0;x<L;x++)y=b.__webglObjects[x],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);J(THREE.NormalBlending);for(x=0;x<L;x++)if(y=b.__webglObjects[x],y.render)z=y.object,buffer=y.buffer,m(z),y=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?
+xa:za,f(aa,A,null,y,buffer,z);for(x=0;x<v;x++)y=b.__webglObjectsImmediate[x],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,aa,!1),m(z),program=e(aa,A,null,za,z),z.render(function(b){h(b,program,za.shading)}));t++}}function A(b,e){var c,f,h;c=Z.attributes;var k=Z.uniforms,m=N/sa,n,p=[],v=sa*0.5,t=N*0.5,u=!0;o.useProgram(Z.program);S=Z.program;pa=la=-1;Fa||(o.enableVertexAttribArray(Z.attributes.position),o.enableVertexAttribArray(Z.attributes.uv),
+Fa=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Z.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,Z.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(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-v)/v,(t-h.position.y)/t,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,
 h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-v)/v,(t-h.position.y)/t,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?N: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.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,
 !1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?N: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.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),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(ga)}function C(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(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=
+6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(fa)}function C(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(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 H(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function M(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,v={},t=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),v[o]==void 0&&(v[o]={hash:o,counter:0}),
 h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function H(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function M(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,v={},t=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),v[o]==void 0&&(v[o]={hash:o,counter:0}),
 p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(v[o].counter+=1,p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t})),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])}
 p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(v[o].counter+=1,p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t})),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 R(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 I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,da(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,da(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,da(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,da(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,U(e.magFilter)),
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,da(b.format),b.image.width,b.image.height,0,da(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+
-e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(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);I(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,da(b.format),b.width,b.height,0,da(b.format),da(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,da(b.format),b.width,b.height,0,da(b.format),da(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,
-0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
-o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=ta,b=N,f=ea,h=ka);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(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 S(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 U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function da(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;
+function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=la){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)}la=b}}function I(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,T(e.magFilter)),
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,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);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(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);I(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),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+
+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
+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=N,f=da,h=ja);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(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 T(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
-case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var Q=this,o,pa=[],T=null,ma=null,ca=null,na=null,ja=null,la=null,ga=null,Z=null,V=null,$=null,ea=0,ka=0,ta=0,N=0,fa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Matrix4,ua=new Float32Array(16),sa=new Float32Array(16),xa=new THREE.Vector4,Ca=
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,
-faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;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 aa,ia=[],b=THREE.ShaderLib.depthRGBA,qa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
-uniforms:qa}),va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa,morphTargets:!0});ya._shadowPass=!0;va._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(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(O.r,O.g,O.b,ha);this.context=o;var Fa=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,S("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,S("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.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 Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ea=b;ka=e;ta=c;N=f;o.viewport(ea,ka,ta,N)};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){O.setHex(b);ha=e;o.clearColor(O.r,O.g,O.b,ha)};this.setClearColor=function(b,e){O.copy(b);ha=e;o.clearColor(O.r,O.g,O.b,ha)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ha};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,
+case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var X=this,o,ha=[],S=null,ma=null,ca=null,ra=null,la=null,pa=null,fa=null,ia=null,U=null,$=null,da=0,ja=0,sa=0,N=0,ea=[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),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca=
+{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ga=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 aa,ka=[],b=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:oa}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:oa,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(na){console.error(na)}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(O.r,O.g,O.b,ga);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Z={};Z.vertices=new Float32Array(16);Z.faces=new Uint16Array(6);i=0;Z.vertices[i++]=-1;Z.vertices[i++]=-1;Z.vertices[i++]=0;Z.vertices[i++]=1;Z.vertices[i++]=1;
+Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=0;Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=0;i=Z.vertices[i++]=0;Z.faces[i++]=0;Z.faces[i++]=1;Z.faces[i++]=2;Z.faces[i++]=0;Z.faces[i++]=2;Z.faces[i++]=3;Z.vertexBuffer=o.createBuffer();Z.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Z.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Z.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,Z.faces,o.STATIC_DRAW);Z.program=o.createProgram();o.attachShader(Z.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Z.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Z.program);Z.attributes={};Z.uniforms={};Z.attributes.position=o.getAttribLocation(Z.program,"position");Z.attributes.uv=o.getAttribLocation(Z.program,"uv");Z.uniforms.uvOffset=o.getUniformLocation(Z.program,"uvOffset");Z.uniforms.uvScale=o.getUniformLocation(Z.program,
+"uvScale");Z.uniforms.rotation=o.getUniformLocation(Z.program,"rotation");Z.uniforms.scale=o.getUniformLocation(Z.program,"scale");Z.uniforms.alignment=o.getUniformLocation(Z.program,"alignment");Z.uniforms.map=o.getUniformLocation(Z.program,"map");Z.uniforms.opacity=o.getUniformLocation(Z.program,"opacity");Z.uniforms.useScreenCoordinates=o.getUniformLocation(Z.program,"useScreenCoordinates");Z.uniforms.affectedByDistance=o.getUniformLocation(Z.program,"affectedByDistance");Z.uniforms.screenPosition=
+o.getUniformLocation(Z.program,"screenPosition");Z.uniforms.modelViewMatrix=o.getUniformLocation(Z.program,"modelViewMatrix");Z.uniforms.projectionMatrix=o.getUniformLocation(Z.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){da=b;ja=e;sa=c;N=f;o.viewport(da,ja,sa,N)};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){O.setHex(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.setClearColor=function(b,e){O.copy(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ga};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);
 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])}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=
-b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture)};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,v,t;p=t=n=0;for(v=e.length;p<v;p++)k=e[p],k instanceof THREE.SpotLight&&t++,k instanceof THREE.DirectionalLight&&t++,k instanceof THREE.PointLight&&n++;n+t<=_maxLights?p=t:(p=Math.ceil(_maxLights*t/(n+t)),n=_maxLights-p);k={directional:p,point:n};n=t=0;for(p=e.length;n<p;n++)v=
-e[n],v instanceof THREE.SpotLight&&v.castShadow&&t++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var w;a:{p=b.fragmentShader;v=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:t,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(p),f.push(v));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=pa.length;x<f;x++)if(pa[x].code==m){w=pa[x].program;break a}x=o.createProgram();f=[Fa?"#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");
+o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);X.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
+X.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),X.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m;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,v,t;p=t=n=0;for(v=e.length;p<v;p++)k=e[p],k instanceof THREE.SpotLight&&t++,k instanceof THREE.DirectionalLight&&t++,k instanceof THREE.PointLight&&
+n++;n+t<=_maxLights?p=t:(p=Math.ceil(_maxLights*t/(n+t)),n=_maxLights-p);k={directional:p,point:n};n=t=0;for(p=e.length;n<p;n++)v=e[n],v instanceof THREE.SpotLight&&v.castShadow&&t++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var w;a:{p=b.fragmentShader;v=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:t,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(p),f.push(v));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=ha.length;x<f;x++)if(ha[x].code==m){w=ha[x].program;break a}x=o.createProgram();f=[ya?"#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,S("fragment",k+p));o.attachShader(x,S("vertex",f+v));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
+c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,R("fragment",k+p));o.attachShader(x,R("vertex",f+v));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(w in e)f.push(w);
 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(w in e)f.push(w);
-w=f;L=0;for(e=w.length;L<e;L++)c=w[L],x.attributes[c]=o.getAttribLocation(x,c);pa.push({program:x,code:m});w=x}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),
-o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(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,v){var L,ha,O,E,G,H,aa,N,I=b.lights,qa=b.fog;this.shadowMapEnabled&&z(b,c);Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(sa);c.projectionMatrix.flattenToArray(ua);ra.multiply(c.projectionMatrix,c.matrixWorldInverse);u(ra);this.initWebGLObjects(b);W(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v<G;v++)if(L=b.__webglObjects[v],aa=L.object,aa.visible)if(!(aa instanceof
-THREE.Mesh)||!aa.frustumCulled||w(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),C(aa,c,!0),p(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(xa.copy(aa.position),ra.multiplyVector3(xa),L.z=xa.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),C(aa,
-c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render)aa=L.object,N=L.buffer,m(aa),f(c,I,qa,b.overrideMaterial,N,aa);for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(m(aa),ha=e(c,I,qa,b.overrideMaterial,aa),aa.render(function(c){h(c,ha,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(v=G-1;v>=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque;
-m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,qa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.opaque;m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ha=e(c,I,qa,E,aa),aa.render(function(b){h(b,ha,E.shading)})}for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;
-O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,qa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ha=e(c,I,qa,E,aa),aa.render(function(b){h(b,ha,E.shading)})}}b.__webglSprites.length&&
+w=f;L=0;for(e=w.length;L<e;L++)c=w[L],x.attributes[c]=o.getAttribLocation(x,c);ha.push({program:x,code:m});X.info.memory.programs=ha.length;w=x}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),
+o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(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,v){var L,ga,O,E,G,H,aa,N,I=b.lights,oa=b.fog;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ta);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(qa);this.initWebGLObjects(b);W(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v<G;v++)if(L=b.__webglObjects[v],
+aa=L.object,aa.visible)if(!(aa instanceof THREE.Mesh)||!aa.frustumCulled||w(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),C(aa,c,!0),p(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(Ba.copy(aa.position),qa.multiplyVector3(Ba),L.z=Ba.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),
+C(aa,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render)aa=L.object,N=L.buffer,m(aa),f(c,I,oa,b.overrideMaterial,N,aa);for(v=0;v<H;v++)L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible&&(m(aa),ga=e(c,I,oa,b.overrideMaterial,aa),aa.render(function(c){h(c,ga,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(v=G-1;v>=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque;
+m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,oa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.opaque;m(aa);for(L=0;L<O.count;L++)E=O.list[L],k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ga=e(c,I,oa,E,aa),aa.render(function(b){h(b,ga,E.shading)})}for(v=0;v<G;v++)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;
+O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,I,oa,E,N,aa)}for(v=0;v<H;v++)if(L=b.__webglObjectsImmediate[v],aa=L.object,aa.visible){O=L.transparent;m(aa);for(L=0;L<O.count;L++)E=O.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ga=e(c,I,oa,E,aa),aa.render(function(b){h(b,ga,E.shading)})}}b.__webglSprites.length&&
 A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&D(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),
 A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&D(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&&M(k),k.geometryGroups){m=k.geometryGroups[h];if(!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&&M(k),k.geometryGroups){m=k.geometryGroups[h];if(!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 v=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}for(var n=m,v=e,t=void 0,u=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,ha=y=p=0,O=w=u=void 0,z=O=u=t=void 0,w=void 0,x=v.geometry,L=x.faces,O=n.faces,t=0,u=O.length;t<u;t++)w=O[t],w=L[w],w instanceof THREE.Face3?(p+=3,
-y+=1,ha+=3):w instanceof THREE.Face4&&(p+=4,y+=2,ha+=4);for(var t=n,u=v,A=O=L=void 0,C=void 0,A=void 0,w=[],L=0,O=u.materials.length;L<O;L++)if(A=u.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<l;A++)(C=t.materials[A])&&w.push(C)}else(C=A)&&w.push(C);t=w;n.__materials=t;a:{L=u=void 0;O=t.length;for(u=0;u<O;u++)if(L=t[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{O=L=void 0;w=t.length;for(L=0;L<w;L++)if(O=t[L],!(O instanceof THREE.MeshBasicMaterial&&
-!O.envMap||O instanceof THREE.MeshDepthMaterial)){O=O&&O.shading!=void 0&&O.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}O=!1}a:{w=L=void 0;A=t.length;for(L=0;L<A;L++)if(w=t[L],w.vertexColors){w=w.vertexColors;break a}w=!1}n.__vertexArray=new Float32Array(p*3);if(O)n.__normalArray=new Float32Array(p*3);if(x.hasTangents)n.__tangentArray=new Float32Array(p*4);if(w)n.__colorArray=new Float32Array(p*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*
-2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ha*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L=
-n.numMorphTargets;x<L;x++)n.__morphTargetsArrays.push(new Float32Array(p*3))}n.__needsSmoothNormals=O==THREE.SmoothShading;n.__uvType=u;n.__vertexColorType=w;n.__normalType=O;n.__webglFaceCount=y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0);n.__webglLineCount=ha*2;x=0;for(L=t.length;x<L;x++)if(u=t[x],u.attributes){if(n.__webglCustomAttributes===void 0)n.__webglCustomAttributes={};for(a in u.attributes){w=u.attributes[a];O={};for(z in w)O[z]=w[z];if(!O.__webglInitialized||O.createUniqueBuffers)O.__webglInitialized=
-!0,y=1,O.type==="v2"?y=2:O.type==="v3"?y=3:O.type==="v4"?y=4:O.type==="c"&&(y=3),O.size=y,O.array=new Float32Array(p*y),O.buffer=o.createBuffer(),O.buffer.belongsToAttribute=a,w.needsUpdate=!0,O.__original=w;n.__webglCustomAttributes[a]=O}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}R(f.__webglObjects,m,e)}else if(e instanceof THREE.Ribbon){k=e.geometry;if(!k.__webglVertexBuffer)h=
-k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglVertexCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;R(f.__webglObjects,k,e)}else if(e instanceof THREE.Line){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*
-3),h.__webglLineCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;R(f.__webglObjects,k,e)}else if(e instanceof THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=n;h.__materials=m.materials;z=p=v=void 0;v=0;for(p=m.materials.length;v<p;v++)if(z=m.materials[v],z.attributes){if(h.__webglCustomAttributes===
-void 0)h.__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(n*size),attribute.buffer=o.createBuffer(),
-attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}R(f.__webglObjects,k,e)}else 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);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];
-e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)H(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;k=void 0;for(k=e.length-1;k>=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(v=k.geometryGroupsList.length;n<
-v;n++)if(m=k.geometryGroupsList[n],p=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,y=!k.dynamic,p.__inittedArrays){var aa=x=ha=void 0,N=void 0,I=aa=void 0,qa=void 0,K=void 0,fa=void 0,ia=C=A=w=O=L=u=t=void 0,J=void 0,F=N=fa=N=K=qa=void 0,B=void 0,D=B=F=qa=void 0,Y=void 0,$=D=B=F=aa=aa=I=fa=N=D=B=F=Y=D=B=F=Y=D=B=F=void 0,V=0,ra=0,S=0,ua=0,ya=0,T=0,oa=0,U=0,Q=0,P=0,W=0,D=F=0,D=void 0,ea=
-p.__vertexArray,da=p.__uvArray,ja=p.__uv2Array,na=p.__normalArray,Z=p.__tangentArray,ka=p.__colorArray,va=p.__skinVertexAArray,ca=p.__skinVertexBArray,sa=p.__skinIndexArray,ga=p.__skinWeightArray,pa=p.__morphTargetsArrays,la=p.__webglCustomAttributes,B=void 0,ta=p.__faceArray,ma=p.__lineArray,Fa=p.__needsSmoothNormals,u=p.__vertexColorType,t=p.__uvType,L=p.__normalType,xa=h.geometry,za=xa.__dirtyVertices,Ca=xa.__dirtyElements,Ba=xa.__dirtyUvs,Aa=xa.__dirtyNormals,Ea=xa.__dirtyTangents,ab=xa.__dirtyColors,
-bb=xa.__dirtyMorphTargets,Oa=xa.vertices,db=p.faces,gb=xa.faces,eb=xa.faceVertexUvs[0],fb=xa.faceVertexUvs[1],Pa=xa.skinVerticesA,Qa=xa.skinVerticesB,Ra=xa.skinIndices,Ha=xa.skinWeights,Ga=xa.morphTargets;if(la)for($ in la)la[$].offset=0,la[$].offsetSrc=0;ha=0;for(x=db.length;ha<x;ha++)if(aa=db[ha],N=gb[aa],eb&&(O=eb[aa]),fb&&(w=fb[aa]),aa=N.vertexNormals,I=N.normal,qa=N.vertexColors,K=N.color,fa=N.vertexTangents,N instanceof THREE.Face3){if(za)A=Oa[N.a].position,C=Oa[N.b].position,ia=Oa[N.c].position,
-ea[ra]=A.x,ea[ra+1]=A.y,ea[ra+2]=A.z,ea[ra+3]=C.x,ea[ra+4]=C.y,ea[ra+5]=C.z,ea[ra+6]=ia.x,ea[ra+7]=ia.y,ea[ra+8]=ia.z,ra+=9;if(la)for($ in la)if(B=la[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+
-1],B.array[F+2]=B.value[D+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ia=B.value[N.c]):B.boundTo==="faces"?(ia=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ia=B.value[D+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ia.x,B.array[F+5]=ia.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]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ia.r,B.array[F+7]=ia.g,B.array[F+8]=ia.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ia.x,B.array[F+7]=ia.y,B.array[F+8]=ia.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]=C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ia.x,B.array[F+9]=ia.y,B.array[F+10]=ia.z,B.array[F+11]=ia.w,B.offset+=12));if(bb){F=0;for(B=
-Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ia=Ga[F].vertices[N.c].position,D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ia.x,D[W+7]=ia.y,D[W+8]=ia.z;W+=9}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],ga[P]=F.x,ga[P+1]=F.y,ga[P+2]=F.z,ga[P+3]=F.w,ga[P+4]=B.x,ga[P+5]=B.y,ga[P+6]=B.z,ga[P+7]=B.w,ga[P+8]=D.x,ga[P+9]=D.y,ga[P+10]=D.z,ga[P+11]=D.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=B.x,sa[P+
-5]=B.y,sa[P+6]=B.z,sa[P+7]=B.w,sa[P+8]=D.x,sa[P+9]=D.y,sa[P+10]=D.z,sa[P+11]=D.w,F=Pa[N.a],B=Pa[N.b],D=Pa[N.c],va[P]=F.x,va[P+1]=F.y,va[P+2]=F.z,va[P+3]=1,va[P+4]=B.x,va[P+5]=B.y,va[P+6]=B.z,va[P+7]=1,va[P+8]=D.x,va[P+9]=D.y,va[P+10]=D.z,va[P+11]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,P+=12;if(ab&&u)qa.length==3&&u==THREE.VertexColors?(N=qa[0],F=qa[1],B=qa[2]):B=F=N=K,
-ka[Q]=N.r,ka[Q+1]=N.g,ka[Q+2]=N.b,ka[Q+3]=F.r,ka[Q+4]=F.g,ka[Q+5]=F.b,ka[Q+6]=B.r,ka[Q+7]=B.g,ka[Q+8]=B.b,Q+=9;if(Ea&&xa.hasTangents)qa=fa[0],K=fa[1],N=fa[2],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=N.x,Z[oa+9]=N.y,Z[oa+10]=N.z,Z[oa+11]=N.w,oa+=12;if(Aa&&L)if(aa.length==3&&Fa)for(fa=0;fa<3;fa++)I=aa[fa],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(fa=0;fa<3;fa++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&O!==void 0&&t)for(fa=0;fa<
-3;fa++)aa=O[fa],da[S]=aa.u,da[S+1]=aa.v,S+=2;if(Ba&&w!==void 0&&t)for(fa=0;fa<3;fa++)aa=w[fa],ja[ua]=aa.u,ja[ua+1]=aa.v,ua+=2;Ca&&(ta[ya]=V,ta[ya+1]=V+1,ta[ya+2]=V+2,ya+=3,ma[U]=V,ma[U+1]=V+1,ma[U+2]=V,ma[U+3]=V+2,ma[U+4]=V+1,ma[U+5]=V+2,U+=6,V+=3)}else if(N instanceof THREE.Face4){if(za)A=Oa[N.a].position,C=Oa[N.b].position,ia=Oa[N.c].position,J=Oa[N.d].position,ea[ra]=A.x,ea[ra+1]=A.y,ea[ra+2]=A.z,ea[ra+3]=C.x,ea[ra+4]=C.y,ea[ra+5]=C.z,ea[ra+6]=ia.x,ea[ra+7]=ia.y,ea[ra+8]=ia.z,ea[ra+9]=J.x,ea[ra+
-10]=J.y,ea[ra+11]=J.z,ra+=12;if(la)for($ in la)if(B=la[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c],B.array[F+3]=B.value[N.d]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.array[F+3]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.array[F+3]=B.value[D+3],
-B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ia=B.value[N.c],J=B.value[N.d]):B.boundTo==="faces"?(J=ia=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ia=B.value[D+2],J=B.value[D+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ia.x,B.array[F+5]=ia.y,B.array[F+6]=J.x,B.array[F+7]=J.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]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ia.r,B.array[F+7]=ia.g,B.array[F+8]=ia.b,B.array[F+9]=J.r,B.array[F+10]=J.g,B.array[F+11]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ia.x,B.array[F+7]=ia.y,B.array[F+8]=ia.z,B.array[F+9]=J.x,B.array[F+10]=J.y,B.array[F+11]=J.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]=C.x,B.array[F+5]=
-C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ia.x,B.array[F+9]=ia.y,B.array[F+10]=ia.z,B.array[F+11]=ia.w,B.array[F+12]=J.x,B.array[F+13]=J.y,B.array[F+14]=J.z,B.array[F+15]=J.w,B.offset+=16));if(bb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ia=Ga[F].vertices[N.c].position,J=Ga[F].vertices[N.d].position,D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ia.x,D[W+7]=ia.y,D[W+8]=ia.z,D[W+9]=J.x,D[W+10]=J.y,D[W+11]=J.z;
-W+=12}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],Y=Ha[N.d],ga[P]=F.x,ga[P+1]=F.y,ga[P+2]=F.z,ga[P+3]=F.w,ga[P+4]=B.x,ga[P+5]=B.y,ga[P+6]=B.z,ga[P+7]=B.w,ga[P+8]=D.x,ga[P+9]=D.y,ga[P+10]=D.z,ga[P+11]=D.w,ga[P+12]=Y.x,ga[P+13]=Y.y,ga[P+14]=Y.z,ga[P+15]=Y.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],Y=Ra[N.d],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=B.x,sa[P+5]=B.y,sa[P+6]=B.z,sa[P+7]=B.w,sa[P+8]=D.x,sa[P+9]=D.y,sa[P+10]=D.z,sa[P+11]=D.w,sa[P+12]=Y.x,sa[P+13]=Y.y,sa[P+14]=Y.z,sa[P+15]=Y.w,F=Pa[N.a],
-B=Pa[N.b],D=Pa[N.c],Y=Pa[N.d],va[P]=F.x,va[P+1]=F.y,va[P+2]=F.z,va[P+3]=1,va[P+4]=B.x,va[P+5]=B.y,va[P+6]=B.z,va[P+7]=1,va[P+8]=D.x,va[P+9]=D.y,va[P+10]=D.z,va[P+11]=1,va[P+12]=Y.x,va[P+13]=Y.y,va[P+14]=Y.z,va[P+15]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],N=Qa[N.d],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,ca[P+12]=N.x,ca[P+13]=N.y,ca[P+14]=N.z,ca[P+15]=1,P+=16;if(ab&&u)qa.length==4&&u==THREE.VertexColors?(N=qa[0],
-F=qa[1],B=qa[2],qa=qa[3]):qa=B=F=N=K,ka[Q]=N.r,ka[Q+1]=N.g,ka[Q+2]=N.b,ka[Q+3]=F.r,ka[Q+4]=F.g,ka[Q+5]=F.b,ka[Q+6]=B.r,ka[Q+7]=B.g,ka[Q+8]=B.b,ka[Q+9]=qa.r,ka[Q+10]=qa.g,ka[Q+11]=qa.b,Q+=12;if(Ea&&xa.hasTangents)qa=fa[0],K=fa[1],N=fa[2],fa=fa[3],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=N.x,Z[oa+9]=N.y,Z[oa+10]=N.z,Z[oa+11]=N.w,Z[oa+12]=fa.x,Z[oa+13]=fa.y,Z[oa+14]=fa.z,Z[oa+15]=fa.w,oa+=16;if(Aa&&L)if(aa.length==4&&Fa)for(fa=0;fa<4;fa++)I=
-aa[fa],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(fa=0;fa<4;fa++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&O!==void 0&&t)for(fa=0;fa<4;fa++)aa=O[fa],da[S]=aa.u,da[S+1]=aa.v,S+=2;if(Ba&&w!==void 0&&t)for(fa=0;fa<4;fa++)aa=w[fa],ja[ua]=aa.u,ja[ua+1]=aa.v,ua+=2;Ca&&(ta[ya]=V,ta[ya+1]=V+1,ta[ya+2]=V+3,ta[ya+3]=V+1,ta[ya+4]=V+2,ta[ya+5]=V+3,ya+=6,ma[U]=V,ma[U+1]=V+1,ma[U+2]=V,ma[U+3]=V+3,ma[U+4]=V+1,ma[U+5]=V+2,ma[U+6]=V+2,ma[U+7]=V+3,U+=8,V+=4)}za&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),
-o.bufferData(o.ARRAY_BUFFER,ea,z));if(la)for($ in la)B=la[$],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,z));if(bb){F=0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,pa[F],z)}ab&&Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ka,z));Aa&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,na,z));Ea&&xa.hasTangents&&
-(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z));Ba&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,da,z));Ba&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ta,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,va,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,sa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));y&&(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)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ha=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;
-if(h.__dirtyVertices){for(y=0;y<t;y++)ha=x[y].position,n=y*3,u[n]=ha.x,u[n+1]=ha.y,u[n+2]=ha.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,u,m)}if(L){for(y=0;y<p;y++)color=v[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ha=y=y=void 0;
-x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<t;y++)ha=x[y].position,n=y*3,u[n]=ha.x,u[n+1]=ha.y,u[n+2]=ha.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,u,m)}if(L){for(y=0;y<p;y++)color=v[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof
-THREE.ParticleSystem)k=h.geometry,p=E(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||p)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,G(k)};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 Fa}};
+n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var v=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}X.info.memory.geometries++;for(var n=m,v=e,t=void 0,u=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,ga=y=p=0,O=w=u=void 0,z=O=u=t=void 0,w=void 0,x=v.geometry,L=x.faces,O=n.faces,t=0,u=O.length;t<u;t++)w=O[t],w=L[w],w instanceof
+THREE.Face3?(p+=3,y+=1,ga+=3):w instanceof THREE.Face4&&(p+=4,y+=2,ga+=4);for(var t=n,u=v,A=O=L=void 0,C=void 0,A=void 0,w=[],L=0,O=u.materials.length;L<O;L++)if(A=u.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<l;A++)(C=t.materials[A])&&w.push(C)}else(C=A)&&w.push(C);t=w;n.__materials=t;a:{L=u=void 0;O=t.length;for(u=0;u<O;u++)if(L=t[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{O=L=void 0;w=t.length;for(L=0;L<w;L++)if(O=t[L],!(O instanceof
+THREE.MeshBasicMaterial&&!O.envMap||O instanceof THREE.MeshDepthMaterial)){O=O&&O.shading!=void 0&&O.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}O=!1}a:{w=L=void 0;A=t.length;for(L=0;L<A;L++)if(w=t[L],w.vertexColors){w=w.vertexColors;break a}w=!1}n.__vertexArray=new Float32Array(p*3);if(O)n.__normalArray=new Float32Array(p*3);if(x.hasTangents)n.__tangentArray=new Float32Array(p*4);if(w)n.__colorArray=new Float32Array(p*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
+0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ga*2);if(n.numMorphTargets){n.__morphTargetsArrays=
+[];x=0;for(L=n.numMorphTargets;x<L;x++)n.__morphTargetsArrays.push(new Float32Array(p*3))}n.__needsSmoothNormals=O==THREE.SmoothShading;n.__uvType=u;n.__vertexColorType=w;n.__normalType=O;n.__webglFaceCount=y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0);n.__webglLineCount=ga*2;x=0;for(L=t.length;x<L;x++)if(u=t[x],u.attributes){if(n.__webglCustomAttributes===void 0)n.__webglCustomAttributes={};for(a in u.attributes){w=u.attributes[a];O={};for(z in w)O[z]=w[z];if(!O.__webglInitialized||
+O.createUniqueBuffers)O.__webglInitialized=!0,y=1,O.type==="v2"?y=2:O.type==="v3"?y=3:O.type==="v4"?y=4:O.type==="c"&&(y=3),O.size=y,O.array=new Float32Array(p*y),O.buffer=o.createBuffer(),O.buffer.belongsToAttribute=a,w.needsUpdate=!0,O.__original=w;n.__webglCustomAttributes[a]=O}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}Q(f.__webglObjects,m,e)}else if(e instanceof THREE.Ribbon){k=
+e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglVertexCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.Line){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,
+h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglLineCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;Q(f.__webglObjects,k,e)}else if(e instanceof THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();X.info.geometries++;h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=
+n;h.__materials=m.materials;z=p=v=void 0;v=0;for(p=m.materials.length;v<p;v++)if(z=m.materials[v],z.attributes){if(h.__webglCustomAttributes===void 0)h.__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(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}Q(f.__webglObjects,k,e)}else 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);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)H(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;k=void 0;for(k=e.length-1;k>=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=
+0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(v=k.geometryGroupsList.length;n<v;n++)if(m=k.geometryGroupsList[n],p=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,y=!k.dynamic,p.__inittedArrays){var aa=x=ga=void 0,N=void 0,I=aa=void 0,oa=void 0,K=void 0,ea=void 0,ka=C=A=w=O=L=u=t=void 0,J=void 0,F=N=ea=
+N=K=oa=void 0,B=void 0,D=B=F=oa=void 0,Z=void 0,$=D=B=F=aa=aa=I=ea=N=D=B=F=Z=D=B=F=Z=D=B=F=void 0,U=0,qa=0,R=0,ua=0,za=0,S=0,na=0,T=0,W=0,P=0,da=0,D=F=0,D=void 0,V=p.__vertexArray,la=p.__uvArray,ra=p.__uv2Array,ia=p.__normalArray,ja=p.__tangentArray,xa=p.__colorArray,ca=p.__skinVertexAArray,ta=p.__skinVertexBArray,fa=p.__skinIndexArray,ha=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,ma=p.__faceArray,ya=p.__lineArray,Ba=p.__needsSmoothNormals,u=p.__vertexColorType,
+t=p.__uvType,L=p.__normalType,va=h.geometry,Ca=va.__dirtyVertices,Fa=va.__dirtyElements,Aa=va.__dirtyUvs,Ea=va.__dirtyNormals,ab=va.__dirtyTangents,bb=va.__dirtyColors,cb=va.__dirtyMorphTargets,Oa=va.vertices,eb=p.faces,hb=va.faces,fb=va.faceVertexUvs[0],gb=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,Ha=va.skinWeights,Ga=va.morphTargets;if(sa)for($ in sa)sa[$].offset=0,sa[$].offsetSrc=0;ga=0;for(x=eb.length;ga<x;ga++)if(aa=eb[ga],N=hb[aa],fb&&(O=fb[aa]),gb&&(w=gb[aa]),
+aa=N.vertexNormals,I=N.normal,oa=N.vertexColors,K=N.color,ea=N.vertexTangents,N instanceof THREE.Face3){if(Ca)A=Oa[N.a].position,C=Oa[N.b].position,ka=Oa[N.c].position,V[qa]=A.x,V[qa+1]=A.y,V[qa+2]=A.z,V[qa+3]=C.x,V[qa+4]=C.y,V[qa+5]=C.z,V[qa+6]=ka.x,V[qa+7]=ka.y,V[qa+8]=ka.z,qa+=9;if(sa)for($ in sa)if(B=sa[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c]):B.boundTo===
+"faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ka=B.value[N.c]):B.boundTo==="faces"?(ka=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ka=B.value[D+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+
+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ka.x,B.array[F+5]=ka.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]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ka.r,B.array[F+7]=ka.g,B.array[F+8]=ka.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ka.x,B.array[F+7]=ka.y,B.array[F+8]=ka.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]=
+C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ka.x,B.array[F+9]=ka.y,B.array[F+10]=ka.z,B.array[F+11]=ka.w,B.offset+=12));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ka=Ga[F].vertices[N.c].position,D=pa[F],D[da]=A.x,D[da+1]=A.y,D[da+2]=A.z,D[da+3]=C.x,D[da+4]=C.y,D[da+5]=C.z,D[da+6]=ka.x,D[da+7]=ka.y,D[da+8]=ka.z;da+=9}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],ha[P]=F.x,ha[P+1]=F.y,ha[P+2]=F.z,ha[P+3]=F.w,ha[P+4]=B.x,ha[P+
+5]=B.y,ha[P+6]=B.z,ha[P+7]=B.w,ha[P+8]=D.x,ha[P+9]=D.y,ha[P+10]=D.z,ha[P+11]=D.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],fa[P]=F.x,fa[P+1]=F.y,fa[P+2]=F.z,fa[P+3]=F.w,fa[P+4]=B.x,fa[P+5]=B.y,fa[P+6]=B.z,fa[P+7]=B.w,fa[P+8]=D.x,fa[P+9]=D.y,fa[P+10]=D.z,fa[P+11]=D.w,F=Pa[N.a],B=Pa[N.b],D=Pa[N.c],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],ta[P]=F.x,ta[P+1]=F.y,ta[P+2]=F.z,ta[P+3]=1,ta[P+
+4]=B.x,ta[P+5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,P+=12;if(bb&&u)oa.length==3&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2]):B=F=N=K,xa[W]=N.r,xa[W+1]=N.g,xa[W+2]=N.b,xa[W+3]=F.r,xa[W+4]=F.g,xa[W+5]=F.b,xa[W+6]=B.r,xa[W+7]=B.g,xa[W+8]=B.b,W+=9;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+5]=K.y,ja[na+6]=K.z,ja[na+7]=K.w,ja[na+8]=N.x,ja[na+9]=N.y,ja[na+10]=N.z,ja[na+11]=N.w,na+=12;if(Ea&&
+L)if(aa.length==3&&Ba)for(ea=0;ea<3;ea++)I=aa[ea],ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;else for(ea=0;ea<3;ea++)ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;if(Aa&&O!==void 0&&t)for(ea=0;ea<3;ea++)aa=O[ea],la[R]=aa.u,la[R+1]=aa.v,R+=2;if(Aa&&w!==void 0&&t)for(ea=0;ea<3;ea++)aa=w[ea],ra[ua]=aa.u,ra[ua+1]=aa.v,ua+=2;Fa&&(ma[za]=U,ma[za+1]=U+1,ma[za+2]=U+2,za+=3,ya[T]=U,ya[T+1]=U+1,ya[T+2]=U,ya[T+3]=U+2,ya[T+4]=U+1,ya[T+5]=U+2,T+=6,U+=3)}else if(N instanceof THREE.Face4){if(Ca)A=Oa[N.a].position,C=Oa[N.b].position,
+ka=Oa[N.c].position,J=Oa[N.d].position,V[qa]=A.x,V[qa+1]=A.y,V[qa+2]=A.z,V[qa+3]=C.x,V[qa+4]=C.y,V[qa+5]=C.z,V[qa+6]=ka.x,V[qa+7]=ka.y,V[qa+8]=ka.z,V[qa+9]=J.x,V[qa+10]=J.y,V[qa+11]=J.z,qa+=12;if(sa)for($ in sa)if(B=sa[$],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[N.a],B.array[F+1]=B.value[N.b],B.array[F+2]=B.value[N.c],B.array[F+3]=B.value[N.d]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+
+2]=D,B.array[F+3]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.array[F+3]=B.value[D+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[N.a],C=B.value[N.b],ka=B.value[N.c],J=B.value[N.d]):B.boundTo==="faces"?(J=ka=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ka=B.value[D+2],J=B.value[D+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=
+A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ka.x,B.array[F+5]=ka.y,B.array[F+6]=J.x,B.array[F+7]=J.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]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ka.r,B.array[F+7]=ka.g,B.array[F+8]=ka.b,B.array[F+9]=J.r,B.array[F+10]=J.g,B.array[F+11]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ka.x,B.array[F+7]=ka.y,B.array[F+
+8]=ka.z,B.array[F+9]=J.x,B.array[F+10]=J.y,B.array[F+11]=J.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]=C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ka.x,B.array[F+9]=ka.y,B.array[F+10]=ka.z,B.array[F+11]=ka.w,B.array[F+12]=J.x,B.array[F+13]=J.y,B.array[F+14]=J.z,B.array[F+15]=J.w,B.offset+=16));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[N.a].position,C=Ga[F].vertices[N.b].position,ka=Ga[F].vertices[N.c].position,
+J=Ga[F].vertices[N.d].position,D=pa[F],D[da]=A.x,D[da+1]=A.y,D[da+2]=A.z,D[da+3]=C.x,D[da+4]=C.y,D[da+5]=C.z,D[da+6]=ka.x,D[da+7]=ka.y,D[da+8]=ka.z,D[da+9]=J.x,D[da+10]=J.y,D[da+11]=J.z;da+=12}if(Ha.length)F=Ha[N.a],B=Ha[N.b],D=Ha[N.c],Z=Ha[N.d],ha[P]=F.x,ha[P+1]=F.y,ha[P+2]=F.z,ha[P+3]=F.w,ha[P+4]=B.x,ha[P+5]=B.y,ha[P+6]=B.z,ha[P+7]=B.w,ha[P+8]=D.x,ha[P+9]=D.y,ha[P+10]=D.z,ha[P+11]=D.w,ha[P+12]=Z.x,ha[P+13]=Z.y,ha[P+14]=Z.z,ha[P+15]=Z.w,F=Ra[N.a],B=Ra[N.b],D=Ra[N.c],Z=Ra[N.d],fa[P]=F.x,fa[P+1]=F.y,
+fa[P+2]=F.z,fa[P+3]=F.w,fa[P+4]=B.x,fa[P+5]=B.y,fa[P+6]=B.z,fa[P+7]=B.w,fa[P+8]=D.x,fa[P+9]=D.y,fa[P+10]=D.z,fa[P+11]=D.w,fa[P+12]=Z.x,fa[P+13]=Z.y,fa[P+14]=Z.z,fa[P+15]=Z.w,F=Pa[N.a],B=Pa[N.b],D=Pa[N.c],Z=Pa[N.d],ca[P]=F.x,ca[P+1]=F.y,ca[P+2]=F.z,ca[P+3]=1,ca[P+4]=B.x,ca[P+5]=B.y,ca[P+6]=B.z,ca[P+7]=1,ca[P+8]=D.x,ca[P+9]=D.y,ca[P+10]=D.z,ca[P+11]=1,ca[P+12]=Z.x,ca[P+13]=Z.y,ca[P+14]=Z.z,ca[P+15]=1,F=Qa[N.a],B=Qa[N.b],D=Qa[N.c],N=Qa[N.d],ta[P]=F.x,ta[P+1]=F.y,ta[P+2]=F.z,ta[P+3]=1,ta[P+4]=B.x,ta[P+
+5]=B.y,ta[P+6]=B.z,ta[P+7]=1,ta[P+8]=D.x,ta[P+9]=D.y,ta[P+10]=D.z,ta[P+11]=1,ta[P+12]=N.x,ta[P+13]=N.y,ta[P+14]=N.z,ta[P+15]=1,P+=16;if(bb&&u)oa.length==4&&u==THREE.VertexColors?(N=oa[0],F=oa[1],B=oa[2],oa=oa[3]):oa=B=F=N=K,xa[W]=N.r,xa[W+1]=N.g,xa[W+2]=N.b,xa[W+3]=F.r,xa[W+4]=F.g,xa[W+5]=F.b,xa[W+6]=B.r,xa[W+7]=B.g,xa[W+8]=B.b,xa[W+9]=oa.r,xa[W+10]=oa.g,xa[W+11]=oa.b,W+=12;if(ab&&va.hasTangents)oa=ea[0],K=ea[1],N=ea[2],ea=ea[3],ja[na]=oa.x,ja[na+1]=oa.y,ja[na+2]=oa.z,ja[na+3]=oa.w,ja[na+4]=K.x,ja[na+
+5]=K.y,ja[na+6]=K.z,ja[na+7]=K.w,ja[na+8]=N.x,ja[na+9]=N.y,ja[na+10]=N.z,ja[na+11]=N.w,ja[na+12]=ea.x,ja[na+13]=ea.y,ja[na+14]=ea.z,ja[na+15]=ea.w,na+=16;if(Ea&&L)if(aa.length==4&&Ba)for(ea=0;ea<4;ea++)I=aa[ea],ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;else for(ea=0;ea<4;ea++)ia[S]=I.x,ia[S+1]=I.y,ia[S+2]=I.z,S+=3;if(Aa&&O!==void 0&&t)for(ea=0;ea<4;ea++)aa=O[ea],la[R]=aa.u,la[R+1]=aa.v,R+=2;if(Aa&&w!==void 0&&t)for(ea=0;ea<4;ea++)aa=w[ea],ra[ua]=aa.u,ra[ua+1]=aa.v,ua+=2;Fa&&(ma[za]=U,ma[za+1]=U+1,ma[za+
+2]=U+3,ma[za+3]=U+1,ma[za+4]=U+2,ma[za+5]=U+3,za+=6,ya[T]=U,ya[T+1]=U+1,ya[T+2]=U,ya[T+3]=U+3,ya[T+4]=U+1,ya[T+5]=U+2,ya[T+6]=U+2,ya[T+7]=U+3,T+=8,U+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,z));if(sa)for($ in sa)B=sa[$],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,pa[F],
+z)}bb&&W>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,ia,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ra,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ta,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
+ha,z));y&&(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)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=
+h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ga=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<t;y++)ga=x[y].position,n=y*3,u[n]=ga.x,u[n+1]=ga.y,u[n+2]=ga.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,u,m)}if(L){for(y=0;y<p;y++)color=v[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
+z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ga=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<t;y++)ga=x[y].position,n=y*3,u[n]=ga.x,u[n+1]=ga.y,u[n+2]=ga.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,u,m)}if(L){for(y=0;y<p;y++)color=v[y],n=y*3,z[n]=color.r,z[n+
+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,p=E(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||p)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,G(k)};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 ya}};
 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};
@@ -473,8 +476,8 @@ c(this,function(b){e&&(m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=
 b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=t=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(u=w=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=t=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(u=w=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,t){function u(b,c,e,k,n,p,t,v){var u,x,y=f||1,z=h||1,S=n/2,U=p/2,da=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",y=m||1;var Q=y+1,o=z+1;n/=y;var pa=p/z;for(x=0;x<o;x++)for(p=0;p<Q;p++){var T=new THREE.Vector3;T[b]=(p*n-S)*e;T[c]=(x*pa-U)*k;T[u]=t;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+
-Q*x+da,p+Q*(x+1)+da,p+1+Q*(x+1)+da,p+1+Q*x+da,null,null,v)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,v=b/2,x=c/2,p=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var z in t)this.sides[z]!=void 0&&(this.sides[z]=
+THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,t){function u(b,c,e,k,n,p,t,v){var u,x,y=f||1,z=h||1,R=n/2,T=p/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",y=m||1;var X=y+1,o=z+1;n/=y;var ha=p/z;for(x=0;x<o;x++)for(p=0;p<X;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ha-T)*k;S[u]=t;w.vertices.push(new THREE.Vertex(S))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+X*
+x+V,p+X*(x+1)+V,p+1+X*(x+1)+V,p+1+X*x+V,null,null,v)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,v=b/2,x=c/2,p=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var z in t)this.sides[z]!=void 0&&(this.sides[z]=
 t[z]);this.sides.px&&u("z","y",1*n,-1,e,c,-v,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,v,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-p,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=w.vertices.length;e<f;e++){for(var h=w.vertices[e],k=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(h.position.x==p.position.x&&
 t[z]);this.sides.px&&u("z","y",1*n,-1,e,c,-v,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,v,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-p,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=w.vertices.length;e<f;e++){for(var h=w.vertices[e],k=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(h.position.x==p.position.x&&
 h.position.y==p.position.y&&h.position.z==p.position.z){c[e]=m;k=!0;break}}if(!k)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=w.faces.length;e<f;e++)h=w.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];w.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 h.position.y==p.position.y&&h.position.z==p.position.z){c[e]=m;k=!0;break}}if(!k)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=w.faces.length;e<f;e++)h=w.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];w.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,t,u=[],w=[];for(t=0;t<=h;t++){var v=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-p*e+k,y*Math.cos(z*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(z,p))}u.push(v);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=u[t][n],v=u[t+1][n],x=u[t+1][n+1],p=u[t][n+1],y=
 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,t,u=[],w=[];for(t=0;t<=h;t++){var v=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-p*e+k,y*Math.cos(z*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(z,p))}u.push(v);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=u[t][n],v=u[t+1][n],x=u[t+1][n+1],p=u[t][n+1],y=
@@ -483,13 +486,13 @@ this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[v].positio
 H=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,v,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 H=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,v,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}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,h=THREE.ExtrudeGeometry.__v2,k=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);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return 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(D=b.length;--D>=0;){la=D;ga=D-1;ga<0&&(ga=b.length-
-1);for(var c=0,e=p+w*2,c=0;c<e;c++){var f=pa*c,h=pa*(c+1),k=Z+la+f,m=Z+la+h,o=k,f=Z+ga+f,h=Z+ga+h,v=m;o+=W;f+=W;h+=W;v+=W;K.faces.push(new THREE.Face4(o,f,h,v,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+t*2,k=(K.vertices[k].position.z+t)/h,m=(K.vertices[m].position.z+t)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=W;c+=W;e+=W;K.faces.push(new THREE.Face3(b,
+n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return 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(D=b.length;--D>=0;){pa=D;fa=D-1;fa<0&&(fa=b.length-
+1);for(var c=0,e=p+w*2,c=0;c<e;c++){var f=ha*c,h=ha*(c+1),k=ia+pa+f,m=ia+pa+h,o=k,f=ia+fa+f,h=ia+fa+h,v=m;o+=W;f+=W;h+=W;v+=W;K.faces.push(new THREE.Face4(o,f,h,v,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+t*2,k=(K.vertices[k].position.z+t)/h,m=(K.vertices[m].position.z+t)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=W;c+=W;e+=W;K.faces.push(new THREE.Face3(b,
 c,e,null,null,G));if(G){var f=M.maxY,h=M.maxX,k=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/h,K.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,v=c.bevelEnabled!==void 0?c.bevelEnabled:
 c,e,null,null,G));if(G){var f=M.maxY,h=M.maxX,k=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/h,K.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,v=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,M=this.shapebb;if(z)A=z.getPoints(x),p=A.length,C=!0,v=!1;v||(u=t=w=0);var R,J,I,K=this,W=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)R=x[J],THREE.Shape.Utils.isClockWise(R)&&
-(x[J]=R.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)R=x[J],y=y.concat(R);var D,S,U,da,Q,o,pa=y.length,T=z.length,ma=[];D=0;S=E.length;la=S-1;for(ga=D+1;D<S;D++,la++,ga++)la==S&&(la=0),ga==S&&(ga=0),ma[D]=f(E[D],E[la],E[ga]);var ca=[],na,ja=ma.concat();J=0;for(I=x.length;J<I;J++){R=x[J];na=[];D=0;S=R.length;la=S-1;for(ga=D+1;D<S;D++,la++,ga++)la==S&&(la=0),ga==S&&(ga=0),na[D]=f(R[D],R[la],R[ga]);ca.push(na);ja=ja.concat(na)}for(U=0;U<w;U++){da=U/w;Q=t*(1-
-da);da=u*Math.sin(da*Math.PI/2);D=0;for(S=E.length;D<S;D++)o=e(E[D],ma[D],da),m(o.x,o.y,-Q);J=0;for(I=x.length;J<I;J++){R=x[J];na=ca[J];D=0;for(S=R.length;D<S;D++)o=e(R[D],na[D],da),m(o.x,o.y,-Q)}}da=u;for(D=0;D<pa;D++)o=v?e(y[D],ja[D],da):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(U=1;U<=p;U++)for(D=0;D<pa;D++)o=v?e(y[D],ja[D],da):y[D],C?m(o.x,o.y+A[U-1].y,A[U-1].x):m(o.x,o.y,n/p*U);for(U=w-1;U>=0;U--){da=U/w;Q=t*(1-da);da=u*Math.sin(da*Math.PI/2);D=0;for(S=E.length;D<S;D++)o=e(E[D],ma[D],
-da),m(o.x,o.y,n+Q);J=0;for(I=x.length;J<I;J++){R=x[J];na=ca[J];D=0;for(S=R.length;D<S;D++)o=e(R[D],na[D],da),C?m(o.x,o.y+A[p-1].y,A[p-1].x+Q):m(o.x,o.y,n+Q)}}if(v){v=pa*0;for(D=0;D<T;D++)u=z[D],k(u[2]+v,u[1]+v,u[0]+v);v=pa*(p+w*2);for(D=0;D<T;D++)u=z[D],k(u[0]+v,u[1]+v,u[2]+v)}else{for(D=0;D<T;D++)u=z[D],k(u[2],u[1],u[0]);for(D=0;D<T;D++)u=z[D],k(u[0]+pa*p,u[1]+pa*p,u[2]+pa*p)}var la,ga,Z=0;h(E);Z+=E.length;J=0;for(I=x.length;J<I;J++)R=x[J],h(R),Z+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,M=this.shapebb;if(z)A=z.getPoints(x),p=A.length,C=!0,v=!1;v||(u=t=w=0);var Q,J,I,K=this,W=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)Q=x[J],THREE.Shape.Utils.isClockWise(Q)&&
+(x[J]=Q.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)Q=x[J],y=y.concat(Q);var D,R,T,V,X,o,ha=y.length,S=z.length,ma=[];D=0;R=E.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ma[D]=f(E[D],E[pa],E[fa]);var ca=[],ra,la=ma.concat();J=0;for(I=x.length;J<I;J++){Q=x[J];ra=[];D=0;R=Q.length;pa=R-1;for(fa=D+1;D<R;D++,pa++,fa++)pa==R&&(pa=0),fa==R&&(fa=0),ra[D]=f(Q[D],Q[pa],Q[fa]);ca.push(ra);la=la.concat(ra)}for(T=0;T<w;T++){V=T/w;X=t*(1-
+V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,-X);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),m(o.x,o.y,-X)}}V=u;for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(T=1;T<=p;T++)for(D=0;D<ha;D++)o=v?e(y[D],la[D],V):y[D],C?m(o.x,o.y+A[T-1].y,A[T-1].x):m(o.x,o.y,n/p*T);for(T=w-1;T>=0;T--){V=T/w;X=t*(1-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D<R;D++)o=e(E[D],ma[D],V),m(o.x,o.y,
+n+X);J=0;for(I=x.length;J<I;J++){Q=x[J];ra=ca[J];D=0;for(R=Q.length;D<R;D++)o=e(Q[D],ra[D],V),C?m(o.x,o.y+A[p-1].y,A[p-1].x+X):m(o.x,o.y,n+X)}}if(v){v=ha*0;for(D=0;D<S;D++)u=z[D],k(u[2]+v,u[1]+v,u[0]+v);v=ha*(p+w*2);for(D=0;D<S;D++)u=z[D],k(u[0]+v,u[1]+v,u[2]+v)}else{for(D=0;D<S;D++)u=z[D],k(u[2],u[1],u[0]);for(D=0;D<S;D++)u=z[D],k(u[0]+ha*p,u[1]+ha*p,u[2]+ha*p)}var pa,fa,ia=0;h(E);ia+=E.length;J=0;for(I=x.length;J<I;J++)Q=x[J],h(Q),ia+=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 t=f(m.faces[n].a,m.faces[n].b),u=f(m.faces[n].b,m.faces[n].c),w=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,t,w,b);e(m.faces[n].b,u,
 -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 t=f(m.faces[n].a,m.faces[n].b),u=f(m.faces[n].b,m.faces[n].c),w=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,t,w,b);e(m.faces[n].b,u,
@@ -509,8 +512,8 @@ this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[
 u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;m.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,u);if(k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,v,p,u);m.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,u,
 u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;m.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,u);if(k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,v,p,u);m.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,u,
 x,p,y,z),k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,y,n),C=THREE.Shape.Utils.b3(C,v,p,z,u),m.push(new THREE.Vector2(E,C))}}}return{offset:A.ha*e,points:m,path:h}}}};
 x,p,y,z),k=m[m.length-1]){w=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,y,n),C=THREE.Shape.Utils.b3(C,v,p,z,u),m.push(new THREE.Vector2(E,C))}}}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=[],t,u,w;if(c(b)>0)for(u=0;u<h;u++)k[u]=u;else for(u=0;u<h;u++)k[u]=h-1-u;var v=2*h;for(u=h-1;h>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=u,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0,
 (function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],t,u,w;if(c(b)>0)for(u=0;u<h;u++)k[u]=u;else for(u=0;u<h;u++)k[u]=h-1-u;var v=2*h;for(u=h-1;h>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=u,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0,
-M=void 0,R=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,R=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(R-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==p||E==y||E==z)){var K=x[C[E]].x,W=x[C[E]].y,D=void 0,S=void 0,U=void 0,da=void 0,Q=void 0,o=void 0,pa=void 0,T=void 0,ma=void 0,ca=void 0,na=void 0,ja=void 0,D=U=Q=void 0,D=J-M,S=I-R,U=G-J,da=H-I,Q=M-G,o=R-H,pa=K-G,T=W-H,ma=K-M,ca=W-R,na=K-J,ja=W-I,D=D*ca-S*ma,Q=Q*T-o*pa,U=U*ja-da*na;if(D>=0&&U>=0&&Q>=0){x=
-!1;break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w<h;t++,w++)k[t]=k[w];h--;v=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};
+M=void 0,Q=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,Q=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(Q-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==p||E==y||E==z)){var K=x[C[E]].x,W=x[C[E]].y,D=void 0,R=void 0,T=void 0,V=void 0,X=void 0,o=void 0,ha=void 0,S=void 0,ma=void 0,ca=void 0,ra=void 0,la=void 0,D=T=X=void 0,D=J-M,R=I-Q,T=G-J,V=H-I,X=M-G,o=Q-H,ha=K-G,S=W-H,ma=K-M,ca=W-Q,ra=K-J,la=W-I,D=D*ca-R*ma,X=X*S-o*ha,T=T*la-V*ra;if(D>=0&&T>=0&&X>=0){x=!1;
+break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w<h;t++,w++)k[t]=k[w];h--;v=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,t=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[m]);t.normal.addSelf(c[k]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
 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,t=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[m]);t.normal.addSelf(c[k]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
 this.faceVertexUvs[0].push([b[h].clone(),b[m].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 this.faceVertexUvs[0].push([b[h].clone(),b[m].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -532,106 +535,106 @@ c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,t=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&&(t==0&&(t=k.getResponseHeader("Content-Length")),m({total:t,loaded:k.responseText.length})):k.readyState==2&&(t=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,t=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&&(t==0&&(t=k.getResponseHeader("Content-Length")),m({total:t,loaded:k.responseText.length})):k.readyState==2&&(t=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=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(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=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function v(c){var e,
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(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=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function v(c){var e,
-f,k;e=h(b,c);f=h(b,c+R);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+R);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+S);k=h(b,c+U);m=h(b,
-c+da);c=t(b,c+Q);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+S);k=h(b,c+U);m=h(b,c+da);p=t(b,c+Q);v=h(b,c+o);u=h(b,c+pa);w=h(b,c+T);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ha=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ha,w),new THREE.Vector3(y,z,c)],null,
-p))}function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+na);c=M[e*2];m=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[k*2];k=M[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+la);m=h(b,c+ga);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var v=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f,
-k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],R,J,I,K,W,D,S,U,da,Q,o,pa,T,ma,ca,na,ja,la,ga,Z,V,$,ea,ka,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
-E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;R=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;S=G.vertex_index_bytes;
-U=G.vertex_index_bytes*2;da=G.vertex_index_bytes*3;Q=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;pa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;T=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;na=G.uv_index_bytes*2;ja=G.uv_index_bytes;la=G.uv_index_bytes*2;ga=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;ta=G.vertex_index_bytes*
-4+G.material_index_bytes;Z=G.ntri_flat*c;V=G.ntri_smooth*(c+G.normal_index_bytes*3);$=G.ntri_flat_uv*(c+G.uv_index_bytes*3);ea=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ka=G.nquad_flat*ta;c=G.nquad_smooth*(ta+G.normal_index_bytes*4);ta=G.nquad_flat_uv*(ta+G.uv_index_bytes*4);E+=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),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,m)));return G.nvertices*n}(E);E+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=u(b,c),f=u(b,c+G.normal_coordinate_bytes),h=u(b,c+G.normal_coordinate_bytes*2),H.push(e/127,f/127,h/127);return G.nnormals*k}(E);E+=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),M.push(f,h);return G.nuvs*m}(E);Z=E+Z;V=Z+V;$=V+$;ea=$+ea;ka=ea+ka;c=ka+c;ta=c+ta;(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)v(c),z(c+e);return h-b})(V);(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),z(c+e);return h-b})($);(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)p(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)y(c),A(c+e);return h-b})(ta);(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)v(c);return f-b})(E);(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})(Z);(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)p(c);return f-b})(ea);(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)y(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
-var ColladaLoader=function(){function b(b,c,e){for(var b=Z.evaluate(b,Z,T,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 ta)for(var h=ta[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||
+f,k;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.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+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,
+c+V);c=t(b,c+X);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,c+V);p=t(b,c+X);v=h(b,c+o);u=h(b,c+ha);w=h(b,c+S);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ga=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ga,w),new THREE.Vector3(y,z,c)],null,p))}
+function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+ra);c=M[e*2];m=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[k*2];k=M[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+la);k=h(b,c+pa);m=h(b,c+fa);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var v=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f,
+k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],Q,J,I,K,W,D,R,T,V,X,o,ha,S,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
+E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;Q=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
+T=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;X=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ha=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;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;ra=G.uv_index_bytes*2;la=G.uv_index_bytes;pa=G.uv_index_bytes*2;fa=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;ia=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);$=G.ntri_flat_uv*(c+G.uv_index_bytes*3);da=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ja=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);E+=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),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,m)));return G.nvertices*n}(E);E+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=u(b,c),f=u(b,c+G.normal_coordinate_bytes),h=u(b,c+G.normal_coordinate_bytes*2),H.push(e/127,f/127,h/127);return G.nnormals*k}(E);E+=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),M.push(f,h);return G.nuvs*m}(E);ia=E+ia;U=ia+U;$=U+$;da=$+da;ja=da+ja;c=ja+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)v(c),z(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),z(c+e);return h-b})($);(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)p(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)y(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)v(c);return f-b})(E);(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})(ia);(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)p(c);return f-b})(da);(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)y(c);return f-b})(ja);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+var ColladaLoader=function(){function b(b,c,e){for(var b=ia.evaluate(b,ia,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in sa)for(var h=sa[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
 new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=N[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=$.getChildById(f.skeleton[0],!0)||$.getChildBySid(f.skeleton[0],
 new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=N[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=$.getChildById(f.skeleton[0],!0)||$.getChildBySid(f.skeleton[0],
 !0),n,o,p,t,v=new THREE.Vector3,u;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];u=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
 !0),n,o,p,t,v=new THREE.Vector3,u;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];u=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];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==u&&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,u=b.vertices[t],t=x[t],v.x=u.position.x,v.y=u.position.y,v.z=u.position.z,w[n].skinningMatrix.multiplyVector3(v),t.position.x+=v.x*p,t.position.y+=v.y*p,t.position.z+=v.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==u&&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,u=b.vertices[t],t=x[t],v.x=u.position.x,v.y=u.position.y,v.z=u.position.z,w[n].skinningMatrix.multiplyVector3(v),t.position.x+=v.x*p,t.position.y+=v.y*p,t.position.z+=v.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=N[b.controllers[m].url];switch(n.type){case "skin":if(fa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(N[n.skin.source]&&(k=n=N[n.skin.source],n.morph&&fa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(fa[n.morph.source])o=
-new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=fa[n.url],p={},t=0,v;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++){v=o[j];var u=ua[ra[v.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;v=p[v.symbol]=
+e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=N[b.controllers[m].url];switch(n.type){case "skin":if(ea[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(N[n.skin.source]&&(k=n=N[n.skin.source],n.morph&&ea[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(ea[n.morph.source])o=
+new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ea[n.url],p={},t=0,v;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++){v=o[j];var u=ua[qa[v.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;v=p[v.symbol]=
 u.material;t++}o=v||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=N[e.url],o.skinInstanceController=e,o.name="skin_"+Aa.length,Aa.push(o);else if(k!==void 0){p=n;t=k instanceof x?N[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
 u.material;t++}o=v||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=N[e.url],o.skinInstanceController=e,o.name="skin_"+Aa.length,Aa.push(o);else if(k!==void 0){p=n;t=k instanceof x?N[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
-else{t=t.morph;for(u=0;u<t.targets.length;u++){var w=fa[t.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+za.length;za.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
+else{t=t.morph;for(u=0;u<t.targets.length;u++){var w=ea[t.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+va.length;va.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
 this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function v(){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 t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function v(){this.type=
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){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 H(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function R(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,c){this.type=b;this.effect=c;this.material=null}function W(b){this.effect=b;this.format=this.init_from=
-null}function D(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function S(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function U(){this.url=""}function da(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Q(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 pa(b){var c=b.getAttribute("id");if(ea[c]!=void 0)return ea[c];ea[c]=(new R(c)).parse(b);return ea[c]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=na(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function ca(b){for(var b=na(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function na(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 la(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 ga(b,c){var e="";e+=la(b.x,c)+",";e+=la(b.y,c)+",";e+=la(b.z,c);return e}var Z=null,V=null,$,ea={},ka={},ta={},N={},fa={},ra={},ua={},sa,xa=null,Ca,za,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
+this.stride=this.count=0;this.params=[]}function H(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function Q(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,c){this.type=b;this.effect=c;this.material=null}function W(b){this.effect=b;this.format=this.init_from=
+null}function D(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 T(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function X(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ha(b){var c=b.getAttribute("id");if(da[c]!=void 0)return da[c];da[c]=(new Q(c)).parse(b);return da[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ra(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function ca(b){for(var b=ra(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ra(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function la(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function pa(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function fa(b,c){var e="";e+=pa(b.x,c)+",";e+=pa(b.y,c)+",";e+=pa(b.z,c);return e}var ia=null,U=null,$,da={},ja={},sa={},N={},ea={},qa={},ua={},ta,Ba=null,Ca,va,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
 b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new t).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 t).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 R).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 M).parse(f))}}return c};t.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
 function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new M).parse(f))}}return c};t.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
-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 R).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};t.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 M).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};t.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 M).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()}}};t.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 M).parse(m));break;case "v":e=ca(m.textContent);break;case "vcount":f=ca(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},v=0;v<h.length;v++){var u=h[v],w=e[m+u.offset];switch(u.semantic){case "JOINT":t.joint=w;break;
 h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.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 M).parse(m));break;case "v":e=ca(m.textContent);break;case "vcount":f=ca(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},v=0;v<h.length;v++){var u=h[v],w=e[m+u.offset];switch(u.semantic){case "JOINT":t.joint=w;break;
 case "WEIGHT":t.weight=c[u.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.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};u.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};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 case "WEIGHT":t.weight=c[u.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.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};u.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};u.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 w).parse(e))}}return this};w.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 w).parse(e))}}return this};w.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};w.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};w.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};w.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};w.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};w.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};w.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};w.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 w).parse(c));break;case "instance_camera":break;
 b)return this.transforms[c];return null};w.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 w).parse(c));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new v).parse(c));
-break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in ta)for(var h=ta[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
+case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=ia.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",ia,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new v).parse(c));
+break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in sa)for(var h=sa[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
 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,t,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
 1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,t,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):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};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};v.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};v.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};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};v.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};v.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=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=e.iterateNext()}}return this};
-p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new p).parse(c)),
-c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=ga(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":pa(f);break;case "vertices":this.vertices=
-(new H).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ea[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=ia.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=e.iterateNext()}}return this};
+p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=ia.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new p).parse(c)),
+c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":ha(f);break;case "vertices":this.vertices=
+(new H).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=da[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,v=0,u=3,w=[];for(h=0;h<n.length;h++)o=n[h],o.semantic=="TEXCOORD"&&w.push(o.set);for(;f<m.length;){var x=[],y=[],z={};b.vcount&&(u=b.vcount[v++]);for(h=0;h<u;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=
 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,v=0,u=3,w=[];for(h=0;h<n.length;h++)o=n[h],o.semantic=="TEXCOORD"&&w.push(o.set);for(;f<m.length;){var x=[],y=[],z={};b.vcount&&(u=b.vcount[v++]);for(h=0;h<u;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=
-ea[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ga(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t+0],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]),z[o.set].push(new THREE.UV(source.data[t+0],source.data[t+1]))}k=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=
+da[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t+0],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]),z[o.set].push(new THREE.UV(source.data[t+0],source.data[t+1]))}k=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=
 z[w[k]],c.faceVertexUvs[k].push([o[0],o[1],o[2]]);if(u>3)for(h=2;h<x.length-1;h++){k=new THREE.Face3(x[0],x[h],x[h+1],[y[0],y[h],y[h+1]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=z[w[k]],c.faceVertexUvs[k].push([o[0],o[h],o[h+1]])}f+=n.length*u}};C.prototype=new E;C.prototype.constructor=C;E.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};E.prototype.parse=function(b){this.inputs=
 z[w[k]],c.faceVertexUvs[k].push([o[0],o[1],o[2]]);if(u>3)for(h=2;h<x.length-1;h++){k=new THREE.Face3(x[0],x[h],x[h+1],[y[0],y[h],y[h+1]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=z[w[k]],c.faceVertexUvs[k].push([o[0],o[h],o[h+1]])}f+=n.length*u}};C.prototype=new E;C.prototype.constructor=C;E.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};E.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 M).parse(b.childNodes[c]));break;case "vcount":this.vcount=ca(e.textContent);break;case "p":this.p=ca(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};H.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 M).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};M.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};R.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=na(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ma(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=ca(e.textContent);this.type=e.nodeName;
-break;case "IDREF_array":case "Name_array":this.data=na(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};R.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 U).parse(b.childNodes[c]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=
+[];this.material=b.getAttribute("material");this.count=la(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 M).parse(b.childNodes[c]));break;case "vcount":this.vcount=ca(e.textContent);break;case "p":this.p=ca(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=la(b,"count",0);this.stride=la(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};H.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 M).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};M.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=la(b,"set",-1);this.offset=
+la(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=ra(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ma(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=ca(e.textContent);this.type=e.nodeName;
+break;case "IDREF_array":case "Name_array":this.data=ra(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};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};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 T).parse(b.childNodes[c]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=
 function(){return this.texture!=null};I.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ma(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==
 function(){return this.texture!=null};I.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ma(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};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 I).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[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 I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ka[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());
+1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new I).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=ia.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 I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ja[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)};W.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};D.prototype.parse=
 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)};W.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};D.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};S.prototype.create=function(){if(this.shader==
-null)return null};S.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};S.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 W(this)).parse(f);
-this.surface.sid=c;break;case "sampler2D":this.sampler=(new D(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};S.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};S.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)}}};U.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};da.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 R).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 Q(this)).parse(e))}}return this};Q.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]=
+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 W(this)).parse(f);
+this.surface.sid=c;break;case "sampler2D":this.sampler=(new D(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)}}};T.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 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 X(this)).parse(e))}}return this};X.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 M).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=
 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 M).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&&
 e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){xa=f;var o,p=e;Z=n.responseXML;o=xa;p!==void 0&&(p=p.split("/"),p.pop(),Ca=p.join("/")+"/");ka=b("//dae:library_images/dae:image",m,"image");ra=b("//dae:library_materials/dae:material",
-J,"material");ua=b("//dae:library_effects/dae:effect",S,"effect");fa=b("//dae:library_geometries/dae:geometry",z,"geometry");N=b("//dae:library_controllers/dae:controller",k,"controller");ta=b("//dae:library_animations/dae:animation",da,"animation");sa=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");za=[];Aa=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),$=sa[p]):
-$=null;V=new THREE.Object3D;for(p=0;p<$.nodes.length;p++)V.addChild(h($.nodes[p]));c();for(var t in ta);t={scene:V,morphs:za,skins:Aa,dae:{images:ka,materials:ra,effects:ua,geometries:fa,controllers:N,animations:ta,visualScenes:sa,scene:$}};o&&o(t)}};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:fa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){Ba=f;var o,p=e;ia=n.responseXML;o=Ba;p!==void 0&&(p=p.split("/"),p.pop(),Ca=p.join("/")+"/");ja=b("//dae:library_images/dae:image",m,"image");qa=b("//dae:library_materials/dae:material",
+J,"material");ua=b("//dae:library_effects/dae:effect",R,"effect");ea=b("//dae:library_geometries/dae:geometry",z,"geometry");N=b("//dae:library_controllers/dae:controller",k,"controller");sa=b("//dae:library_animations/dae:animation",V,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");va=[];Aa=[];(p=ia.evaluate(".//dae:scene/dae:instance_visual_scene",ia,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),$=ta[p]):
+$=null;U=new THREE.Object3D;for(p=0;p<$.nodes.length;p++)U.addChild(h($.nodes[p]));c();for(var t in sa);t={scene:U,morphs:va,skins:Aa,dae:{images:ja,materials:qa,effects:ua,geometries:ea,controllers:N,animations:sa,visualScenes:ta,scene:$}};o&&o(t)}};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:ea}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,t,u,w,v,x,p,y,z,A,C,E,G,H=b.faces;v=b.vertices;var M=b.normals,R=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]=[];u=0;for(w=v.length;u<w;)x=new THREE.Vertex,x.position.x=v[u++]*c,x.position.y=
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,t,u,w,v,x,p,y,z,A,C,E,G,H=b.faces;v=b.vertices;var M=b.normals,Q=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]=[];u=0;for(w=v.length;u<w;)x=new THREE.Vertex,x.position.x=v[u++]*c,x.position.y=
 v[u++]*c,x.position.z=v[u++]*c,f.vertices.push(x);u=0;for(w=H.length;u<w;){c=H[u++];v=c&1;t=c&2;e=c&4;h=c&8;p=c&16;x=c&32;z=c&64;c&=128;v?(A=new THREE.Face4,A.a=H[u++],A.b=H[u++],A.c=H[u++],A.d=H[u++],v=4):(A=new THREE.Face3,A.a=H[u++],A.b=H[u++],A.c=H[u++],v=3);if(t)t=H[u++],A.materials=f.materials[t];t=f.faces.length;if(e)for(e=0;e<J;e++)C=b.uvs[e],y=H[u++],G=C[y*2],y=C[y*2+1],f.faceUvs[e][t]=new THREE.UV(G,y);if(h)for(e=0;e<J;e++){C=b.uvs[e];E=[];for(h=0;h<v;h++)y=H[u++],G=C[y*2],y=C[y*2+1],E[h]=
 v[u++]*c,x.position.z=v[u++]*c,f.vertices.push(x);u=0;for(w=H.length;u<w;){c=H[u++];v=c&1;t=c&2;e=c&4;h=c&8;p=c&16;x=c&32;z=c&64;c&=128;v?(A=new THREE.Face4,A.a=H[u++],A.b=H[u++],A.c=H[u++],A.d=H[u++],v=4):(A=new THREE.Face3,A.a=H[u++],A.b=H[u++],A.c=H[u++],v=3);if(t)t=H[u++],A.materials=f.materials[t];t=f.faces.length;if(e)for(e=0;e<J;e++)C=b.uvs[e],y=H[u++],G=C[y*2],y=C[y*2+1],f.faceUvs[e][t]=new THREE.UV(G,y);if(h)for(e=0;e<J;e++){C=b.uvs[e];E=[];for(h=0;h<v;h++)y=H[u++],G=C[y*2],y=C[y*2+1],E[h]=
-new THREE.UV(G,y);f.faceVertexUvs[e][t]=E}if(p)p=H[u++]*3,h=new THREE.Vector3,h.x=M[p++],h.y=M[p++],h.z=M[p],A.normal=h;if(x)for(e=0;e<v;e++)p=H[u++]*3,h=new THREE.Vector3,h.x=M[p++],h.y=M[p++],h.z=M[p],A.vertexNormals.push(h);if(z)x=H[u++],x=new THREE.Color(R[x]),A.color=x;if(c)for(e=0;e<v;e++)x=H[u++],x=new THREE.Color(R[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,t;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],t=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+new THREE.UV(G,y);f.faceVertexUvs[e][t]=E}if(p)p=H[u++]*3,h=new THREE.Vector3,h.x=M[p++],h.y=M[p++],h.z=M[p],A.normal=h;if(x)for(e=0;e<v;e++)p=H[u++]*3,h=new THREE.Vector3,h.x=M[p++],h.y=M[p++],h.z=M[p],A.vertexNormals.push(h);if(z)x=H[u++],x=new THREE.Color(Q[x]),A.color=x;if(c)for(e=0;e<v;e++)x=H[u++],x=new THREE.Color(Q[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,t;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],t=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
 t,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],t=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,t,u,w,v,x,p,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];p=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;t=0;for(u=y.length;t<u;t+=3)w=y[t]*c,v=y[t+1]*
 t,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],t=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,t,u,w,v,x,p,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];p=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;t=0;for(u=y.length;t<u;t+=3)w=y[t]*c,v=y[t+1]*
 c,x=y[t+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(w,v,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=[];u=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(t=w.length;c<t;c+=3)v=new THREE.Color(16755200),v.setRGB(w[c],w[c+1],w[c+2]),u.push(v)}}})(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=y[t+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(w,v,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=[];u=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(t=w.length;c<t;c+=3)v=new THREE.Color(16755200),v.setRGB(w[c],w[c+1],w[c+2]),u.push(v)}}})(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(p in S.objects)if(!T.objects[p])if(E=S.objects[p],E.geometry!==void 0){if(R=T.geometries[E.geometry]){var b=!1;W=[];for(ca=0;ca<E.materials.length;ca++)W[ca]=T.materials[E.materials[ca]],b=W[ca]instanceof THREE.ShaderMaterial;b&&R.computeTangents();G=E.position;r=E.rotation;
-q=E.quaternion;s=E.scale;q=0;W.length==0&&(W[0]=new THREE.MeshFaceMaterial);W.length>1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(R,W);object.name=p;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=E.visible;T.scene.addObject(object);T.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
-if(E.castsShadow)b=new THREE.ShadowVolume(R),T.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,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=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[p]=object,T.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function t(b){return function(c){T.geometries[b]=c;n();da-=1;e.onLoadComplete();w()}}function u(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-da,loadedTextures:pa-Q},T);e.onLoadProgress();da==0&&Q==0&&c(T)}
-var v,x,p,y,z,A,C,E,G,H,M,R,J,I,K,W,D,S,U,da,Q,o,pa,T;S=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;Q=da=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in S.objects)if(E=S.objects[p],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;H=S.transform.rotation;var ma=S.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0],
-H[1],H[2]);ma&&T.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&T.scene.updateMatrix()}b=function(){Q-=1;w();e.onLoadComplete()};for(z in S.cameras){H=S.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);T.cameras[z]=J}for(y in S.lights)z=S.lights[y],
-J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),T.scene.addLight(D),T.lights[y]=D;for(A in S.fogs)y=S.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
-y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),T.fogs[A]=I;if(T.cameras&&S.defaults.camera)T.currentCamera=T.cameras[S.defaults.camera];if(T.fogs&&S.defaults.fog)T.scene.fog=T.fogs[S.defaults.fog];H=S.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(H[0],H[1],H[2]);T.bgColorAlpha=S.defaults.bgalpha;for(v in S.geometries)if(A=S.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")da+=1,e.onLoadStart();o=da;for(v in S.geometries)A=S.geometries[v],A.type=="cube"?(R=new THREE.CubeGeometry(A.width,
-A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[v]=R):A.type=="plane"?(R=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[v]=R):A.type=="sphere"?(R=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[v]=R):A.type=="cylinder"?(R=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[v]=R):A.type=="torus"?(R=new THREE.TorusGeometry(A.radius,A.tube,
-A.segmentsR,A.segmentsT),T.geometries[v]=R):A.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[v]=R):A.type=="bin_mesh"?K.load({model:f(A.url,S.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?U.load({model:f(A.url,S.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&U.createModel(A,u(v),"");for(C in S.textures)if(v=S.textures[C],v.url instanceof Array){Q+=v.url.length;for(K=0;K<v.url.length;K++)e.onLoadStart()}else Q+=1,e.onLoadStart();pa=
-Q;for(C in S.textures){v=S.textures[C];if(v.mapping!=void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var ca=0;ca<v.url.length;ca++)K[ca]=f(v.url[ca],S.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(v.url,S.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);
-if(v.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}v.offset&&K.offset.set(v.offset[0],v.offset[1]);if(v.wrap){U={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(U[v.wrap[0]]!==void 0)K.wrapS=U[v.wrap[0]];if(U[v.wrap[1]]!==void 0)K.wrapT=U[v.wrap[1]]}}T.textures[C]=K}for(x in S.materials){C=S.materials[x];for(M in C.parameters)if(M=="envMap"||M=="map"||M=="lightMap")C.parameters[M]=T.textures[C.parameters[M]];else if(M=="shading")C.parameters[M]=
+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(p in R.objects)if(!S.objects[p])if(E=R.objects[p],E.geometry!==void 0){if(Q=S.geometries[E.geometry]){var b=!1;W=[];for(ca=0;ca<E.materials.length;ca++)W[ca]=S.materials[E.materials[ca]],b=W[ca]instanceof THREE.ShaderMaterial;b&&Q.computeTangents();G=E.position;r=E.rotation;
+q=E.quaternion;s=E.scale;q=0;W.length==0&&(W[0]=new THREE.MeshFaceMaterial);W.length>1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,W);object.name=p;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=E.visible;S.scene.addObject(object);S.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
+if(E.castsShadow)b=new THREE.ShadowVolume(Q),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,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=E.visible!==void 0?E.visible:!1,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ha,loadedModels:o-V,loadedTextures:ha-X},S);e.onLoadProgress();V==0&&X==0&&c(S)}
+var v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K,W,D,R,T,V,X,o,ha,S;R=b.data;K=new THREE.BinaryLoader;T=new THREE.JSONLoader;X=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(E=R.objects[p],E.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);H&&S.scene.rotation.set(H[0],
+H[1],H[2]);ma&&S.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&S.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in R.cameras){H=R.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);S.cameras[z]=J}for(y in R.lights)z=R.lights[y],
+J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),S.scene.addLight(D),S.lights[y]=D;for(A in R.fogs)y=R.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
+y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),S.fogs[A]=I;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];H=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(H[0],H[1],H[2]);S.bgColorAlpha=R.defaults.bgalpha;for(v in R.geometries)if(A=R.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(v in R.geometries)A=R.geometries[v],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[v]=Q):A.type=="plane"?(Q=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="sphere"?(Q=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="cylinder"?(Q=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[v]=Q):A.type=="torus"?(Q=new THREE.TorusGeometry(A.radius,A.tube,
+A.segmentsR,A.segmentsT),S.geometries[v]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[v]=Q):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,u(v),"");for(C in R.textures)if(v=R.textures[C],v.url instanceof Array){X+=v.url.length;for(K=0;K<v.url.length;K++)e.onLoadStart()}else X+=1,e.onLoadStart();ha=
+X;for(C in R.textures){v=R.textures[C];if(v.mapping!=void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var ca=0;ca<v.url.length;ca++)K[ca]=f(v.url[ca],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(v.url,R.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);
+if(v.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}v.offset&&K.offset.set(v.offset[0],v.offset[1]);if(v.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[v.wrap[0]]!==void 0)K.wrapS=T[v.wrap[0]];if(T[v.wrap[1]]!==void 0)K.wrapT=T[v.wrap[1]]}}S.textures[C]=K}for(x in R.materials){C=R.materials[x];for(M in C.parameters)if(M=="envMap"||M=="map"||M=="lightMap")C.parameters[M]=S.textures[C.parameters[M]];else if(M=="shading")C.parameters[M]=
 C.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")C.parameters[M]=THREE[C.parameters[M]]?THREE[C.parameters[M]]:THREE.NormalBlending;else if(M=="combine")C.parameters[M]=C.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(C.parameters[M]=="face")C.parameters[M]=THREE.FaceColors;else if(C.parameters[M])C.parameters[M]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
 C.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")C.parameters[M]=THREE[C.parameters[M]]?THREE[C.parameters[M]]:THREE.NormalBlending;else if(M=="combine")C.parameters[M]=C.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(C.parameters[M]=="face")C.parameters[M]=THREE.FaceColors;else if(C.parameters[M])C.parameters[M]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
-!0;if(C.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(v.uniforms);K=C.parameters.color;U=C.parameters.specular;A=C.parameters.ambient;I=C.parameters.shininess;b.tNormal.texture=T.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
-T.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(U);b.uAmbientColor.value.setHex(A);b.uShininess.value=I;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);T.materials[x]=C}n();e.callbackSync(T)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(C.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(v.uniforms);K=C.parameters.color;T=C.parameters.specular;A=C.parameters.ambient;I=C.parameters.shininess;b.tNormal.texture=S.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
+S.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(T);b.uAmbientColor.value.setHex(A);b.uShininess.value=I;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);S.materials[x]=C}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),u=[],w=[];(function(b,k,p){for(var t,u,w,C=b.length;p<C;p+=k)t=b[p],u=b[p+1],w=b[p+2],t=t/16383*e,u=u/16383*e,w=w/16383*e,t+=f,u+=h,w+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))})(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,w.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),u=[],w=[];(function(b,k,p){for(var t,u,w,C=b.length;p<C;p+=k)t=b[p],u=b[p+1],w=b[p+2],t=t/16383*e,u=u/16383*e,w=w/16383*e,t+=f,u+=h,w+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))})(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,w.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,u.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,t,E,G,H,M=b.length;for(e=0;e<M;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;H=h;t=k;E=f;var R=h,J=k,I=m.materials[0],K=u[R*3],W=u[R*3+1],R=u[R*3+2],D=u[J*3],S=u[J*3+1],J=u[J*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);R=new THREE.Vector3(K,W,R);J=new THREE.Vector3(D,S,J);m.faces.push(new THREE.Face3(G,H,t,[E,R,J],null,I));m=w[f*2];f=w[f*2+
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,t,E,G,H,M=b.length;for(e=0;e<M;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;H=h;t=k;E=f;var Q=h,J=k,I=m.materials[0],K=u[Q*3],W=u[Q*3+1],Q=u[Q*3+2],D=u[J*3],R=u[J*3+1],J=u[J*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);Q=new THREE.Vector3(K,W,Q);J=new THREE.Vector3(D,R,J);m.faces.push(new THREE.Face3(G,H,t,[E,Q,J],null,I));m=w[f*2];f=w[f*2+
 1];t=w[h*2];E=w[h*2+1];G=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,t));E.push(new THREE.UV(G,H));k.push(E)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
 1];t=w[h*2];E=w[h*2+1];G=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,t));E.push(new THREE.UV(G,H));k.push(E)}})(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,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=t;c[m+2]=u;h[m]=this.lerp(w[b],w[b+3],k);h[m+1]=this.lerp(w[b+1],w[b+4],k);h[m+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t+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,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=t;c[m+2]=u;h[m]=this.lerp(w[b],w[b+3],k);h[m+1]=this.lerp(w[b+1],w[b+4],k);h[m+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t+k*this.delta;c[m+
 2]=u;c=b+this.yd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t;c[m+2]=u+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[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]=u;c=b+this.yd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,t,u,w,v){k=(k-w)/(v-w);w=this.normal_cache;c[m]=n;c[m+1]=t;c[m+2]=u+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[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 t=m+1,u=m+this.yd,w=m+this.zd,v=t+this.yd,x=t+this.zd,p=m+this.yd+this.zd,y=t+this.yd+this.zd,z=0,A=this.field[m],C=this.field[t],E=this.field[u],G=this.field[v],H=this.field[w],M=this.field[x],R=this.field[p],J=this.field[y];A<k&&(z|=1);C<k&&(z|=2);E<k&&(z|=8);G<k&&(z|=4);H<k&&(z|=16);M<k&&(z|=32);R<k&&(z|=128);J<k&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var K=this.delta,
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,m,k,n){var t=m+1,u=m+this.yd,w=m+this.zd,v=t+this.yd,x=t+this.zd,p=m+this.yd+this.zd,y=t+this.yd+this.zd,z=0,A=this.field[m],C=this.field[t],E=this.field[u],G=this.field[v],H=this.field[w],M=this.field[x],Q=this.field[p],J=this.field[y];A<k&&(z|=1);C<k&&(z|=2);E<k&&(z|=8);G<k&&(z|=4);H<k&&(z|=16);M<k&&(z|=32);Q<k&&(z|=128);J<k&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var K=this.delta,
 W=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,3,k,W,c,h,C,G));I&4&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,M));I&32&&(this.compNorm(x),
 W=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,3,k,W,c,h,C,G));I&4&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,M));I&32&&(this.compNorm(x),
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,W,c,K,M,J));I&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,k,b,D,K,R,J));I&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,R));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,k,W,c,h,C,M));I&1024&&(this.compNorm(v),this.compNorm(y),this.VIntZ(v*
-3,this.vlist,this.nlist,30,k,W,D,h,G,J));I&2048&&(this.compNorm(u),this.compNorm(p),this.VIntZ(u*3,this.vlist,this.nlist,33,k,b,D,h,E,R));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[m];this.positionArray[t+
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,W,c,K,M,J));I&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,k,b,D,K,Q,J));I&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,Q));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,k,W,c,h,C,M));I&1024&&(this.compNorm(v),this.compNorm(y),this.VIntZ(v*
+3,this.vlist,this.nlist,30,k,W,D,h,G,J));I&2048&&(this.compNorm(u),this.compNorm(p),this.VIntZ(u*3,this.vlist,this.nlist,33,k,b,D,h,E,Q));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[m];this.positionArray[t+
 4]=b[m+1];this.positionArray[t+5]=b[m+2];this.positionArray[t+6]=b[k];this.positionArray[t+7]=b[k+1];this.positionArray[t+8]=b[k+2];this.normalArray[t]=c[h];this.normalArray[t+1]=c[h+1];this.normalArray[t+2]=c[h+2];this.normalArray[t+3]=c[m];this.normalArray[t+4]=c[m+1];this.normalArray[t+5]=c[m+2];this.normalArray[t+6]=c[k];this.normalArray[t+7]=c[k+1];this.normalArray[t+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[t+5]=b[m+2];this.positionArray[t+6]=b[k];this.positionArray[t+7]=b[k+1];this.positionArray[t+8]=b[k+2];this.normalArray[t]=c[h];this.normalArray[t+1]=c[h+1];this.normalArray[t+2]=c[h+2];this.normalArray[t+3]=c[m];this.normalArray[t+4]=c[m+1];this.normalArray[t+5]=c[m+2];this.normalArray[t+6]=c[k];this.normalArray[t+7]=c[k+1];this.normalArray[t+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),t=h*this.size,u=c*this.size,w=b*this.size,v=Math.floor(t-n);v<1&&(v=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,m,k){var n=this.size*Math.sqrt(m/k),t=h*this.size,u=c*this.size,w=b*this.size,v=Math.floor(t-n);v<1&&(v=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
 1);for(var y,z,A,C,E,G;v<t;v++){w=this.size2*v;z=v/this.size-h;E=z*z;for(z=x;z<u;z++){A=w+this.size*z;y=z/this.size-c;G=y*y;for(y=p;y<n;y++)C=y/this.size-b,C=m/(1.0E-6+C*C+G+E)-k,C>0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,u=this.size,w=this.yd,v=this.zd,x=this.field,p=u*Math.sqrt(b/c);p>u&&(p=u);for(h=0;h<p;h++)if(m=h/u,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<u;m++){t=h+m*w;for(k=0;k<u;k++)x[v*k+t]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,t,u,w=this.size,v=this.yd,x=
 1);for(var y,z,A,C,E,G;v<t;v++){w=this.size2*v;z=v/this.size-h;E=z*z;for(z=x;z<u;z++){A=w+this.size*z;y=z/this.size-c;G=y*y;for(y=p;y<n;y++)C=y/this.size-b,C=m/(1.0E-6+C*C+G+E)-k,C>0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,u=this.size,w=this.yd,v=this.zd,x=this.field,p=u*Math.sqrt(b/c);p>u&&(p=u);for(h=0;h<p;h++)if(m=h/u,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<u;m++){t=h+m*w;for(k=0;k<u;k++)x[v*k+t]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,t,u,w=this.size,v=this.yd,x=

+ 23 - 23
build/custom/ThreeCanvas.js

@@ -126,32 +126,32 @@ THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addCh
 THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
 THREE.CanvasRenderer=function(a){function b(a){if(w!=a)k.globalAlpha=w=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}u=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function e(a){if(R!=a)k.fillStyle=R=a}var g=this,f=null,h=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(a){function b(a){if(w!=a)k.globalAlpha=w=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}u=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function e(a){if(R!=a)k.fillStyle=R=a}var g=this,f=null,h=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
 j,n,i,o,k=l.getContext("2d"),r=new THREE.Color(0),s=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,t,m,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,ba,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ca=new THREE.Color,aa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
 j,n,i,o,k=l.getContext("2d"),r=new THREE.Color(0),s=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,t,m,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,ba,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ca=new THREE.Color,aa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
-Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(a,b){j=a;n=b;i=Math.floor(j/2);o=Math.floor(n/2);l.width=j;l.height=n;
-ka.set(-i,-o,i,o);$.set(-i,-o,i,o);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);s=b;$.set(-i,-o,i,o)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;$.set(-i,-o,i,o)};this.clear=function(){k.setTransform(1,0,0,-1,i,o);$.isEmpty()||($.minSelf(ka),$.inflate(2),s<1&&k.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
+Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;n=b;i=Math.floor(j/2);o=Math.floor(n/2);l.width=j;l.height=
+n;ka.set(-i,-o,i,o);$.set(-i,-o,i,o);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);s=b;$.set(-i,-o,i,o)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;$.set(-i,-o,i,o)};this.clear=function(){k.setTransform(1,0,0,-1,i,o);$.isEmpty()||($.minSelf(ka),$.inflate(2),s<1&&k.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
 255)+","+s+")"),k.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,j){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(aa.r+=d.r,aa.g+=d.g,aa.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function n(a,b,c,
 255)+","+s+")"),k.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,j){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(aa.r+=d.r,aa.g+=d.g,aa.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function n(a,b,c,
 d){var e,f,g,h,k=a.lights,a=0;for(e=k.length;a<e;a++)f=k[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(S.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function r(a,f,g){b(g.opacity);c(g.blending);var h,j,n,l,p,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
 d){var e,f,g,h,k=a.lights,a=0;for(e=k.length;a<e;a++)f=k[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(S.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function r(a,f,g){b(g.opacity);c(g.blending);var h,j,n,l,p,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
 g.map.image,p=l.width>>1,m=l.height>>1,g=f.scale.x*i,n=f.scale.y*o,h=g*p,j=n*m,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-n),k.translate(-p,-m),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*i,j=f.scale.y*o,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,j),g.program(k),
 g.map.image,p=l.width>>1,m=l.height>>1,g=f.scale.x*i,n=f.scale.y*o,h=g*p,j=n*m,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-n),k.translate(-p,-m),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*i,j=f.scale.y*o,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,j),g.program(k),
-k.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)k.lineWidth=B=a;a=g.linecap;if(N!=a)k.lineCap=N=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color.getContextStyle());k.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,e,f,h,k,i,p,l){g.data.vertices+=3;g.data.faces++;b(p.opacity);c(p.blending);F=a.positionScreen.x;
-K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=e.positionScreen.x;Q=e.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*
-0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
-(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*
-x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*
-ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(e.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,
-P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,e,f,h,k,i,p,l){g.data.vertices+=4;g.data.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,f,0,1,3,i,p,l),u(h,e,k,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=e.positionScreen.x,Q=e.positionScreen.y,
-V=f.positionScreen.x,E=f.positionScreen.y,pa=h.positionScreen.x,y=h.positionScreen.y,L=k.positionScreen.x,H=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],
-x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,
-Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,
-p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=
-1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(e.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function R(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ga(a,b,c,e){if(B!=b)k.lineWidth=B=b;
-if(N!=c)k.lineCap=N=c;if(O!=e)k.lineJoin=O=e;d(a.getContextStyle());k.stroke();Y.inflate(b*2)}function ha(a){e(a.getContextStyle());k.fill()}function Ca(a,b,c,d,f,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||za[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;za[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(za[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-
-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=(j+q)*s,l=(l+r)*m,n=(n+q)*s,o=(o+r)*m;c-=a;d-=b;f-=a;g-=b;j-=h;l-=i;n-=h;o-=i;q=1/(j*o-n*l);m=(o*c-l*f)*q;l=(o*d-l*g)*q;c=(j*f-n*c)*q;d=(j*g-n*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-
-l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:j;da[10]=c<0?
-0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():k.setTransform(1,0,0,-1,i,o);g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,j,this.sortElements);
-(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=f.length;xa<Ja;xa++){A=f[xa];Y.empty();if(A instanceof THREE.RenderableParticle){t=A;t.x*=i;t.y*=o;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(t,A,X,a)}else if(A instanceof THREE.RenderableLine){if(t=A.v1,m=A.v2,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=
-A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&s(t,m,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(t=A.v1,m=A.v2,C=A.v3,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,C.positionScreen.x*=i,C.positionScreen.y*=o,A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,C.positionScreen),ia(C.positionScreen,t.positionScreen)),Y.add3Points(t.positionScreen.x,t.positionScreen.y,m.positionScreen.x,m.positionScreen.y,C.positionScreen.x,
-C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}else X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(t=A.v1,m=A.v2,C=A.v3,D=A.v4,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,C.positionScreen.x*=i,C.positionScreen.y*=o,D.positionScreen.x*=
-i,D.positionScreen.y*=o,T.positionScreen.copy(m.positionScreen),U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,D.positionScreen),ia(D.positionScreen,t.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),
-ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}else X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}$.addRectangle(Y)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
+k.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)k.lineWidth=B=a;a=g.linecap;if(N!=a)k.lineCap=N=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color.getContextStyle());k.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,e,f,h,k,i,p,l){g.info.render.vertices+=3;g.info.render.faces++;b(p.opacity);c(p.blending);
+F=a.positionScreen.x;K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=e.positionScreen.x;Q=e.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+
+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
+THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,
+Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,
+Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(e.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,
+q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,e,f,h,k,i,p,l){g.info.render.vertices+=4;g.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,f,0,1,3,i,p,l),u(h,e,k,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=e.positionScreen.x,
+Q=e.positionScreen.y,V=f.positionScreen.x,E=f.positionScreen.y,pa=h.positionScreen.x,y=h.positionScreen.y,L=k.positionScreen.x,H=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,n(l,i.v1.positionWorld,
+i.vertexNormalsWorld[0],x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*
+v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),
+p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,
+ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(e.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function R(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ga(a,b,c,e){if(B!=
+b)k.lineWidth=B=b;if(N!=c)k.lineCap=N=c;if(O!=e)k.lineJoin=O=e;d(a.getContextStyle());k.stroke();Y.inflate(b*2)}function ha(a){e(a.getContextStyle());k.fill()}function Ca(a,b,c,d,f,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||za[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;za[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(za[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,
+s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=(j+q)*s,l=(l+r)*m,n=(n+q)*s,o=(o+r)*m;c-=a;d-=b;f-=a;g-=b;j-=h;l-=i;n-=h;o-=i;q=1/(j*o-n*l);m=(o*c-l*f)*q;l=(o*d-l*g)*q;c=(j*f-n*c)*q;d=(j*g-n*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*
+e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:
+j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():k.setTransform(1,0,0,-1,i,o);g.info.render.vertices=0;g.info.render.faces=0;
+f=h.projectScene(a,j,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=f.length;xa<Ja;xa++){A=f[xa];Y.empty();if(A instanceof THREE.RenderableParticle){t=A;t.x*=i;t.y*=o;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(t,A,X,a)}else if(A instanceof THREE.RenderableLine){if(t=A.v1,m=A.v2,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),
+ka.intersects(Y)){fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&s(t,m,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(t=A.v1,m=A.v2,C=A.v3,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,C.positionScreen.x*=i,C.positionScreen.y*=o,A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,C.positionScreen),ia(C.positionScreen,t.positionScreen)),Y.add3Points(t.positionScreen.x,t.positionScreen.y,m.positionScreen.x,
+m.positionScreen.y,C.positionScreen.x,C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}else X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(t=A.v1,m=A.v2,C=A.v3,D=A.v4,t.positionScreen.x*=i,t.positionScreen.y*=o,m.positionScreen.x*=i,m.positionScreen.y*=o,C.positionScreen.x*=
+i,C.positionScreen.y*=o,D.positionScreen.x*=i,D.positionScreen.y*=o,T.positionScreen.copy(m.positionScreen),U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,D.positionScreen),ia(D.positionScreen,t.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),
+Y.addPoint(D.positionScreen.x,D.positionScreen.y),ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}else X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}$.addRectangle(Y)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};

+ 9 - 9
build/custom/ThreeSVG.js

@@ -119,15 +119,15 @@ THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=fu
 THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.data.vertices+=3;g.data.faces++;A=d(M++);A.setAttribute("d",
-"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?t.copy(i.color):i instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,h,w),t.r=Math.max(0,Math.min(i.color.r*w.r,1)),t.g=Math.max(0,Math.min(i.color.g*w.g,1)),t.b=Math.max(0,Math.min(i.color.b*w.b,1))):t.copy(i.color):i instanceof THREE.MeshDepthMaterial?(E=1-i.__2near/(i.__farPlusNear-h.z*i.__farMinusNear),
-t.setRGB(E,E,E)):i instanceof THREE.MeshNormalMaterial&&t.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(A)}function c(b,c,f,h,i,j,m){g.data.vertices+=4;g.data.faces++;
-A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(m,i,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):t.copy(j.color):j instanceof
-THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+
-j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),y=new THREE.Color(0),
-o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=
-function(a,d){var e,i,l,r,t,w,s,x;this.autoClear&&this.clear();g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);e=0;for(i=s.length;e<i;e++)l=s[e],r=l.color,l instanceof THREE.AmbientLight?(z.r+=r.r,z.g+=r.g,z.b+=r.b):l instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):l instanceof THREE.PointLight&&(o.r+=r.r,o.g+=r.g,o.b+=r.b)}e=0;for(i=f.length;e<i;e++)if(s=f[e],C.empty(),
-s instanceof THREE.RenderableParticle){n=s;n.x*=j;n.y*=-m;l=0;for(r=s.materials.length;l<r;)l++}else if(s instanceof THREE.RenderableLine){if(n=s.v1,p=s.v2,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){l=0;for(r=s.materials.length;l<r;)if((x=s.materials[l++])&&x.opacity!=0){t=n;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg",
+THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.info.render.vertices+=3;g.info.render.faces++;A=d(M++);
+A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?t.copy(i.color):i instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,h,w),t.r=Math.max(0,Math.min(i.color.r*w.r,1)),t.g=Math.max(0,Math.min(i.color.g*w.g,1)),t.b=Math.max(0,Math.min(i.color.b*w.b,1))):t.copy(i.color):i instanceof THREE.MeshDepthMaterial?(E=1-i.__2near/(i.__farPlusNear-
+h.z*i.__farMinusNear),t.setRGB(E,E,E)):i instanceof THREE.MeshNormalMaterial&&t.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(A)}function c(b,c,f,h,i,j,m){g.info.render.vertices+=
+4;g.info.render.faces++;A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(m,i,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):
+t.copy(j.color):j instanceof THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+
+"; fill-opacity: "+j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),
+y=new THREE.Color(0),o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(a,d){var e,i,l,r,t,w,s,x;this.autoClear&&this.clear();g.info.render.vertices=0;g.info.render.faces=0;f=h.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);e=0;for(i=s.length;e<i;e++)l=s[e],r=l.color,l instanceof THREE.AmbientLight?(z.r+=r.r,z.g+=r.g,z.b+=r.b):l instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):l instanceof THREE.PointLight&&(o.r+=r.r,o.g+=r.g,o.b+=r.b)}e=0;for(i=f.length;e<
+i;e++)if(s=f[e],C.empty(),s instanceof THREE.RenderableParticle){n=s;n.x*=j;n.y*=-m;l=0;for(r=s.materials.length;l<r;)l++}else if(s instanceof THREE.RenderableLine){if(n=s.v1,p=s.v2,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){l=0;for(r=s.materials.length;l<r;)if((x=s.materials[l++])&&x.opacity!=0){t=n;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg",
 "line"),O==0&&G[B].setAttribute("shape-rendering","crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(s instanceof
 "line"),O==0&&G[B].setAttribute("shape-rendering","crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(s instanceof
 THREE.RenderableFace3){if(n=s.v1,p=s.v2,q=s.v3,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){l=0;for(r=s.meshMaterials.length;l<r;)if(x=s.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&
 THREE.RenderableFace3){if(n=s.v1,p=s.v2,q=s.v3,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){l=0;for(r=s.meshMaterials.length;l<r;)if(x=s.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&
 x.opacity!=0&&b(n,p,q,s,x,a)}else x&&x.opacity!=0&&b(n,p,q,s,x,a)}}else if(s instanceof THREE.RenderableFace4&&(n=s.v1,p=s.v2,q=s.v3,v=s.v4,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,v.positionScreen.x*=j,v.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),
 x.opacity!=0&&b(n,p,q,s,x,a)}else x&&x.opacity!=0&&b(n,p,q,s,x,a)}}else if(s instanceof THREE.RenderableFace4&&(n=s.v1,p=s.v2,q=s.v3,v=s.v4,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,v.positionScreen.x*=j,v.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),

+ 123 - 123
build/custom/ThreeWebGL.js

@@ -26,22 +26,22 @@ THREE.Matrix4=function(b,c,d,f,j,h,k,m,p,q,s,r,u,v,B,y){this.set(b!==void 0?b:1,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,p,q,s,r,u,v,B,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=p;this.n32=q;this.n33=s;this.n34=r;this.n41=u;this.n42=v;this.n43=B;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,d,f,j,h,k,m,p,q,s,r,u,v,B,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=p;this.n32=q;this.n33=s;this.n34=r;this.n41=u;this.n42=v;this.n43=B;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;
 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+
 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,p=b.n23,q=b.n24,s=b.n31,r=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,C=b.n44,ya=c.n11,za=
-c.n12,qa=c.n13,sa=c.n14,ga=c.n21,F=c.n22,w=c.n23,ja=c.n24,L=c.n31,ka=c.n32,Y=c.n33,va=c.n34,Q=c.n41,M=c.n42,e=c.n43,Ea=c.n44;this.n11=d*ya+f*ga+j*L+h*Q;this.n12=d*za+f*F+j*ka+h*M;this.n13=d*qa+f*w+j*Y+h*e;this.n14=d*sa+f*ja+j*va+h*Ea;this.n21=k*ya+m*ga+p*L+q*Q;this.n22=k*za+m*F+p*ka+q*M;this.n23=k*qa+m*w+p*Y+q*e;this.n24=k*sa+m*ja+p*va+q*Ea;this.n31=s*ya+r*ga+u*L+v*Q;this.n32=s*za+r*F+u*ka+v*M;this.n33=s*qa+r*w+u*Y+v*e;this.n34=s*sa+r*ja+u*va+v*Ea;this.n41=B*ya+y*ga+E*L+C*Q;this.n42=B*za+y*F+E*ka+
-C*M;this.n43=B*qa+y*w+E*Y+C*e;this.n44=B*sa+y*ja+E*va+C*Ea;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,p=this.n31,q=this.n32,s=this.n33,r=this.n34,u=this.n41,v=this.n42,B=this.n43,y=this.n44;return f*k*q*u-d*m*q*u-f*h*s*u+c*m*s*u+d*h*r*u-c*k*r*u-f*k*p*v+d*m*p*v+f*j*s*v-b*m*s*v-d*j*r*v+b*k*r*v+f*h*p*B-c*m*p*B-f*j*q*B+b*m*q*B+c*j*r*
-B-b*h*r*B-d*h*p*y+c*k*p*y+d*j*q*y-b*k*q*y-c*j*s*y+b*h*s*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,p=j*h,q=j*k;this.set(p*h+d,p*k-f*m,p*m+f*k,0,p*k+f*m,q*k+d,q*m-f*h,0,p*m-f*k,q*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 p=k*m,q=k*j,s=f*m,r=f*j;this.n11=p+r*d;this.n12=s*d-q;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=q*d-s;this.n32=r+p*d;this.n33=h*k;break;case "ZXY":p=k*m;q=k*j;s=f*m;r=f*j;this.n11=p-r*d;this.n12=-h*j;this.n13=s+q*d;this.n21=q+s*d;this.n22=h*m;this.n23=r-p*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":p=h*m;q=h*j;s=d*m;r=d*j;this.n11=k*m;this.n12=s*f-q;this.n13=p*f+r;this.n21=k*j;this.n22=r*f+p;this.n23=
-q*f-s;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":p=h*k;q=h*f;s=d*k;r=d*f;this.n11=k*m;this.n12=r-p*j;this.n13=s*j+q;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=q*j+s;this.n33=p-r*j;break;case "XZY":p=h*k;q=h*f;s=d*k;r=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=p*j+r;this.n22=h*m;this.n23=q*j-s;this.n31=s*j-q;this.n32=d*m;this.n33=r*j+p;break;default:p=h*m,q=h*j,s=d*m,r=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=q+s*f,this.n22=p-r*f,this.n23=-d*k,this.n31=
-r-p*f,this.n32=s+q*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,p=c*k;c*=m;var q=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(q+f);this.n12=p-j;this.n13=c+k;this.n21=p+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+q);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}};
+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,p=b.n23,q=b.n24,s=b.n31,r=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,C=b.n44,xa=c.n11,ya=
+c.n12,ra=c.n13,sa=c.n14,ha=c.n21,F=c.n22,w=c.n23,S=c.n24,P=c.n31,ka=c.n32,Y=c.n33,za=c.n34,T=c.n41,O=c.n42,e=c.n43,Da=c.n44;this.n11=d*xa+f*ha+j*P+h*T;this.n12=d*ya+f*F+j*ka+h*O;this.n13=d*ra+f*w+j*Y+h*e;this.n14=d*sa+f*S+j*za+h*Da;this.n21=k*xa+m*ha+p*P+q*T;this.n22=k*ya+m*F+p*ka+q*O;this.n23=k*ra+m*w+p*Y+q*e;this.n24=k*sa+m*S+p*za+q*Da;this.n31=s*xa+r*ha+u*P+v*T;this.n32=s*ya+r*F+u*ka+v*O;this.n33=s*ra+r*w+u*Y+v*e;this.n34=s*sa+r*S+u*za+v*Da;this.n41=B*xa+y*ha+E*P+C*T;this.n42=B*ya+y*F+E*ka+C*O;
+this.n43=B*ra+y*w+E*Y+C*e;this.n44=B*sa+y*S+E*za+C*Da;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,p=this.n31,q=this.n32,s=this.n33,r=this.n34,u=this.n41,v=this.n42,B=this.n43,y=this.n44;return f*k*q*u-d*m*q*u-f*h*s*u+c*m*s*u+d*h*r*u-c*k*r*u-f*k*p*v+d*m*p*v+f*j*s*v-b*m*s*v-d*j*r*v+b*k*r*v+f*h*p*B-c*m*p*B-f*j*q*B+b*m*q*B+c*j*r*B-b*h*r*B-
+d*h*p*y+c*k*p*y+d*j*q*y-b*k*q*y-c*j*s*y+b*h*s*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,p=j*h,q=j*k;this.set(p*h+d,p*k-f*m,p*m+f*k,0,p*k+f*m,q*k+d,q*m-f*h,0,p*m-f*k,q*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 p=
+k*m,q=k*j,s=f*m,r=f*j;this.n11=p+r*d;this.n12=s*d-q;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=q*d-s;this.n32=r+p*d;this.n33=h*k;break;case "ZXY":p=k*m;q=k*j;s=f*m;r=f*j;this.n11=p-r*d;this.n12=-h*j;this.n13=s+q*d;this.n21=q+s*d;this.n22=h*m;this.n23=r-p*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":p=h*m;q=h*j;s=d*m;r=d*j;this.n11=k*m;this.n12=s*f-q;this.n13=p*f+r;this.n21=k*j;this.n22=r*f+p;this.n23=q*f-s;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":p=h*k;q=
+h*f;s=d*k;r=d*f;this.n11=k*m;this.n12=r-p*j;this.n13=s*j+q;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=q*j+s;this.n33=p-r*j;break;case "XZY":p=h*k;q=h*f;s=d*k;r=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=p*j+r;this.n22=h*m;this.n23=q*j-s;this.n31=s*j-q;this.n32=d*m;this.n33=r*j+p;break;default:p=h*m,q=h*j,s=d*m,r=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=q+s*f,this.n22=p-r*f,this.n23=-d*k,this.n31=r-p*f,this.n32=s+q*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,p=c*k;c*=m;var q=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(q+f);this.n12=p-j;this.n13=c+k;this.n21=p+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+q);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,p=b.n23,q=b.n24,s=b.n31,r=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*y-q*u*y+q*r*E-m*v*E-p*r*C+m*u*C;c.n12=h*u*y-j*v*y-h*r*E+f*v*E+j*r*C-f*u*C;c.n13=j*q*y-h*p*y+h*m*E-f*q*E-j*m*C+f*p*C;c.n14=h*p*r-j*q*r-h*m*u+f*q*u+j*m*v-f*p*v;c.n21=q*u*B-p*v*B-q*s*E+k*v*E+p*s*C-k*u*C;c.n22=j*v*B-h*u*B+h*s*E-d*v*E-j*s*C+d*u*C;c.n23=h*p*B-j*q*B-h*k*E+d*q*E+j*k*C-d*p*C;c.n24=
 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,p=b.n23,q=b.n24,s=b.n31,r=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*y-q*u*y+q*r*E-m*v*E-p*r*C+m*u*C;c.n12=h*u*y-j*v*y-h*r*E+f*v*E+j*r*C-f*u*C;c.n13=j*q*y-h*p*y+h*m*E-f*q*E-j*m*C+f*p*C;c.n14=h*p*r-j*q*r-h*m*u+f*q*u+j*m*v-f*p*v;c.n21=q*u*B-p*v*B-q*s*E+k*v*E+p*s*C-k*u*C;c.n22=j*v*B-h*u*B+h*s*E-d*v*E-j*s*C+d*u*C;c.n23=h*p*B-j*q*B-h*k*E+d*q*E+j*k*C-d*p*C;c.n24=
 j*q*s-h*p*s+h*k*u-d*q*u-j*k*v+d*p*v;c.n31=m*v*B-q*r*B+q*s*y-k*v*y-m*s*C+k*r*C;c.n32=h*r*B-f*v*B-h*s*y+d*v*y+f*s*C-d*r*C;c.n33=j*q*B-h*m*B+h*k*y-d*q*y-f*k*C+d*m*C;c.n34=h*m*s-f*q*s-h*k*r+d*q*r+f*k*v-d*m*v;c.n41=p*r*B-m*u*B-p*s*y+k*u*y+m*s*E-k*r*E;c.n42=f*u*B-j*r*B+j*s*y-d*u*y-f*s*E+d*r*E;c.n43=j*m*B-f*p*B-j*k*y+d*p*y+f*k*E-d*m*E;c.n44=f*p*s-j*m*s+j*k*r-d*p*r-f*k*u+d*m*u;c.multiplyScalar(1/b.determinant());return c};
 j*q*s-h*p*s+h*k*u-d*q*u-j*k*v+d*p*v;c.n31=m*v*B-q*r*B+q*s*y-k*v*y-m*s*C+k*r*C;c.n32=h*r*B-f*v*B-h*s*y+d*v*y+f*s*C-d*r*C;c.n33=j*q*B-h*m*B+h*k*y-d*q*y-f*k*C+d*m*C;c.n34=h*m*s-f*q*s-h*k*r+d*q*r+f*k*v-d*m*v;c.n41=p*r*B-m*u*B-p*s*y+k*u*y+m*s*E-k*r*E;c.n42=f*u*B-j*r*B+j*s*y-d*u*y-f*s*E+d*r*E;c.n43=j*m*B-f*p*B-j*k*y+d*p*y+f*k*E-d*m*E;c.n44=f*p*s-j*m*s+j*k*r-d*p*r-f*k*u+d*m*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,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,p=-b.n32*b.n11+b.n31*b.n12,q=b.n23*b.n12-b.n22*b.n13,s=-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*q;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*p;d[6]=b*q;d[7]=b*s;d[8]=b*r;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,p=-b.n32*b.n11+b.n31*b.n12,q=b.n23*b.n12-b.n22*b.n13,s=-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*q;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*p;d[6]=b*q;d[7]=b*s;d[8]=b*r;return c};
@@ -54,17 +54,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 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&&
 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&&
 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=p[m]=p[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,p=[],q,s,r=[],u,v=[],B,y,E=[],C,ya,za=[],qa=[],sa=[],ga=new THREE.Vector4,
-F=new THREE.Vector4,w=new THREE.Matrix4,ja=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,Y=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=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){m=e[b];var q;if(!(q=!m.visible))if(q=m instanceof THREE.Mesh)if(q=m.frustumCulled){a:{q=void 0;for(var p=m.matrixWorld,s=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(q=L[r].x*p.n14+L[r].y*p.n24+L[r].z*p.n34+L[r].w,q<=s){q=!1;break a}q=!0}q=!q}if(!q)q=h[j]=h[j]||new THREE.RenderableObject,j++,f=q,ga.copy(m.position),w.multiplyVector3(ga),f.object=m,f.z=ga.z,qa.push(f)}k&&qa.sort(c);return qa};
-this.projectScene=function(f,j,h){var e=j.near,qa=j.far,ga,wa,T,Z,J,W,S,V,xa,P,ta,Ga,Aa,Fa,R,Ba,Da;ya=y=u=s=sa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);w.multiply(j.projectionMatrix,j.matrixWorldInverse);L[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);L[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);L[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);L[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);L[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-
-w.n33,w.n44-w.n34);L[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(ga=0;ga<6;ga++)xa=L[ga],xa.divideScalar(Math.sqrt(xa.x*xa.x+xa.y*xa.y+xa.z*xa.z));xa=this.projectObjects(f,j,!0);f=0;for(ga=xa.length;f<ga;f++)if(P=xa[f].object,P.visible)if(ta=P.matrixWorld,Ga=P.matrixRotationWorld,Aa=P.materials,Fa=P.overdraw,m=0,P instanceof THREE.Mesh){R=P.geometry;Z=R.vertices;Ba=R.faces;R=R.faceVertexUvs;wa=0;for(T=Z.length;wa<T;wa++)k=b(),k.positionWorld.copy(Z[wa].position),ta.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<qa;Z=0;for(wa=Ba.length;Z<wa;Z++){T=Ba[Z];if(T instanceof THREE.Face3)if(J=p[T.a],W=p[T.b],S=p[T.c],J.visible&&W.visible&&S.visible&&(P.doubleSided||P.flipSided!=(S.positionScreen.x-J.positionScreen.x)*(W.positionScreen.y-J.positionScreen.y)-(S.positionScreen.y-J.positionScreen.y)*(W.positionScreen.x-
-J.positionScreen.x)<0))V=r[s]=r[s]||new THREE.RenderableFace3,s++,q=V,q.v1.copy(J),q.v2.copy(W),q.v3.copy(S);else continue;else if(T instanceof THREE.Face4)if(J=p[T.a],W=p[T.b],S=p[T.c],V=p[T.d],J.visible&&W.visible&&S.visible&&V.visible&&(P.doubleSided||P.flipSided!=((V.positionScreen.x-J.positionScreen.x)*(W.positionScreen.y-J.positionScreen.y)-(V.positionScreen.y-J.positionScreen.y)*(W.positionScreen.x-J.positionScreen.x)<0||(W.positionScreen.x-S.positionScreen.x)*(V.positionScreen.y-S.positionScreen.y)-
-(W.positionScreen.y-S.positionScreen.y)*(V.positionScreen.x-S.positionScreen.x)<0)))Da=v[u]=v[u]||new THREE.RenderableFace4,u++,q=Da,q.v1.copy(J),q.v2.copy(W),q.v3.copy(S),q.v4.copy(V);else continue;q.normalWorld.copy(T.normal);Ga.multiplyVector3(q.normalWorld);q.centroidWorld.copy(T.centroid);ta.multiplyVector3(q.centroidWorld);q.centroidScreen.copy(q.centroidWorld);w.multiplyVector3(q.centroidScreen);S=T.vertexNormals;J=0;for(W=S.length;J<W;J++)V=q.vertexNormalsWorld[J],V.copy(S[J]),Ga.multiplyVector3(V);
-J=0;for(W=R.length;J<W;J++)if(Da=R[J][Z]){S=0;for(V=Da.length;S<V;S++)q.uvs[J][S]=Da[S]}q.meshMaterials=Aa;q.faceMaterials=T.materials;q.overdraw=Fa;q.z=q.centroidScreen.z;sa.push(q)}}else if(P instanceof THREE.Line){ja.multiply(w,ta);Z=P.geometry.vertices;J=b();J.positionScreen.copy(Z[0].position);ja.multiplyVector4(J.positionScreen);wa=1;for(T=Z.length;wa<T;wa++)if(J=b(),J.positionScreen.copy(Z[wa].position),ja.multiplyVector4(J.positionScreen),W=p[m-2],ka.copy(J.positionScreen),Y.copy(W.positionScreen),
-d(ka,Y))ka.multiplyScalar(1/ka.w),Y.multiplyScalar(1/Y.w),ta=E[y]=E[y]||new THREE.RenderableLine,y++,B=ta,B.v1.positionScreen.copy(ka),B.v2.positionScreen.copy(Y),B.z=Math.max(ka.z,Y.z),B.materials=P.materials,sa.push(B)}else if(P instanceof THREE.Particle&&(F.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),w.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ta=za[ya]=za[ya]||new THREE.RenderableParticle,ya++,C=ta,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=P.rotation.z,C.scale.x=P.scale.x*Math.abs(C.x-
-(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),C.scale.y=P.scale.y*Math.abs(C.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),C.materials=P.materials,sa.push(C);h&&sa.sort(c);return sa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=p[m]=p[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,p=[],q,s,r=[],u,v=[],B,y,E=[],C,xa,ya=[],ra=[],sa=[],ha=new THREE.Vector4,
+F=new THREE.Vector4,w=new THREE.Matrix4,S=new THREE.Matrix4,P=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,Y=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=ra.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){m=e[b];var q;if(!(q=!m.visible))if(q=m instanceof THREE.Mesh)if(q=m.frustumCulled){a:{q=void 0;for(var p=m.matrixWorld,s=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(q=P[r].x*p.n14+P[r].y*p.n24+P[r].z*p.n34+P[r].w,q<=s){q=!1;break a}q=!0}q=!q}if(!q)q=h[j]=h[j]||new THREE.RenderableObject,j++,f=q,ha.copy(m.position),w.multiplyVector3(ha),f.object=m,f.z=ha.z,ra.push(f)}k&&ra.sort(c);return ra};
+this.projectScene=function(f,j,h){var e=j.near,ra=j.far,ha,wa,Z,ta,J,U,Q,ma,ia,L,Aa,Ba,Ga,Fa,R,va,Ea;xa=y=u=s=sa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);w.multiply(j.projectionMatrix,j.matrixWorldInverse);P[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);P[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);P[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);P[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);P[4].set(w.n41-w.n31,w.n42-w.n32,
+w.n43-w.n33,w.n44-w.n34);P[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(ha=0;ha<6;ha++)ia=P[ha],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(f,j,!0);f=0;for(ha=ia.length;f<ha;f++)if(L=ia[f].object,L.visible)if(Aa=L.matrixWorld,Ba=L.matrixRotationWorld,Ga=L.materials,Fa=L.overdraw,m=0,L instanceof THREE.Mesh){R=L.geometry;ta=R.vertices;va=R.faces;R=R.faceVertexUvs;wa=0;for(Z=ta.length;wa<Z;wa++)k=b(),k.positionWorld.copy(ta[wa].position),Aa.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<ra;ta=0;for(wa=va.length;ta<wa;ta++){Z=va[ta];if(Z instanceof THREE.Face3)if(J=p[Z.a],U=p[Z.b],Q=p[Z.c],J.visible&&U.visible&&Q.visible&&(L.doubleSided||L.flipSided!=(Q.positionScreen.x-J.positionScreen.x)*(U.positionScreen.y-J.positionScreen.y)-(Q.positionScreen.y-J.positionScreen.y)*(U.positionScreen.x-
+J.positionScreen.x)<0))ma=r[s]=r[s]||new THREE.RenderableFace3,s++,q=ma,q.v1.copy(J),q.v2.copy(U),q.v3.copy(Q);else continue;else if(Z instanceof THREE.Face4)if(J=p[Z.a],U=p[Z.b],Q=p[Z.c],ma=p[Z.d],J.visible&&U.visible&&Q.visible&&ma.visible&&(L.doubleSided||L.flipSided!=((ma.positionScreen.x-J.positionScreen.x)*(U.positionScreen.y-J.positionScreen.y)-(ma.positionScreen.y-J.positionScreen.y)*(U.positionScreen.x-J.positionScreen.x)<0||(U.positionScreen.x-Q.positionScreen.x)*(ma.positionScreen.y-Q.positionScreen.y)-
+(U.positionScreen.y-Q.positionScreen.y)*(ma.positionScreen.x-Q.positionScreen.x)<0)))Ea=v[u]=v[u]||new THREE.RenderableFace4,u++,q=Ea,q.v1.copy(J),q.v2.copy(U),q.v3.copy(Q),q.v4.copy(ma);else continue;q.normalWorld.copy(Z.normal);Ba.multiplyVector3(q.normalWorld);q.centroidWorld.copy(Z.centroid);Aa.multiplyVector3(q.centroidWorld);q.centroidScreen.copy(q.centroidWorld);w.multiplyVector3(q.centroidScreen);Q=Z.vertexNormals;J=0;for(U=Q.length;J<U;J++)ma=q.vertexNormalsWorld[J],ma.copy(Q[J]),Ba.multiplyVector3(ma);
+J=0;for(U=R.length;J<U;J++)if(Ea=R[J][ta]){Q=0;for(ma=Ea.length;Q<ma;Q++)q.uvs[J][Q]=Ea[Q]}q.meshMaterials=Ga;q.faceMaterials=Z.materials;q.overdraw=Fa;q.z=q.centroidScreen.z;sa.push(q)}}else if(L instanceof THREE.Line){S.multiply(w,Aa);ta=L.geometry.vertices;J=b();J.positionScreen.copy(ta[0].position);S.multiplyVector4(J.positionScreen);wa=1;for(Z=ta.length;wa<Z;wa++)if(J=b(),J.positionScreen.copy(ta[wa].position),S.multiplyVector4(J.positionScreen),U=p[m-2],ka.copy(J.positionScreen),Y.copy(U.positionScreen),
+d(ka,Y))ka.multiplyScalar(1/ka.w),Y.multiplyScalar(1/Y.w),Aa=E[y]=E[y]||new THREE.RenderableLine,y++,B=Aa,B.v1.positionScreen.copy(ka),B.v2.positionScreen.copy(Y),B.z=Math.max(ka.z,Y.z),B.materials=L.materials,sa.push(B)}else if(L instanceof THREE.Particle&&(F.set(L.matrixWorld.n14,L.matrixWorld.n24,L.matrixWorld.n34,1),w.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))Aa=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,C=Aa,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=L.rotation.z,C.scale.x=L.scale.x*Math.abs(C.x-
+(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),C.scale.y=L.scale.y*Math.abs(C.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),C.materials=L.materials,sa.push(C);h&&sa.sort(c);return sa}};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.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);
 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=
@@ -79,9 +79,9 @@ c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid
 d,f,j,h,k,m=new THREE.Vector3,p=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),p.sub(c.position,d.position),m.crossSelf(p);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,j,h,k,m=new THREE.Vector3,p=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),p.sub(c.position,d.position),m.crossSelf(p);m.isZero()||m.normalize();h.normal.copy(m)}},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;p=b.vertices[c].position;q=b.vertices[d].position;s=k[f];r=k[j];u=k[h];v=p.x-m.x;B=q.x-m.x;y=p.y-m.y;E=q.y-m.y;C=p.z-m.z;ya=q.z-m.z;za=r.u-s.u;qa=u.u-s.u;sa=r.v-s.v;ga=u.v-s.v;F=1/(za*ga-qa*sa);ka.set((ga*v-sa*B)*F,(ga*y-sa*E)*F,(ga*C-sa*ya)*F);Y.set((za*B-qa*v)*F,(za*E-qa*y)*F,(za*ya-qa*C)*F);ja[e].addSelf(ka);ja[c].addSelf(ka);
-ja[d].addSelf(ka);L[e].addSelf(Y);L[c].addSelf(Y);L[d].addSelf(Y)}var c,d,f,j,h,k,m,p,q,s,r,u,v,B,y,E,C,ya,za,qa,sa,ga,F,w,ja=[],L=[],ka=new THREE.Vector3,Y=new THREE.Vector3,va=new THREE.Vector3,Q=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)ja[c]=new THREE.Vector3,L[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=ja[j],va.copy(w),va.subSelf(M.multiplyScalar(M.dot(w))).normalize(),Q.cross(h.vertexNormals[f],w),j=Q.dot(L[j]),j=j<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(va.x,va.y,va.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,j,h){m=b.vertices[e].position;p=b.vertices[c].position;q=b.vertices[d].position;s=k[f];r=k[j];u=k[h];v=p.x-m.x;B=q.x-m.x;y=p.y-m.y;E=q.y-m.y;C=p.z-m.z;xa=q.z-m.z;ya=r.u-s.u;ra=u.u-s.u;sa=r.v-s.v;ha=u.v-s.v;F=1/(ya*ha-ra*sa);ka.set((ha*v-sa*B)*F,(ha*y-sa*E)*F,(ha*C-sa*xa)*F);Y.set((ya*B-ra*v)*F,(ya*E-ra*y)*F,(ya*xa-ra*C)*F);S[e].addSelf(ka);S[c].addSelf(ka);
+S[d].addSelf(ka);P[e].addSelf(Y);P[c].addSelf(Y);P[d].addSelf(Y)}var c,d,f,j,h,k,m,p,q,s,r,u,v,B,y,E,C,xa,ya,ra,sa,ha,F,w,S=[],P=[],ka=new THREE.Vector3,Y=new THREE.Vector3,za=new THREE.Vector3,T=new THREE.Vector3,O=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)S[c]=new THREE.Vector3,P[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++)O.copy(h.vertexNormals[f]),j=h[e[f]],w=S[j],za.copy(w),za.subSelf(O.multiplyScalar(O.dot(w))).normalize(),T.cross(h.vertexNormals[f],w),j=T.dot(P[j]),j=j<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(za.x,za.y,za.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],
 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],
 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],
@@ -182,20 +182,20 @@ 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,H=b.colors,I=H.length,D=b.__vertexArray,q=b.__colorArray,p=b.__sortArray,r=b.__dirtyVertices,s=b.__dirtyColors,u=b.__webglCustomAttributes,w,n;if(u)for(w in u)u[w].offset=0;if(d.sortParticles){Ba.multiplySelf(d.matrixWorld);for(f=0;f<m;f++)j=k[f].position,Ja.copy(j),Ba.multiplyVector3(Ja),p[f]=[Ja.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<m;f++)j=k[p[f][1]].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,j,h,k=b.vertices,m=k.length,H=b.colors,I=H.length,D=b.__vertexArray,q=b.__colorArray,p=b.__sortArray,r=b.__dirtyVertices,s=b.__dirtyColors,u=b.__webglCustomAttributes,w,n;if(u)for(w in u)u[w].offset=0;if(d.sortParticles){va.multiplySelf(d.matrixWorld);for(f=0;f<m;f++)j=k[f].position,Ja.copy(j),va.multiplyVector3(Ja),p[f]=[Ja.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<m;f++)j=k[p[f][1]].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;
 for(f=0;f<I;f++)h=f*3,color=H[p[f][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(u)for(w in u){f=u[w];H=f.value.length;for(h=0;h<H;h++){index=p[h][1];I=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[I]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")n=f.value[index];f.size===2?(f.array[I]=n.x,f.array[I+1]=n.y):f.size===3?f.type==="c"?(f.array[I]=n.r,f.array[I+1]=n.g,f.array[I+2]=n.b):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z):(f.array[I]=
 for(f=0;f<I;f++)h=f*3,color=H[p[f][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(u)for(w in u){f=u[w];H=f.value.length;for(h=0;h<H;h++){index=p[h][1];I=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[I]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")n=f.value[index];f.size===2?(f.array[I]=n.x,f.array[I+1]=n.y):f.size===3?f.type==="c"?(f.array[I]=n.r,f.array[I+1]=n.g,f.array[I+2]=n.b):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z):(f.array[I]=
 n.x,f.array[I+1]=n.y,f.array[I+2]=n.z,f.array[I+3]=n.w)}f.offset+=f.size}}}else{if(r)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(s)for(f=0;f<I;f++)color=H[f],h=f*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(u)for(w in u)if(f=u[w],f.__original.needsUpdate){H=f.value.length;for(h=0;h<H;h++){I=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[I]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")n=f.value[h];f.size===2?(f.array[I]=
 n.x,f.array[I+1]=n.y,f.array[I+2]=n.z,f.array[I+3]=n.w)}f.offset+=f.size}}}else{if(r)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(s)for(f=0;f<I;f++)color=H[f],h=f*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(u)for(w in u)if(f=u[w],f.__original.needsUpdate){H=f.value.length;for(h=0;h<H;h++){I=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[I]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")n=f.value[h];f.size===2?(f.array[I]=
 n.x,f.array[I+1]=n.y):f.size===3?f.type==="c"?(f.array[I]=n.r,f.array[I+1]=n.g,f.array[I+2]=n.b):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z,f.array[I+3]=n.w)}f.offset+=f.size}}}if(r||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(s||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,q,c);if(u)for(w in u)if(f=u[w],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
 n.x,f.array[I+1]=n.y):f.size===3?f.type==="c"?(f.array[I]=n.r,f.array[I+1]=n.g,f.array[I+2]=n.b):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z):(f.array[I]=n.x,f.array[I+1]=n.y,f.array[I+2]=n.z,f.array[I+3]=n.w)}f.offset+=f.size}}}if(r||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(s||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,q,c);if(u)for(w in u)if(f=u[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,Da);if(d&&f.fog)if(m.fogColor.value=d.color,d instanceof THREE.Fog)m.fogNear.value=d.near,
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,j){f.program||O.initMaterial(f,c,d,j);if(f.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var h=0,k=O.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,Ea);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 H,q,D,p=0,r=0,s=0,n,u,v,B=Wa,G=B.directional.colors,K=B.directional.positions,y=B.point.colors,A=B.point.positions,C=B.point.distances,E=0,F=0,d=q=v=0;for(H=c.length;d<H;d++)if(q=c[d],D=q.color,n=q.position,u=q.intensity,v=q.distance,q instanceof THREE.AmbientLight)p+=D.r,r+=D.g,s+=D.b;else if(q instanceof THREE.DirectionalLight)v=
 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 H,q,D,p=0,r=0,s=0,n,u,v,B=Wa,G=B.directional.colors,K=B.directional.positions,y=B.point.colors,A=B.point.positions,C=B.point.distances,E=0,F=0,d=q=v=0;for(H=c.length;d<H;d++)if(q=c[d],D=q.color,n=q.position,u=q.intensity,v=q.distance,q instanceof THREE.AmbientLight)p+=D.r,r+=D.g,s+=D.b;else if(q instanceof THREE.DirectionalLight)v=
 E*3,G[v]=D.r*u,G[v+1]=D.g*u,G[v+2]=D.b*u,K[v]=n.x,K[v+1]=n.y,K[v+2]=n.z,E+=1;else if(q instanceof THREE.SpotLight)v=E*3,G[v]=D.r*u,G[v+1]=D.g*u,G[v+2]=D.b*u,D=1/n.length(),K[v]=n.x*D,K[v+1]=n.y*D,K[v+2]=n.z*D,E+=1;else if(q instanceof THREE.PointLight)q=F*3,y[q]=D.r*u,y[q+1]=D.g*u,y[q+2]=D.b*u,A[q]=n.x,A[q+1]=n.y,A[q+2]=n.z,C[F]=v,F+=1;for(d=E*3;d<G.length;d++)G[d]=0;for(d=F*3;d<y.length;d++)y[d]=0;B.point.length=F;B.directional.length=E;B.ambient[0]=p;B.ambient[1]=r;B.ambient[2]=s;c=Wa;m.enableLighting.value=
 E*3,G[v]=D.r*u,G[v+1]=D.g*u,G[v+2]=D.b*u,K[v]=n.x,K[v+1]=n.y,K[v+2]=n.z,E+=1;else if(q instanceof THREE.SpotLight)v=E*3,G[v]=D.r*u,G[v+1]=D.g*u,G[v+2]=D.b*u,D=1/n.length(),K[v]=n.x*D,K[v+1]=n.y*D,K[v+2]=n.z*D,E+=1;else if(q instanceof THREE.PointLight)q=F*3,y[q]=D.r*u,y[q+1]=D.g*u,y[q+2]=D.b*u,A[q]=n.x,A[q+1]=n.y,A[q+2]=n.z,C[F]=v,F+=1;for(d=E*3;d<G.length;d++)G[d]=0;for(d=F*3;d<y.length;d++)y[d]=0;B.point.length=F;B.directional.length=E;B.ambient[0]=p;B.ambient[1]=r;B.ambient[2]=s;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)&&
 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=
 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=Ka.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<Sa.length;c++)m.shadowMatrix.value[c]=Sa[c],m.shadowMap.texture[c]=
-M.shadowMap[c];m.shadowDarkness.value=M.shadowMapDarkness;m.shadowBias.value=M.shadowMapBias}for(var N in m)if(H=h.uniforms[N])if(d=m[N],p=d.type,c=d.value,p=="i")e.uniform1i(H,c);else if(p=="f")e.uniform1f(H,c);else if(p=="v2")e.uniform2f(H,c.x,c.y);else if(p=="v3")e.uniform3f(H,c.x,c.y,c.z);else if(p=="v4")e.uniform4f(H,c.x,c.y,c.z,c.w);else if(p=="c")e.uniform3f(H,c.r,c.g,c.b);else if(p=="fv1")e.uniform1fv(H,c);else if(p=="fv")e.uniform3fv(H,c);else if(p=="v3v"){if(!d._array)d._array=new Float32Array(3*
+f.opacity,m.size.value=f.size,m.scale.value=Ha.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<Ma.length;c++)m.shadowMatrix.value[c]=Ma[c],m.shadowMap.texture[c]=
+O.shadowMap[c];m.shadowDarkness.value=O.shadowMapDarkness;m.shadowBias.value=O.shadowMapBias}for(var M in m)if(H=h.uniforms[M])if(d=m[M],p=d.type,c=d.value,p=="i")e.uniform1i(H,c);else if(p=="f")e.uniform1f(H,c);else if(p=="v2")e.uniform2f(H,c.x,c.y);else if(p=="v3")e.uniform3f(H,c.x,c.y,c.z);else if(p=="v4")e.uniform4f(H,c.x,c.y,c.z,c.w);else if(p=="c")e.uniform3f(H,c.r,c.g,c.b);else if(p=="fv1")e.uniform1fv(H,c);else if(p=="fv")e.uniform3fv(H,c);else if(p=="v3v"){if(!d._array)d._array=new Float32Array(3*
 c.length);p=0;for(r=c.length;p<r;p++)s=p*3,d._array[s]=c[p].x,d._array[s+1]=c[p].y,d._array[s+2]=c[p].z;e.uniform3fv(H,d._array)}else if(p=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(H,!1,d._array)}else if(p=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);p=0;for(r=c.length;p<r;p++)c[p].flattenToArrayOffset(d._array,p*16);e.uniformMatrix4fv(H,!1,d._array)}else if(p=="t"){if(e.uniform1i(H,c),H=d.texture)if(H.image instanceof Array&&H.image.length==
 c.length);p=0;for(r=c.length;p<r;p++)s=p*3,d._array[s]=c[p].x,d._array[s+1]=c[p].y,d._array[s+2]=c[p].z;e.uniform3fv(H,d._array)}else if(p=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(H,!1,d._array)}else if(p=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);p=0;for(r=c.length;p<r;p++)c[p].flattenToArrayOffset(d._array,p*16);e.uniformMatrix4fv(H,!1,d._array)}else if(p=="t"){if(e.uniform1i(H,c),H=d.texture)if(H.image instanceof Array&&H.image.length==
 6){if(d=H,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 H instanceof THREE.WebGLRenderTargetCube?
 6){if(d=H,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 H instanceof THREE.WebGLRenderTargetCube?
-(d=H,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):ja(H,c)}else if(p=="tv"){if(!d._array){d._array=[];p=0;for(r=d.texture.length;p<r;p++)d._array[p]=c+p}e.uniform1iv(H,d._array);p=0;for(r=d.texture.length;p<r;p++)(H=d.texture[p])&&ja(H,d._array[p])}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)&&
+(d=H,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):S(H,c)}else if(p=="tv"){if(!d._array){d._array=[];p=0;for(r=d.texture.length;p<r;p++)d._array[p]=c+p}e.uniform1iv(H,d._array);p=0;for(r=d.texture.length;p<r;p++)(H=d.texture[p])&&S(H,d._array[p])}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,
 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),
 !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,p=k.morphTargetForcedOrder,H=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<p.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=H[p[f]],f++;else{var p=[],q=-1,D=0,H=k.morphTargetInfluences,r,s=H.length,f=0;for(k.morphTargetBase!==-1&&(p[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(r=
 e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,p=k.morphTargetForcedOrder,H=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<p.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=H[p[f]],f++;else{var p=[],q=-1,D=0,H=k.morphTargetInfluences,r,s=H.length,f=0;for(k.morphTargetBase!==-1&&(p[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(r=
@@ -203,97 +203,97 @@ e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.
 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,
 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,
 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.data.vertices+=h.__webglFaceCount,M.data.faces+=h.__webglFaceCount/3,M.data.drawCalls++):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.data.drawCalls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.data.drawCalls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.data.drawCalls++)}}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,H,p,q,r,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],H=d[s+4],q=d[s+5],m=d[s+6],p=d[s+7],r=d[s+8],f=(f+k+m)/3,h=(h+H+p)/3,j=(j+q+r)/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(T!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE),T=b.doubleSided;if(Z!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Z=b.flipSided}function k(b){W!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),W=b)}function m(b){S!=b&&(e.depthMask(b),S=b)}function p(b,c,d){V!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),V=b);if(b&&(xa!=c||P!=d))e.polygonOffset(c,d),xa=c,P=d}function q(b){R[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);R[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+
-b.n14);R[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);R[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);R[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);R[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=R[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function s(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=R[e].x*c.n14+R[e].y*c.n24+R[e].z*c.n34+R[e].w,
-b<=d)return!1;return!0}function r(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?r(h,d):r(f,d)}function v(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 B(b,c){return c.z-b.z}function y(b,c){var m,p,Ma,r=0,fa,n,H,I,D=b.lights;ra||(ra=new THREE.Camera(M.shadowCameraFov,c.aspect,M.shadowCameraNear,M.shadowCameraFar));m=0;for(p=D.length;m<p;m++)if(Ma=D[m],Ma instanceof THREE.SpotLight&&Ma.castShadow){M.shadowMap[r]||(M.shadowMap[r]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[r]||(Sa[r]=new THREE.Matrix4);
-fa=M.shadowMap[r];n=Sa[r];ra.position.copy(Ma.position);ra.target.position.copy(Ma.target.position);ra.update(void 0,!0);b.update(void 0,!1,ra);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(ra.projectionMatrix);n.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Ta);ra.projectionMatrix.flattenToArray(Da);Ba.multiply(ra.projectionMatrix,ra.matrixWorldInverse);q(Ba);M.initWebGLObjects(b);L(fa);e.clearColor(1,1,1,1);M.clear();e.clearColor(ha.r,ha.g,ha.b,Ha);
-n=b.__webglObjects.length;Ma=b.__webglObjectsImmediate.length;for(fa=0;fa<n;fa++)H=b.__webglObjects[fa],I=H.object,I.visible&&I.castShadow?!(I instanceof THREE.Mesh)||!I.frustumCulled||s(I)?(I.matrixWorld.flattenToArray(I._objectMatrixArray),C(I,ra,!1),H.render=!0):H.render=!1:H.render=!1;k(!0);F(THREE.NormalBlending);for(fa=0;fa<n;fa++)if(H=b.__webglObjects[fa],H.render)I=H.object,buffer=H.buffer,h(I),H=I.customDepthMaterial?I.customDepthMaterial:I.geometry.morphTargets.length?Xa:Ua,f(ra,D,null,
-H,buffer,I);for(fa=0;fa<Ma;fa++)H=b.__webglObjectsImmediate[fa],I=H.object,I.visible&&I.castShadow&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),C(I,ra,!1),h(I),program=d(ra,D,null,Ua,I),I.render(function(b){j(b,program,Ua.shading)}));r++}}function E(b,c){var d,f,h;d=n.attributes;var j=n.uniforms,k=Fa/Aa,m,p=[],q=Aa*0.5,r=Fa*0.5,s=!0;e.useProgram(n.program);Va=n.program;W=J=-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,Da);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(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.material===void 0&&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?Fa:1),p[0]=m*k*h.scale.x,p[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.uniform1f(j.rotation,h.rotation),e.uniform2fv(j.scale,p),h.mergeWith3D&&!s?(e.enable(e.DEPTH_TEST),s=!0):!h.mergeWith3D&&s&&(e.disable(e.DEPTH_TEST),s=!1),F(h.blending),ja(h.map,0),e.drawElements(e.TRIANGLES,
-6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(S)}function C(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ya(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 za(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 qa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function sa(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,p,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}),
-p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:r}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(q[m].counter+=1,p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[p].faces.push(f),b.geometryGroups[p].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}
-function ga(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=J){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)}J=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,Q(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,Q(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,Q(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,Q(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,va(c.magFilter)),
-e.texParameteri(b,e.TEXTURE_MIN_FILTER,va(c.minFilter)))}function ja(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,Q(b.format),b.image.width,b.image.height,0,Q(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 L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;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,Q(b.format),b.width,b.height,0,Q(b.format),Q(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,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,
-0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,
-e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,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=Aa,b=Fa,f=ta,h=Ga);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function ka(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 Y(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 va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
-case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,Ea=[],Va=null,wa=null,T=null,Z=null,J=null,W=null,S=null,V=null,xa=null,P=null,ta=0,Ga=0,Aa=0,Fa=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Da=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0,
-0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ka=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,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,
-drawCalls:0};this.maxMorphTargets=8;this.domElement=Ka;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 ra,Sa=[],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=Ka.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(ha.r,ha.g,ha.b,Ha);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,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,Y("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.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){Ka.width=b;Ka.height=c;this.setViewport(0,0,Ka.width,Ka.height)};this.setViewport=function(b,c,d,f){ta=b;Ga=c;Aa=d;Fa=f;e.viewport(ta,Ga,Aa,Fa)};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){ha.setHex(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.setClearColor=function(b,c){ha.copy(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return Ha};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);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])}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=
-b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture)};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 p,q,r;p=r=m=0;for(q=c.length;p<q;p++)j=c[p],j instanceof THREE.SpotLight&&r++,j instanceof THREE.DirectionalLight&&r++,j instanceof THREE.PointLight&&m++;m+r<=_maxLights?p=r:(p=Math.ceil(_maxLights*r/(m+r)),m=_maxLights-p);j={directional:p,point:m};m=r=0;for(p=c.length;m<p;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:{p=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(p),f.push(q));for(u in d)f.push(u),f.push(d[u]);k=f.join();u=0;for(f=Ea.length;u<f;u++)if(Ea[u].code==k){n=Ea[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");
+h.__webglFaceCount,e.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=h.__webglFaceCount,O.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),O.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),O.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),O.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,H,p,q,r,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],H=d[s+4],q=d[s+5],m=d[s+6],p=d[s+7],r=d[s+8],f=(f+k+m)/3,h=(h+H+p)/3,j=(j+q+r)/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(Z!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE),Z=b.doubleSided;if(ta!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),ta=b.flipSided}function k(b){U!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),U=b)}function m(b){Q!=b&&(e.depthMask(b),Q=b)}function p(b,c,d){ma!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),ma=b);if(b&&(ia!=c||L!=d))e.polygonOffset(c,d),ia=c,L=d}function q(b){R[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);R[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,
+b.n44+b.n14);R[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);R[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);R[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);R[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=R[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function s(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=R[e].x*c.n14+R[e].y*c.n24+R[e].z*c.n34+
+R[e].w,b<=d)return!1;return!0}function r(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?r(h,d):r(f,d)}function v(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 B(b,c){return c.z-b.z}function y(b,c){var m,p,Na,r=0,ga,n,H,I,D=b.lights;W||(W=new THREE.Camera(O.shadowCameraFov,c.aspect,O.shadowCameraNear,O.shadowCameraFar));m=0;for(p=D.length;m<p;m++)if(Na=D[m],Na instanceof THREE.SpotLight&&Na.castShadow){O.shadowMap[r]||(O.shadowMap[r]=new THREE.WebGLRenderTarget(O.shadowMapWidth,O.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ma[r]||(Ma[r]=new THREE.Matrix4);
+ga=O.shadowMap[r];n=Ma[r];W.position.copy(Na.position);W.target.position.copy(Na.target.position);W.update(void 0,!0);b.update(void 0,!1,W);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(W.projectionMatrix);n.multiplySelf(W.matrixWorldInverse);W.matrixWorldInverse.flattenToArray(Ta);W.projectionMatrix.flattenToArray(Ea);va.multiply(W.projectionMatrix,W.matrixWorldInverse);q(va);O.initWebGLObjects(b);P(ga);e.clearColor(1,1,1,1);O.clear();e.clearColor($.r,$.g,$.b,Ka);n=b.__webglObjects.length;
+Na=b.__webglObjectsImmediate.length;for(ga=0;ga<n;ga++)H=b.__webglObjects[ga],I=H.object,I.visible&&I.castShadow?!(I instanceof THREE.Mesh)||!I.frustumCulled||s(I)?(I.matrixWorld.flattenToArray(I._objectMatrixArray),C(I,W,!1),H.render=!0):H.render=!1:H.render=!1;k(!0);F(THREE.NormalBlending);for(ga=0;ga<n;ga++)if(H=b.__webglObjects[ga],H.render)I=H.object,buffer=H.buffer,h(I),H=I.customDepthMaterial?I.customDepthMaterial:I.geometry.morphTargets.length?Xa:Ua,f(W,D,null,H,buffer,I);for(ga=0;ga<Na;ga++)H=
+b.__webglObjectsImmediate[ga],I=H.object,I.visible&&I.castShadow&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),C(I,W,!1),h(I),program=d(W,D,null,Ua,I),I.render(function(b){j(b,program,Ua.shading)}));r++}}function E(b,c){var d,f,h;d=n.attributes;var j=n.uniforms,k=Fa/Ga,m,p=[],q=Ga*0.5,r=Fa*0.5,s=!0;e.useProgram(n.program);Va=n.program;U=J=-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,Ea);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(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.material===void 0&&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?Fa:1),p[0]=m*k*h.scale.x,p[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.uniform1f(j.rotation,h.rotation),e.uniform2fv(j.scale,p),h.mergeWith3D&&!s?(e.enable(e.DEPTH_TEST),s=!0):!h.mergeWith3D&&s&&(e.disable(e.DEPTH_TEST),s=!1),F(h.blending),S(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);
+e.enable(e.DEPTH_TEST);e.depthMask(Q)}function C(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}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)if(e.attributes[c].needsUpdate)return!0;return!1}function ya(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 ra(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function sa(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,p,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}),p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
+materials:k,vertices:0,numMorphTargets:r}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(q[m].counter+=1,p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[p].faces.push(f),b.geometryGroups[p].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!=J){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)}J=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,T(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,T(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,T(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,T(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,za(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,za(c.minFilter)))}function S(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=
+!0,b.__webglTexture=e.createTexture(),O.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function P(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,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=
+e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,
+e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,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=Ga,b=Fa,f=Aa,h=Ba);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function ka(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 Y(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function za(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+default:return e.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return e.BYTE;case THREE.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 O=this,e,Da=[],Va=null,wa=null,Z=null,ta=null,J=null,U=null,Q=null,ma=null,ia=null,L=null,Aa=0,Ba=0,Ga=0,Fa=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ea=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ha=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,$=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ka=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=Ha;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 W,Ma=[],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=Ha.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($.r,$.g,$.b,Ka);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,Y("fragment",
+THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,Y("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.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){Ha.width=b;Ha.height=c;this.setViewport(0,0,Ha.width,Ha.height)};this.setViewport=function(b,c,d,f){Aa=b;Ba=c;Ga=d;Fa=f;e.viewport(Aa,Ba,Ga,Fa)};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){$.setHex(b);Ka=c;e.clearColor($.r,$.g,$.b,Ka)};this.setClearColor=
+function(b,c){$.copy(b);Ka=c;e.clearColor($.r,$.g,$.b,Ka)};this.getClearColor=function(){return $};this.getClearAlpha=function(){return Ka};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);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]);O.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),O.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),O.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
+O.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),O.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 p,q,r;p=r=m=0;for(q=c.length;p<q;p++)j=c[p],j instanceof THREE.SpotLight&&r++,j instanceof THREE.DirectionalLight&&r++,j instanceof THREE.PointLight&&m++;m+r<=_maxLights?p=r:(p=Math.ceil(_maxLights*r/(m+r)),m=_maxLights-p);j={directional:p,point:m};m=r=0;for(p=c.length;m<p;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:{p=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(p),f.push(q));for(u in d)f.push(u),f.push(d[u]);k=f.join();u=0;for(f=Da.length;u<f;u++)if(Da[u].code==k){n=Da[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":"",
 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,Y("fragment",j+p));e.attachShader(u,Y("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 ["+
 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,Y("fragment",j+p));e.attachShader(u,Y("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++)p=v[f],u.uniforms[p]=e.getUniformLocation(u,p);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);
 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++)p=v[f],u.uniforms[p]=e.getUniformLocation(u,p);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);Ea.push({program:u,code:k});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){L(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,H,I,D,Qa,J=b.lights,Ra=b.fog;this.shadowMapEnabled&&y(b,c);M.data.vertices=0;M.data.faces=0;M.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Da);Ba.multiply(c.projectionMatrix,c.matrixWorldInverse);q(Ba);this.initWebGLObjects(b);L(e);(this.autoClear||r)&&this.clear();H=b.__webglObjects.length;for(r=0;r<H;r++)if(n=b.__webglObjects[r],D=n.object,D.visible)if(!(D instanceof THREE.Mesh)||
-!D.frustumCulled||s(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),C(D,c,!0),v(n),n.render=!0,this.sortObjects)n.object.renderDepth?n.z=n.object.renderDepth:(Ja.copy(D.position),Ba.multiplyVector3(Ja),n.z=Ja.z)}else n.render=!1;else n.render=!1;this.sortObjects&&b.__webglObjects.sort(B);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),C(D,c,!0),u(n));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);
-F(b.overrideMaterial.blending);for(r=0;r<H;r++)if(n=b.__webglObjects[r],n.render)D=n.object,Qa=n.buffer,h(D),f(c,J,Ra,b.overrideMaterial,Qa,D);for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(h(D),w=d(c,J,Ra,b.overrideMaterial,D),D.render(function(c){j(c,w,b.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(r=H-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),p(U.polygonOffset,
-U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,J,Ra,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),p(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,J,Ra,U,D),D.render(function(b){j(b,w,U.shading)})}for(r=0;r<H;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),
-p(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,J,Ra,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),p(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,J,Ra,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&&ka(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&&sa(j),j.geometryGroups){k=j.geometryGroups[h];if(!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 p=void 0,n=void 0;m.__webglMorphTargetsBuffers=[];p=0;for(n=m.numMorphTargets;p<n;p++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}for(var m=k,p=d,r=void 0,q=void 0,s=void 0,u=s=void 0,v=void 0,w=void 0,B=w=n=0,y=s=q=void 0,C=y=q=r=void 0,s=void 0,u=p.geometry,v=u.faces,y=m.faces,r=0,q=y.length;r<q;r++)s=y[r],s=v[s],s instanceof THREE.Face3?(n+=3,w+=1,B+=3):s instanceof THREE.Face4&&(n+=4,w+=2,B+=4);for(var r=m,
-q=p,G=y=v=void 0,K=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++)(K=r.materials[G])&&s.push(K)}else(K=G)&&s.push(K);r=s;m.__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}m.__vertexArray=new Float32Array(n*3);if(y)m.__normalArray=new Float32Array(n*3);if(u.hasTangents)m.__tangentArray=new Float32Array(n*4);if(s)m.__colorArray=new Float32Array(n*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
-1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u<v;u++)m.__morphTargetsArrays.push(new Float32Array(n*
-3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=q;m.__vertexColorType=s;m.__normalType=y;m.__webglFaceCount=w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;u=0;for(v=r.length;u<v;u++)if(q=r[u],q.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];y={};for(C in s)y[C]=s[C];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(n*w),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}ga(f.__webglObjects,k,d)}else if(d instanceof THREE.Ribbon){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=
-e.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglVertexCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;ga(f.__webglObjects,j,d)}else if(d instanceof THREE.Line){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=e.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,j.__dirtyVertices=!0,j.__dirtyColors=
-!0;ga(f.__webglObjects,j,d)}else if(d instanceof THREE.ParticleSystem){j=d.geometry;if(!j.__webglVertexBuffer){h=j;h.__webglVertexBuffer=e.createBuffer();h.__webglColorBuffer=e.createBuffer();h=j;k=d;m=h.vertices.length;h.__vertexArray=new Float32Array(m*3);h.__colorArray=new Float32Array(m*3);h.__sortArray=[];h.__webglParticleCount=m;h.__materials=k.materials;C=n=p=void 0;p=0;for(n=k.materials.length;p<n;p++)if(C=k.materials[p],C.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes=
-{};for(a in C.attributes){originalAttribute=C.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(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=
-a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=!0;j.__dirtyColors=!0}ga(f.__webglObjects,j,d)}else 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);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];d=b;if(f instanceof
-THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)qa(d.__webglObjects,f);else if(f instanceof THREE.Sprite){d=d.__webglSprites;j=void 0;for(j=d.length-1;j>=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&qa(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(p=j.geometryGroupsList.length;m<p;m++)if(k=
-j.geometryGroupsList[m],n=ya(k),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||n)if(n=k,C=e.DYNAMIC_DRAW,w=!j.dynamic,n.__inittedArrays){var E=u=B=void 0,A=void 0,J=E=void 0,F=void 0,M=void 0,N=void 0,O=K=G=s=y=v=q=r=void 0,L=void 0,t=A=N=A=M=F=void 0,o=void 0,z=o=t=F=void 0,P=void 0,S=z=o=t=E=E=J=N=A=z=o=t=P=z=o=t=P=z=o=t=void 0,ia=0,ma=0,W=0,Y=0,T=0,Q=0,X=0,R=0,la=0,x=0,na=0,z=t=0,z=void 0,oa=n.__vertexArray,ja=n.__uvArray,
-ka=n.__uv2Array,V=n.__normalArray,$=n.__tangentArray,pa=n.__colorArray,aa=n.__skinVertexAArray,ca=n.__skinVertexBArray,da=n.__skinIndexArray,ea=n.__skinWeightArray,ra=n.__morphTargetsArrays,Z=n.__webglCustomAttributes,o=void 0,ha=n.__faceArray,Ca=n.__lineArray,xa=n.__needsSmoothNormals,q=n.__vertexColorType,r=n.__uvType,v=n.__normalType,ua=h.geometry,va=ua.__dirtyVertices,wa=ua.__dirtyElements,ta=ua.__dirtyUvs,Ba=ua.__dirtyNormals,Da=ua.__dirtyTangents,Ea=ua.__dirtyColors,Fa=ua.__dirtyMorphTargets,
-Aa=ua.vertices,Ga=n.faces,Ka=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Na=ua.skinVerticesA,Oa=ua.skinVerticesB,Pa=ua.skinIndices,La=ua.skinWeights,Ia=ua.morphTargets;if(Z)for(S in Z)Z[S].offset=0,Z[S].offsetSrc=0;B=0;for(u=Ga.length;B<u;B++)if(E=Ga[B],A=Ka[E],Ha&&(y=Ha[E]),Ja&&(s=Ja[E]),E=A.vertexNormals,J=A.normal,F=A.vertexColors,M=A.color,N=A.vertexTangents,A instanceof THREE.Face3){if(va)G=Aa[A.a].position,K=Aa[A.b].position,O=Aa[A.c].position,oa[ma]=G.x,oa[ma+1]=G.y,oa[ma+2]=G.z,
-oa[ma+3]=K.x,oa[ma+4]=K.y,oa[ma+5]=K.z,oa[ma+6]=O.x,oa[ma+7]=O.y,oa[ma+8]=O.z,ma+=9;if(Z)for(S in Z)if(o=Z[S],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.offsetSrc+=
-3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[A.a],K=o.value[A.b],O=o.value[A.c]):o.boundTo==="faces"?(O=K=G=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(G=o.value[z],K=o.value[z+1],O=o.value[z+2],o.offsetSrc+=3),o.size===2?(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=K.x,o.array[t+3]=K.y,o.array[t+4]=O.x,o.array[t+5]=O.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[t]=G.r,o.array[t+1]=G.g,o.array[t+2]=G.b,o.array[t+3]=K.r,o.array[t+4]=K.g,o.array[t+5]=K.b,
-o.array[t+6]=O.r,o.array[t+7]=O.g,o.array[t+8]=O.b):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=K.x,o.array[t+4]=K.y,o.array[t+5]=K.z,o.array[t+6]=O.x,o.array[t+7]=O.y,o.array[t+8]=O.z),o.offset+=9):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=G.w,o.array[t+4]=K.x,o.array[t+5]=K.y,o.array[t+6]=K.z,o.array[t+7]=K.w,o.array[t+8]=O.x,o.array[t+9]=O.y,o.array[t+10]=O.z,o.array[t+11]=O.w,o.offset+=12));if(Fa){t=0;for(o=Ia.length;t<o;t++)G=Ia[t].vertices[A.a].position,
-K=Ia[t].vertices[A.b].position,O=Ia[t].vertices[A.c].position,z=ra[t],z[na]=G.x,z[na+1]=G.y,z[na+2]=G.z,z[na+3]=K.x,z[na+4]=K.y,z[na+5]=K.z,z[na+6]=O.x,z[na+7]=O.y,z[na+8]=O.z;na+=9}if(La.length)t=La[A.a],o=La[A.b],z=La[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,t=Pa[A.a],o=Pa[A.b],z=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]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=o.w,da[x+8]=
-z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.w,t=Na[A.a],o=Na[A.b],z=Na[A.c],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=o.x,aa[x+5]=o.y,aa[x+6]=o.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.z,aa[x+11]=1,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,x+=12;if(Ea&&q)F.length==3&&q==THREE.VertexColors?(A=F[0],t=F[1],o=F[2]):o=t=A=M,pa[la]=A.r,pa[la+1]=A.g,pa[la+2]=A.b,pa[la+
-3]=t.r,pa[la+4]=t.g,pa[la+5]=t.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Da&&ua.hasTangents)F=N[0],M=N[1],A=N[2],$[X]=F.x,$[X+1]=F.y,$[X+2]=F.z,$[X+3]=F.w,$[X+4]=M.x,$[X+5]=M.y,$[X+6]=M.z,$[X+7]=M.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,X+=12;if(Ba&&v)if(E.length==3&&xa)for(N=0;N<3;N++)J=E[N],V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,Q+=3;else for(N=0;N<3;N++)V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,Q+=3;if(ta&&y!==void 0&&r)for(N=0;N<3;N++)E=y[N],ja[W]=E.u,ja[W+1]=E.v,W+=2;if(ta&&s!==void 0&&r)for(N=
-0;N<3;N++)E=s[N],ka[Y]=E.u,ka[Y+1]=E.v,Y+=2;wa&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+2,T+=3,Ca[R]=ia,Ca[R+1]=ia+1,Ca[R+2]=ia,Ca[R+3]=ia+2,Ca[R+4]=ia+1,Ca[R+5]=ia+2,R+=6,ia+=3)}else if(A instanceof THREE.Face4){if(va)G=Aa[A.a].position,K=Aa[A.b].position,O=Aa[A.c].position,L=Aa[A.d].position,oa[ma]=G.x,oa[ma+1]=G.y,oa[ma+2]=G.z,oa[ma+3]=K.x,oa[ma+4]=K.y,oa[ma+5]=K.z,oa[ma+6]=O.x,oa[ma+7]=O.y,oa[ma+8]=O.z,oa[ma+9]=L.x,oa[ma+10]=L.y,oa[ma+11]=L.z,ma+=12;if(Z)for(S in Z)if(o=Z[S],o.__original.needsUpdate)t=
-o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c],o.array[t+3]=o.value[A.d]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.array[t+3]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.array[t+3]=o.value[z+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[A.a],
-K=o.value[A.b],O=o.value[A.c],L=o.value[A.d]):o.boundTo==="faces"?(L=O=K=G=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(G=o.value[z],K=o.value[z+1],O=o.value[z+2],L=o.value[z+3],o.offsetSrc+=4),o.size===2?(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=K.x,o.array[t+3]=K.y,o.array[t+4]=O.x,o.array[t+5]=O.y,o.array[t+6]=L.x,o.array[t+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[t]=G.r,o.array[t+1]=G.g,o.array[t+2]=G.b,o.array[t+3]=K.r,o.array[t+4]=K.g,o.array[t+5]=K.b,o.array[t+
-6]=O.r,o.array[t+7]=O.g,o.array[t+8]=O.b,o.array[t+9]=L.r,o.array[t+10]=L.g,o.array[t+11]=L.b):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=K.x,o.array[t+4]=K.y,o.array[t+5]=K.z,o.array[t+6]=O.x,o.array[t+7]=O.y,o.array[t+8]=O.z,o.array[t+9]=L.x,o.array[t+10]=L.y,o.array[t+11]=L.z),o.offset+=12):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=G.w,o.array[t+4]=K.x,o.array[t+5]=K.y,o.array[t+6]=K.z,o.array[t+7]=K.w,o.array[t+8]=O.x,o.array[t+9]=O.y,o.array[t+10]=O.z,
-o.array[t+11]=O.w,o.array[t+12]=L.x,o.array[t+13]=L.y,o.array[t+14]=L.z,o.array[t+15]=L.w,o.offset+=16));if(Fa){t=0;for(o=Ia.length;t<o;t++)G=Ia[t].vertices[A.a].position,K=Ia[t].vertices[A.b].position,O=Ia[t].vertices[A.c].position,L=Ia[t].vertices[A.d].position,z=ra[t],z[na]=G.x,z[na+1]=G.y,z[na+2]=G.z,z[na+3]=K.x,z[na+4]=K.y,z[na+5]=K.z,z[na+6]=O.x,z[na+7]=O.y,z[na+8]=O.z,z[na+9]=L.x,z[na+10]=L.y,z[na+11]=L.z;na+=12}if(La.length)t=La[A.a],o=La[A.b],z=La[A.c],P=La[A.d],ea[x]=t.x,ea[x+1]=t.y,ea[x+
-2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.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],o=Pa[A.b],z=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]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=o.w,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.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],o=Na[A.b],z=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]=o.x,
-aa[x+5]=o.y,aa[x+6]=o.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.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],o=Oa[A.b],z=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]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.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(Ea&&q)F.length==4&&q==THREE.VertexColors?(A=F[0],t=F[1],o=F[2],F=F[3]):F=o=t=A=M,pa[la]=A.r,pa[la+1]=A.g,pa[la+2]=A.b,pa[la+3]=t.r,pa[la+
-4]=t.g,pa[la+5]=t.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=F.r,pa[la+10]=F.g,pa[la+11]=F.b,la+=12;if(Da&&ua.hasTangents)F=N[0],M=N[1],A=N[2],N=N[3],$[X]=F.x,$[X+1]=F.y,$[X+2]=F.z,$[X+3]=F.w,$[X+4]=M.x,$[X+5]=M.y,$[X+6]=M.z,$[X+7]=M.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,$[X+12]=N.x,$[X+13]=N.y,$[X+14]=N.z,$[X+15]=N.w,X+=16;if(Ba&&v)if(E.length==4&&xa)for(N=0;N<4;N++)J=E[N],V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,Q+=3;else for(N=0;N<4;N++)V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,Q+=3;if(ta&&y!==void 0&&
-r)for(N=0;N<4;N++)E=y[N],ja[W]=E.u,ja[W+1]=E.v,W+=2;if(ta&&s!==void 0&&r)for(N=0;N<4;N++)E=s[N],ka[Y]=E.u,ka[Y+1]=E.v,Y+=2;wa&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+3,ha[T+3]=ia+1,ha[T+4]=ia+2,ha[T+5]=ia+3,T+=6,Ca[R]=ia,Ca[R+1]=ia+1,Ca[R+2]=ia,Ca[R+3]=ia+3,Ca[R+4]=ia+1,Ca[R+5]=ia+2,Ca[R+6]=ia+2,Ca[R+7]=ia+3,R+=8,ia+=4)}va&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,C));if(Z)for(S in Z)o=Z[S],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,
-o.array,C));if(Fa){t=0;for(o=Ia.length;t<o;t++)e.bindBuffer(e.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),e.bufferData(e.ARRAY_BUFFER,ra[t],C)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,C));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,C));Da&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,$,C));ta&&W>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,
-ja,C));ta&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ka,C));wa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,C),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,C));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,aa,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,C),e.bindBuffer(e.ARRAY_BUFFER,
-n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ea,C));w&&(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)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=
-!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;za(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<r;w++)B=u[w].position,m=w*3,q[m]=B.x,q[m+1]=B.y,q[m+2]=B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,k)}if(v){for(w=
-0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,C[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<r;w++)B=u[w].position,m=w*3,q[m]=B.x,q[m+1]=B.y,q[m+2]=
-B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,k)}if(v){for(w=0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,C[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)j=h.geometry,n=ya(j),(j.__dirtyVertices||j.__dirtyColors||h.sortParticles||n)&&c(j,e.DYNAMIC_DRAW,h),j.__dirtyVertices=!1,j.__dirtyColors=!1,za(j)};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}};
+n=f;v=0;for(c=n.length;v<c;v++)d=n[v],u.attributes[d]=e.getAttribLocation(u,d);Da.push({program:u,code:k});O.info.memory.programs=Da.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){P(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,ga,V,H,I,D,Ra,J=b.lights,Sa=b.fog;this.shadowMapEnabled&&y(b,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Ea);va.multiply(c.projectionMatrix,c.matrixWorldInverse);q(va);this.initWebGLObjects(b);P(e);(this.autoClear||r)&&this.clear();H=b.__webglObjects.length;for(r=0;r<H;r++)if(n=b.__webglObjects[r],
+D=n.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||s(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),C(D,c,!0),v(n),n.render=!0,this.sortObjects)n.object.renderDepth?n.z=n.object.renderDepth:(Ja.copy(D.position),va.multiplyVector3(Ja),n.z=Ja.z)}else n.render=!1;else n.render=!1;this.sortObjects&&b.__webglObjects.sort(B);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),
+C(D,c,!0),u(n));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);F(b.overrideMaterial.blending);for(r=0;r<H;r++)if(n=b.__webglObjects[r],n.render)D=n.object,Ra=n.buffer,h(D),f(c,J,Sa,b.overrideMaterial,Ra,D);for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(h(D),w=d(c,J,Sa,b.overrideMaterial,D),D.render(function(c){j(c,w,b.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(r=H-1;r>=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Ra=n.buffer;ga=n.opaque;h(D);
+for(n=0;n<ga.count;n++)V=ga.list[n],k(V.depthTest),m(V.depthWrite),p(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),f(c,J,Sa,V,Ra,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){ga=n.opaque;h(D);for(n=0;n<ga.count;n++)V=ga.list[n],k(V.depthTest),m(V.depthWrite),p(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),w=d(c,J,Sa,V,D),D.render(function(b){j(b,w,V.shading)})}for(r=0;r<H;r++)if(n=b.__webglObjects[r],n.render){D=n.object;Ra=n.buffer;ga=n.transparent;
+h(D);for(n=0;n<ga.count;n++)V=ga.list[n],F(V.blending),k(V.depthTest),m(V.depthWrite),p(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),f(c,J,Sa,V,Ra,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){ga=n.transparent;h(D);for(n=0;n<ga.count;n++)V=ga.list[n],F(V.blending),k(V.depthTest),m(V.depthWrite),p(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),w=d(c,J,Sa,V,D),D.render(function(b){j(b,w,V.shading)})}}b.__webglSprites.length&&E(b,c);e&&e.minFilter!==
+THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&ka(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&&sa(j),j.geometryGroups){k=j.geometryGroups[h];if(!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 p=void 0,n=void 0;m.__webglMorphTargetsBuffers=[];p=0;for(n=m.numMorphTargets;p<n;p++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}O.info.memory.geometries++;for(var m=k,p=d,r=void 0,q=void 0,s=void 0,u=s=void 0,v=void 0,w=void 0,B=w=n=0,y=s=q=void 0,C=y=q=r=void 0,s=void 0,u=p.geometry,v=u.faces,y=m.faces,r=0,q=y.length;r<q;r++)s=y[r],s=v[s],s instanceof
+THREE.Face3?(n+=3,w+=1,B+=3):s instanceof THREE.Face4&&(n+=4,w+=2,B+=4);for(var r=m,q=p,G=y=v=void 0,K=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++)(K=r.materials[G])&&s.push(K)}else(K=G)&&s.push(K);r=s;m.__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}m.__vertexArray=new Float32Array(n*3);if(y)m.__normalArray=new Float32Array(n*3);if(u.hasTangents)m.__tangentArray=new Float32Array(n*4);if(s)m.__colorArray=new Float32Array(n*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>
+0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=
+[];u=0;for(v=m.numMorphTargets;u<v;u++)m.__morphTargetsArrays.push(new Float32Array(n*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=q;m.__vertexColorType=s;m.__normalType=y;m.__webglFaceCount=w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;u=0;for(v=r.length;u<v;u++)if(q=r[u],q.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];y={};for(C in s)y[C]=s[C];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(n*w),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}ha(f.__webglObjects,k,d)}else if(d instanceof THREE.Ribbon){j=d.geometry;if(!j.__webglVertexBuffer)h=
+j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=e.createBuffer(),O.info.memory.geometries++,h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglVertexCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;ha(f.__webglObjects,j,d)}else if(d instanceof THREE.Line){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=e.createBuffer(),O.info.memory.geometries++,h=j,k=h.vertices.length,h.__vertexArray=
+new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;ha(f.__webglObjects,j,d)}else if(d instanceof THREE.ParticleSystem){j=d.geometry;if(!j.__webglVertexBuffer){h=j;h.__webglVertexBuffer=e.createBuffer();h.__webglColorBuffer=e.createBuffer();O.info.geometries++;h=j;k=d;m=h.vertices.length;h.__vertexArray=new Float32Array(m*3);h.__colorArray=new Float32Array(m*3);h.__sortArray=[];h.__webglParticleCount=m;h.__materials=k.materials;C=
+n=p=void 0;p=0;for(n=k.materials.length;p<n;p++)if(C=k.materials[p],C.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in C.attributes){originalAttribute=C.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(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=!0;j.__dirtyColors=!0}ha(f.__webglObjects,j,d)}else 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);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];d=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)ra(d.__webglObjects,f);else if(f instanceof THREE.Sprite){d=d.__webglSprites;j=void 0;for(j=d.length-1;j>=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&ra(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<
+f;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(p=j.geometryGroupsList.length;m<p;m++)if(k=j.geometryGroupsList[m],n=xa(k),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||n)if(n=k,C=e.DYNAMIC_DRAW,w=!j.dynamic,n.__inittedArrays){var E=u=B=void 0,A=void 0,J=E=void 0,F=void 0,P=void 0,M=void 0,N=K=G=s=y=v=q=r=void 0,L=void 0,t=A=M=A=P=F=void 0,o=void 0,z=o=t=F=void 0,Q=void 0,
+U=z=o=t=E=E=J=M=A=z=o=t=Q=z=o=t=Q=z=o=t=void 0,ja=0,na=0,Y=0,Z=0,T=0,R=0,X=0,S=0,la=0,x=0,oa=0,z=t=0,z=void 0,pa=n.__vertexArray,ka=n.__uvArray,ma=n.__uv2Array,W=n.__normalArray,aa=n.__tangentArray,qa=n.__colorArray,ca=n.__skinVertexAArray,da=n.__skinVertexBArray,ea=n.__skinIndexArray,fa=n.__skinWeightArray,ta=n.__morphTargetsArrays,$=n.__webglCustomAttributes,o=void 0,ia=n.__faceArray,Ca=n.__lineArray,za=n.__needsSmoothNormals,q=n.__vertexColorType,r=n.__uvType,v=n.__normalType,ua=h.geometry,wa=
+ua.__dirtyVertices,Aa=ua.__dirtyElements,va=ua.__dirtyUvs,Da=ua.__dirtyNormals,Ea=ua.__dirtyTangents,Fa=ua.__dirtyColors,Ga=ua.__dirtyMorphTargets,Ba=ua.vertices,Ha=n.faces,Ka=ua.faces,Ja=ua.faceVertexUvs[0],Ma=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,La=ua.skinWeights,Ia=ua.morphTargets;if($)for(U in $)$[U].offset=0,$[U].offsetSrc=0;B=0;for(u=Ha.length;B<u;B++)if(E=Ha[B],A=Ka[E],Ja&&(y=Ja[E]),Ma&&(s=Ma[E]),E=A.vertexNormals,J=A.normal,F=A.vertexColors,P=A.color,
+M=A.vertexTangents,A instanceof THREE.Face3){if(wa)G=Ba[A.a].position,K=Ba[A.b].position,N=Ba[A.c].position,pa[na]=G.x,pa[na+1]=G.y,pa[na+2]=G.z,pa[na+3]=K.x,pa[na+4]=K.y,pa[na+5]=K.z,pa[na+6]=N.x,pa[na+7]=N.y,pa[na+8]=N.z,na+=9;if($)for(U in $)if(o=$[U],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+
+2]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[A.a],K=o.value[A.b],N=o.value[A.c]):o.boundTo==="faces"?(N=K=G=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(G=o.value[z],K=o.value[z+1],N=o.value[z+2],o.offsetSrc+=3),o.size===2?(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=K.x,o.array[t+3]=K.y,o.array[t+4]=N.x,o.array[t+5]=N.y,o.offset+=
+6):o.size===3?(o.type==="c"?(o.array[t]=G.r,o.array[t+1]=G.g,o.array[t+2]=G.b,o.array[t+3]=K.r,o.array[t+4]=K.g,o.array[t+5]=K.b,o.array[t+6]=N.r,o.array[t+7]=N.g,o.array[t+8]=N.b):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=K.x,o.array[t+4]=K.y,o.array[t+5]=K.z,o.array[t+6]=N.x,o.array[t+7]=N.y,o.array[t+8]=N.z),o.offset+=9):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=G.w,o.array[t+4]=K.x,o.array[t+5]=K.y,o.array[t+6]=K.z,o.array[t+7]=K.w,o.array[t+8]=N.x,o.array[t+
+9]=N.y,o.array[t+10]=N.z,o.array[t+11]=N.w,o.offset+=12));if(Ga){t=0;for(o=Ia.length;t<o;t++)G=Ia[t].vertices[A.a].position,K=Ia[t].vertices[A.b].position,N=Ia[t].vertices[A.c].position,z=ta[t],z[oa]=G.x,z[oa+1]=G.y,z[oa+2]=G.z,z[oa+3]=K.x,z[oa+4]=K.y,z[oa+5]=K.z,z[oa+6]=N.x,z[oa+7]=N.y,z[oa+8]=N.z;oa+=9}if(La.length)t=La[A.a],o=La[A.b],z=La[A.c],fa[x]=t.x,fa[x+1]=t.y,fa[x+2]=t.z,fa[x+3]=t.w,fa[x+4]=o.x,fa[x+5]=o.y,fa[x+6]=o.z,fa[x+7]=o.w,fa[x+8]=z.x,fa[x+9]=z.y,fa[x+10]=z.z,fa[x+11]=z.w,t=Qa[A.a],
+o=Qa[A.b],z=Qa[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,t=Pa[A.a],o=Pa[A.b],z=Pa[A.c],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=1,da[x+4]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=1,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=1,x+=
+12;if(Fa&&q)F.length==3&&q==THREE.VertexColors?(A=F[0],t=F[1],o=F[2]):o=t=A=P,qa[la]=A.r,qa[la+1]=A.g,qa[la+2]=A.b,qa[la+3]=t.r,qa[la+4]=t.g,qa[la+5]=t.b,qa[la+6]=o.r,qa[la+7]=o.g,qa[la+8]=o.b,la+=9;if(Ea&&ua.hasTangents)F=M[0],P=M[1],A=M[2],aa[X]=F.x,aa[X+1]=F.y,aa[X+2]=F.z,aa[X+3]=F.w,aa[X+4]=P.x,aa[X+5]=P.y,aa[X+6]=P.z,aa[X+7]=P.w,aa[X+8]=A.x,aa[X+9]=A.y,aa[X+10]=A.z,aa[X+11]=A.w,X+=12;if(Da&&v)if(E.length==3&&za)for(M=0;M<3;M++)J=E[M],W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;else for(M=0;M<3;M++)W[R]=
+J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;if(va&&y!==void 0&&r)for(M=0;M<3;M++)E=y[M],ka[Y]=E.u,ka[Y+1]=E.v,Y+=2;if(va&&s!==void 0&&r)for(M=0;M<3;M++)E=s[M],ma[Z]=E.u,ma[Z+1]=E.v,Z+=2;Aa&&(ia[T]=ja,ia[T+1]=ja+1,ia[T+2]=ja+2,T+=3,Ca[S]=ja,Ca[S+1]=ja+1,Ca[S+2]=ja,Ca[S+3]=ja+2,Ca[S+4]=ja+1,Ca[S+5]=ja+2,S+=6,ja+=3)}else if(A instanceof THREE.Face4){if(wa)G=Ba[A.a].position,K=Ba[A.b].position,N=Ba[A.c].position,L=Ba[A.d].position,pa[na]=G.x,pa[na+1]=G.y,pa[na+2]=G.z,pa[na+3]=K.x,pa[na+4]=K.y,pa[na+5]=K.z,pa[na+6]=
+N.x,pa[na+7]=N.y,pa[na+8]=N.z,pa[na+9]=L.x,pa[na+10]=L.y,pa[na+11]=L.z,na+=12;if($)for(U in $)if(o=$[U],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c],o.array[t+3]=o.value[A.d]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.array[t+3]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+
+2]=o.value[z+2],o.array[t+3]=o.value[z+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[A.a],K=o.value[A.b],N=o.value[A.c],L=o.value[A.d]):o.boundTo==="faces"?(L=N=K=G=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(G=o.value[z],K=o.value[z+1],N=o.value[z+2],L=o.value[z+3],o.offsetSrc+=4),o.size===2?(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=K.x,o.array[t+3]=K.y,o.array[t+4]=N.x,o.array[t+5]=N.y,o.array[t+6]=L.x,o.array[t+7]=L.y,o.offset+=8):o.size===
+3?(o.type==="c"?(o.array[t]=G.r,o.array[t+1]=G.g,o.array[t+2]=G.b,o.array[t+3]=K.r,o.array[t+4]=K.g,o.array[t+5]=K.b,o.array[t+6]=N.r,o.array[t+7]=N.g,o.array[t+8]=N.b,o.array[t+9]=L.r,o.array[t+10]=L.g,o.array[t+11]=L.b):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+3]=K.x,o.array[t+4]=K.y,o.array[t+5]=K.z,o.array[t+6]=N.x,o.array[t+7]=N.y,o.array[t+8]=N.z,o.array[t+9]=L.x,o.array[t+10]=L.y,o.array[t+11]=L.z),o.offset+=12):(o.array[t]=G.x,o.array[t+1]=G.y,o.array[t+2]=G.z,o.array[t+
+3]=G.w,o.array[t+4]=K.x,o.array[t+5]=K.y,o.array[t+6]=K.z,o.array[t+7]=K.w,o.array[t+8]=N.x,o.array[t+9]=N.y,o.array[t+10]=N.z,o.array[t+11]=N.w,o.array[t+12]=L.x,o.array[t+13]=L.y,o.array[t+14]=L.z,o.array[t+15]=L.w,o.offset+=16));if(Ga){t=0;for(o=Ia.length;t<o;t++)G=Ia[t].vertices[A.a].position,K=Ia[t].vertices[A.b].position,N=Ia[t].vertices[A.c].position,L=Ia[t].vertices[A.d].position,z=ta[t],z[oa]=G.x,z[oa+1]=G.y,z[oa+2]=G.z,z[oa+3]=K.x,z[oa+4]=K.y,z[oa+5]=K.z,z[oa+6]=N.x,z[oa+7]=N.y,z[oa+8]=
+N.z,z[oa+9]=L.x,z[oa+10]=L.y,z[oa+11]=L.z;oa+=12}if(La.length)t=La[A.a],o=La[A.b],z=La[A.c],Q=La[A.d],fa[x]=t.x,fa[x+1]=t.y,fa[x+2]=t.z,fa[x+3]=t.w,fa[x+4]=o.x,fa[x+5]=o.y,fa[x+6]=o.z,fa[x+7]=o.w,fa[x+8]=z.x,fa[x+9]=z.y,fa[x+10]=z.z,fa[x+11]=z.w,fa[x+12]=Q.x,fa[x+13]=Q.y,fa[x+14]=Q.z,fa[x+15]=Q.w,t=Qa[A.a],o=Qa[A.b],z=Qa[A.c],Q=Qa[A.d],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,ea[x+12]=Q.x,ea[x+13]=
+Q.y,ea[x+14]=Q.z,ea[x+15]=Q.w,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],Q=Oa[A.d],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,ca[x+12]=Q.x,ca[x+13]=Q.y,ca[x+14]=Q.z,ca[x+15]=1,t=Pa[A.a],o=Pa[A.b],z=Pa[A.c],A=Pa[A.d],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=1,da[x+4]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=1,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=1,da[x+12]=A.x,da[x+13]=A.y,da[x+14]=A.z,da[x+15]=1,x+=16;if(Fa&&q)F.length==
+4&&q==THREE.VertexColors?(A=F[0],t=F[1],o=F[2],F=F[3]):F=o=t=A=P,qa[la]=A.r,qa[la+1]=A.g,qa[la+2]=A.b,qa[la+3]=t.r,qa[la+4]=t.g,qa[la+5]=t.b,qa[la+6]=o.r,qa[la+7]=o.g,qa[la+8]=o.b,qa[la+9]=F.r,qa[la+10]=F.g,qa[la+11]=F.b,la+=12;if(Ea&&ua.hasTangents)F=M[0],P=M[1],A=M[2],M=M[3],aa[X]=F.x,aa[X+1]=F.y,aa[X+2]=F.z,aa[X+3]=F.w,aa[X+4]=P.x,aa[X+5]=P.y,aa[X+6]=P.z,aa[X+7]=P.w,aa[X+8]=A.x,aa[X+9]=A.y,aa[X+10]=A.z,aa[X+11]=A.w,aa[X+12]=M.x,aa[X+13]=M.y,aa[X+14]=M.z,aa[X+15]=M.w,X+=16;if(Da&&v)if(E.length==
+4&&za)for(M=0;M<4;M++)J=E[M],W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;else for(M=0;M<4;M++)W[R]=J.x,W[R+1]=J.y,W[R+2]=J.z,R+=3;if(va&&y!==void 0&&r)for(M=0;M<4;M++)E=y[M],ka[Y]=E.u,ka[Y+1]=E.v,Y+=2;if(va&&s!==void 0&&r)for(M=0;M<4;M++)E=s[M],ma[Z]=E.u,ma[Z+1]=E.v,Z+=2;Aa&&(ia[T]=ja,ia[T+1]=ja+1,ia[T+2]=ja+3,ia[T+3]=ja+1,ia[T+4]=ja+2,ia[T+5]=ja+3,T+=6,Ca[S]=ja,Ca[S+1]=ja+1,Ca[S+2]=ja,Ca[S+3]=ja+3,Ca[S+4]=ja+1,Ca[S+5]=ja+2,Ca[S+6]=ja+2,Ca[S+7]=ja+3,S+=8,ja+=4)}wa&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer),
+e.bufferData(e.ARRAY_BUFFER,pa,C));if($)for(U in $)o=$[U],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,C));if(Ga){t=0;for(o=Ia.length;t<o;t++)e.bindBuffer(e.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),e.bufferData(e.ARRAY_BUFFER,ta[t],C)}Fa&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,qa,C));Da&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,C));Ea&&ua.hasTangents&&
+(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,aa,C));va&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,C));va&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,C));Aa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,C),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,C));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,
+n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ca,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,da,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ea,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,fa,C));w&&(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)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;ya(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;
+if(h.__dirtyVertices){for(w=0;w<r;w++)B=u[w].position,m=w*3,q[m]=B.x,q[m+1]=B.y,q[m+2]=B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,k)}if(v){for(w=0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,C[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;
+u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<r;w++)B=u[w].position,m=w*3,q[m]=B.x,q[m+1]=B.y,q[m+2]=B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,k)}if(v){for(w=0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,C[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)j=
+h.geometry,n=xa(j),(j.__dirtyVertices||j.__dirtyColors||h.sortParticles||n)&&c(j,e.DYNAMIC_DRAW,h),j.__dirtyVertices=!1,j.__dirtyColors=!1,ya(j)};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}};
 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};

+ 13 - 9
src/renderers/CanvasRenderer.js

@@ -87,10 +87,14 @@ THREE.CanvasRenderer = function ( parameters ) {
 	this.sortObjects = true;
 	this.sortObjects = true;
 	this.sortElements = true;
 	this.sortElements = true;
 
 
-	this.data = {
+	this.info = {
 
 
-		vertices: 0,
-		faces: 0
+		render: {
+
+			vertices: 0,
+			faces: 0
+
+		}
 
 
 	}
 	}
 
 
@@ -174,8 +178,8 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 		this.autoClear ? this.clear() : _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
 		this.autoClear ? this.clear() : _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
 
 
-		_this.data.vertices = 0;
-		_this.data.faces = 0;
+		_this.info.render.vertices = 0;
+		_this.info.render.faces = 0;
 
 
 		_renderList = _projector.projectScene( scene, camera, this.sortElements );
 		_renderList = _projector.projectScene( scene, camera, this.sortElements );
 
 
@@ -561,8 +565,8 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 		function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material, scene ) {
 		function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material, scene ) {
 
 
-			_this.data.vertices += 3;
-			_this.data.faces ++;
+			_this.info.render.vertices += 3;
+			_this.info.render.faces ++;
 
 
 			setOpacity( material.opacity );
 			setOpacity( material.opacity );
 			setBlending( material.blending );
 			setBlending( material.blending );
@@ -718,8 +722,8 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 		function renderFace4( v1, v2, v3, v4, v5, v6, element, material, scene ) {
 		function renderFace4( v1, v2, v3, v4, v5, v6, element, material, scene ) {
 
 
-			_this.data.vertices += 4;
-			_this.data.faces ++;
+			_this.info.render.vertices += 4;
+			_this.info.render.faces ++;
 
 
 			setOpacity( material.opacity );
 			setOpacity( material.opacity );
 			setBlending( material.blending );
 			setBlending( material.blending );

+ 13 - 9
src/renderers/SVGRenderer.js

@@ -35,10 +35,14 @@ THREE.SVGRenderer = function () {
 	this.sortObjects = true;
 	this.sortObjects = true;
 	this.sortElements = true;
 	this.sortElements = true;
 
 
-	this.data = {
+	this.info = {
 
 
-		vertices: 0,
-		faces: 0
+		render: {
+
+			vertices: 0,
+			faces: 0
+
+		}
 
 
 	}
 	}
 
 
@@ -82,8 +86,8 @@ THREE.SVGRenderer = function () {
 
 
 		this.autoClear && this.clear();
 		this.autoClear && this.clear();
 
 
-		_this.data.vertices = 0;
-		_this.data.faces = 0;
+		_this.info.render.vertices = 0;
+		_this.info.render.faces = 0;
 
 
 		_renderList = _projector.projectScene( scene, camera, this.sortElements );
 		_renderList = _projector.projectScene( scene, camera, this.sortElements );
 
 
@@ -373,8 +377,8 @@ THREE.SVGRenderer = function () {
 
 
 	function renderFace3( v1, v2, v3, element, material, scene ) {
 	function renderFace3( v1, v2, v3, element, material, scene ) {
 
 
-		_this.data.vertices += 3;
-		_this.data.faces ++;
+		_this.info.render.vertices += 3;
+		_this.info.render.faces ++;
 
 
 		_svgNode = getPathNode( _pathCount ++ );
 		_svgNode = getPathNode( _pathCount ++ );
 		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + 'z' );
 		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + 'z' );
@@ -430,8 +434,8 @@ THREE.SVGRenderer = function () {
 
 
 	function renderFace4( v1, v2, v3, v4, element, material, scene ) {
 	function renderFace4( v1, v2, v3, v4, element, material, scene ) {
 
 
-		_this.data.vertices += 4;
-		_this.data.faces ++;
+		_this.info.render.vertices += 4;
+		_this.info.render.faces ++;
 
 
 		_svgNode = getPathNode( _pathCount ++ );
 		_svgNode = getPathNode( _pathCount ++ );
 		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + ' L ' + v4.positionScreen.x + ',' + v4.positionScreen.y + 'z' );
 		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y + ' L ' + v3.positionScreen.x + ',' + v3.positionScreen.y + ' L ' + v4.positionScreen.x + ',' + v4.positionScreen.y + 'z' );

+ 51 - 17
src/renderers/WebGLRenderer.js

@@ -72,11 +72,23 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_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.data = {
+	this.info = {
 
 
-		vertices: 0,
-		faces: 0,
-		drawCalls: 0
+		memory: {
+
+			programs: 0,
+			geometries: 0,
+			textures: 0
+
+		},
+
+		render: {
+
+			calls: 0,
+			vertices: 0,
+			faces: 0
+
+		}
 
 
 	};
 	};
 
 
@@ -344,6 +356,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		texture.__webglInit = false;
 		texture.__webglInit = false;
 		_gl.deleteTexture( texture.__webglTexture );
 		_gl.deleteTexture( texture.__webglTexture );
 
 
+		_this.info.memory.textures --;
+
 	};
 	};
 
 
 	//
 	//
@@ -456,6 +470,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 
 
+		_this.info.geometries ++;
+
 	};
 	};
 
 
 	function createLineBuffers( geometry ) {
 	function createLineBuffers( geometry ) {
@@ -463,6 +479,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 
 
+		_this.info.memory.geometries ++;
+
 	};
 	};
 
 
 	function createRibbonBuffers( geometry ) {
 	function createRibbonBuffers( geometry ) {
@@ -470,6 +488,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglVertexBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 		geometry.__webglColorBuffer = _gl.createBuffer();
 
 
+		_this.info.memory.geometries ++;
+
 	};
 	};
 
 
 	function createMeshBuffers( geometryGroup ) {
 	function createMeshBuffers( geometryGroup ) {
@@ -503,6 +523,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		_this.info.memory.geometries ++;
+
 	};
 	};
 
 
 	// Buffer deallocation
 	// Buffer deallocation
@@ -512,6 +534,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 
 
+		_this.info.memory.geometries --;
+
 	};
 	};
 
 
 	function deleteLineBuffers( geometry ) {
 	function deleteLineBuffers( geometry ) {
@@ -519,6 +543,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 
 
+		_this.info.memory.geometries --;
+
 	};
 	};
 
 
 	function deleteRibbonBuffers( geometry ) {
 	function deleteRibbonBuffers( geometry ) {
@@ -526,6 +552,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglVertexBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 		_gl.deleteBuffer( geometry.__webglColorBuffer );
 
 
+		_this.info.memory.geometries --;
+
 	};
 	};
 
 
 	function deleteMeshBuffers( geometryGroup ) {
 	function deleteMeshBuffers( geometryGroup ) {
@@ -555,6 +583,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		_this.info.memory.geometries --;
+
 	};
 	};
 
 
 	//
 	//
@@ -635,10 +665,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 						size = 1;		// "f" and "i"
 						size = 1;		// "f" and "i"
 
 
-						if( attribute.type === "v2" ) size = 2;
-						else if( attribute.type === "v3" ) size = 3;
-						else if( attribute.type === "v4" ) size = 4;
-						else if( attribute.type === "c"  ) size = 3;
+						if ( attribute.type === "v2" ) size = 2;
+						else if ( attribute.type === "v3" ) size = 3;
+						else if ( attribute.type === "v4" ) size = 4;
+						else if ( attribute.type === "c"  ) size = 3;
 
 
 						attribute.size = size;
 						attribute.size = size;
 						attribute.array = new Float32Array( nvertices * size );
 						attribute.array = new Float32Array( nvertices * size );
@@ -2985,9 +3015,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			}
 			}
 
 
-			_this.data.vertices += geometryGroup.__webglFaceCount;
-			_this.data.faces += geometryGroup.__webglFaceCount / 3;
-			_this.data.drawCalls ++;
+			_this.info.render.calls ++;
+			_this.info.render.vertices += geometryGroup.__webglFaceCount;
+			_this.info.render.faces += geometryGroup.__webglFaceCount / 3;
 
 
 		// render lines
 		// render lines
 
 
@@ -2998,7 +3028,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			_gl.lineWidth( material.linewidth );
 			_gl.lineWidth( material.linewidth );
 			_gl.drawArrays( primitives, 0, geometryGroup.__webglLineCount );
 			_gl.drawArrays( primitives, 0, geometryGroup.__webglLineCount );
 
 
-			_this.data.drawCalls ++;
+			_this.info.render.calls ++;
 
 
 		// render particles
 		// render particles
 
 
@@ -3006,7 +3036,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			_gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount );
 			_gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount );
 
 
-			_this.data.drawCalls ++;
+			_this.info.render.calls ++;
 
 
 		// render ribbon
 		// render ribbon
 
 
@@ -3014,7 +3044,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryGroup.__webglVertexCount );
 			_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryGroup.__webglVertexCount );
 
 
-			_this.data.drawCalls ++;
+			_this.info.render.calls ++;
 
 
 		}
 		}
 
 
@@ -3590,9 +3620,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		if ( this.shadowMapEnabled ) renderShadowMap( scene, camera );
 		if ( this.shadowMapEnabled ) renderShadowMap( scene, camera );
 
 
-		_this.data.vertices = 0;
-		_this.data.faces = 0;
-		_this.data.drawCalls = 0;
+		_this.info.render.calls = 0;
+		_this.info.render.vertices = 0;
+		_this.info.render.faces = 0;
 
 
 		camera.matrixAutoUpdate && camera.update( undefined, true );
 		camera.matrixAutoUpdate && camera.update( undefined, true );
 
 
@@ -4761,6 +4791,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		_programs.push( { program: program, code: code } );
 		_programs.push( { program: program, code: code } );
 
 
+		_this.info.memory.programs = _programs.length;
+
 		return program;
 		return program;
 
 
 	};
 	};
@@ -5038,6 +5070,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 				texture.__webglInit = true;
 				texture.__webglInit = true;
 				texture.__webglTexture = _gl.createTexture();
 				texture.__webglTexture = _gl.createTexture();
 
 
+				_this.info.memory.textures ++;
+
 			}
 			}
 
 
 			_gl.activeTexture( _gl.TEXTURE0 + slot );
 			_gl.activeTexture( _gl.TEXTURE0 + slot );