浏览代码

Added "autoUpdateObjects" flag to WebGLRenderer.

This is to be able to skip redundant updates in multipass rendering (like for shadow maps or dynamic cube maps).

Also reshuffled initWebGLObjects calls to have just a single update in a basic scenario of shadow map pass followed by scene render.

Still need to solve somehow potential redundant updates in EffectComposer (which can mix multiple scenes).
alteredq 13 年之前
父节点
当前提交
5edfb12697

+ 96 - 96
build/Three.js

@@ -29,7 +29,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,k,l,
 b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
 a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
 c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44,z=b.n11,C=b.n12,
-B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,H=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*H+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*H+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*H+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*H+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
+B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,I=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*I+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*I+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*I+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*I+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
 K+x*O+w*L+A*aa;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=
 a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,k=this.n23,l=this.n24,n=this.n31,p=this.n32,u=this.n33,t=this.n34,v=this.n41,o=this.n42,y=this.n43,x=this.n44;return e*k*p*v-c*l*p*v-e*h*u*v+b*l*u*v+c*h*t*v-b*k*t*v-e*k*n*o+c*l*n*o+e*f*u*o-a*l*u*o-c*f*t*o+a*k*t*o+e*h*n*y-b*l*n*y-e*f*p*y+a*l*p*y+b*f*t*y-a*h*t*y-c*h*n*x+b*k*n*x+c*f*p*x-a*k*p*x-b*f*
 u*x+a*h*u*x},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=
@@ -57,7 +57,7 @@ a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:fu
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<b?!1:(a.lerpSelf(c,b),c.lerpSelf(a,1-e),!0))}var e,f,h=[],k,l,n=[],p,u,t=[],v,o=[],y,x,w=[],A,z,C=[],B=[],K=[],F=new THREE.Vector4,M=new THREE.Vector4,
-E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
+E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
 a.y,1);this.unprojectVector(a,c);this.unprojectVector(b,c);b.subSelf(a).normalize();return new THREE.Ray(a,b)};this.projectObjects=function(a,c,k){var m,l;f=B.length=0;m=a.objects;a=0;for(c=m.length;a<c;a++){l=m[a];var n;if(!(n=!l.visible))if(n=l instanceof THREE.Mesh)if(n=l.frustumCulled){a:{n=void 0;for(var p=l.matrixWorld,o=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),t=0;t<6;t++)if(n=V[t].x*p.n14+V[t].y*p.n24+V[t].z*p.n34+V[t].w,n<=o){n=!1;break a}n=!0}n=
 !n}if(!n)n=h[f]=h[f]||new THREE.RenderableObject,f++,e=n,F.copy(l.position),E.multiplyVector3(F),e.object=l,e.z=F.z,B.push(e)}k&&B.sort(b);return B};this.projectScene=function(e,f,h){var m=f.near,B=f.far,F,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa,na,fa,qa,la;z=x=v=u=K.length=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);E.multiply(f.projectionMatrix,f.matrixWorldInverse);V[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);V[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);V[2].set(E.n41+
 E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);V[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);V[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);V[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(F=0;F<6;F++)R=V[F],R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z));R=this.projectObjects(e,f,!0);e=0;for(F=R.length;e<F;e++)if(Y=R[e].object,Y.visible)if(X=Y.matrixWorld,ga=Y.matrixRotationWorld,oa=Y.materials,na=Y.overdraw,l=0,Y instanceof THREE.Mesh){fa=Y.geometry;ia=fa.vertices;
@@ -65,7 +65,7 @@ qa=fa.faces;fa=fa.faceVertexUvs;ea=0;for(da=ia.length;ea<da;ea++)k=a(),k.positio
 Y.flipSided!=(ca.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0))Z=t[u]=t[u]||new THREE.RenderableFace3,u++,p=Z,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca);else continue;else if(da instanceof THREE.Face4)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],Z=n[da.d],ha.visible&&ja.visible&&ca.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-
 ha.positionScreen.y)-(Z.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0||(ja.positionScreen.x-ca.positionScreen.x)*(Z.positionScreen.y-ca.positionScreen.y)-(ja.positionScreen.y-ca.positionScreen.y)*(Z.positionScreen.x-ca.positionScreen.x)<0)))la=o[v]=o[v]||new THREE.RenderableFace4,v++,p=la,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca),p.v4.copy(Z);else continue;p.normalWorld.copy(da.normal);ga.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);X.multiplyVector3(p.centroidWorld);
 p.centroidScreen.copy(p.centroidWorld);E.multiplyVector3(p.centroidScreen);ca=da.vertexNormals;ha=0;for(ja=ca.length;ha<ja;ha++)Z=p.vertexNormalsWorld[ha],Z.copy(ca[ha]),ga.multiplyVector3(Z);ha=0;for(ja=fa.length;ha<ja;ha++)if(la=fa[ha][ia]){ca=0;for(Z=la.length;ca<Z;ca++)p.uvs[ha][ca]=la[ca]}p.meshMaterials=oa;p.faceMaterials=da.materials;p.overdraw=na;p.z=p.centroidScreen.z;K.push(p)}}else if(Y instanceof THREE.Line){O.multiply(E,X);ia=Y.geometry.vertices;ha=a();ha.positionScreen.copy(ia[0].position);
-O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],H.copy(ha.positionScreen),P.copy(ja.positionScreen),c(H,P))H.multiplyScalar(1/H.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(P),y.z=Math.max(H.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
+O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],I.copy(ha.positionScreen),P.copy(ja.positionScreen),c(I,P))I.multiplyScalar(1/I.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(P),y.z=Math.max(I.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
 Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
@@ -81,8 +81,8 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
-V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],H=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);I.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(I);O[b].addSelf(I);O[e].addSelf(I);V[c].addSelf(P);
+V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],I=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
@@ -153,7 +153,7 @@ 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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,f,h;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;e=b;f=c/2;h=e/2};this.render=function(c,e){var n,p,u,t,v,o,y,x;a=b.projectScene(c,e);n=0;for(p=a.length;n<p;n++)if(v=a[n],v instanceof THREE.RenderableParticle){y=v.x*f+f;x=v.y*h+h;u=0;for(t=v.material.length;u<t;u++)if(o=v.material[u],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=y+"px",o.style.top=x+"px"}}};
 THREE.CanvasRenderer=function(a){function b(a){if(w!=a)o.globalAlpha=w=a}function c(a){if(A!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}A=a}}function e(a){if(z!=a)o.strokeStyle=z=a}function f(a){if(C!=a)o.fillStyle=C=a}var h=this,k=null,l=new THREE.Projector,a=a||{},n=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,H=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,I=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
+p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,I=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,H=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
 ya,va,Ca,Ba,Ga,W,a=16;ya=document.createElement("canvas");ya.width=ya.height=2;va=ya.getContext("2d");va.fillStyle="rgba(0,0,0,1)";va.fillRect(0,0,2,2);Ca=va.getImageData(0,0,2,2);Ba=Ca.data;Ga=document.createElement("canvas");Ga.width=Ga.height=a;W=Ga.getContext("2d");W.translate(-a/2,-a/2);W.scale(a,a);a--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,c){p=a;u=c;t=Math.floor(p/2);v=Math.floor(u/2);n.width=p;
 n.height=u;xa.set(-t,-v,t,v);G.set(-t,-v,t,v);w=1;A=0;F=K=B=C=z=null};this.setClearColor=function(a,c){y.copy(a);x=c;G.set(-t,-v,t,v)};this.setClearColorHex=function(a,c){y.setHex(a);x=c;G.set(-t,-v,t,v)};this.clear=function(){o.setTransform(1,0,0,-1,t,v);G.isEmpty()||(G.minSelf(xa),G.inflate(2),x<1&&o.clearRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+
 Math.floor(y.b*255)+","+x+")"),o.fillRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight()))),G.empty())};this.render=function(a,n){function p(a){var c,b,e,f=a.lights;N.setRGB(0,0,0);ta.setRGB(0,0,0);pa.setRGB(0,0,0);a=0;for(c=f.length;a<c;a++)b=f[a],e=b.color,b instanceof THREE.AmbientLight?(N.r+=e.r,N.g+=e.g,N.b+=e.b):b instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):b instanceof THREE.PointLight&&(pa.r+=e.r,pa.g+=e.g,pa.b+=e.b)}function u(a,
@@ -163,13 +163,13 @@ o.restore()))}function w(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.mov
 L=a.positionScreen.x;T=a.positionScreen.y;S=e.positionScreen.x;m=e.positionScreen.y;aa=f.positionScreen.x;U=f.positionScreen.y;A(L,T,S,m,aa,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,ka.copy(t.vertexNormalsWorld[0]),ua=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,
 sa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[1]),Da=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Ea=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[2]),za=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Fa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,$a(L,T,S,m,aa,U,ua,sa,Da,Ea,za,Fa,o.envMap)}else o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&
 (o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map)),c(THREE.SubtractiveBlending)),ma?!o.wireframe&&o.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(R.r=Y.r=X.r=N.r,R.g=Y.g=X.g=N.g,R.b=Y.b=X.b=N.b,u(v,t.v1.positionWorld,t.vertexNormalsWorld[0],R),u(v,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(v,t.v3.positionWorld,t.vertexNormalsWorld[2],X),R.r=Math.max(0,Math.min(o.color.r*R.r,1)),R.g=Math.max(0,Math.min(o.color.g*
-R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,t.centroidWorld,t.normalWorld,I),Z.r=Math.max(0,Math.min(o.color.r*
-I.r,1)),Z.g=Math.max(0,Math.min(o.color.g*I.g,1)),Z.b=Math.max(0,Math.min(o.color.b*I.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
+R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(H.r=N.r,H.g=N.g,H.b=N.b,u(v,t.centroidWorld,t.normalWorld,H),Z.r=Math.max(0,Math.min(o.color.r*
+H.r,1)),Z.g=Math.max(0,Math.min(o.color.g*H.g,1)),Z.b=Math.max(0,Math.min(o.color.b*H.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
 ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(t.normalWorld.x),Z.g=Va(t.normalWorld.y),Z.b=Va(t.normalWorld.z),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)}function z(a,e,f,k,l,p,o,t,v){h.info.render.vertices+=4;h.info.render.faces++;b(t.opacity);c(t.blending);if(t.map||t.envMap)y(a,e,k,0,1,3,o,t,v),y(l,f,p,1,2,3,o,t,v);else if(L=a.positionScreen.x,T=a.positionScreen.y,S=e.positionScreen.x,
 m=e.positionScreen.y,aa=f.positionScreen.x,U=f.positionScreen.y,ea=k.positionScreen.x,da=k.positionScreen.y,ia=l.positionScreen.x,ha=l.positionScreen.y,ja=p.positionScreen.x,ca=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)ma?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(R.r=Y.r=X.r=ga.r=N.r,R.g=
 Y.g=X.g=ga.g=N.g,R.b=Y.b=X.b=ga.b=N.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],R),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],Y),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],X),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),R.r=Math.max(0,Math.min(t.color.r*R.r,1)),R.g=Math.max(0,Math.min(t.color.g*R.g,1)),R.b=Math.max(0,Math.min(t.color.b*R.b,1)),Y.r=Math.max(0,Math.min(t.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(t.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(t.color.b*Y.b,1)),X.r=Math.max(0,
-Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,o.centroidWorld,o.normalWorld,I),Z.r=Math.max(0,Math.min(t.color.r*I.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
-I.g,1)),Z.b=Math.max(0,Math.min(t.color.b*I.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
+Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(H.r=N.r,H.g=N.g,H.b=N.b,u(v,o.centroidWorld,o.normalWorld,H),Z.r=Math.max(0,Math.min(t.color.r*H.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
+H.g,1)),Z.b=Math.max(0,Math.min(t.color.b*H.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
 else if(t instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(k.positionScreen.z,na,fa),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,na,fa),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)}function A(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function C(a,c,b,e,f,k,h,m){o.beginPath();
 o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,m);o.lineTo(a,c);o.closePath()}function Ka(a,c,b,f){if(B!=c)o.lineWidth=B=c;if(K!=b)o.lineCap=K=b;if(F!=f)o.lineJoin=F=f;e(a.getContextStyle());o.stroke();$.inflate(c*2)}function La(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,m,l,n,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||oa[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,G=v.wrapT==THREE.RepeatWrapping;oa[v.id]=o.createPattern(v.image,wa&&G?"repeat":wa&&!G?"repeat-x":
 !wa&&G?"repeat-y":"no-repeat");v.needsUpdate=!1}f(oa[v.id]);var wa=v.offset.x/v.repeat.x,G=v.offset.y/v.repeat.y,x=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,m=(m+wa)*x,l=(l+G)*v,n=(n+wa)*x,p=(p+G)*v,t=(t+wa)*x,u=(u+G)*v;b-=a;e-=c;k-=a;h-=c;n-=m;p-=l;t-=m;u-=l;wa=1/(n*u-t*p);v=(u*b-p*k)*wa;p=(u*e-p*h)*wa;b=(n*k-t*b)*wa;e=(n*h-t*e)*wa;a=a-v*m-b*l;c=c-p*m-e*l;o.save();o.transform(v,p,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,m,l,n,p,t,v){var u,wa;u=v.width-1;wa=v.height-
@@ -178,22 +178,22 @@ a>255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=m<0?0:m>255?255:m;Ba[6]=c<0?0:c>255?25
 ab,ra,Ha,Na,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,t,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,n,this.sortElements);(ma=a.lights.length>0)&&p(a);Ya=0;for(ab=k.length;Ya<ab;Ya++){ra=k[Ya];$.empty();if(ra instanceof THREE.RenderableParticle){M=ra;M.x*=t;M.y*=v;Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&x(M,ra,Aa,a)}else if(ra instanceof THREE.RenderableLine){if(M=ra.v1,E=ra.v2,M.positionScreen.x*=t,M.positionScreen.y*=
 v,E.positionScreen.x*=t,E.positionScreen.y*=v,$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&w(M,E,ra,Aa,a)}}else if(ra instanceof THREE.RenderableFace3){if(M=ra.v1,E=ra.v2,O=ra.v3,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),
 Ma(E.positionScreen,O.positionScreen),Ma(O.positionScreen,M.positionScreen)),$.add3Points(M.positionScreen.x,M.positionScreen.y,E.positionScreen.x,E.positionScreen.y,O.positionScreen.x,O.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}else Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}}else if(ra instanceof
-THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,H.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,H.positionScreen),Ma(O.positionScreen,P.positionScreen)),
-$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
+THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,I.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,I.positionScreen),Ma(O.positionScreen,P.positionScreen)),
+$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,I,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,I,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
 0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(a,c,b){var e,f,k,h;e=0;for(f=a.lights.length;e<f;e++)k=a.lights[e],k instanceof THREE.DirectionalLight?(h=c.normalWorld.dot(k.position)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(V.sub(k.position,c.centroidWorld),V.normalize(),h=c.normalWorld.dot(V)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,m,l,p){h.info.render.vertices+=3;h.info.render.faces++;L=e(T++);
 L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?B.copy(l.color):l instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(p,m,K),B.r=Math.max(0,Math.min(l.color.r*K.r,1)),B.g=Math.max(0,Math.min(l.color.g*K.g,1)),B.b=Math.max(0,Math.min(l.color.b*K.b,1))):B.copy(l.color):l instanceof THREE.MeshDepthMaterial?(O=1-l.__2near/(l.__farPlusNear-
 m.z*l.__farMinusNear),B.setRGB(O,O,O)):l instanceof THREE.MeshNormalMaterial&&B.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));l.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+l.opacity);n.appendChild(L)}function c(c,b,k,m,l,p,t){h.info.render.vertices+=
 4;h.info.render.faces++;L=e(T++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?B.copy(p.color):p instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(t,l,K),B.r=Math.max(0,Math.min(p.color.r*K.r,1)),B.g=Math.max(0,Math.min(p.color.g*K.g,1)),B.b=Math.max(0,Math.min(p.color.b*K.b,1))):
 B.copy(p.color):p instanceof THREE.MeshDepthMaterial?(O=1-p.__2near/(p.__farPlusNear-l.z*p.__farMinusNear),B.setRGB(O,O,O)):p instanceof THREE.MeshNormalMaterial&&B.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));p.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+
-"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
-M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,H=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
-this.render=function(a,e){var f,p,u,B,O,H,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
-p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;H=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",H.positionScreen.x);L.setAttribute("y2",H.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
-THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&
+"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
+M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,I=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
+this.render=function(a,e){var f,p,u,B,O,I,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
+p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;I=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",I.positionScreen.x);L.setAttribute("y2",I.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
+THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(I=K.faceMaterials.length;O<I;)(R=K.faceMaterials[O++])&&
 R.opacity!=0&&b(o,y,x,K,R,a)}else R&&R.opacity!=0&&b(o,y,x,K,R,a)}}else if(K instanceof THREE.RenderableFace4&&(o=K.v1,y=K.v2,x=K.v3,w=K.v4,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),z.addPoint(w.positionScreen.x,w.positionScreen.y),
-A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
+A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(I=K.faceMaterials.length;O<I;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
 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 float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\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\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -233,8 +233,8 @@ l.value[index];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type===
 l.value.length;for(n=0;n<p;n++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=l.value[n];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}if(v||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),
 m.bufferData(m.ARRAY_BUFFER,t,c);if(G||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,o,c);if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,l.buffer),m.bufferData(m.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||S.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var f=0,h=S.maxMorphTargets;f<
 h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!==U&&(m.useProgram(f),U=f,l=!0);if(e.id!==da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
-$=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,I=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
-THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=I*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[I]=x,I+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=I*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=I;y.directional.length=
+$=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,H=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
+THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=H*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[H]=x,H+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=H*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=H;y.directional.length=
 B;y.ambient[0]=o;y.ambient[1]=u;y.ambient[2]=v;c=Fa;n.enableLighting.value=c.directional.length+c.point.length;n.ambientLightColor.value=c.ambient;n.directionalLightColor.value=c.directional.colors;n.directionalLightDirection.value=c.directional.positions;n.pointLightColor.value=c.point.colors;n.pointLightPosition.value=c.point.positions;n.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
 e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
 if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=xa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
@@ -258,52 +258,52 @@ c,b){X!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),
 for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=
 b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=
 -1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);
-pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);
-for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));
-p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);
-m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&
-(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),
-m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
-a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a){for(var c in a.attributes)if(a.attributes[c].needsUpdate)return!0;return!1}function C(a){for(var c in a.attributes)a.attributes[c].needsUpdate=!1}function B(a,c){for(var b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);
-m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,
-m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;
-m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
-m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
-if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,
-a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,
-b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?
-(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),
-null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;
-case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;
-case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,
-Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=
-!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
-" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=
-m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,
-"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=
-m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=
-c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};
-this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);
-m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);
-S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=
-function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");
-if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=
-e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
-maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,
-"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.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");
+pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(H.r,H.g,H.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);for(o=0;o<v;o++)if(G=
+a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));p++}}function w(a,
+c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.uniformMatrix4fv(k.projectionMatrix,
+!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,
+1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),
+m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
+function z(a){for(var c in a.attributes)if(a.attributes[c].needsUpdate)return!0;return!1}function C(a){for(var c in a.attributes)a.attributes[c].needsUpdate=!1}function B(a,c){for(var b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,
+m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,
+m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
+m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
+m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();
+if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,
+f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),
+O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function I(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),
+m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;
+default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}
+var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,H=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=
+this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,
+0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(H.r,H.g,H.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=
+-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,
+W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=
+m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");
+W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?
+m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){H.setHex(a);N=c;m.clearColor(H.r,H.g,H.b,N)};this.setClearColor=function(a,c){H.copy(a);N=c;m.clearColor(H.r,H.g,H.b,N)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return N};this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=
+function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);
+m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
+a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof
+THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;
+for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":
+"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.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=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
 "",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(w,P("fragment",h+p));m.attachShader(w,
 P("vertex",e+t));m.linkProgram(w);m.getProgramParameter(w,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(w,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");w.uniforms={};w.attributes={};var G,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(G in n)e.push(G);G=e;e=0;for(n=G.length;e<n;e++)p=G[e],w.uniforms[p]=m.getUniformLocation(w,
 p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(G=0;G<b.maxMorphTargets;G++)e.push("morphTarget"+G);for(u in c)e.push(u);u=e;G=0;for(c=u.length;G<c;G++)b=u[G],w.attributes[b]=m.getAttribLocation(w,b);w.id=aa.length;aa.push({program:w,code:l});S.info.memory.programs=aa.length;u=w}a.program=u;u=a.program.attributes;u.position>=0&&m.enableVertexAttribArray(u.position);u.color>=0&&m.enableVertexAttribArray(u.color);u.normal>=0&&m.enableVertexAttribArray(u.normal);
 u.tangent>=0&&m.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(m.enableVertexAttribArray(u.skinVertexA),m.enableVertexAttribArray(u.skinVertexB),m.enableVertexAttribArray(u.skinIndex),m.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(k in a.attributes)u[k]!==void 0&&u[k]>=0&&m.enableVertexAttribArray(u[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)G="morphTarget"+k,u[G]>=0&&(m.enableVertexAttribArray(u[G]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,I,K,E=a.lights,na=a.fog;da=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=z.parent;z.update(void 0,!0)}a.update(void 0,!1,
-c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);this.initWebGLObjects(a);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],I=B.object,I.visible)if(!(I instanceof THREE.Mesh)||!I.frustumCulled||t(I)){if(I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),o(B),B.render=!0,this.sortObjects)B.object.renderDepth?
-B.z=B.object.renderDepth:(za.copy(I.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render)I=B.object,K=B.buffer,
-k(I),f(c,E,na,a.overrideMaterial,K,I);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,k(I),ma=e(c,E,na,a.overrideMaterial,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K,
-I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
-f(c,E,na,$,K,I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&H(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,H,K,E=a.lights,na=a.fog;da=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=
+z.parent;z.update(void 0,!0)}a.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],H=B.object,H.visible)if(!(H instanceof THREE.Mesh)||!H.frustumCulled||t(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),o(B),B.render=
+!0,this.sortObjects)H.renderDepth?B.z=H.renderDepth:(za.copy(H.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],
+B.render)H=B.object,K=B.buffer,k(H),f(c,E,na,a.overrideMaterial,K,H);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,k(H),ma=e(c,E,na,a.overrideMaterial,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(H=B.object,K=B.buffer,$=B.opaque))k(H),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
+f(c,E,na,$,K,H);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,$=B.opaque))k(H),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(H=B.object,K=B.buffer,$=B.transparent))k(H),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,
+$.polygonOffsetUnits),f(c,E,na,$,K,H);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],H=B.object,H.visible&&(ia=-1,$=B.transparent))k(H),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,H),H.immediateRenderCallback?H.immediateRenderCallback(ma,m,ua):H.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&I(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
 [],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=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){h=e.geometry;if(h.geometryGroups===void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
 v=t=void 0,u=void 0,G={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]===void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],
 materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer=
@@ -318,23 +318,23 @@ l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertice
 attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
 e instanceof THREE.ParticleSystem?(h=e.geometry,K(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)B(f.__webglObjects,
 e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;for(h=f.length-1;h>=0;h--)f[h]===k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,k=h.geometry,l=v=o=void 0,h instanceof THREE.Mesh){n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(o=k.geometryGroupsList[n],l=b(h,o),v=l.attributes&&z(l),k.__dirtyVertices||
-k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||v)if(v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,I=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,H=void 0,F=void 0,fa=void 0,ta=void 0,N=I=O=I=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=I=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,
+k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||v)if(v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,H=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,I=void 0,F=void 0,fa=void 0,ta=void 0,N=H=O=H=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=H=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,
 aa=o.__tangentArray,da=o.__colorArray,ga=o.__skinVertexAArray,ea=o.__skinVertexBArray,Z=o.__skinIndexArray,ca=o.__skinWeightArray,ja=o.__morphTargetsArrays,oa=o.__webglCustomAttributesList,D=void 0,Ca=o.__faceArray,va=o.__lineArray,Ba=o.__needsSmoothNormals,y=o.__vertexColorType,t=o.__uvType,ma=o.__normalType,sa=h.geometry,Da=sa.__dirtyVertices,Ea=sa.__dirtyElements,za=sa.__dirtyUvs,Fa=sa.__dirtyNormals,xa=sa.__dirtyTangents,Ga=sa.__dirtyColors,Ta=sa.__dirtyMorphTargets,Pa=sa.vertices,bb=o.faces,
-eb=sa.faces,cb=sa.faceVertexUvs[0],db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],I=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=I.vertexNormals,A=I.normal,E=I.vertexColors,na=I.color,O=I.vertexTangents,I instanceof THREE.Face3){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+
-3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=
-3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=D.value[I.c]):D.boundTo==="faces"?(fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=
-F.b,D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,
-F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,
-Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,
-da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&
-t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(I instanceof THREE.Face4){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ta=Pa[I.d].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=
-D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c],D.array[J+3]=D.value[I.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],
-F=D.value[I.b],fa=D.value[I.c],ta=D.value[I.d]):D.boundTo==="faces"?(ta=fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,
-D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=
-fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,ta=Ia[N].vertices[I.d].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],D=Ja[I.d],ca[Q]=
-N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],D=Sa[I.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],D=Qa[I.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=
-L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,
-da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,
+eb=sa.faces,cb=sa.faceVertexUvs[0],db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],H=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=H.vertexNormals,A=H.normal,E=H.vertexColors,na=H.color,O=H.vertexTangents,H instanceof THREE.Face3){if(Da)I=Pa[H.a].position,F=Pa[H.b].position,fa=Pa[H.c].position,ka[P]=I.x,ka[P+1]=I.y,ka[P+2]=I.z,ka[P+
+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[H.a],D.array[J+1]=D.value[H.b],D.array[J+2]=D.value[H.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=
+3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(I=D.value[H.a],F=D.value[H.b],fa=D.value[H.c]):D.boundTo==="faces"?(fa=F=I=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(I=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=I.r,D.array[J+1]=I.g,D.array[J+2]=I.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=
+F.b,D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=I.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)I=Ia[N].vertices[H.a].position,
+F=Ia[N].vertices[H.b].position,fa=Ia[N].vertices[H.c].position,J=ja[N],J[U]=I.x,J[U+1]=I.y,J[U+2]=I.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[H.a],L=Ja[H.b],J=Ja[H.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[H.a],L=Sa[H.b],J=Sa[H.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,
+Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[H.a],L=Qa[H.b],J=Qa[H.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[H.a],L=Ra[H.b],J=Ra[H.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(H=E[0],N=E[1],L=E[2]):L=N=H=na,da[V]=H.r,da[V+1]=H.g,da[V+2]=H.b,da[V+3]=N.r,da[V+4]=N.g,
+da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],H=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=H.x,aa[T+9]=H.y,aa[T+10]=H.z,aa[T+11]=H.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&
+t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(H instanceof THREE.Face4){if(Da)I=Pa[H.a].position,F=Pa[H.b].position,fa=Pa[H.c].position,ta=Pa[H.d].position,ka[P]=I.x,ka[P+1]=I.y,ka[P+2]=I.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=
+D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[H.a],D.array[J+1]=D.value[H.b],D.array[J+2]=D.value[H.c],D.array[J+3]=D.value[H.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(I=D.value[H.a],
+F=D.value[H.b],fa=D.value[H.c],ta=D.value[H.d]):D.boundTo==="faces"?(ta=fa=F=I=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(I=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=I.r,D.array[J+1]=I.g,D.array[J+2]=I.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,
+D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=I.x,D.array[J+1]=I.y,D.array[J+2]=I.z,D.array[J+3]=I.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=
+fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)I=Ia[N].vertices[H.a].position,F=Ia[N].vertices[H.b].position,fa=Ia[N].vertices[H.c].position,ta=Ia[N].vertices[H.d].position,J=ja[N],J[U]=I.x,J[U+1]=I.y,J[U+2]=I.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[H.a],L=Ja[H.b],J=Ja[H.c],D=Ja[H.d],ca[Q]=
+N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[H.a],L=Sa[H.b],J=Sa[H.c],D=Sa[H.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[H.a],L=Qa[H.b],J=Qa[H.c],D=Qa[H.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=
+L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[H.a],L=Ra[H.b],J=Ra[H.c],H=Ra[H.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=H.x,ea[Q+13]=H.y,ea[Q+14]=H.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(H=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=H=na,da[V]=H.r,da[V+1]=H.g,da[V+2]=H.b,da[V+3]=N.r,
+da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],H=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=H.x,aa[T+9]=H.y,aa[T+10]=H.z,aa[T+11]=H.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,
 ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<4;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<4;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+3,Ca[la+3]=R+1,Ca[la+4]=R+2,Ca[la+5]=R+3,la+=6,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+3,va[W+4]=R+1,va[W+5]=R+2,va[W+6]=R+2,va[W+7]=R+3,W+=8,R+=4)}Da&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,ka,v));if(oa){N=0;for(L=oa.length;N<L;N++)D=oa[N],D.__original.needsUpdate&&
 (m.bindBuffer(m.ARRAY_BUFFER,D.buffer),m.bufferData(m.ARRAY_BUFFER,D.array,v))}if(Ta){N=0;for(L=Ia.length;N<L;N++)m.bindBuffer(m.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[N]),m.bufferData(m.ARRAY_BUFFER,ja[N],v)}Ga&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,
 v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,
@@ -495,13 +495,13 @@ this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].positio
 B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
-l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
+l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(I=a.length;--I>=0;){ja=I;ca=I-1;ca<0&&(ca=a.length-
 1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
 c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
 !0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
-(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
-(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,
-m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var I,P,L,T,S,m,aa=y.length,U=x.length,ea=[];I=0;P=z.length;ja=P-1;for(ca=I+1;I<P;I++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[I]=e(z[I],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];I=0;P=F.length;ja=P-1;for(ca=I+1;I<P;I++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[I]=e(F[I],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
+(1-T);T=p*Math.sin(T*Math.PI/2);I=0;for(P=z.length;I<P;I++)m=c(z[I],ea[I],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];I=0;for(P=F.length;I<P;I++)m=c(F[I],ia[I],T),h(m.x,m.y,-S)}}T=p;for(I=0;I<aa;I++)m=t?c(y[I],ha[I],T):y[I],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(I=0;I<aa;I++)m=t?c(y[I],ha[I],T):y[I],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);I=0;for(P=z.length;I<P;I++)m=c(z[I],ea[I],T),h(m.x,
+m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];I=0;for(P=F.length;I<P;I++)m=c(F[I],ia[I],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(I=0;I<U;I++)p=x[I],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(I=0;I<U;I++)p=x[I],k(p[0]+t,p[1]+t,p[2]+t)}else{for(I=0;I<U;I++)p=x[I],k(p[2],p[1],p[0]);for(I=0;I<U;I++)p=x[I],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
@@ -525,7 +525,7 @@ this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,k=[
 p));f.moveTo(l,p);break;case "l":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,p));f.lineTo(l,p);break;case "q":l=b[a++]*c+e;p=b[a++]*c;v=b[a++]*c+e;o=b[a++]*c;f.quadraticCurveTo(v,o,l,p);if(k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var A=k/divisions,z=THREE.Shape.Utils.b2(A,u,v,l),A=THREE.Shape.Utils.b2(A,t,o,p);h.push(new THREE.Vector2(z,A))}}break;case "b":if(l=b[a++]*c+e,p=b[a++]*c,v=b[a++]*c+e,o=b[a++]*-c,y=b[a++]*c+e,x=b[a++]*-c,f.bezierCurveTo(l,p,
 v,o,y,x),k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)A=k/divisions,z=THREE.Shape.Utils.b3(A,u,v,y,l),A=THREE.Shape.Utils.b3(A,t,o,x,p),h.push(new THREE.Vector2(z,A))}}}return{offset:w.ha*c,points:h,path:f}}}};
 (function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,k=0;k<b;h=k++)f+=a[h].x*a[k].y-a[k].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],k=[],l=[],n,p,u;if(b(a)>0)for(p=0;p<f;p++)k[p]=p;else for(p=0;p<f;p++)k[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;f<=n&&(n=0);p=n+1;f<=p&&(p=0);u=p+1;f<=u&&(u=0);var v;a:{v=a;var o=n,y=p,x=u,w=f,A=k,z=void 0,C=void 0,B=void 0,
-K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,H=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,H=L=S=void 0,H=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,H=H*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(H>=0&&L>=0&&S>=0){v=!1;
+K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,I=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,I=L=S=void 0,I=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,I=I*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(I>=0&&L>=0&&S>=0){v=!1;
 break a}}v=!0}}if(v){h.push([a[k[n]],a[k[p]],a[k[u]]]);l.push([k[n],k[p],k[u]]);n=p;for(u=p+1;u<f;n++,u++)k[n]=k[u];f--;t=2*f}}if(e)return l;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);l.z=
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(l.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e,l=(this.segmentsT+1)*c+e,n=new THREE.Face4(f,h,k,l,[b[f],b[h],b[k],b[l]]);n.normal.addSelf(b[f]);n.normal.addSelf(b[h]);n.normal.addSelf(b[k]);n.normal.addSelf(b[l]);n.normal.normalize();this.faces.push(n);
@@ -555,11 +555,11 @@ b,e,c,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var k=new XMLHttpRequest,l=e+"/"+a,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,f,b):alert("Couldn't load ["+l+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",l,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=u(a,c),f=u(a,c+1),h=u(a,c+2),k=u(a,c+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function n(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function p(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function t(c){var b,
-e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+H);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
-e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],I=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,I,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
+e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+I);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
+e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],H=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,H,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
 2+1];b=K[e*2];var m=A.faceVertexUvs[0];e=K[e*2+1];var n=K[h*2];h=K[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ha);h=f(a,c+ja);k=f(a,c+ca);c=K[b*2];m=K[b*2+1];b=K[e*2];n=K[e*2+1];e=K[h*2];var o=A.faceVertexUvs[0];h=K[h*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var A=this,z=0,C,B=[],K=
-[],F,M,E,O,V,H,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
-z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
+[],F,M,E,O,V,I,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
+z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;I=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
 4;m=C.vertex_index_bytes*4+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ia=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ca=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;Z=C.ntri_flat*c;R=C.ntri_smooth*(c+
 C.normal_index_bytes*3);Y=C.ntri_flat_uv*(c+C.uv_index_bytes*3);X=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ga=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);z+=function(c){for(var e,h,f,l=C.vertex_coordinate_bytes*3,m=c+C.nvertices*l;c<m;c+=l)e=b(a,c),h=b(a,c+C.vertex_coordinate_bytes),f=b(a,c+C.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,f)));return C.nvertices*l}(z);z+=function(c){for(var b,
 e,h,f=C.normal_coordinate_bytes*3,k=c+C.nnormals*f;c<k;c+=f)b=p(a,c),e=p(a,c+C.normal_coordinate_bytes),h=p(a,c+C.normal_coordinate_bytes*2),B.push(b/127,e/127,h/127);return C.nnormals*f}(z);z+=function(c){for(var e,h,f=C.uv_coordinate_bytes*2,l=c+C.nuvs*f;c<l;c+=f)e=b(a,c),h=b(a,c+C.uv_coordinate_bytes),K.push(e,h);return C.nuvs*f}(z);Z=z+Z;R=Z+R;Y=R+Y;X=Y+X;ga=X+ga;c=ga+c;oa=c+oa;(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=b+C.uv_index_bytes*3,h=a+C.ntri_flat_uv*e;for(c=
@@ -579,7 +579,7 @@ qa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");else
 0;k<a.nodes.length;k++)c.add(h(a.nodes[k],a));return c}function k(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function t(){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 o(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function w(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function C(){this.material="";this.count=0;this.inputs=
 [];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function B(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function F(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function O(){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 V(a,c){this.type=
-a;this.effect=c;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
+a;this.effect=c;this.material=null}function I(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
 this.sid=null}function aa(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function U(a){var c=a.getAttribute("id");if(oa[c]!=void 0)return oa[c];oa[c]=(new M(c)).parse(a);return oa[c]}function ea(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function ia(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],
 10));return c}function ha(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function ca(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function Z(a,c){var b="";b+=ca(a.x,c)+",";b+=ca(a.y,c)+",";b+=ca(a.z,c);return b}var R=null,Y=null,X,ga=null,oa={},na={},fa={},qa={},la={},ua=
 {},sa={},Da,Ea,za,Fa,xa=THREE.SmoothShading;k.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new p).parse(b);this.type=b.nodeName;break;case "morph":this.morph=
@@ -611,10 +611,10 @@ switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.dat
 "instance_effect"){this.instance_effect=(new T).parse(a.childNodes[c]);break}return this};O.prototype.isColor=function(){return this.texture==null};O.prototype.isTexture=function(){return this.texture!=null};O.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=da(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),
 this.texcoord=b.getAttribute("texcoord")}}return this};V.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new O).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=R.evaluate(".//dae:float",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=e.iterateNext(),f=[];h;)f.push(h),h=e.iterateNext();
 e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};V.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
-a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
+a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
 b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};P.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;
 break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};L.prototype.parseNewparam=
-function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new H(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new I(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
 break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};L.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new V(b.nodeName,this)).parse(b)}}};T.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=(new M).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new aa(this)).parse(b));break;case "channel":this.channel.push((new m(this)).parse(b))}}return this};m.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=
 c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};aa.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new F).parse(b))}}return this};
@@ -632,9 +632,9 @@ THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.pos
 s=z.scale;q=0;V.length==0&&(V=new THREE.MeshFaceMaterial);V.length>1&&(V=new THREE.MeshFaceMaterial);object=new THREE.Mesh(F,V);object.name=o;object.position.set(C[0],C[1],C[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=z.visible;U.scene.add(object);U.objects[o]=object;z.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(z.castsShadow)a=
 new THREE.ShadowVolume(F),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}}else C=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(C[0],C[1],C[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=
 z.visible!==void 0?z.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}function n(a){return function(b){U.geometries[a]=b;l();T-=1;c.onLoadComplete();u()}}function p(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:m,totalTextures:aa,loadedModels:m-T,loadedTextures:aa-S},U);c.onLoadProgress();T==0&&S==0&&b(U)}var t,v,o,y,x,w,A,z,C,B,K,F,M,E,
-O,V,H,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
+O,V,I,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
 U.scene.scale.set(ea[0],ea[1],ea[2]);(a||B||ea)&&U.scene.updateMatrix()}a=function(){S-=1;u();c.onLoadComplete()};for(x in P.cameras)B=P.cameras[x],B.type=="perspective"?M=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type=="ortho"&&(M=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),C=B.position,B=B.target,M.position.set(C[0],C[1],C[2]),M.target=new THREE.Vector3(B[0],B[1],B[2]),U.cameras[x]=M;for(y in P.lights)x=P.lights[y],M=x.color!==void 0?x.color:16777215,
-B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,H=new THREE.DirectionalLight(M,B),H.position.set(C[0],C[1],C[2]),H.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,H=new THREE.PointLight(M,B,d),H.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(M)),U.scene.add(H),U.lights[y]=H;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
+B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,I=new THREE.DirectionalLight(M,B),I.position.set(C[0],C[1],C[2]),I.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,I=new THREE.PointLight(M,B,d),I.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(I=new THREE.AmbientLight(M)),U.scene.add(I),U.lights[y]=I;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
 B[1],B[2]),U.fogs[w]=E;if(U.cameras&&P.defaults.camera)U.currentCamera=U.cameras[P.defaults.camera];if(U.fogs&&P.defaults.fog)U.scene.fog=U.fogs[P.defaults.fog];B=P.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(B[0],B[1],B[2]);U.bgColorAlpha=P.defaults.bgalpha;for(t in P.geometries)if(w=P.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")T+=1,c.onLoadStart();m=T;for(t in P.geometries)w=P.geometries[t],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,
 w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),U.geometries[t]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[t]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[t]=
 F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[t]=F):w.type=="bin_mesh"?O.load(e(w.url,P.urlBaseType),n(t)):w.type=="ascii_mesh"?L.load(e(w.url,P.urlBaseType),n(t)):w.type=="embedded_mesh"&&(w=P.embeds[w.id])&&L.createModel(w,p(t),"");for(A in P.textures)if(t=P.textures[A],t.url instanceof Array){S+=t.url.length;for(O=0;O<t.url.length;O++)c.onLoadStart()}else S+=1,c.onLoadStart();aa=S;for(A in P.textures){t=P.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=
@@ -647,7 +647,7 @@ THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var e=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,h=c.offsetX!==void 0?c.offsetX:0,k=c.offsetY!==void 0?c.offsetY:0,l=c.offsetZ!==void 0?c.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
 b,f,h,k,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k<b;++k){var l=a.charCodeAt(k+e);h+=l>>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f<b;f++)l=a.charCodeAt(f+e),h[f]=k-l,l==0&&k++;return[c,h]};
 THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var k=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],u=[];(function(a,k,n){for(var p,u,w,A=a.length;n<A;n+=k)p=a[n],u=a[n+1],w=a[n+2],p=p/16383*c,u=u/16383*c,w=w/16383*c,p+=e,u+=f,w+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(p,u,w)))})(k[0],8,0);(function(a,c,b){for(var e,f,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,u.push(e,1-f)})(k[0],8,3);(function(a,
-c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],H=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(H,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
+c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],I=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(I,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
 1];n=u[f*2];z=u[f*2+1];C=u[h*2];B=u[h*2+1];h=b.faceVertexUvs[0];f=n;n=z;z=[];z.push(new THREE.UV(k,e));z.push(new THREE.UV(f,n));z.push(new THREE.UV(C,B));h.push(z)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;b(new k)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
@@ -655,9 +655,9 @@ THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b ins
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
 2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-
 this.field[a+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E===0)return 0;
-var O=this.delta,V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
-E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
-this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
+var O=this.delta,V=a+O,I=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,I,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
+E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,I,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
+this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,I,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,I,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
 3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=
 function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);
 l>this.size-1&&(l=this.size-1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,

+ 116 - 116
build/custom/ThreeWebGL.js

@@ -16,37 +16,37 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,e){var e=e.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,o,k,m,p,l,t,A,C=a.geometry,E=C.vertices,h=0,i=C.faces.length;h<i;h++)if(e=C.faces[h],t=this.origin.clone(),A=this.direction.clone(),m=a.matrixWorld,j=m.multiplyVector3(e.centroid.clone()).subSelf(t),l=j.dot(A),!(l<=0)&&(j=m.multiplyVector3(E[e.a].position.clone()),o=m.multiplyVector3(E[e.b].position.clone()),k=m.multiplyVector3(E[e.c].position.clone()),
-m=e instanceof THREE.Face4?m.multiplyVector3(E[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),l=A.dot(p),a.doubleSided||(a.flipSided?l>0:l<0)))if(l=p.dot((new THREE.Vector3).sub(j,t))/l,t=t.addSelf(A.multiplyScalar(l)),e instanceof THREE.Face3)c(t,j,o,k)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(t,j,o,m)||c(t,o,k,m)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e)}return f}};
-THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,m,p){j=!1;b=h;c=i;e=m;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
-function(h,i,m,p,l,t){j?(j=!1,b=h<m?h<l?h:l:m<l?m:l,c=i<p?i<t?i:t:p<t?p:t,e=h>m?h>l?h:l:m>l?m:l,f=i>p?i>t?i:t:p>t?p:t):(b=h<m?h<l?h<b?h:b:l<b?l:b:m<l?m<b?m:b:l<b?l:b,c=i<p?i<t?i<c?i:c:t<c?t:c:p<t?p<c?p:c:t<c?t:c,e=h>m?h>l?h>e?h:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e,f=i>p?i>t?i>f?i:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,m,k,o,p,l,t,A,C=a.geometry,E=C.vertices,h=0,i=C.faces.length;h<i;h++)if(e=C.faces[h],t=this.origin.clone(),A=this.direction.clone(),o=a.matrixWorld,j=o.multiplyVector3(e.centroid.clone()).subSelf(t),l=j.dot(A),!(l<=0)&&(j=o.multiplyVector3(E[e.a].position.clone()),m=o.multiplyVector3(E[e.b].position.clone()),k=o.multiplyVector3(E[e.c].position.clone()),
+o=e instanceof THREE.Face4?o.multiplyVector3(E[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),l=A.dot(p),a.doubleSided||(a.flipSided?l>0:l<0)))if(l=p.dot((new THREE.Vector3).sub(j,t))/l,t=t.addSelf(A.multiplyScalar(l)),e instanceof THREE.Face3)c(t,j,m,k)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(t,j,m,o)||c(t,m,k,o)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e)}return f}};
+THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,o,p){j=!1;b=h;c=i;e=o;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
+function(h,i,o,p,l,t){j?(j=!1,b=h<o?h<l?h:l:o<l?o:l,c=i<p?i<t?i:t:p<t?p:t,e=h>o?h>l?h:l:o>l?o:l,f=i>p?i>t?i:t:p>t?p:t):(b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b,c=i<p?i<t?i<c?i:c:t<c?t:c:p<t?p<c?p:c:t<c?t:c,e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e,f=i>p?i>t?i>f?i:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
 h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,h,i,j,o,k,m,p,l,t,A,C){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,o||0,k||0,m!==void 0?m:1,p||0,l||0,t||0,A||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,o,k,m,p,l,t,A,C){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=o;this.n32=k;this.n33=m;this.n34=p;this.n41=l;this.n42=t;this.n43=A;this.n44=C;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+THREE.Matrix4=function(a,b,c,e,f,h,i,j,m,k,o,p,l,t,A,C){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,m||0,k||0,o!==void 0?o:1,p||0,l||0,t||0,A||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,m,k,o,p,l,t,A,C){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=m;this.n32=k;this.n33=o;this.n34=p;this.n41=l;this.n42=t;this.n43=A;this.n44=C;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
 a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
-c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,o=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44,va=b.n11,wa=
-b.n12,pa=b.n13,qa=b.n14,N=b.n21,F=b.n22,z=b.n23,W=b.n24,U=b.n31,ja=b.n32,$=b.n33,xa=b.n34,Q=b.n41,G=b.n42,d=b.n43,ta=b.n44;this.n11=c*va+e*N+f*U+h*Q;this.n12=c*wa+e*F+f*ja+h*G;this.n13=c*pa+e*z+f*$+h*d;this.n14=c*qa+e*W+f*xa+h*ta;this.n21=i*va+j*N+o*U+k*Q;this.n22=i*wa+j*F+o*ja+k*G;this.n23=i*pa+j*z+o*$+k*d;this.n24=i*qa+j*W+o*xa+k*ta;this.n31=m*va+p*N+l*U+t*Q;this.n32=m*wa+p*F+l*ja+t*G;this.n33=m*pa+p*z+l*$+t*d;this.n34=m*qa+p*W+l*xa+t*ta;this.n41=A*va+C*N+E*U+B*Q;this.n42=A*wa+C*F+E*ja+B*G;this.n43=
+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44,va=b.n11,wa=
+b.n12,pa=b.n13,qa=b.n14,N=b.n21,F=b.n22,z=b.n23,W=b.n24,U=b.n31,ja=b.n32,$=b.n33,xa=b.n34,Q=b.n41,G=b.n42,d=b.n43,ta=b.n44;this.n11=c*va+e*N+f*U+h*Q;this.n12=c*wa+e*F+f*ja+h*G;this.n13=c*pa+e*z+f*$+h*d;this.n14=c*qa+e*W+f*xa+h*ta;this.n21=i*va+j*N+m*U+k*Q;this.n22=i*wa+j*F+m*ja+k*G;this.n23=i*pa+j*z+m*$+k*d;this.n24=i*qa+j*W+m*xa+k*ta;this.n31=o*va+p*N+l*U+t*Q;this.n32=o*wa+p*F+l*ja+t*G;this.n33=o*pa+p*z+l*$+t*d;this.n34=o*qa+p*W+l*xa+t*ta;this.n41=A*va+C*N+E*U+B*Q;this.n42=A*wa+C*F+E*ja+B*G;this.n43=
 A*pa+C*z+E*$+B*d;this.n44=A*qa+C*W+E*xa+B*ta;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
-a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,o=this.n31,k=this.n32,m=this.n33,p=this.n34,l=this.n41,t=this.n42,A=this.n43,C=this.n44;return e*i*k*l-c*j*k*l-e*h*m*l+b*j*m*l+c*h*p*l-b*i*p*l-e*i*o*t+c*j*o*t+e*f*m*t-a*j*m*t-c*f*p*t+a*i*p*t+e*h*o*A-b*j*o*A-e*f*k*A+a*j*k*A+b*f*p*A-a*h*p*A-c*h*o*C+b*i*
-o*C+c*f*k*C-a*i*k*C-b*f*m*C+a*h*m*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
+a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,m=this.n31,k=this.n32,o=this.n33,p=this.n34,l=this.n41,t=this.n42,A=this.n43,C=this.n44;return e*i*k*l-c*j*k*l-e*h*o*l+b*j*o*l+c*h*p*l-b*i*p*l-e*i*m*t+c*j*m*t+e*f*o*t-a*j*o*t-c*f*p*t+a*i*p*t+e*h*m*A-b*j*m*A-e*f*k*A+a*j*k*A+b*f*p*A-a*h*p*A-c*h*m*C+b*i*
+m*C+c*f*k*C-a*i*k*C-b*f*o*C+a*h*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
 a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=
 this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
 this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
-0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,o=f*h,k=f*i;this.set(o*h+c,o*i-e*j,o*j+e*i,0,o*i+e*j,k*i+c,k*j-e*h,0,o*j-e*i,k*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.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(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var o=
-i*j,k=i*f,m=e*j,p=e*f;this.n11=o+p*c;this.n12=m*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-m;this.n32=p+o*c;this.n33=h*i;break;case "ZXY":o=i*j;k=i*f;m=e*j;p=e*f;this.n11=o-p*c;this.n12=-h*f;this.n13=m+k*c;this.n21=k+m*c;this.n22=h*j;this.n23=p-o*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":o=h*j;k=h*f;m=c*j;p=c*f;this.n11=i*j;this.n12=m*e-k;this.n13=o*e+p;this.n21=i*f;this.n22=p*e+o;this.n23=k*e-m;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":o=h*i;k=
-h*e;m=c*i;p=c*e;this.n11=i*j;this.n12=p-o*f;this.n13=m*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+m;this.n33=o-p*f;break;case "XZY":o=h*i;k=h*e;m=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=o*f+p;this.n22=h*j;this.n23=k*f-m;this.n31=m*f-k;this.n32=c*j;this.n33=p*f+o;break;default:o=h*j,k=h*f,m=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+m*e,this.n22=o-p*e,this.n23=-c*i,this.n31=p-o*e,this.n32=m+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,o=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=o-f;this.n13=b+i;this.n21=o+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,m=f*h,k=f*i;this.set(m*h+c,m*i-e*j,m*j+e*i,0,m*i+e*j,k*i+c,k*j-e*h,0,m*j-e*i,k*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.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(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=
+i*j,k=i*f,o=e*j,p=e*f;this.n11=m+p*c;this.n12=o*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-o;this.n32=p+m*c;this.n33=h*i;break;case "ZXY":m=i*j;k=i*f;o=e*j;p=e*f;this.n11=m-p*c;this.n12=-h*f;this.n13=o+k*c;this.n21=k+o*c;this.n22=h*j;this.n23=p-m*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":m=h*j;k=h*f;o=c*j;p=c*f;this.n11=i*j;this.n12=o*e-k;this.n13=m*e+p;this.n21=i*f;this.n22=p*e+m;this.n23=k*e-o;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":m=h*i;k=
+h*e;o=c*i;p=c*e;this.n11=i*j;this.n12=p-m*f;this.n13=o*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+o;this.n33=m-p*f;break;case "XZY":m=h*i;k=h*e;o=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=m*f+p;this.n22=h*j;this.n23=k*f-o;this.n31=o*f-k;this.n32=c*j;this.n33=p*f+m;break;default:m=h*j,k=h*f,o=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+o*e,this.n22=m-p*e,this.n23=-c*i,this.n31=p-m*e,this.n32=o+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,m=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=m-f;this.n13=b+i;this.n21=m+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
 e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();
 c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=
 a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,o=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=o*t*C-k*l*C+k*p*E-j*t*E-o*p*B+j*l*B;b.n12=h*l*C-f*t*C-h*p*E+e*t*E+f*p*B-e*l*B;b.n13=f*k*C-h*o*C+h*j*E-e*k*E-f*j*B+e*o*B;b.n14=h*o*p-f*k*p-h*j*l+e*k*l+f*j*t-e*o*t;b.n21=k*l*A-o*t*A-k*m*E+i*t*E+o*m*B-i*l*B;b.n22=f*t*A-h*l*A+h*m*E-c*t*E-f*m*B+c*l*B;b.n23=h*o*A-f*k*A-h*i*E+c*k*E+f*i*B-c*o*B;b.n24=
-f*k*m-h*o*m+h*i*l-c*k*l-f*i*t+c*o*t;b.n31=j*t*A-k*p*A+k*m*C-i*t*C-j*m*B+i*p*B;b.n32=h*p*A-e*t*A-h*m*C+c*t*C+e*m*B-c*p*B;b.n33=f*k*A-h*j*A+h*i*C-c*k*C-e*i*B+c*j*B;b.n34=h*j*m-e*k*m-h*i*p+c*k*p+e*i*t-c*j*t;b.n41=o*p*A-j*l*A-o*m*C+i*l*C+j*m*E-i*p*E;b.n42=e*l*A-f*p*A+f*m*C-c*l*C-e*m*E+c*p*E;b.n43=f*j*A-e*o*A-f*i*C+c*o*C+e*i*E-c*j*E;b.n44=e*o*m-f*j*m+f*i*p-c*o*p-e*i*l+c*j*l;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*o;c[6]=a*k;c[7]=a*m;c[8]=a*p;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*t*C-k*l*C+k*p*E-j*t*E-m*p*B+j*l*B;b.n12=h*l*C-f*t*C-h*p*E+e*t*E+f*p*B-e*l*B;b.n13=f*k*C-h*m*C+h*j*E-e*k*E-f*j*B+e*m*B;b.n14=h*m*p-f*k*p-h*j*l+e*k*l+f*j*t-e*m*t;b.n21=k*l*A-m*t*A-k*o*E+i*t*E+m*o*B-i*l*B;b.n22=f*t*A-h*l*A+h*o*E-c*t*E-f*o*B+c*l*B;b.n23=h*m*A-f*k*A-h*i*E+c*k*E+f*i*B-c*m*B;b.n24=
+f*k*o-h*m*o+h*i*l-c*k*l-f*i*t+c*m*t;b.n31=j*t*A-k*p*A+k*o*C-i*t*C-j*o*B+i*p*B;b.n32=h*p*A-e*t*A-h*o*C+c*t*C+e*o*B-c*p*B;b.n33=f*k*A-h*j*A+h*i*C-c*k*C-e*i*B+c*j*B;b.n34=h*j*o-e*k*o-h*i*p+c*k*p+e*i*t-c*j*t;b.n41=m*p*A-j*l*A-m*o*C+i*l*C+j*o*E-i*p*E;b.n42=e*l*A-f*p*A+f*o*C-c*l*C-e*o*E+c*p*E;b.n43=f*j*A-e*m*A-f*i*C+c*m*C+e*i*E-c*j*E;b.n44=e*m*o-f*j*o+f*i*p-c*m*p-e*i*l+c*j*l;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*m;c[6]=a*k;c[7]=a*o;c[8]=a*p;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,o,k;i=new THREE.Matrix4;j=b-a;o=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((c+e)/o);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,m,k;i=new THREE.Matrix4;j=b-a;m=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/m;i.n23=0;i.n24=-((c+e)/m);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
@@ -54,40 +54,40 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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(a,b,c){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=o[j]=o[j]||new THREE.RenderableVertex;j++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return e>=0&&h>=0&&f>=0&&i>=0?!0:e<0&&h<0||f<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,h=[],i,j,o=[],k,m,p=[],l,t=[],A,C,E=[],B,va,wa=[],pa=[],qa=[],N=new THREE.Vector4,
+THREE.Projector=function(){function a(){var a=m[j]=m[j]||new THREE.RenderableVertex;j++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return e>=0&&h>=0&&f>=0&&i>=0?!0:e<0&&h<0||f<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,h=[],i,j,m=[],k,o,p=[],l,t=[],A,C,E=[],B,va,wa=[],pa=[],qa=[],N=new THREE.Vector4,
 F=new THREE.Vector4,z=new THREE.Matrix4,W=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(a,b){z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){z.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;
-a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,i){var d,j;f=pa.length=0;d=a.objects;a=0;for(c=d.length;a<c;a++){j=d[a];var k;if(!(k=!j.visible))if(k=j instanceof THREE.Mesh)if(k=j.frustumCulled){a:{k=void 0;for(var o=j.matrixWorld,t=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),m=0;m<6;m++)if(k=U[m].x*o.n14+U[m].y*o.n24+U[m].z*o.n34+
-U[m].w,k<=t){k=!1;break a}k=!0}k=!k}if(!k)k=h[f]=h[f]||new THREE.RenderableObject,f++,e=k,N.copy(j.position),z.multiplyVector3(N),e.object=j,e.z=N.z,pa.push(e)}i&&pa.sort(b);return pa};this.projectScene=function(e,h,f){var d=h.near,pa=h.far,N,ua,J,R,S,T,X,ka,aa,O,za,La,Ra,Ha,Aa,Ca,ya;va=C=l=m=qa.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);z.multiply(h.projectionMatrix,h.matrixWorldInverse);U[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);U[1].set(z.n41+z.n11,z.n42+
+a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,i){var d,j;f=pa.length=0;d=a.objects;a=0;for(c=d.length;a<c;a++){j=d[a];var k;if(!(k=!j.visible))if(k=j instanceof THREE.Mesh)if(k=j.frustumCulled){a:{k=void 0;for(var m=j.matrixWorld,t=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++)if(k=U[o].x*m.n14+U[o].y*m.n24+U[o].z*m.n34+
+U[o].w,k<=t){k=!1;break a}k=!0}k=!k}if(!k)k=h[f]=h[f]||new THREE.RenderableObject,f++,e=k,N.copy(j.position),z.multiplyVector3(N),e.object=j,e.z=N.z,pa.push(e)}i&&pa.sort(b);return pa};this.projectScene=function(e,h,f){var d=h.near,pa=h.far,N,ua,J,R,S,T,X,ka,aa,O,za,La,Ra,Ha,Aa,Ca,ya;va=C=l=o=qa.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);z.multiply(h.projectionMatrix,h.matrixWorldInverse);U[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);U[1].set(z.n41+z.n11,z.n42+
 z.n12,z.n43+z.n13,z.n44+z.n14);U[2].set(z.n41+z.n21,z.n42+z.n22,z.n43+z.n23,z.n44+z.n24);U[3].set(z.n41-z.n21,z.n42-z.n22,z.n43-z.n23,z.n44-z.n24);U[4].set(z.n41-z.n31,z.n42-z.n32,z.n43-z.n33,z.n44-z.n34);U[5].set(z.n41+z.n31,z.n42+z.n32,z.n43+z.n33,z.n44+z.n34);for(N=0;N<6;N++)aa=U[N],aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z));aa=this.projectObjects(e,h,!0);e=0;for(N=aa.length;e<N;e++)if(O=aa[e].object,O.visible)if(za=O.matrixWorld,La=O.matrixRotationWorld,Ra=O.materials,Ha=O.overdraw,
-j=0,O instanceof THREE.Mesh){Aa=O.geometry;R=Aa.vertices;Ca=Aa.faces;Aa=Aa.faceVertexUvs;ua=0;for(J=R.length;ua<J;ua++)i=a(),i.positionWorld.copy(R[ua].position),za.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),z.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>d&&i.positionScreen.z<pa;R=0;for(ua=Ca.length;R<ua;R++){J=Ca[R];if(J instanceof THREE.Face3)if(S=o[J.a],T=o[J.b],X=o[J.c],
-S.visible&&T.visible&&X.visible&&(O.doubleSided||O.flipSided!=(X.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(X.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)<0))ka=p[m]=p[m]||new THREE.RenderableFace3,m++,k=ka,k.v1.copy(S),k.v2.copy(T),k.v3.copy(X);else continue;else if(J instanceof THREE.Face4)if(S=o[J.a],T=o[J.b],X=o[J.c],ka=o[J.d],S.visible&&T.visible&&X.visible&&ka.visible&&(O.doubleSided||O.flipSided!=((ka.positionScreen.x-S.positionScreen.x)*
+j=0,O instanceof THREE.Mesh){Aa=O.geometry;R=Aa.vertices;Ca=Aa.faces;Aa=Aa.faceVertexUvs;ua=0;for(J=R.length;ua<J;ua++)i=a(),i.positionWorld.copy(R[ua].position),za.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),z.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>d&&i.positionScreen.z<pa;R=0;for(ua=Ca.length;R<ua;R++){J=Ca[R];if(J instanceof THREE.Face3)if(S=m[J.a],T=m[J.b],X=m[J.c],
+S.visible&&T.visible&&X.visible&&(O.doubleSided||O.flipSided!=(X.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(X.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)<0))ka=p[o]=p[o]||new THREE.RenderableFace3,o++,k=ka,k.v1.copy(S),k.v2.copy(T),k.v3.copy(X);else continue;else if(J instanceof THREE.Face4)if(S=m[J.a],T=m[J.b],X=m[J.c],ka=m[J.d],S.visible&&T.visible&&X.visible&&ka.visible&&(O.doubleSided||O.flipSided!=((ka.positionScreen.x-S.positionScreen.x)*
 (T.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)<0||(T.positionScreen.x-X.positionScreen.x)*(ka.positionScreen.y-X.positionScreen.y)-(T.positionScreen.y-X.positionScreen.y)*(ka.positionScreen.x-X.positionScreen.x)<0)))ya=t[l]=t[l]||new THREE.RenderableFace4,l++,k=ya,k.v1.copy(S),k.v2.copy(T),k.v3.copy(X),k.v4.copy(ka);else continue;k.normalWorld.copy(J.normal);La.multiplyVector3(k.normalWorld);k.centroidWorld.copy(J.centroid);
 za.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);X=J.vertexNormals;S=0;for(T=X.length;S<T;S++)ka=k.vertexNormalsWorld[S],ka.copy(X[S]),La.multiplyVector3(ka);S=0;for(T=Aa.length;S<T;S++)if(ya=Aa[S][R]){X=0;for(ka=ya.length;X<ka;X++)k.uvs[S][X]=ya[X]}k.meshMaterials=Ra;k.faceMaterials=J.materials;k.overdraw=Ha;k.z=k.centroidScreen.z;qa.push(k)}}else if(O instanceof THREE.Line){W.multiply(z,za);R=O.geometry.vertices;S=a();S.positionScreen.copy(R[0].position);
-W.multiplyVector4(S.positionScreen);ua=1;for(J=R.length;ua<J;ua++)if(S=a(),S.positionScreen.copy(R[ua].position),W.multiplyVector4(S.positionScreen),T=o[j-2],ja.copy(S.positionScreen),$.copy(T.positionScreen),c(ja,$))ja.multiplyScalar(1/ja.w),$.multiplyScalar(1/$.w),za=E[C]=E[C]||new THREE.RenderableLine,C++,A=za,A.v1.positionScreen.copy(ja),A.v2.positionScreen.copy($),A.z=Math.max(ja.z,$.z),A.materials=O.materials,qa.push(A)}else if(O instanceof THREE.Particle&&(F.set(O.matrixWorld.n14,O.matrixWorld.n24,
+W.multiplyVector4(S.positionScreen);ua=1;for(J=R.length;ua<J;ua++)if(S=a(),S.positionScreen.copy(R[ua].position),W.multiplyVector4(S.positionScreen),T=m[j-2],ja.copy(S.positionScreen),$.copy(T.positionScreen),c(ja,$))ja.multiplyScalar(1/ja.w),$.multiplyScalar(1/$.w),za=E[C]=E[C]||new THREE.RenderableLine,C++,A=za,A.v1.positionScreen.copy(ja),A.v2.positionScreen.copy($),A.z=Math.max(ja.z,$.z),A.materials=O.materials,qa.push(A)}else if(O instanceof THREE.Particle&&(F.set(O.matrixWorld.n14,O.matrixWorld.n24,
 O.matrixWorld.n34,1),z.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))za=wa[va]=wa[va]||new THREE.RenderableParticle,va++,B=za,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=O.rotation.z,B.scale.x=O.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),B.scale.y=O.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),B.materials=O.materials,qa.push(B);f&&qa.sort(b);return qa}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,o=this.w,k=o*c+i*f-j*e,m=o*e+j*c-h*f,p=o*f+h*e-i*c,c=-h*
-c-i*e-j*f;b.x=k*o+c*-h+m*-j-p*-i;b.y=m*o+c*-i+p*-h-k*-j;b.z=p*o+c*-j+k*-i-m*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
+this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,m=this.w,k=m*c+i*f-j*e,o=m*e+j*c-h*f,p=m*f+h*e-i*c,c=-h*
+c-i*e-j*f;b.x=k*m+c*-h+o*-j-p*-i;b.y=o*m+c*-i+p*-h-k*-j;b.z=p*m+c*-j+k*-i-o*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,f,h,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,h,i,j=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),o.sub(b.position,c.position),j.crossSelf(o);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
+c,e,f,h,i,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),m.sub(b.position,c.position),j.crossSelf(m);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;o=a.vertices[b].position;k=a.vertices[c].position;m=i[e];p=i[h];l=i[f];t=o.x-j.x;A=k.x-j.x;C=o.y-j.y;E=k.y-j.y;B=o.z-j.z;va=k.z-j.z;wa=p.u-m.u;pa=l.u-m.u;qa=p.v-m.v;N=l.v-m.v;F=1/(wa*N-pa*qa);ja.set((N*t-qa*A)*F,(N*C-qa*E)*F,(N*B-qa*va)*F);$.set((wa*A-pa*t)*F,(wa*E-pa*C)*F,(wa*va-pa*B)*F);W[d].addSelf(ja);W[b].addSelf(ja);W[c].addSelf(ja);
-U[d].addSelf($);U[b].addSelf($);U[c].addSelf($)}var b,c,e,f,h,i,j,o,k,m,p,l,t,A,C,E,B,va,wa,pa,qa,N,F,z,W=[],U=[],ja=new THREE.Vector3,$=new THREE.Vector3,xa=new THREE.Vector3,Q=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)W[b]=new THREE.Vector3,U[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;m=a.vertices[b].position;k=a.vertices[c].position;o=i[e];p=i[h];l=i[f];t=m.x-j.x;A=k.x-j.x;C=m.y-j.y;E=k.y-j.y;B=m.z-j.z;va=k.z-j.z;wa=p.u-o.u;pa=l.u-o.u;qa=p.v-o.v;N=l.v-o.v;F=1/(wa*N-pa*qa);ja.set((N*t-qa*A)*F,(N*C-qa*E)*F,(N*B-qa*va)*F);$.set((wa*A-pa*t)*F,(wa*E-pa*C)*F,(wa*va-pa*B)*F);W[d].addSelf(ja);W[b].addSelf(ja);W[c].addSelf(ja);
+U[d].addSelf($);U[b].addSelf($);U[c].addSelf($)}var b,c,e,f,h,i,j,m,k,o,p,l,t,A,C,E,B,va,wa,pa,qa,N,F,z,W=[],U=[],ja=new THREE.Vector3,$=new THREE.Vector3,xa=new THREE.Vector3,Q=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)W[b]=new THREE.Vector3,U[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,
 0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)G.copy(h.vertexNormals[e]),f=h[d[e]],z=W[f],xa.copy(z),xa.subSelf(G.multiplyScalar(G.dot(z))).normalize(),Q.cross(h.vertexNormals[e],z),f=Q.dot(U[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(xa.x,xa.y,xa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
 this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
 a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,o,k,m,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];m=this.points[c[1]];
-p=this.points[c[2]];l=this.points[c[3]];j=i*i;o=i*j;e.x=b(k.x,m.x,p.x,l.x,i,j,o);e.y=b(k.y,m.y,p.y,l.y,i,j,o);e.z=b(k.z,m.z,p.z,l.z,i,j,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
-j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=o.chunks[b]-o.chunks[b-1];i=Math.ceil(a*c/o.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
+THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,m,k,o,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];o=this.points[c[1]];
+p=this.points[c[2]];l=this.points[c[3]];j=i*i;m=i*j;e.x=b(k.x,o.x,p.x,l.x,i,j,m);e.y=b(k.y,o.y,p.y,l.y,i,j,m);e.z=b(k.z,o.z,p.z,l.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
+j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,m=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];i=Math.ceil(a*c/m.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
 j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
@@ -119,7 +119,7 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
 THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,h,i,j,o){THREE.Texture.call(this,null,f,h,i,j,o);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,h,i,j,m){THREE.Texture.call(this,null,f,h,i,j,m);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
 THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
@@ -179,107 +179,107 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,d){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(d.materialIndex>=0)return a.geometry.materials[d.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,v=a.colors,r=v.length,j=a.__vertexArray,k=a.__colorArray,o=a.__sortArray,P=a.__dirtyVertices,m=a.__dirtyColors,p=a.__webglCustomAttributesList,l;if(p){f=0;for(e=p.length;f<e;f++)p[f].offset=0}if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(e=
-0;e<u;e++)h=i[e].position,Ja.copy(h),Da.multiplyVector3(Ja),o[e]=[Ja.z,e];o.sort(function(a,d){return d[0]-a[0]});for(e=0;e<u;e++)h=i[o[e][1]].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;for(e=0;e<r;e++)f=e*3,color=v[o[e][1]],k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++){u=p[f];r=u.value.length;for(v=0;v<r;v++){index=o[v][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo==="vertices")l=
-u.value[index];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(m)for(e=0;e<r;e++)color=v[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate){r=
-u.value.length;for(v=0;v<r;v++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[v]}else{if(u.boundTo===void 0||u.boundTo==="vertices")l=u.value[v];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
-d.bufferData(d.ARRAY_BUFFER,j,b);if(m||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||G.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,i=G.maxMorphTargets;f<
-i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,v=e.uniforms;f!==Wa&&(d.useProgram(f),Wa=f,u=!0);if(e.id!==J)J=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(v.fogColor.value=c.color,c instanceof THREE.Fog)v.fogNear.value=c.near,v.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)v.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var r,j,k=0,o=0,P=0,m,p,l,t=Ya,y=t.directional.colors,
-q=t.directional.positions,A=t.point.colors,C=t.point.positions,B=t.point.distances,E=0,H=0,c=r=l=0,u=b.length;c<u;c++)if(r=b[c],j=r.color,m=r.position,p=r.intensity,l=r.distance,r instanceof THREE.AmbientLight)G.gammaInput?(k+=j.r*j.r,o+=j.g*j.g,P+=j.b*j.b):(k+=j.r,o+=j.g,P+=j.b);else if(r instanceof THREE.DirectionalLight)l=E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),q[l]=m.x,q[l+1]=m.y,q[l+2]=m.z,E+=1;else if(r instanceof THREE.SpotLight)l=
-E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),j=1/m.length(),q[l]=m.x*j,q[l+1]=m.y*j,q[l+2]=m.z*j,E+=1;else if(r instanceof THREE.PointLight)r=H*3,G.gammaInput?(A[r]=j.r*j.r*p*p,A[r+1]=j.g*j.g*p*p,A[r+2]=j.b*j.b*p*p):(A[r]=j.r*p,A[r+1]=j.g*p,A[r+2]=j.b*p),C[r]=m.x,C[r+1]=m.y,C[r+2]=m.z,B[H]=l,H+=1;c=E*3;for(u=y.length;c<u;c++)y[c]=0;c=H*3;for(u=A.length;c<u;c++)A[c]=0;t.point.length=H;t.directional.length=E;t.ambient[0]=k;t.ambient[1]=
-o;t.ambient[2]=P;b=Ya;v.enableLighting.value=b.directional.length+b.point.length;v.ambientLightColor.value=b.ambient;v.directionalLightColor.value=b.directional.colors;v.directionalLightDirection.value=b.directional.positions;v.pointLightColor.value=b.point.colors;v.pointLightPosition.value=b.point.positions;v.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)v.opacity.value=e.opacity,G.gammaInput?
+THREE.WebGLRenderer=function(a){function b(a,d){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(d.materialIndex>=0)return a.geometry.materials[d.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,v=a.colors,q=v.length,j=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,P=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList,l;if(p){f=0;for(e=p.length;f<e;f++)p[f].offset=0}if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(e=
+0;e<u;e++)h=i[e].position,Ja.copy(h),Da.multiplyVector3(Ja),m[e]=[Ja.z,e];m.sort(function(a,d){return d[0]-a[0]});for(e=0;e<u;e++)h=i[m[e][1]].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;for(e=0;e<q;e++)f=e*3,color=v[m[e][1]],k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++){u=p[f];q=u.value.length;for(v=0;v<q;v++){index=m[v][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo==="vertices")l=
+u.value[index];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(o)for(e=0;e<q;e++)color=v[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate){q=
+u.value.length;for(v=0;v<q;v++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[v]}else{if(u.boundTo===void 0||u.boundTo==="vertices")l=u.value[v];u.size===2?(u.array[i]=l.x,u.array[i+1]=l.y):u.size===3?u.type==="c"?(u.array[i]=l.r,u.array[i+1]=l.g,u.array[i+2]=l.b):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z):(u.array[i]=l.x,u.array[i+1]=l.y,u.array[i+2]=l.z,u.array[i+3]=l.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
+d.bufferData(d.ARRAY_BUFFER,j,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p){f=0;for(e=p.length;f<e;f++)if(u=p[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||G.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,i=G.maxMorphTargets;f<
+i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,v=e.uniforms;f!==Wa&&(d.useProgram(f),Wa=f,u=!0);if(e.id!==J)J=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(v.fogColor.value=c.color,c instanceof THREE.Fog)v.fogNear.value=c.near,v.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)v.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,m=0,P=0,o,p,l,t=Ya,y=t.directional.colors,
+r=t.directional.positions,A=t.point.colors,C=t.point.positions,B=t.point.distances,E=0,H=0,c=q=l=0,u=b.length;c<u;c++)if(q=b[c],j=q.color,o=q.position,p=q.intensity,l=q.distance,q instanceof THREE.AmbientLight)G.gammaInput?(k+=j.r*j.r,m+=j.g*j.g,P+=j.b*j.b):(k+=j.r,m+=j.g,P+=j.b);else if(q instanceof THREE.DirectionalLight)l=E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),r[l]=o.x,r[l+1]=o.y,r[l+2]=o.z,E+=1;else if(q instanceof THREE.SpotLight)l=
+E*3,G.gammaInput?(y[l]=j.r*j.r*p*p,y[l+1]=j.g*j.g*p*p,y[l+2]=j.b*j.b*p*p):(y[l]=j.r*p,y[l+1]=j.g*p,y[l+2]=j.b*p),j=1/o.length(),r[l]=o.x*j,r[l+1]=o.y*j,r[l+2]=o.z*j,E+=1;else if(q instanceof THREE.PointLight)q=H*3,G.gammaInput?(A[q]=j.r*j.r*p*p,A[q+1]=j.g*j.g*p*p,A[q+2]=j.b*j.b*p*p):(A[q]=j.r*p,A[q+1]=j.g*p,A[q+2]=j.b*p),C[q]=o.x,C[q+1]=o.y,C[q+2]=o.z,B[H]=l,H+=1;c=E*3;for(u=y.length;c<u;c++)y[c]=0;c=H*3;for(u=A.length;c<u;c++)A[c]=0;t.point.length=H;t.directional.length=E;t.ambient[0]=k;t.ambient[1]=
+m;t.ambient[2]=P;b=Ya;v.enableLighting.value=b.directional.length+b.point.length;v.ambientLightColor.value=b.ambient;v.directionalLightColor.value=b.directional.colors;v.directionalLightDirection.value=b.directional.positions;v.pointLightColor.value=b.point.colors;v.pointLightPosition.value=b.point.positions;v.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)v.opacity.value=e.opacity,G.gammaInput?
 v.diffuse.value.copyGammaToLinear(e.color):v.diffuse.value=e.color,(v.map.texture=e.map)&&v.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),v.lightMap.texture=e.lightMap,v.envMap.texture=e.envMap,v.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,v.reflectivity.value=e.reflectivity,v.refractionRatio.value=e.refractionRatio,v.combine.value=e.combine,v.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
 THREE.LineBasicMaterial)v.diffuse.value=e.color,v.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)v.psColor.value=e.color,v.opacity.value=e.opacity,v.size.value=e.size,v.scale.value=Ba.height/2,v.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)v.shininess.value=e.shininess,G.gammaInput?(v.ambient.value.copyGammaToLinear(e.ambient),v.specular.value.copyGammaToLinear(e.specular)):(v.ambient.value=e.ambient,v.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)G.gammaInput?
 v.ambient.value.copyGammaToLinear(e.ambient):v.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)v.mNear.value=a.near,v.mFar.value=a.far,v.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)v.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&v.shadowMatrix){for(b=0;b<Sa.length;b++)v.shadowMatrix.value[b]=Sa[b],v.shadowMap.texture[b]=G.shadowMap[b];v.shadowDarkness.value=G.shadowMapDarkness;v.shadowBias.value=G.shadowMapBias}b=e.uniformsList;v=0;for(c=
-b.length;v<c;v++)if(o=f.uniforms[b[v][1]])if(k=b[v][0],P=k.type,u=k.value,P==="i")d.uniform1i(o,u);else if(P==="f")d.uniform1f(o,u);else if(P==="v2")d.uniform2f(o,u.x,u.y);else if(P==="v3")d.uniform3f(o,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(o,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(o,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(o,u);else if(P==="fv")d.uniform3fv(o,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(m=u.length;P<m;P++)t=P*3,k._array[t]=u[P].x,k._array[t+
-1]=u[P].y,k._array[t+2]=u[P].z;d.uniform3fv(o,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(o,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(m=u.length;P<m;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(o,!1,k._array)}else if(P==="t"){if(d.uniform1i(o,u),o=k.texture)if(o.image instanceof Array&&o.image.length===6){if(k=o,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
-d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);F(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(k=o,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):z(o,u)}else if(P===
-"tv"){if(!k._array){k._array=[];P=0;for(m=k.texture.length;P<m;P++)k._array[P]=u+P}d.uniform1iv(o,k._array);P=0;for(m=k.texture.length;P<m;P++)(o=k.texture[P])&&z(o,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
+b.length;v<c;v++)if(m=f.uniforms[b[v][1]])if(k=b[v][0],P=k.type,u=k.value,P==="i")d.uniform1i(m,u);else if(P==="f")d.uniform1f(m,u);else if(P==="v2")d.uniform2f(m,u.x,u.y);else if(P==="v3")d.uniform3f(m,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(m,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(m,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(m,u);else if(P==="fv")d.uniform3fv(m,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(o=u.length;P<o;P++)t=P*3,k._array[t]=u[P].x,k._array[t+
+1]=u[P].y,k._array[t+2]=u[P].z;d.uniform3fv(m,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(m,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(o=u.length;P<o;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(m,!1,k._array)}else if(P==="t"){if(d.uniform1i(m,u),m=k.texture)if(m.image instanceof Array&&m.image.length===6){if(k=m,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
+d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);F(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(k=m,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):z(m,u)}else if(P===
+"tv"){if(!k._array){k._array=[];P=0;for(o=k.texture.length;P<o;P++)k._array[P]=u+P}d.uniform1iv(m,k._array);P=0;for(o=k.texture.length;P<o;P++)(m=k.texture[P])&&z(m,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
 d.uniformMatrix4fv(i.viewMatrix,!1,Ua);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ua),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!==
 0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==R&&(R=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
-d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var v=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<v.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[v[j]],j++}else{var v=[],k=-1,o=0;u=i.morphTargetInfluences;var p,m=u.length;j=0;for(i.morphTargetBase!==-1&&(v[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(p=
-0;p<m;p++)!v[p]&&u[p]>k&&(o=p,k=u[o]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=k;v[o]=1;k=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
+d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var v=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<v.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[v[j]],j++}else{var v=[],q=-1,k=0;u=i.morphTargetInfluences;var m,p=u.length;j=0;for(i.morphTargetBase!==-1&&(v[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(m=
+0;m<p;m++)!v[m]&&u[m]>q&&(k=m,q=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=q;v[k]=1;q=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
 f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
 d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
 d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),G.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++):
 i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
-a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,v,k,o,p,m,l=a.count*3;for(m=0;m<l;m+=9)c=a.normalArray,e=c[m],f=c[m+1],h=c[m+2],i=c[m+3],v=c[m+4],o=c[m+5],j=c[m+6],k=c[m+7],p=c[m+8],e=(e+i+j)/3,f=(f+v+k)/3,h=(h+o+p)/3,c[m]=e,c[m+1]=f,c[m+2]=h,c[m+3]=e,c[m+4]=f,c[m+5]=h,c[m+6]=e,c[m+7]=f,c[m+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
-0,a.count);a.count=0}function i(a){if(T!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),T=a.doubleSided;if(X!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),X=a.flipSided}function j(a){aa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),aa=a)}function o(a){O!==a&&(d.depthMask(a),O=a)}function k(a,b,c){za!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),za=a);if(a&&(La!==b||Ra!==c))d.polygonOffset(b,c),La=b,Ra=c}function m(a){ha[0].set(a.n41-
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,v,k,m,p,o,l=a.count*3;for(o=0;o<l;o+=9)c=a.normalArray,e=c[o],f=c[o+1],h=c[o+2],i=c[o+3],v=c[o+4],m=c[o+5],j=c[o+6],k=c[o+7],p=c[o+8],e=(e+i+j)/3,f=(f+v+k)/3,h=(h+m+p)/3,c[o]=e,c[o+1]=f,c[o+2]=h,c[o+3]=e,c[o+4]=f,c[o+5]=h,c[o+6]=e,c[o+7]=f,c[o+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
+0,a.count);a.count=0}function i(a){if(T!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),T=a.doubleSided;if(X!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),X=a.flipSided}function j(a){aa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),aa=a)}function m(a){O!==a&&(d.depthMask(a),O=a)}function k(a,b,c){za!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),za=a);if(a&&(La!==b||Ra!==c))d.polygonOffset(b,c),La=b,Ra=c}function o(a){ha[0].set(a.n41-
 a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ha[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
 Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=ha[c].x*b.n14+ha[c].y*b.n24+ha[c].z*b.n34+ha[c].w,a<=d)return!1;return!0}function l(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function t(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=
-b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(a,b){return b.z-a.z}function C(a){var b,c,k,o=0,K,l,u,v,r=a.lights;ra||(ra=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=r.length;b<c;b++)if(k=r[b],k instanceof THREE.SpotLight&&k.castShadow){J=-1;G.shadowMap[o]||(G.shadowMap[o]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-Sa[o]||(Sa[o]=new THREE.Matrix4);K=G.shadowMap[o];l=Sa[o];ra.position.copy(k.position);ra.lookAt(k.target.position);ra.update(void 0,!0);a.update(void 0,!1,ra);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(ra.projectionMatrix);l.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Ua);ra.projectionMatrix.flattenToArray(Ta);Da.multiply(ra.projectionMatrix,ra.matrixWorldInverse);m(Da);G.initWebGLObjects(a);U(K);d.clearColor(1,1,1,1);G.clear();d.clearColor(Y.r,
-Y.g,Y.b,Fa);l=a.__webglObjects.length;k=a.__webglObjectsImmediate.length;for(K=0;K<l;K++)u=a.__webglObjects[K],v=u.object,v.visible&&v.castShadow?!(v instanceof THREE.Mesh)||!v.frustumCulled||p(v)?(v.matrixWorld.flattenToArray(v._objectMatrixArray),B(v,ra,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);N(THREE.NormalBlending);for(K=0;K<l;K++)if(u=a.__webglObjects[K],u.render)v=u.object,buffer=u.buffer,i(v),u=v.customDepthMaterial?v.customDepthMaterial:v.geometry.morphTargets.length?Za:Va,f(ra,r,null,
-u,buffer,v);for(K=0;K<k;K++)u=a.__webglObjectsImmediate[K],v=u.object,v.visible&&v.castShadow&&(v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray),R=-1,B(v,ra,!1),i(v),program=e(ra,r,null,Va,v),v.immediateRenderCallback?v.immediateRenderCallback(program,d,ha):v.render(function(a){h(a,program,Va.shading)}));o++}}function E(a,b){var c,e,f;c=q.attributes;var h=q.uniforms,i=ya/Ca,j,k=[],r=Ca*0.5,o=ya*0.5,m=!0;d.useProgram(q.program);Wa=q.program;R=aa=ka=-1;$a||(d.enableVertexAttribArray(q.attributes.position),
-d.enableVertexAttribArray(q.attributes.uv),$a=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,q.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?
-f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-r)/r,(o-f.position.y)/o,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
-0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?ya:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),
-f.mergeWith3D&&!m?(d.enable(d.DEPTH_TEST),m=!0):!f.mergeWith3D&&m&&(d.disable(d.DEPTH_TEST),m=!1),N(f.blending),z(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(O)}function B(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function va(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
-return!1}function wa(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function pa(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function qa(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!==ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function F(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,
-d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,xa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,xa(b.minFilter)))}function z(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),d.UNSIGNED_BYTE,
-a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function W(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,
-d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function U(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);
-F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);W(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),
-a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),W(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);
-d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ca,a=ya,e=Ha,f=Aa);b!==ua&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ua=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),
-d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function $(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}
-function Q(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
-var G=this,d,ta=[],Wa=null,ua=null,J=-1,R=null,S=0,T=null,X=null,ka=null,aa=null,O=null,za=null,La=null,Ra=null,Ha=0,Aa=0,Ca=0,ya=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ba=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-I=a.stencil!==void 0?a.stencil:!0,cb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,db=a.antialias!==void 0?a.antialias:!1,Y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Fa=a.clearAlpha!==void 0?a.clearAlpha:0,Xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
-!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var ra,Sa=[],a=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab}),
-Za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab,morphTargets:!0});Va._shadowPass=!0;Za._shadowPass=!0;try{if(!(d=Ba.getContext("experimental-webgl",{antialias:db,stencil:I,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}d.clearColor(0,
-0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(Y.r,Y.g,Y.b,Fa);this.context=d;var bb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,q={};q.vertices=new Float32Array(16);q.faces=new Uint16Array(6);I=0;q.vertices[I++]=-1;q.vertices[I++]=-1;q.vertices[I++]=0;q.vertices[I++]=1;q.vertices[I++]=1;
-q.vertices[I++]=-1;q.vertices[I++]=1;q.vertices[I++]=1;q.vertices[I++]=1;q.vertices[I++]=1;q.vertices[I++]=1;q.vertices[I++]=0;q.vertices[I++]=-1;q.vertices[I++]=1;q.vertices[I++]=0;I=q.vertices[I++]=0;q.faces[I++]=0;q.faces[I++]=1;q.faces[I++]=2;q.faces[I++]=0;q.faces[I++]=2;q.faces[I++]=3;q.vertexBuffer=d.createBuffer();q.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,q.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,q.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.elementBuffer);
-d.bufferData(d.ELEMENT_ARRAY_BUFFER,q.faces,d.STATIC_DRAW);q.program=d.createProgram();d.attachShader(q.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(q.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(q.program);q.attributes={};q.uniforms={};q.attributes.position=d.getAttribLocation(q.program,"position");q.attributes.uv=d.getAttribLocation(q.program,"uv");q.uniforms.uvOffset=d.getUniformLocation(q.program,"uvOffset");q.uniforms.uvScale=d.getUniformLocation(q.program,
-"uvScale");q.uniforms.rotation=d.getUniformLocation(q.program,"rotation");q.uniforms.scale=d.getUniformLocation(q.program,"scale");q.uniforms.alignment=d.getUniformLocation(q.program,"alignment");q.uniforms.color=d.getUniformLocation(q.program,"color");q.uniforms.map=d.getUniformLocation(q.program,"map");q.uniforms.opacity=d.getUniformLocation(q.program,"opacity");q.uniforms.useScreenCoordinates=d.getUniformLocation(q.program,"useScreenCoordinates");q.uniforms.affectedByDistance=d.getUniformLocation(q.program,
-"affectedByDistance");q.uniforms.screenPosition=d.getUniformLocation(q.program,"screenPosition");q.uniforms.modelViewMatrix=d.getUniformLocation(q.program,"modelViewMatrix");q.uniforms.projectionMatrix=d.getUniformLocation(q.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){Ba.width=a;Ba.height=b;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(a,b,c,e){Ha=a;Aa=b;Ca=c;ya=e;d.viewport(Ha,Aa,Ca,ya)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(a,b){return b.z-a.z}function C(a){var b,c,k,m=0,K,l,u,v,q=a.lights;ra||(ra=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k instanceof THREE.SpotLight&&k.castShadow){J=-1;G.shadowMap[m]||(G.shadowMap[m]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+Sa[m]||(Sa[m]=new THREE.Matrix4);K=G.shadowMap[m];l=Sa[m];ra.position.copy(k.position);ra.lookAt(k.target.position);ra.update(void 0,!0);a.update(void 0,!1,ra);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(ra.projectionMatrix);l.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Ua);ra.projectionMatrix.flattenToArray(Ta);Da.multiply(ra.projectionMatrix,ra.matrixWorldInverse);o(Da);U(K);d.clearColor(1,1,1,1);G.clear();d.clearColor(Y.r,Y.g,Y.b,Fa);l=a.__webglObjects.length;
+k=a.__webglObjectsImmediate.length;for(K=0;K<l;K++)u=a.__webglObjects[K],v=u.object,v.visible&&v.castShadow?!(v instanceof THREE.Mesh)||!v.frustumCulled||p(v)?(v.matrixWorld.flattenToArray(v._objectMatrixArray),B(v,ra,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);N(THREE.NormalBlending);for(K=0;K<l;K++)if(u=a.__webglObjects[K],u.render)v=u.object,buffer=u.buffer,i(v),u=v.customDepthMaterial?v.customDepthMaterial:v.geometry.morphTargets.length?Za:Va,f(ra,q,null,u,buffer,v);for(K=0;K<k;K++)u=a.__webglObjectsImmediate[K],
+v=u.object,v.visible&&v.castShadow&&(v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray),R=-1,B(v,ra,!1),i(v),program=e(ra,q,null,Va,v),v.immediateRenderCallback?v.immediateRenderCallback(program,d,ha):v.render(function(a){h(a,program,Va.shading)}));m++}}function E(a,b){var c,e,f;c=r.attributes;var h=r.uniforms,i=ya/Ca,j,k=[],q=Ca*0.5,m=ya*0.5,o=!0;d.useProgram(r.program);Wa=r.program;R=aa=ka=-1;$a||(d.enableVertexAttribArray(r.attributes.position),d.enableVertexAttribArray(r.attributes.uv),
+$a=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,r.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(m-f.position.y)/m,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,
+!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?ya:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),f.mergeWith3D&&!o?(d.enable(d.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(d.disable(d.DEPTH_TEST),o=!1),
+N(f.blending),z(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(O)}function B(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function va(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function wa(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}
+function pa(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function qa(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!==ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,
+d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function F(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),
+d.texParameteri(a,d.TEXTURE_MAG_FILTER,xa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,xa(b.minFilter)))}function z(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,
+d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function W(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function U(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=
+d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);W(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,
+a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),W(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ca,a=ya,e=Ha,f=Aa);b!==ua&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ua=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function $(a,
+b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;
+case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;
+case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var G=this,d,ta=[],Wa=
+null,ua=null,J=-1,R=null,S=0,T=null,X=null,ka=null,aa=null,O=null,za=null,La=null,Ra=null,Ha=0,Aa=0,Ca=0,ya=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ba=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+I=a.stencil!==void 0?a.stencil:!0,cb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,db=a.antialias!==void 0?a.antialias:!1,Y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Fa=a.clearAlpha!==void 0?a.clearAlpha:0,Xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ba;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=
+this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var ra,Sa=[],a=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:ab}),Za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab,morphTargets:!0});Va._shadowPass=!0;Za._shadowPass=!0;try{if(!(d=Ba.getContext("experimental-webgl",{antialias:db,stencil:I,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}d.clearColor(0,
+0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(Y.r,Y.g,Y.b,Fa);this.context=d;var bb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);I=0;r.vertices[I++]=-1;r.vertices[I++]=-1;r.vertices[I++]=0;r.vertices[I++]=1;r.vertices[I++]=1;
+r.vertices[I++]=-1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=0;r.vertices[I++]=-1;r.vertices[I++]=1;r.vertices[I++]=0;I=r.vertices[I++]=0;r.faces[I++]=0;r.faces[I++]=1;r.faces[I++]=2;r.faces[I++]=0;r.faces[I++]=2;r.faces[I++]=3;r.vertexBuffer=d.createBuffer();r.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,r.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,r.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.elementBuffer);
+d.bufferData(d.ELEMENT_ARRAY_BUFFER,r.faces,d.STATIC_DRAW);r.program=d.createProgram();d.attachShader(r.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(r.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=d.getAttribLocation(r.program,"position");r.attributes.uv=d.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=d.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=d.getUniformLocation(r.program,
+"uvScale");r.uniforms.rotation=d.getUniformLocation(r.program,"rotation");r.uniforms.scale=d.getUniformLocation(r.program,"scale");r.uniforms.alignment=d.getUniformLocation(r.program,"alignment");r.uniforms.color=d.getUniformLocation(r.program,"color");r.uniforms.map=d.getUniformLocation(r.program,"map");r.uniforms.opacity=d.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=d.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=d.getUniformLocation(r.program,
+"affectedByDistance");r.uniforms.screenPosition=d.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=d.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=d.getUniformLocation(r.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){Ba.width=a;Ba.height=b;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(a,b,c,e){Ha=a;Aa=b;Ca=c;ya=e;d.viewport(Ha,Aa,Ca,ya)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
 function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.setClearColor=function(a,b){Y.copy(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Fa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
 this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
 d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof
 THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
-a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var r,o,m;r=m=k=0;for(o=b.length;r<o;r++)i=b[r],i instanceof
-THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&k++;k+m<=Xa?r=m:(r=Math.ceil(Xa*m/(k+m)),k=Xa-r);i={directional:r,point:k};k=m=0;for(r=b.length;k<r;k++)o=b[k],o instanceof THREE.SpotLight&&o.castShadow&&m++;var p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var l;a:{r=a.fragmentShader;o=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},t,e=[];j?e.push(j):(e.push(r),e.push(o));for(t in c)e.push(t),e.push(c[t]);j=e.join();t=0;
+a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var q,m,o;q=o=k=0;for(m=b.length;q<m;q++)i=b[q],i instanceof
+THREE.SpotLight&&o++,i instanceof THREE.DirectionalLight&&o++,i instanceof THREE.PointLight&&k++;k+o<=Xa?q=o:(q=Math.ceil(Xa*o/(k+o)),k=Xa-q);i={directional:q,point:k};k=o=0;for(q=b.length;k<q;k++)m=b[k],m instanceof THREE.SpotLight&&m.castShadow&&o++;var p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var l;a:{q=a.fragmentShader;m=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},t,e=[];j?e.push(j):(e.push(q),e.push(m));for(t in c)e.push(t),e.push(c[t]);j=e.join();t=0;
 for(e=ta.length;t<e;t++)if(ta[t].code===j){l=ta[t].program;break a}t=d.createProgram();e=[bb?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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");
 i=["#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:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",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.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",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");d.attachShader(t,$("fragment",i+r));d.attachShader(t,
-$("vertex",e+o));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};var q,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in k)e.push(q);q=e;e=0;for(k=q.length;e<k;e++)r=q[e],t.uniforms[r]=d.getUniformLocation(t,
-r);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)e.push("morphTarget"+q);for(l in b)e.push(l);l=e;q=0;for(b=l.length;q<b;q++)c=l[q],t.attributes[c]=d.getAttribLocation(t,c);t.id=ta.length;ta.push({program:t,code:j});G.info.memory.programs=ta.length;l=t}a.program=l;l=a.program.attributes;l.position>=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal);
-l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)q="morphTarget"+h,l[q]>=0&&(d.enableVertexAttribArray(l[q]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){C(a,b)};this.render=function(a,b,c,q){var Ia,K,Ea,u,v,r,z,Pa=a.lights,Qa=a.fog;J=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&C(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;if(b.matrixAutoUpdate){for(Ea=b;Ea.parent;)Ea=Ea.parent;Ea.update(void 0,!0)}a.update(void 0,
-!1,b);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);m(Da);this.initWebGLObjects(a);U(c);(this.autoClear||q)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ea=a.__webglObjects.length;for(q=0;q<Ea;q++)if(v=a.__webglObjects[q],r=v.object,r.visible)if(!(r instanceof THREE.Mesh)||!r.frustumCulled||p(r)){if(r.matrixWorld.flattenToArray(r._objectMatrixArray),B(r,b,!0),t(v),v.render=!0,this.sortObjects)v.object.renderDepth?
-v.z=v.object.renderDepth:(Ja.copy(r.position),Da.multiplyVector3(Ja),v.z=Ja.z)}else v.render=!1;else v.render=!1;this.sortObjects&&a.__webglObjects.sort(A);u=a.__webglObjectsImmediate.length;for(q=0;q<u;q++)v=a.__webglObjectsImmediate[q],r=v.object,r.visible&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),B(r,b,!0),l(v));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);N(a.overrideMaterial.blending);for(q=0;q<Ea;q++)if(v=a.__webglObjects[q],v.render)r=v.object,z=v.buffer,
-i(r),f(b,Pa,Qa,a.overrideMaterial,z,r);for(q=0;q<u;q++)v=a.__webglObjectsImmediate[q],r=v.object,r.visible&&(R=-1,i(r),Ia=e(b,Pa,Qa,a.overrideMaterial,r),r.immediateRenderCallback?r.immediateRenderCallback(Ia,d,ha):r.render(function(b){h(b,Ia,a.overrideMaterial.shading)}))}else{N(THREE.NormalBlending);for(q=Ea-1;q>=0;q--)if(v=a.__webglObjects[q],v.render&&(r=v.object,z=v.buffer,K=v.opaque))i(r),j(K.depthTest),o(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),f(b,Pa,Qa,
-K,z,r);for(q=0;q<u;q++)if(v=a.__webglObjectsImmediate[q],r=v.object,r.visible&&(R=-1,K=v.opaque))i(r),j(K.depthTest),o(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,r),r.immediateRenderCallback?r.immediateRenderCallback(Ia,d,ha):r.render(function(a){h(a,Ia,K.shading)});for(q=0;q<Ea;q++)if(v=a.__webglObjects[q],v.render&&(r=v.object,z=v.buffer,K=v.transparent))i(r),N(K.blending),j(K.depthTest),o(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),
-f(b,Pa,Qa,K,z,r);for(q=0;q<u;q++)if(v=a.__webglObjectsImmediate[q],r=v.object,r.visible&&(R=-1,K=v.transparent))i(r),N(K.blending),j(K.depthTest),o(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,r),r.immediateRenderCallback?r.immediateRenderCallback(Ia,d,ha):r.render(function(a){h(a,Ia,K.shading)})}a.__webglSprites.length&&E(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ja(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=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){i=e.geometry;if(i.geometryGroups===void 0){var j=i,k=void 0,o=void 0,m=void 0,r=void 0,
-l=m=void 0,p=void 0,q={},t=j.morphTargets.length;j.geometryGroups={};k=0;for(o=j.faces.length;k<o;k++)m=j.faces[k],r=m.materialIndex,l=r!==void 0?r:-1,q[l]===void 0&&(q[l]={hash:l,counter:0}),p=q[l].hash+"_"+q[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces:[],materialIndex:r,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+m>65535&&(q[l].counter+=1,p=q[l].hash+"_"+q[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces:[],
-materialIndex:r,vertices:0,numMorphTargets:t})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=m;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=S++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();
-k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){r=o=void 0;k.__webglMorphTargetsBuffers=[];o=0;for(r=k.numMorphTargets;o<r;o++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}G.info.memory.geometries++;for(var r=e,z=m=q=void 0,l=z=t=z=void 0,
-p=l=k=0,A=m=void 0,C=void 0,m=o=t=q=void 0,t=r.geometry,A=t.faces,C=j.faces,q=0,m=C.length;q<m;q++)z=C[q],z=A[z],z instanceof THREE.Face3?(k+=3,l+=1,p+=3):z instanceof THREE.Face4&&(k+=4,l+=2,p+=4);q=b(r,j);m=q.map||q.lightMap||q instanceof THREE.ShaderMaterial?!0:!1;C=q instanceof THREE.MeshBasicMaterial&&!q.envMap||q instanceof THREE.MeshDepthMaterial?!1:q&&q.shading!==void 0&&q.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=q.vertexColors?q.vertexColors:!1;j.__vertexArray=
-new Float32Array(k*3);if(C)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(A)j.__colorArray=new Float32Array(k*3);if(m){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),j.__skinIndexArray=
-new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t<z;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=C===THREE.SmoothShading;j.__uvType=m;j.__vertexColorType=A;j.__normalType=C;j.__webglFaceCount=l*3;j.__webglLineCount=p*2;if(q.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
-[];r=void 0;for(r in q.attributes){m=q.attributes[r];t={};for(o in m)t[o]=m[o];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,l=1,t.type==="v2"?l=2:t.type==="v3"?l=3:t.type==="v4"?l=4:t.type==="c"&&(l=3),t.size=l,t.array=new Float32Array(k*l),t.buffer=d.createBuffer(),t.buffer.belongsToAttribute=r,m.needsUpdate=!0,t.__original=m;j.__webglCustomAttributesList.push(t)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",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");d.attachShader(t,$("fragment",i+q));d.attachShader(t,
+$("vertex",e+m));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};var r,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in k)e.push(r);r=e;e=0;for(k=r.length;e<k;e++)q=r[e],t.uniforms[q]=d.getUniformLocation(t,
+q);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<c.maxMorphTargets;r++)e.push("morphTarget"+r);for(l in b)e.push(l);l=e;r=0;for(b=l.length;r<b;r++)c=l[r],t.attributes[c]=d.getAttribLocation(t,c);t.id=ta.length;ta.push({program:t,code:j});G.info.memory.programs=ta.length;l=t}a.program=l;l=a.program.attributes;l.position>=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal);
+l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)r="morphTarget"+h,l[r]>=0&&(d.enableVertexAttribArray(l[r]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){C(a,b)};this.render=function(a,b,c,r){var Ia,K,Ea,u,v,q,z,Pa=a.lights,Qa=a.fog;J=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&C(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;if(b.matrixAutoUpdate){for(Ea=b;Ea.parent;)Ea=
+Ea.parent;Ea.update(void 0,!0)}a.update(void 0,!1,b);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);o(Da);U(c);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ea=a.__webglObjects.length;for(r=0;r<Ea;r++)if(v=a.__webglObjects[r],q=v.object,q.visible)if(!(q instanceof THREE.Mesh)||!q.frustumCulled||p(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),B(q,b,!0),t(v),
+v.render=!0,this.sortObjects)q.renderDepth?v.z=q.renderDepth:(Ja.copy(q.position),Da.multiplyVector3(Ja),v.z=Ja.z)}else v.render=!1;else v.render=!1;this.sortObjects&&a.__webglObjects.sort(A);u=a.__webglObjectsImmediate.length;for(r=0;r<u;r++)v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),B(q,b,!0),l(v));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);N(a.overrideMaterial.blending);for(r=0;r<Ea;r++)if(v=a.__webglObjects[r],
+v.render)q=v.object,z=v.buffer,i(q),f(b,Pa,Qa,a.overrideMaterial,z,q);for(r=0;r<u;r++)v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,i(q),Ia=e(b,Pa,Qa,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(b){h(b,Ia,a.overrideMaterial.shading)}))}else{N(THREE.NormalBlending);for(r=Ea-1;r>=0;r--)if(v=a.__webglObjects[r],v.render&&(q=v.object,z=v.buffer,K=v.opaque))i(q),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),
+f(b,Pa,Qa,K,z,q);for(r=0;r<u;r++)if(v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,K=v.opaque))i(q),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(a){h(a,Ia,K.shading)});for(r=0;r<Ea;r++)if(v=a.__webglObjects[r],v.render&&(q=v.object,z=v.buffer,K=v.transparent))i(q),N(K.blending),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,
+K.polygonOffsetUnits),f(b,Pa,Qa,K,z,q);for(r=0;r<u;r++)if(v=a.__webglObjectsImmediate[r],q=v.object,q.visible&&(R=-1,K=v.transparent))i(q),N(K.blending),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ia=e(b,Pa,Qa,K,q),q.immediateRenderCallback?q.immediateRenderCallback(Ia,d,ha):q.render(function(a){h(a,Ia,K.shading)})}a.__webglSprites.length&&E(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ja(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=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){i=e.geometry;if(i.geometryGroups===void 0){var j=i,k=void 0,m=void 0,o=void 0,q=void 0,
+l=o=void 0,p=void 0,r={},t=j.morphTargets.length;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)o=j.faces[k],q=o.materialIndex,l=q!==void 0?q:-1,r[l]===void 0&&(r[l]={hash:l,counter:0}),p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t}),o=o instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+o>65535&&(r[l].counter+=1,p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces:[],
+materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=o;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=S++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();
+k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){q=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(q=k.numMorphTargets;m<q;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}G.info.memory.geometries++;for(var q=e,z=o=r=void 0,l=z=t=z=void 0,
+p=l=k=0,A=o=void 0,C=void 0,o=m=t=r=void 0,t=q.geometry,A=t.faces,C=j.faces,r=0,o=C.length;r<o;r++)z=C[r],z=A[z],z instanceof THREE.Face3?(k+=3,l+=1,p+=3):z instanceof THREE.Face4&&(k+=4,l+=2,p+=4);r=b(q,j);o=r.map||r.lightMap||r instanceof THREE.ShaderMaterial?!0:!1;C=r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial?!1:r&&r.shading!==void 0&&r.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=r.vertexColors?r.vertexColors:!1;j.__vertexArray=
+new Float32Array(k*3);if(C)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(A)j.__colorArray=new Float32Array(k*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),j.__skinIndexArray=
+new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t<z;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=C===THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=A;j.__normalType=C;j.__webglFaceCount=l*3;j.__webglLineCount=p*2;if(r.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
+[];q=void 0;for(q in r.attributes){o=r.attributes[q];t={};for(m in o)t[m]=o[m];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,l=1,t.type==="v2"?l=2:t.type==="v3"?l=3:t.type==="v4"?l=4:t.type==="c"&&(l=3),t.size=l,t.array=new Float32Array(k*l),t.buffer=d.createBuffer(),t.buffer.belongsToAttribute=q,o.needsUpdate=!0,t.__original=o;j.__webglCustomAttributesList.push(t)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
 !0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
-j.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();G.info.geometries++;j=i;o=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
-3);j.__sortArray=[];j.__webglParticleCount=k;o=o.material;if(o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];r=void 0;for(r in o.attributes){originalAttribute=o.attributes[r];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(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=r,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],qa(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof
+j.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();G.info.geometries++;j=i;m=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
+3);j.__sortArray=[];j.__webglParticleCount=k;m=m.material;if(m.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];q=void 0;for(q in m.attributes){originalAttribute=m.attributes[q];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(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=q,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],qa(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof
 THREE.Line||e instanceof THREE.ParticleSystem?(i=e.geometry,qa(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof
-THREE.Line)pa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&pa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=r=void 0,i instanceof THREE.Mesh){k=0;for(o=h.geometryGroupsList.length;k<o;k++)if(r=h.geometryGroupsList[k],j=b(i,r),l=
-j.attributes&&va(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,p=!h.dynamic,r.__inittedArrays){var B=t=q=void 0,y=void 0,E=B=void 0,F=void 0,N=void 0,O=void 0,U=z=C=A=m=void 0,H=void 0,L=void 0,M=void 0,I=void 0,w=y=O=y=N=F=void 0,D=void 0,s=D=w=F=void 0,n=void 0,s=D=w=B=B=E=D=w=y=s=D=w=n=s=D=w=n=s=D=w=void 0,ia=0,J=0,X=0,$=0,T=0,Q=0,Z=0,R=0,la=0,x=0,ma=0,V=s=0,V=void 0,na=r.__vertexArray,ja=
-r.__uvArray,ka=r.__uv2Array,W=r.__normalArray,ca=r.__tangentArray,oa=r.__colorArray,da=r.__skinVertexAArray,ea=r.__skinVertexBArray,fa=r.__skinIndexArray,ga=r.__skinWeightArray,ra=r.__morphTargetsArrays,aa=r.__webglCustomAttributesList,n=void 0,ha=r.__faceArray,Y=r.__lineArray,xa=r.__needsSmoothNormals,A=r.__vertexColorType,m=r.__uvType,C=r.__normalType,sa=i.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,za=sa.__dirtyNormals,Aa=sa.__dirtyTangents,Ca=sa.__dirtyColors,Da=sa.__dirtyMorphTargets,
-Ba=sa.vertices,Fa=r.faces,La=sa.faces,Ha=sa.faceVertexUvs[0],Ja=sa.faceVertexUvs[1],Ma=sa.skinVerticesA,Na=sa.skinVerticesB,Oa=sa.skinIndices,Ka=sa.skinWeights,Ga=sa.morphTargets;if(aa){w=0;for(D=aa.length;w<D;w++)aa[w].offset=0,aa[w].offsetSrc=0}q=0;for(t=Fa.length;q<t;q++)if(B=Fa[q],y=La[B],Ha&&(z=Ha[B]),Ja&&(U=Ja[B]),B=y.vertexNormals,E=y.normal,F=y.vertexColors,N=y.color,O=y.vertexTangents,y instanceof THREE.Face3){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,na[J]=H.x,na[J+
+THREE.Line)pa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&pa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=q=void 0,i instanceof THREE.Mesh){k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(q=h.geometryGroupsList[k],j=b(i,q),l=
+j.attributes&&va(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,p=!h.dynamic,q.__inittedArrays){var B=t=r=void 0,y=void 0,E=B=void 0,F=void 0,N=void 0,O=void 0,U=z=C=A=o=void 0,H=void 0,L=void 0,M=void 0,I=void 0,w=y=O=y=N=F=void 0,D=void 0,s=D=w=F=void 0,n=void 0,s=D=w=B=B=E=D=w=y=s=D=w=n=s=D=w=n=s=D=w=void 0,ia=0,J=0,X=0,$=0,T=0,Q=0,Z=0,R=0,la=0,x=0,ma=0,V=s=0,V=void 0,na=q.__vertexArray,ja=
+q.__uvArray,ka=q.__uv2Array,W=q.__normalArray,ca=q.__tangentArray,oa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ra=q.__morphTargetsArrays,aa=q.__webglCustomAttributesList,n=void 0,ha=q.__faceArray,Y=q.__lineArray,xa=q.__needsSmoothNormals,A=q.__vertexColorType,o=q.__uvType,C=q.__normalType,sa=i.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,za=sa.__dirtyNormals,Aa=sa.__dirtyTangents,Ca=sa.__dirtyColors,Da=sa.__dirtyMorphTargets,
+Ba=sa.vertices,Fa=q.faces,La=sa.faces,Ha=sa.faceVertexUvs[0],Ja=sa.faceVertexUvs[1],Ma=sa.skinVerticesA,Na=sa.skinVerticesB,Oa=sa.skinIndices,Ka=sa.skinWeights,Ga=sa.morphTargets;if(aa){w=0;for(D=aa.length;w<D;w++)aa[w].offset=0,aa[w].offsetSrc=0}r=0;for(t=Fa.length;r<t;r++)if(B=Fa[r],y=La[B],Ha&&(z=Ha[B]),Ja&&(U=Ja[B]),B=y.vertexNormals,E=y.normal,F=y.vertexColors,N=y.color,O=y.vertexTangents,y instanceof THREE.Face3){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,na[J]=H.x,na[J+
 1]=H.y,na[J+2]=H.z,na[J+3]=L.x,na[J+4]=L.y,na[J+5]=L.z,na[J+6]=M.x,na[J+7]=M.y,na[J+8]=M.z,J+=9;if(aa){w=0;for(D=aa.length;w<D;w++)if(n=aa[w],n.__original.needsUpdate)s=n.offset,V=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[y.a],n.array[s+1]=n.value[y.b],n.array[s+2]=n.value[y.c]):n.boundTo==="faces"?(V=n.value[V],n.array[s]=V,n.array[s+1]=V,n.array[s+2]=V,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[V],n.array[s+1]=n.value[V+1],n.array[s+
 2]=n.value[V+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],L=n.value[y.b],M=n.value[y.c]):n.boundTo==="faces"?(M=L=H=V=n.value[V],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[V],L=n.value[V+1],M=n.value[V+2],n.offsetSrc+=3),n.size===2?(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=L.x,n.array[s+3]=L.y,n.array[s+4]=M.x,n.array[s+5]=M.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=H.r,n.array[s+1]=H.g,n.array[s+2]=H.b,n.array[s+3]=L.r,n.array[s+
 4]=L.g,n.array[s+5]=L.b,n.array[s+6]=M.r,n.array[s+7]=M.g,n.array[s+8]=M.b):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=L.x,n.array[s+4]=L.y,n.array[s+5]=L.z,n.array[s+6]=M.x,n.array[s+7]=M.y,n.array[s+8]=M.z),n.offset+=9):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=H.w,n.array[s+4]=L.x,n.array[s+5]=L.y,n.array[s+6]=L.z,n.array[s+7]=L.w,n.array[s+8]=M.x,n.array[s+9]=M.y,n.array[s+10]=M.z,n.array[s+11]=M.w,n.offset+=12))}if(Da){w=0;for(D=Ga.length;w<D;w++)H=Ga[w].vertices[y.a].position,
 L=Ga[w].vertices[y.b].position,M=Ga[w].vertices[y.c].position,s=ra[w],s[ma]=H.x,s[ma+1]=H.y,s[ma+2]=H.z,s[ma+3]=L.x,s[ma+4]=L.y,s[ma+5]=L.z,s[ma+6]=M.x,s[ma+7]=M.y,s[ma+8]=M.z;ma+=9}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=s.x,ga[x+9]=s.y,ga[x+10]=s.z,ga[x+11]=s.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=
 s.x,fa[x+9]=s.y,fa[x+10]=s.z,fa[x+11]=s.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,x+=12;if(Ca&&A)F.length===3&&A===THREE.VertexColors?(y=F[0],w=F[1],D=F[2]):D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+
-3]=w.r,oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,la+=9;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,Z+=12;if(za&&C)if(B.length===3&&xa)for(w=0;w<3;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;if(ta&&z!==void 0&&m)for(w=0;w<3;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&
-m)for(w=0;w<3;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+2,T+=3,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+2,Y[R+4]=ia+1,Y[R+5]=ia+2,R+=6,ia+=3)}else if(y instanceof THREE.Face4){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,I=Ba[y.d].position,na[J]=H.x,na[J+1]=H.y,na[J+2]=H.z,na[J+3]=L.x,na[J+4]=L.y,na[J+5]=L.z,na[J+6]=M.x,na[J+7]=M.y,na[J+8]=M.z,na[J+9]=I.x,na[J+10]=I.y,na[J+11]=I.z,J+=12;if(aa){w=0;for(D=aa.length;w<D;w++)if(n=aa[w],n.__original.needsUpdate)s=
+3]=w.r,oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,la+=9;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,Z+=12;if(za&&C)if(B.length===3&&xa)for(w=0;w<3;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;if(ta&&z!==void 0&&o)for(w=0;w<3;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&
+o)for(w=0;w<3;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+2,T+=3,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+2,Y[R+4]=ia+1,Y[R+5]=ia+2,R+=6,ia+=3)}else if(y instanceof THREE.Face4){if(ua)H=Ba[y.a].position,L=Ba[y.b].position,M=Ba[y.c].position,I=Ba[y.d].position,na[J]=H.x,na[J+1]=H.y,na[J+2]=H.z,na[J+3]=L.x,na[J+4]=L.y,na[J+5]=L.z,na[J+6]=M.x,na[J+7]=M.y,na[J+8]=M.z,na[J+9]=I.x,na[J+10]=I.y,na[J+11]=I.z,J+=12;if(aa){w=0;for(D=aa.length;w<D;w++)if(n=aa[w],n.__original.needsUpdate)s=
 n.offset,V=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[y.a],n.array[s+1]=n.value[y.b],n.array[s+2]=n.value[y.c],n.array[s+3]=n.value[y.d]):n.boundTo==="faces"?(V=n.value[V],n.array[s]=V,n.array[s+1]=V,n.array[s+2]=V,n.array[s+3]=V,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[V],n.array[s+1]=n.value[V+1],n.array[s+2]=n.value[V+2],n.array[s+3]=n.value[V+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],
 L=n.value[y.b],M=n.value[y.c],I=n.value[y.d]):n.boundTo==="faces"?(I=M=L=H=V=n.value[V],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[V],L=n.value[V+1],M=n.value[V+2],I=n.value[V+3],n.offsetSrc+=4),n.size===2?(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=L.x,n.array[s+3]=L.y,n.array[s+4]=M.x,n.array[s+5]=M.y,n.array[s+6]=I.x,n.array[s+7]=I.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=H.r,n.array[s+1]=H.g,n.array[s+2]=H.b,n.array[s+3]=L.r,n.array[s+4]=L.g,n.array[s+5]=L.b,n.array[s+
 6]=M.r,n.array[s+7]=M.g,n.array[s+8]=M.b,n.array[s+9]=I.r,n.array[s+10]=I.g,n.array[s+11]=I.b):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=L.x,n.array[s+4]=L.y,n.array[s+5]=L.z,n.array[s+6]=M.x,n.array[s+7]=M.y,n.array[s+8]=M.z,n.array[s+9]=I.x,n.array[s+10]=I.y,n.array[s+11]=I.z),n.offset+=12):(n.array[s]=H.x,n.array[s+1]=H.y,n.array[s+2]=H.z,n.array[s+3]=H.w,n.array[s+4]=L.x,n.array[s+5]=L.y,n.array[s+6]=L.z,n.array[s+7]=L.w,n.array[s+8]=M.x,n.array[s+9]=M.y,n.array[s+10]=M.z,
@@ -287,13 +287,13 @@ n.array[s+11]=M.w,n.array[s+12]=I.x,n.array[s+13]=I.y,n.array[s+14]=I.z,n.array[
 2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=s.x,ga[x+9]=s.y,ga[x+10]=s.z,ga[x+11]=s.w,ga[x+12]=n.x,ga[x+13]=n.y,ga[x+14]=n.z,ga[x+15]=n.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],n=Oa[y.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=s.x,fa[x+9]=s.y,fa[x+10]=s.z,fa[x+11]=s.w,fa[x+12]=n.x,fa[x+13]=n.y,fa[x+14]=n.z,fa[x+15]=n.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],n=Ma[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,
 da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=1,da[x+12]=n.x,da[x+13]=n.y,da[x+14]=n.z,da[x+15]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],y=Na[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=1,ea[x+12]=y.x,ea[x+13]=y.y,ea[x+14]=y.z,ea[x+15]=1,x+=16;if(Ca&&A)F.length===4&&A===THREE.VertexColors?(y=F[0],w=F[1],D=F[2],F=F[3]):F=D=w=y=N,oa[la]=y.r,oa[la+1]=y.g,oa[la+2]=y.b,oa[la+3]=w.r,
 oa[la+4]=w.g,oa[la+5]=w.b,oa[la+6]=D.r,oa[la+7]=D.g,oa[la+8]=D.b,oa[la+9]=F.r,oa[la+10]=F.g,oa[la+11]=F.b,la+=12;if(Aa&&sa.hasTangents)F=O[0],N=O[1],y=O[2],O=O[3],ca[Z]=F.x,ca[Z+1]=F.y,ca[Z+2]=F.z,ca[Z+3]=F.w,ca[Z+4]=N.x,ca[Z+5]=N.y,ca[Z+6]=N.z,ca[Z+7]=N.w,ca[Z+8]=y.x,ca[Z+9]=y.y,ca[Z+10]=y.z,ca[Z+11]=y.w,ca[Z+12]=O.x,ca[Z+13]=O.y,ca[Z+14]=O.z,ca[Z+15]=O.w,Z+=16;if(za&&C)if(B.length===4&&xa)for(w=0;w<4;w++)E=B[w],W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=E.z,Q+=3;else for(w=0;w<4;w++)W[Q]=E.x,W[Q+1]=E.y,W[Q+2]=
-E.z,Q+=3;if(ta&&z!==void 0&&m)for(w=0;w<4;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&m)for(w=0;w<4;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(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,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+3,Y[R+4]=ia+1,Y[R+5]=ia+2,Y[R+6]=ia+2,Y[R+7]=ia+3,R+=8,ia+=4)}ua&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(aa){w=0;for(D=aa.length;w<D;w++)n=aa[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
-n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,l))}if(Da){w=0;for(D=Ga.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,ra[w],l)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));za&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,W,l));Aa&&sa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l));ta&&X>0&&(d.bindBuffer(d.ARRAY_BUFFER,
-r.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ta&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ka,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ha,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,Y,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexBBuffer),
-d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l));p&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}h.__dirtyVertices=
-!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&wa(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=q=p=p=void 0;t=i.vertices;o=i.colors;m=t.length;r=o.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<m;p++)q=t[p].position,k=p*3,A[k]=q.x,A[k+1]=q.y,A[k+2]=q.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-A,j)}if(C){for(p=0;p<r;p++)color=o[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=q=p=p=void 0;t=i.vertices;o=i.colors;m=t.length;r=o.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<m;p++)q=t[p].position,k=p*3,A[k]=q.x,A[k+1]=q.y,A[k+
-2]=q.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,A,j)}if(C){for(p=0;p<r;p++)color=o[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,r),l=j.attributes&&va(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
+E.z,Q+=3;if(ta&&z!==void 0&&o)for(w=0;w<4;w++)B=z[w],ja[X]=B.u,ja[X+1]=B.v,X+=2;if(ta&&U!==void 0&&o)for(w=0;w<4;w++)B=U[w],ka[$]=B.u,ka[$+1]=B.v,$+=2;ya&&(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,Y[R]=ia,Y[R+1]=ia+1,Y[R+2]=ia,Y[R+3]=ia+3,Y[R+4]=ia+1,Y[R+5]=ia+2,Y[R+6]=ia+2,Y[R+7]=ia+3,R+=8,ia+=4)}ua&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(aa){w=0;for(D=aa.length;w<D;w++)n=aa[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
+n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,l))}if(Da){w=0;for(D=Ga.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,ra[w],l)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));za&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,W,l));Aa&&sa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l));ta&&X>0&&(d.bindBuffer(d.ARRAY_BUFFER,
+q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ta&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ka,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ha,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,Y,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),
+d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l));p&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}h.__dirtyVertices=
+!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&wa(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=p=p=void 0;t=i.vertices;m=i.colors;o=t.length;q=m.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<o;p++)r=t[p].position,k=p*3,A[k]=r.x,A[k+1]=r.y,A[k+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+A,j)}if(C){for(p=0;p<q;p++)color=m[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=p=p=void 0;t=i.vertices;m=i.colors;o=t.length;q=m.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<o;p++)r=t[p].position,k=p*3,A[k]=r.x,A[k+1]=r.y,A[k+
+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,A,j)}if(C){for(p=0;p<q;p++)color=m[p],k=p*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,q),l=j.attributes&&va(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
 wa(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};

+ 4 - 0
examples/webgl_materials_cubemap_dynamic.html

@@ -987,6 +987,9 @@
 
 					cubeCamera.updatePosition( currentCar.root.position );
 
+					renderer.autoUpdateObjects = false;
+					renderer.initWebGLObjects( scene );
+
 					renderer.autoClear = true;
 					cubeCamera.updateCubeMap( renderer, scene );
 
@@ -999,6 +1002,7 @@
 
 				renderer.autoClear = false;
 				renderer.shadowMapEnabled = true;
+				renderer.autoUpdateObjects = true;
 
 				camera.lookAt( cameraTarget );
 

+ 4 - 4
examples/webgl_particles_dynamic.html

@@ -403,9 +403,9 @@
 
 					// all down
 
-					if ( data.down == vl ) {
+					if ( data.down === vl ) {
 
-						if ( data.delay == 0 ) {
+						if ( data.delay === 0 ) {
 
 							data.direction = 1;
 							data.speed = 10;
@@ -429,9 +429,9 @@
 
 					// all up
 
-					if ( data.up == vl ) {
+					if ( data.up === vl ) {
 
-						if ( data.delay == 0 ) {
+						if ( data.delay === 0 ) {
 
 							data.direction = -1;
 							data.speed = 35;

+ 5 - 1
examples/webgl_shading_physical.html

@@ -462,7 +462,6 @@
 				renderer.gammaOutput = true;
 				renderer.physicallyBasedShading = true;
 
-
 				// STATS
 
 				stats = new Stats();
@@ -617,6 +616,9 @@
 
 				// render shadow map
 
+				renderer.autoUpdateObjects = false;
+
+				renderer.initWebGLObjects( scene );
 				renderer.updateShadowMap( scene, camera );
 
 				// render cube map
@@ -632,6 +634,8 @@
 
 				// render scene
 
+				renderer.autoUpdateObjects = true;
+
 				//renderer.render( scene, camera );
 				//renderer.clearTarget( null, 1, 1, 1 );
 				composer.render( 0.1 );

+ 6 - 6
src/renderers/WebGLRenderer.js

@@ -105,6 +105,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.sortObjects = true;
 
+	this.autoUpdateObjects = true;
+
 	// physically based shading
 
 	this.gammaInput = false;
@@ -3629,8 +3631,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_projScreenMatrix.multiply( _cameraLight.projectionMatrix, _cameraLight.matrixWorldInverse );
 				computeFrustum( _projScreenMatrix );
 
-				_this.initWebGLObjects( scene );
-
 				setRenderTarget( shadowMap );
 
 				// using arbitrary clear color in depth pass
@@ -3782,6 +3782,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		_currentMaterialId = -1;
 
+		if ( this.autoUpdateObjects ) this.initWebGLObjects( scene );
+
 		if ( this.shadowMapEnabled && this.shadowMapAutoUpdate ) renderShadowMap( scene, camera );
 
 		_this.info.render.calls = 0;
@@ -3812,8 +3814,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
 		computeFrustum( _projScreenMatrix );
 
-		this.initWebGLObjects( scene );
-
 		setRenderTarget( renderTarget );
 
 		if ( this.autoClear || forceClear ) {
@@ -3845,9 +3845,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					if ( this.sortObjects ) {
 
-						if ( webglObject.object.renderDepth ) {
+						if ( object.renderDepth ) {
 
-							webglObject.z = webglObject.object.renderDepth;
+							webglObject.z = object.renderDepth;
 
 						} else {