Browse Source

Moved matrixWorldInverse logic to renderers as per @greggman suggestion.
Now `Camera` can use inherited `update()`

Mr.doob 14 years ago
parent
commit
df94d2af57

+ 134 - 136
build/Three.js

@@ -54,18 +54,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,t=[],u,v,p=[],x,w=[],z,y,A=[],E,F,D=[],G=[],K=[],N=new THREE.Vector4,L=new THREE.Vector4,
-B=new THREE.Matrix4,M=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,
-b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,m){var o,n;h=G.length=0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var t;if(!(t=!n.visible))if(t=n instanceof THREE.Mesh)if(t=n.frustumCulled){a:{t=void 0;for(var u=n.matrixWorld,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(t=U[p].x*u.n14+U[p].y*u.n24+U[p].z*u.n34+U[p].w,t<=w){t=!1;break a}t=!0}t=
-!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,N.copy(n.position),B.multiplyVector3(N),f.object=n,f.z=N.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var o=k.near,G=k.far,N,ha,fa,oa,ca,ja,la,da,X,V,aa,ia,ra,ma,ga,na,qa;F=y=x=v=K.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);U[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);U[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);
-U[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);U[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);U[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);U[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(N=0;N<6;N++)X=U[N],X.divideScalar(Math.sqrt(X.x*X.x+X.y*X.y+X.z*X.z));X=this.projectObjects(f,k,!0);f=0;for(N=X.length;f<N;f++)if(V=X[f].object,V.visible)if(aa=V.matrixWorld,ia=V.matrixRotationWorld,ra=V.materials,ma=V.overdraw,n=0,V instanceof THREE.Mesh){ga=V.geometry;
-oa=ga.vertices;na=ga.faces;ga=ga.faceVertexUvs;ha=0;for(fa=oa.length;ha<fa;ha++)m=b(),m.positionWorld.copy(oa[ha].position),aa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;oa=0;for(ha=na.length;oa<ha;oa++){fa=na[oa];if(fa instanceof THREE.Face3)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],ca.visible&&ja.visible&&la.visible&&
-(V.doubleSided||V.flipSided!=(la.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(la.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0))da=p[v]=p[v]||new THREE.RenderableFace3,v++,u=da,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la);else continue;else if(fa instanceof THREE.Face4)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],da=t[fa.d],ca.visible&&ja.visible&&la.visible&&da.visible&&(V.doubleSided||V.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*
-(ja.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0||(ja.positionScreen.x-la.positionScreen.x)*(da.positionScreen.y-la.positionScreen.y)-(ja.positionScreen.y-la.positionScreen.y)*(da.positionScreen.x-la.positionScreen.x)<0)))qa=w[x]=w[x]||new THREE.RenderableFace4,x++,u=qa,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la),u.v4.copy(da);else continue;u.normalWorld.copy(fa.normal);ia.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);
-aa.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);B.multiplyVector3(u.centroidScreen);la=fa.vertexNormals;ca=0;for(ja=la.length;ca<ja;ca++)da=u.vertexNormalsWorld[ca],da.copy(la[ca]),ia.multiplyVector3(da);ca=0;for(ja=ga.length;ca<ja;ca++)if(qa=ga[ca][oa]){la=0;for(da=qa.length;la<da;la++)u.uvs[ca][la]=qa[la]}u.meshMaterials=ra;u.faceMaterials=fa.materials;u.overdraw=ma;u.z=u.centroidScreen.z;K.push(u)}}else if(V instanceof THREE.Line){M.multiply(B,aa);oa=V.geometry.vertices;
-ca=b();ca.positionScreen.copy(oa[0].position);M.multiplyVector4(ca.positionScreen);ha=1;for(fa=oa.length;ha<fa;ha++)if(ca=b(),ca.positionScreen.copy(oa[ha].position),M.multiplyVector4(ca.positionScreen),ja=t[n-2],I.copy(ca.positionScreen),S.copy(ja.positionScreen),e(I,S))I.multiplyScalar(1/I.w),S.multiplyScalar(1/S.w),aa=A[y]=A[y]||new THREE.RenderableLine,y++,z=aa,z.v1.positionScreen.copy(I),z.v2.positionScreen.copy(S),z.z=Math.max(I.z,S.z),z.materials=V.materials,K.push(z)}else if(V instanceof THREE.Particle&&
-(L.set(V.matrixWorld.n14,V.matrixWorld.n24,V.matrixWorld.n34,1),B.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))aa=D[F]=D[F]||new THREE.RenderableParticle,F++,E=aa,E.x=L.x/L.w,E.y=L.y/L.w,E.z=L.z,E.rotation=V.rotation.z,E.scale.x=V.scale.x*Math.abs(E.x-(L.x+k.projectionMatrix.n11)/(L.w+k.projectionMatrix.n14)),E.scale.y=V.scale.y*Math.abs(E.y-(L.y+k.projectionMatrix.n22)/(L.w+k.projectionMatrix.n24)),E.materials=V.materials,K.push(E);h&&K.sort(c);return K}};
-THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,t=[],u,v,p=[],x,w=[],z,y,A=[],E,F,D=[],G=[],K=[],N=new THREE.Vector3,L=new THREE.Vector4,
+B=new THREE.Matrix4,M=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){THREE.Matrix4.makeInvert(c.matrixWorld,c.matrixWorldInverse);B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};
+this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,m){var o,n;h=G.length=0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var t;if(!(t=!n.visible))if(t=n instanceof THREE.Mesh)if(t=n.frustumCulled){a:{t=void 0;for(var u=n.matrixWorld,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(t=U[p].x*
+u.n14+U[p].y*u.n24+U[p].z*u.n34+U[p].w,t<=w){t=!1;break a}t=!0}t=!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,N.copy(n.position),B.multiplyVector3(N),f.object=n,f.z=N.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var o=k.near,G=k.far,N,ha,fa,oa,ca,ja,la,da,X,V,aa,ia,ra,ma,ga,na,qa;F=y=x=v=K.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);THREE.Matrix4.makeInvert(k.matrixWorld,k.matrixWorldInverse);B.multiply(k.projectionMatrix,k.matrixWorldInverse);
+U[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);U[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);U[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);U[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);U[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);U[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(N=0;N<6;N++)X=U[N],X.divideScalar(Math.sqrt(X.x*X.x+X.y*X.y+X.z*X.z));X=this.projectObjects(f,k,!0);f=0;for(N=X.length;f<N;f++)if(V=X[f].object,V.visible)if(aa=
+V.matrixWorld,ia=V.matrixRotationWorld,ra=V.materials,ma=V.overdraw,n=0,V instanceof THREE.Mesh){ga=V.geometry;oa=ga.vertices;na=ga.faces;ga=ga.faceVertexUvs;ha=0;for(fa=oa.length;ha<fa;ha++)m=b(),m.positionWorld.copy(oa[ha].position),aa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;oa=0;for(ha=na.length;oa<
+ha;oa++){fa=na[oa];if(fa instanceof THREE.Face3)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],ca.visible&&ja.visible&&la.visible&&(V.doubleSided||V.flipSided!=(la.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(la.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0))da=p[v]=p[v]||new THREE.RenderableFace3,v++,u=da,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la);else continue;else if(fa instanceof THREE.Face4)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],da=t[fa.d],
+ca.visible&&ja.visible&&la.visible&&da.visible&&(V.doubleSided||V.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0||(ja.positionScreen.x-la.positionScreen.x)*(da.positionScreen.y-la.positionScreen.y)-(ja.positionScreen.y-la.positionScreen.y)*(da.positionScreen.x-la.positionScreen.x)<0)))qa=w[x]=w[x]||new THREE.RenderableFace4,x++,u=qa,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la),
+u.v4.copy(da);else continue;u.normalWorld.copy(fa.normal);ia.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);aa.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);B.multiplyVector3(u.centroidScreen);la=fa.vertexNormals;ca=0;for(ja=la.length;ca<ja;ca++)da=u.vertexNormalsWorld[ca],da.copy(la[ca]),ia.multiplyVector3(da);ca=0;for(ja=ga.length;ca<ja;ca++)if(qa=ga[ca][oa]){la=0;for(da=qa.length;la<da;la++)u.uvs[ca][la]=qa[la]}u.meshMaterials=ra;u.faceMaterials=fa.materials;
+u.overdraw=ma;u.z=u.centroidScreen.z;K.push(u)}}else if(V instanceof THREE.Line){M.multiply(B,aa);oa=V.geometry.vertices;ca=b();ca.positionScreen.copy(oa[0].position);M.multiplyVector4(ca.positionScreen);ha=1;for(fa=oa.length;ha<fa;ha++)if(ca=b(),ca.positionScreen.copy(oa[ha].position),M.multiplyVector4(ca.positionScreen),ja=t[n-2],I.copy(ca.positionScreen),S.copy(ja.positionScreen),e(I,S))I.multiplyScalar(1/I.w),S.multiplyScalar(1/S.w),aa=A[y]=A[y]||new THREE.RenderableLine,y++,z=aa,z.v1.positionScreen.copy(I),
+z.v2.positionScreen.copy(S),z.z=Math.max(I.z,S.z),z.materials=V.materials,K.push(z)}else if(V instanceof THREE.Particle&&(L.set(V.matrixWorld.n14,V.matrixWorld.n24,V.matrixWorld.n34,1),B.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))aa=D[F]=D[F]||new THREE.RenderableParticle,F++,E=aa,E.x=L.x/L.w,E.y=L.y/L.w,E.z=L.z,E.rotation=V.rotation.z,E.scale.x=V.scale.x*Math.abs(E.x-(L.x+k.projectionMatrix.n11)/(L.w+k.projectionMatrix.n14)),E.scale.y=V.scale.y*Math.abs(E.y-(L.y+k.projectionMatrix.n22)/(L.w+k.projectionMatrix.n24)),
+E.materials=V.materials,K.push(E);h&&K.sort(c);return K}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
@@ -88,12 +88,10 @@ e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[
 THREE.Spline=function(b){function c(b,c,e,f,k,h,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*h+b*k+c}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,m,n,t,u,v,p,x;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);m=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;u=this.points[e[0]];v=this.points[e[1]];
 p=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(u.x,v.x,p.x,x.x,m,n,t);f.y=c(u.y,v.y,p.y,x.y,m,n,t);f.z=c(u.z,v.z,p.z,x.z,m,n,t);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);e=this.points.length*b;k.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
 n+=h.distanceTo(k),k.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(m[c]=n,f=c);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,k,h,m,n=[],t=new THREE.Vector3,u=this.getLength();n.push(t.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=u.chunks[c]-u.chunks[c-1];m=Math.ceil(b*e/u.total);k=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<m-1;e++)f=k+e*(1/m)*(h-k),position=this.getPoint(f),n.push(t.copy(position).clone());
-n.push(t.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];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(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
-THREE.OrthographicCamera=function(b,c,e,f,h,k){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=f;this.near=h!==void 0?h:0.1;this.far=k!==void 0?k:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(b,c,e,f){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,e,f,h,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=k;this.updateProjectionMatrix()};
+n.push(t.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];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.projectionMatrix=new THREE.Matrix4;this.matrixWorldInverse=new THREE.Matrix4};
+THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,c,e,f,h,k){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=f;this.near=h!==void 0?h:0.1;this.far=k!==void 0?k:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
+THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(b,c,e,f){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
+THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,e,f,h,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=k;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.PointLight.prototype=new THREE.Light;
@@ -149,10 +147,10 @@ THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addCh
 THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var t,u,v,p,x,w,z,y;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*k+k;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)w.strokeStyle=F=b}function h(b){if(D!=b)w.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-u,v,p,x,w=t.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,F=null,D=null,G=null,K=null,N=null,L,B,M,U,I=new THREE.RenderableVertex,S=new THREE.RenderableVertex,Q,Y,W,o,$,T,ha,fa,oa,ca,ja,la,da=new THREE.Color(0),X=new THREE.Color(0),V=new THREE.Color(0),aa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],ma,ga,na,qa,wa,Ca,Fa,Ea,Da,Ga,ya=new THREE.Rectangle,H=new THREE.Rectangle,Z=new THREE.Rectangle,ea=!1,ka=new THREE.Color,O=new THREE.Color,va=new THREE.Color,ua=new THREE.Color,pa=new THREE.Vector3,
+u,v,p,x,w=t.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,F=null,D=null,G=null,K=null,N=null,L,B,M,U,I=new THREE.RenderableVertex,S=new THREE.RenderableVertex,Q,Y,W,o,$,T,ha,fa,oa,ca,ja,la,da=new THREE.Color(0),X=new THREE.Color(0),V=new THREE.Color(0),aa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],ma,ga,na,qa,wa,Ca,Fa,Ea,Da,Ga,ya=new THREE.Rectangle,H=new THREE.Rectangle,Z=new THREE.Rectangle,ea=!1,ka=new THREE.Color,O=new THREE.Color,ua=new THREE.Color,va=new THREE.Color,pa=new THREE.Vector3,
 za,Ha,Aa,sa,Ia,R,b=16;za=document.createElement("canvas");za.width=za.height=2;Ha=za.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);Aa=Ha.getImageData(0,0,2,2);sa=Aa.data;Ia=document.createElement("canvas");Ia.width=Ia.height=b;R=Ia.getContext("2d");R.translate(-b/2,-b/2);R.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){u=b;v=c;p=Math.floor(u/2);x=Math.floor(v/2);t.width=u;
 t.height=v;ya.set(-p,-x,p,x);H.set(-p,-x,p,x);A=1;E=0;N=K=G=D=F=null};this.setClearColor=function(b,c){z.copy(b);y=c;H.set(-p,-x,p,x)};this.setClearColorHex=function(b,c){z.setHex(b);y=c;H.set(-p,-x,p,x)};this.clear=function(){w.setTransform(1,0,0,-1,p,x);H.isEmpty()||(H.minSelf(ya),H.inflate(2),y<1&&w.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+
-Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;O.setRGB(0,0,0);va.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):e instanceof THREE.DirectionalLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function v(b,
+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;O.setRGB(0,0,0);ua.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):e instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):e instanceof THREE.PointLight&&(va.r+=f.r,va.g+=f.g,va.b+=f.b)}function v(b,
 c,e,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function y(b,k,m){c(m.opacity);e(m.blending);var o,n,t,u,v,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)u=
 m.map.image,v=u.width>>1,xa=u.height>>1,m=k.scale.x*p,t=k.scale.y*x,o=m*v,n=t*xa,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),ya.intersects(Z)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-t),w.translate(-v,-xa),w.drawImage(u,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*p,n=k.scale.y*x,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),ya.intersects(Z)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
 w.restore()))}function A(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)w.lineWidth=G=b;b=m.linecap;if(K!=b)w.lineCap=K=b;b=m.linejoin;if(N!=b)w.lineJoin=N=b;f(m.color.getContextStyle());w.stroke();Z.inflate(m.linewidth*2)}}function z(b,f,h,m,n,u,p,w,x){k.info.render.vertices+=3;k.info.render.faces++;c(w.opacity);e(w.blending);
@@ -225,53 +223,53 @@ THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.len
 for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(y)for(A in y){f=y[A];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[p]=z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=
 z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(H)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(y)for(A in y)if(f=y[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[p]=
 z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(H||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,c);if(y)for(A in y)if(f=y[A],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||W.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var k=0,m=W.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,p=f.uniforms;k!=T&&(o.useProgram(k),T=k,n=!0);if(f.id!=fa)fa=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Fa);if(e&&f.fog)if(p.fogColor.value=e.color,e instanceof
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,p=f.uniforms;h!=T&&(o.useProgram(h),T=h,n=!0);if(f.id!=fa)fa=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Fa);if(e&&f.fog)if(p.fogColor.value=e.color,e instanceof
 THREE.Fog)p.fogNear.value=e.near,p.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)p.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,u,w=0,v=0,x=0,H,y,z,A=Ga,ea=A.directional.colors,Z=A.directional.positions,E=A.point.colors,F=A.point.positions,D=A.point.distances,G=0,ka=0,e=t=z=0,n=c.length;e<n;e++)if(t=c[e],u=t.color,H=t.position,y=t.intensity,z=t.distance,t instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(t instanceof
 THREE.DirectionalLight)z=G*3,ea[z]=u.r*y,ea[z+1]=u.g*y,ea[z+2]=u.b*y,Z[z]=H.x,Z[z+1]=H.y,Z[z+2]=H.z,G+=1;else if(t instanceof THREE.SpotLight)z=G*3,ea[z]=u.r*y,ea[z+1]=u.g*y,ea[z+2]=u.b*y,u=1/H.length(),Z[z]=H.x*u,Z[z+1]=H.y*u,Z[z+2]=H.z*u,G+=1;else if(t instanceof THREE.PointLight)t=ka*3,E[t]=u.r*y,E[t+1]=u.g*y,E[t+2]=u.b*y,F[t]=H.x,F[t+1]=H.y,F[t+2]=H.z,D[ka]=z,ka+=1;e=G*3;for(n=ea.length;e<n;e++)ea[e]=0;e=ka*3;for(n=E.length;e<n;e++)E[e]=0;A.point.length=ka;A.directional.length=G;A.ambient[0]=
 w;A.ambient[1]=v;A.ambient[2]=x;c=Ga;p.enableLighting.value=c.directional.length+c.point.length;p.ambientLightColor.value=c.ambient;p.directionalLightColor.value=c.directional.colors;p.directionalLightDirection.value=c.directional.positions;p.pointLightColor.value=c.point.colors;p.pointLightPosition.value=c.point.positions;p.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=
 f.color,p.opacity.value=f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=
-f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=ya.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(c=0;c<pa.length;c++)p.shadowMatrix.value[c]=
-pa[c],p.shadowMap.texture[c]=W.shadowMap[c];p.shadowDarkness.value=W.shadowMapDarkness;p.shadowBias.value=W.shadowMapBias}c=f.uniformsList;p=0;for(e=c.length;p<e;p++)if(v=k.uniforms[c[p][1]])if(w=c[p][0],x=w.type,n=w.value,x=="i")o.uniform1i(v,n);else if(x=="f")o.uniform1f(v,n);else if(x=="v2")o.uniform2f(v,n.x,n.y);else if(x=="v3")o.uniform3f(v,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(v,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(v,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(v,n);else if(x=="fv")o.uniform3fv(v,
+f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=ya.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(c=0;c<pa.length;c++)p.shadowMatrix.value[c]=
+pa[c],p.shadowMap.texture[c]=W.shadowMap[c];p.shadowDarkness.value=W.shadowMapDarkness;p.shadowBias.value=W.shadowMapBias}c=f.uniformsList;p=0;for(e=c.length;p<e;p++)if(v=h.uniforms[c[p][1]])if(w=c[p][0],x=w.type,n=w.value,x=="i")o.uniform1i(v,n);else if(x=="f")o.uniform1f(v,n);else if(x=="v2")o.uniform2f(v,n.x,n.y);else if(x=="v3")o.uniform3f(v,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(v,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(v,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(v,n);else if(x=="fv")o.uniform3fv(v,
 n);else if(x=="v3v"){if(!w._array)w._array=new Float32Array(3*n.length);x=0;for(H=n.length;x<H;x++)A=x*3,w._array[A]=n[x].x,w._array[A+1]=n[x].y,w._array[A+2]=n[x].z;o.uniform3fv(v,w._array)}else if(x=="m4"){if(!w._array)w._array=new Float32Array(16);n.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="m4v"){if(!w._array)w._array=new Float32Array(16*n.length);x=0;for(H=n.length;x<H;x++)n[x].flattenToArrayOffset(w._array,x*16);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="t"){if(o.uniform1i(v,
 n),v=w.texture)if(v.image instanceof Array&&v.image.length==6){if(w=v,w.image.length==6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[n]);B(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof
 THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):M(v,n)}else if(x=="tv"){if(!w._array){w._array=[];x=0;for(H=w.texture.length;x<H;x++)w._array[x]=n+x}o.uniform1iv(v,w._array);x=0;for(H=w.texture.length;x<H;x++)(v=w.texture[x])&&M(v,w._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Ea);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,h._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&
-m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,c,f,h,k,m){if(h.opacity!=0){var n,f=e(b,c,f,h,m),b=f.attributes,c=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=oa&&(oa=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),
-o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;p<h.numSupportedMorphTargets&&p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=u[t[p]],p++;else{var t=[],w=-1,
-x=0,u=m.morphTargetInfluences,v,H=u.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<h.numSupportedMorphTargets;){for(v=0;v<H;v++)!t[v]&&u[v]>w&&(x=v,w=u[x]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[x]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=w;t[x]=1;w=-1;p++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=
-0&&(f=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
-k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
-o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,
-o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=k.__webglFaceCount,W.info.render.faces+=k.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),W.info.render.calls++):
-m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,k,h,m,n,p,t,u,w,x,v=b.count*3;for(x=0;x<v;x+=9)e=b.normalArray,f=e[x],k=e[x+1],h=e[x+2],m=e[x+3],p=e[x+4],u=e[x+5],n=e[x+6],t=e[x+7],w=e[x+8],f=(f+m+n)/3,k=(k+p+t)/3,h=(h+u+w)/3,e[x]=f,e[x+1]=k,e[x+2]=h,e[x+3]=f,e[x+4]=k,e[x+5]=h,e[x+6]=f,e[x+7]=k,e[x+8]=h}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
+THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Ea);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
+m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id*2+(k.wireframe?1:0);f!=oa&&(oa=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
+o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;p<k.numSupportedMorphTargets&&p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=u[t[p]],p++;else{var t=[],w=-1,
+x=0,u=m.morphTargetInfluences,v,H=u.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<k.numSupportedMorphTargets;){for(v=0;v<H;v++)!t[v]&&u[v]>w&&(x=v,w=u[x]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=w;t[x]=1;w=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
+0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
+h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
+o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
+o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
+m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,p,t,u,w,x,v=b.count*3;for(x=0;x<v;x+=9)e=b.normalArray,f=e[x],h=e[x+1],k=e[x+2],m=e[x+3],p=e[x+4],u=e[x+5],n=e[x+6],t=e[x+7],w=e[x+8],f=(f+m+n)/3,h=(h+p+t)/3,k=(k+u+w)/3,e[x]=f,e[x+1]=h,e[x+2]=k,e[x+3]=f,e[x+4]=h,e[x+5]=k,e[x+6]=f,e[x+7]=h,e[x+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
 0,b.count);b.count=0}function k(b){if(ja!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ja=b.doubleSided;if(la!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),la=b.flipSided}function m(b){X!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),X=b)}function n(b){V!=b&&(o.depthMask(b),V=b)}function t(b,c,e){aa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),aa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=c,ra=e}function u(b){wa[0].set(b.n41-
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=wa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function v(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*c.n14+wa[f].y*c.n24+wa[f].z*c.n34+wa[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,k=b.opaque,h=b.transparent;h.count=0;b=k.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(k,e)}function w(b){var c,e,f,k,h=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=m.materials.length;c<e;c++)(k=m.materials[c])&&(k.transparent?p(o,k):p(n,k))}else(k=c)&&(k.transparent?p(o,k):p(n,k))}function z(b,c){return c.z-b.z}function y(b){var c,n,p,t=0,w,x,H,y,z=b.lights;ua||(ua=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){fa=-1;W.shadowMap[t]||(W.shadowMap[t]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[t]||(pa[t]=new THREE.Matrix4);w=W.shadowMap[t];x=pa[t];ua.position.copy(p.position);ua.lookAt(p.target.position);ua.update(void 0,!0);b.update(void 0,!1,ua);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ua.projectionMatrix);x.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(Ea);ua.projectionMatrix.flattenToArray(Fa);Ca.multiply(ua.projectionMatrix,ua.matrixWorldInverse);
-u(Ca);W.initWebGLObjects(b);U(w);o.clearColor(1,1,1,1);W.clear();o.clearColor(ka.r,ka.g,ka.b,O);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(w=0;w<x;w++)H=b.__webglObjects[w],y=H.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||v(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,ua,!1),H.render=!0):H.render=!1:H.render=!1;m(!0);L(THREE.NormalBlending);for(w=0;w<x;w++)if(H=b.__webglObjects[w],H.render)y=H.object,buffer=H.buffer,k(y),H=y.customDepthMaterial?
-y.customDepthMaterial:y.geometry.morphTargets.length?Aa:Ha,f(ua,z,null,H,buffer,y);for(w=0;w<p;w++)H=b.__webglObjectsImmediate[w],y=H.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),oa=-1,E(y,ua,!1),k(y),program=e(ua,z,null,Ha,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,wa):y.render(function(b){h(b,program,Ha.shading)}));t++}}function A(b,c){var e,f,k;e=R.attributes;var h=R.uniforms,m=qa/na,n,p=[],t=na*0.5,w=qa*0.5,u=!0;
-o.useProgram(R.program);T=R.program;oa=X=da=-1;Ka||(o.enableVertexAttribArray(R.attributes.position),o.enableVertexAttribArray(R.attributes.uv),Ka=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,R.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,R.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Fa);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);e=0;
-for(f=b.__webglSprites.length;e<f;e++)if(k=b.__webglSprites[e],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);b.__webglSprites.sort(z);e=0;for(f=b.__webglSprites.length;e<f;e++)k=b.__webglSprites[e],k.visible&&k.opacity!=0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(k.position.x-
-t)/t,(w-k.position.y)/w,Math.max(0,Math.min(1,k.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,k.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray)),n=k.map.image.width/(k.scaleByViewport?qa:1),p[0]=n*m*k.scale.x,p[1]=n*k.scale.y,o.uniform2f(h.uvScale,k.uvScale.x,k.uvScale.y),o.uniform2f(h.uvOffset,k.uvOffset.x,k.uvOffset.y),o.uniform2f(h.alignment,k.alignment.x,k.alignment.y),o.uniform1f(h.opacity,k.opacity),o.uniform3f(h.color,
-k.color.r,k.color.g,k.color.b),o.uniform1f(h.rotation,k.rotation),o.uniform2fv(h.scale,p),k.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!k.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),L(k.blending),M(k.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(V)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function F(b){var c,e,f,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function K(b){function c(b){var k=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?k.push("undefined"):k.push(b[e].id);return k.join("_")}
-var e,f,k,h,m,n,o,p,t={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};k=0;for(h=b.faces.length;k<h;k++)m=b.faces[k],n=m.materials,o=c(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
-materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(k),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function N(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
+Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*c.n14+wa[f].y*c.n24+wa[f].z*c.n34+wa[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(k,e):p(h,e)}function w(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?p(o,h):p(n,h))}else(h=c)&&(h.transparent?p(o,h):p(n,h))}function z(b,c){return c.z-b.z}function y(b){var c,n,p,t=0,w,x,H,y,z=b.lights;va||(va=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){fa=-1;W.shadowMap[t]||(W.shadowMap[t]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[t]||(pa[t]=new THREE.Matrix4);w=W.shadowMap[t];x=pa[t];va.position.copy(p.position);va.lookAt(p.target.position);va.update(void 0,!0);b.update(void 0,!1,va);THREE.Matrix4.makeInvert(va.matrixWorld,va.matrixWorldInverse);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Ea);va.projectionMatrix.flattenToArray(Fa);
+Ca.multiply(va.projectionMatrix,va.matrixWorldInverse);u(Ca);W.initWebGLObjects(b);U(w);o.clearColor(1,1,1,1);W.clear();o.clearColor(ka.r,ka.g,ka.b,O);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(w=0;w<x;w++)H=b.__webglObjects[w],y=H.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||v(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,va,!1),H.render=!0):H.render=!1:H.render=!1;m(!0);L(THREE.NormalBlending);for(w=0;w<x;w++)if(H=b.__webglObjects[w],
+H.render)y=H.object,buffer=H.buffer,k(y),H=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?Aa:Ha,f(va,z,null,H,buffer,y);for(w=0;w<p;w++)H=b.__webglObjectsImmediate[w],y=H.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),oa=-1,E(y,va,!1),k(y),program=e(va,z,null,Ha,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,wa):y.render(function(b){h(b,program,Ha.shading)}));t++}}function A(b,c){var e,f,h;e=R.attributes;
+var k=R.uniforms,m=qa/na,n,p=[],t=na*0.5,w=qa*0.5,u=!0;o.useProgram(R.program);T=R.program;oa=X=da=-1;Ka||(o.enableVertexAttribArray(R.attributes.position),o.enableVertexAttribArray(R.attributes.uv),Ka=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,R.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,R.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Fa);
+o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,
+1),o.uniform3f(k.screenPosition,(h.position.x-t)/t,(w-h.position.y)/w,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),
+o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),L(h.blending),M(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(V)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function K(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
+var e,f,h,k,m,n,o,p,t={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
+materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function N(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
 o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}da=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)),
 o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function M(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
 THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);B(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function U(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
 b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);B(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),B(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format),
 b.width,b.height,0,Y(b.format),Y(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
 o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
-null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,k;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,k=f=0):(c=null,e=na,b=qa,f=ma,k=ga);c!=ha&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,k,e,b),ha=c)}function I(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
+null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=na,b=qa,f=ma,h=ga);c!=ha&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),ha=c)}function I(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
 o.bindTexture(o.TEXTURE_2D,null))}function S(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
 case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;
 case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,$=[],T=null,
 ha=null,fa=-1,oa=null,ca=0,ja=null,la=null,da=null,X=null,V=null,aa=null,ia=null,ra=null,ma=0,ga=0,na=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Fa=new Float32Array(16),Ea=new Float32Array(16),Da=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-H=b.stencil!==void 0?b.stencil:!0,Z=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ea=b.antialias!==void 0?b.antialias:!1,ka=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),O=b.clearAlpha!==void 0?b.clearAlpha:0,va=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
-!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ua,pa=[],b=THREE.ShaderLib.depthRGBA,za=THREE.UniformsUtils.clone(b.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:za}),Aa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+H=b.stencil!==void 0?b.stencil:!0,Z=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ea=b.antialias!==void 0?b.antialias:!1,ka=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),O=b.clearAlpha!==void 0?b.clearAlpha:0,ua=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
+!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var va,pa=[],b=THREE.ShaderLib.depthRGBA,za=THREE.UniformsUtils.clone(b.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:za}),Aa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
 uniforms:za,morphTargets:!0});Ha._shadowPass=!0;Aa._shadowPass=!0;try{if(!(o=ya.getContext("experimental-webgl",{antialias:ea,stencil:H,preserveDrawingBuffer:Z})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
 o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ka.r,ka.g,ka.b,O);this.context=o;var Ia=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);H=0;R.vertices[H++]=-1;R.vertices[H++]=-1;R.vertices[H++]=0;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=-1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=
 1;R.vertices[H++]=1;R.vertices[H++]=0;R.vertices[H++]=-1;R.vertices[H++]=1;R.vertices[H++]=0;H=R.vertices[H++]=0;R.faces[H++]=0;R.faces[H++]=1;R.faces[H++]=2;R.faces[H++]=0;R.faces[H++]=2;R.faces[H++]=3;R.vertexBuffer=o.createBuffer();R.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,R.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,R.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,R.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,R.faces,o.STATIC_DRAW);R.program=o.createProgram();
@@ -281,61 +279,61 @@ R.uniforms.scale=o.getUniformLocation(R.program,"scale");R.uniforms.alignment=o.
 function(b,c){ka.setHex(b);O=c;o.clearColor(ka.r,ka.g,ka.b,O)};this.setClearColor=function(b,c){ka.copy(b);O=c;o.clearColor(ka.r,ka.g,ka.b,O)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return O};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
 delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
 o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
-W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var k,h,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
+W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
 b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var t,w,u;t=u=p=0;for(w=c.length;t<w;t++)m=c[t],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
-p++;p+u<=va?t=u:(t=Math.ceil(va*u/(p+u)),p=va-t);m={directional:t,point:p};p=u=0;for(t=c.length;p<t;p++)w=c[p],w instanceof THREE.SpotLight&&w.castShadow&&u++;var x=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)x=f.bones.length;var v;a:{t=b.fragmentShader;w=b.vertexShader;var p=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+p++;p+u<=ua?t=u:(t=Math.ceil(ua*u/(p+u)),p=ua-t);m={directional:t,point:p};p=u=0;for(t=c.length;p<t;p++)w=c[p],w instanceof THREE.SpotLight&&w.castShadow&&u++;var x=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)x=f.bones.length;var v;a:{t=b.fragmentShader;w=b.vertexShader;var p=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
 maxDirLights:m.directional,maxPointLights:m.point,maxBones:x,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},H,f=[];n?f.push(n):(f.push(t),f.push(w));for(H in e)f.push(H),f.push(e[H]);n=f.join();H=0;for(f=$.length;H<f;H++)if($[H].code==n){v=$[H].program;break a}H=o.createProgram();f=[Ia?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(H,S("fragment",m+t));o.attachShader(H,S("vertex",f+w));o.linkProgram(H);o.getProgramParameter(H,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(H,o.VALIDATE_STATUS)+", gl error ["+
 o.getError()+"]");H.uniforms={};H.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in p)f.push(y);y=f;f=0;for(p=y.length;f<p;f++)t=y[f],H.uniforms[t]=o.getUniformLocation(H,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(v in c)f.push(v);
 v=f;y=0;for(c=v.length;y<c;y++)e=v[y],H.attributes[e]=o.getAttribLocation(H,e);H.id=$.length;$.push({program:H,code:n});W.info.memory.programs=$.length;v=H}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
-o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)y="morphTarget"+h,v[y]>=0&&(o.enableVertexAttribArray(v[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){U(b);
-this.clear(c,e,f)};this.render=function(b,c,p,H){var ea,Z,F,D,G,ka,B,ma,K=b.lights,ga=b.fog;fa=-1;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Fa);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(b);U(p);(this.autoClear||H)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(H=0;H<G;H++)if(ea=b.__webglObjects[H],B=ea.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||v(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),w(ea),ea.render=!0,this.sortObjects)ea.object.renderDepth?ea.z=ea.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),ea.z=Da.z)}else ea.render=!1;else ea.render=!1;this.sortObjects&&b.__webglObjects.sort(z);ka=b.__webglObjectsImmediate.length;
-for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(ea));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);L(b.overrideMaterial.blending);for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render)B=ea.object,ma=ea.buffer,k(B),f(c,K,ga,b.overrideMaterial,ma,B);for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(oa=-1,k(B),Z=e(c,K,ga,b.overrideMaterial,B),B.immediateRenderCallback?
-B.immediateRenderCallback(Z,o,wa):B.render(function(c){h(c,Z,b.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(H=G-1;H>=0;H--)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible){oa=-1;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],
-m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],
-B=ea.object,B.visible){oa=-1;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}}b.__webglSprites.length&&A(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&I(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
-[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,k=void 0,h=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups==void 0&&K(h),h.geometryGroups){if(m=h.geometryGroups[k],!m.__webglVertexBuffer){var n=
-m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=
-void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,x=void 0,v=x=void 0,H=void 0,y=void 0,z=y=p=0,A=x=u=void 0,x=t=A=u=w=void 0,v=n.geometry,H=v.faces,A=m.faces,w=0,u=A.length;w<u;w++)x=A[w],x=H[x],x instanceof THREE.Face3?(p+=3,y+=1,z+=3):x instanceof THREE.Face4&&(p+=4,y+=2,z+=4);for(var w=m,u=n,ea=A=H=void 0,Z=void 0,ea=void 0,x=[],H=0,A=u.materials.length;H<
-A;H++)if(ea=u.materials[H],ea instanceof THREE.MeshFaceMaterial){ea=0;for(l=w.materials.length;ea<l;ea++)(Z=w.materials[ea])&&x.push(Z)}else(Z=ea)&&x.push(Z);w=x;m.__materials=w;a:{H=u=void 0;A=w.length;for(u=0;u<A;u++)if(H=w[u],H.map||H.lightMap||H instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{A=H=void 0;x=w.length;for(H=0;H<x;H++)if(A=w[H],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:
-THREE.FlatShading;break a}A=!1}a:{x=H=void 0;ea=w.length;for(H=0;H<ea;H++)if(x=w[H],x.vertexColors){x=x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(p*3);if(A)m.__normalArray=new Float32Array(p*3);if(v.hasTangents)m.__tangentArray=new Float32Array(p*4);if(x)m.__colorArray=new Float32Array(p*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&
-n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];v=0;for(H=m.numMorphTargets;v<H;v++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=A==THREE.SmoothShading;
-m.__uvType=u;m.__vertexColorType=x;m.__normalType=A;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=z*2;v=0;for(H=w.length;v<H;v++)if(u=w[v],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){x=u.attributes[a];A={};for(t in x)A[t]=x[t];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,y=1,A.type==="v2"?y=2:A.type==="v3"?y=3:A.type==="v4"?y=4:A.type==="c"&&(y=3),A.size=y,A.array=
-new Float32Array(p*y),A.buffer=o.createBuffer(),A.buffer.belongsToAttribute=a,x.needsUpdate=!0,A.__original=x;m.__webglCustomAttributes[a]=A}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=h,n=m.vertices.length,
-m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&
-(h=e.geometry,!h.__webglVertexBuffer)){m=h;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=h;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;z=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(z=n.materials[t],z.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=
-z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(p*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
-originalAttribute;m.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)m=h.geometryGroups[k],N(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,N(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],
-count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&
-G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,t=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(m=k.geometryGroupsList[n],t=F(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=m,y=o.DYNAMIC_DRAW,z=!k.dynamic,t.__inittedArrays){var E=w=v=void 0,B=void 0,
-ka=E=void 0,ma=void 0,L=void 0,ga=void 0,I=Z=ea=x=A=H=u=void 0,M=void 0,va=void 0,J=B=ga=B=L=ma=void 0,C=void 0,O=C=J=ma=void 0,Q=void 0,X=O=C=J=E=E=ka=ga=B=O=C=J=Q=O=C=J=Q=O=C=J=void 0,na=0,V=0,S=0,qa=0,ua=0,U=0,R=0,Y=0,T=0,P=0,aa=0,O=J=0,O=void 0,pa=t.__vertexArray,wa=t.__uvArray,oa=t.__uv2Array,za=t.__normalArray,$=t.__tangentArray,fa=t.__colorArray,ca=t.__skinVertexAArray,ia=t.__skinVertexBArray,da=t.__skinIndexArray,ha=t.__skinWeightArray,la=t.__morphTargetsArrays,ja=t.__webglCustomAttributes,
-C=void 0,ra=t.__faceArray,Aa=t.__lineArray,Ha=t.__needsSmoothNormals,H=t.__vertexColorType,u=t.__uvType,A=t.__normalType,sa=h.geometry,Ca=sa.__dirtyVertices,Fa=sa.__dirtyElements,Ea=sa.__dirtyUvs,Da=sa.__dirtyNormals,ya=sa.__dirtyTangents,Ia=sa.__dirtyColors,Ga=sa.__dirtyMorphTargets,Ka=sa.vertices,cb=t.faces,fb=sa.faces,db=sa.faceVertexUvs[0],eb=sa.faceVertexUvs[1],Sa=sa.skinVerticesA,Ta=sa.skinVerticesB,Ua=sa.skinIndices,Ma=sa.skinWeights,La=sa.morphTargets;if(ja)for(X in ja)ja[X].offset=0,ja[X].offsetSrc=
-0;v=0;for(w=cb.length;v<w;v++)if(E=cb[v],B=fb[E],db&&(x=db[E]),eb&&(ea=eb[E]),E=B.vertexNormals,ka=B.normal,ma=B.vertexColors,L=B.color,ga=B.vertexTangents,B instanceof THREE.Face3){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,V+=9;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=
-C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c]):C.boundTo==="faces"?(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c]):C.boundTo==="faces"?(M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(Z=C.value[O],I=C.value[O+1],M=C.value[O+
-2],C.offsetSrc+=3),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+6]=M.x,C.array[J+7]=M.y,C.array[J+8]=M.z),C.offset+=9):(C.array[J]=Z.x,
-C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.offset+=12));if(Ga){J=0;for(C=La.length;J<C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,M=La[J].vertices[B.c].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z;aa+=9}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ha[P]=
-J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=O.y,ca[P+10]=O.z,ca[P+11]=1,J=Ta[B.a],C=Ta[B.b],O=
-Ta[B.c],ia[P]=J.x,ia[P+1]=J.y,ia[P+2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,P+=12;if(Ia&&H)ma.length==3&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2]):C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,T+=9;if(ya&&sa.hasTangents)ma=ga[0],L=ga[1],B=ga[2],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,
-$[R+10]=B.z,$[R+11]=B.w,R+=12;if(Da&&A)if(E.length==3&&Ha)for(ga=0;ga<3;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<3;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<3;ga++)E=x[ga],wa[S]=E.u,wa[S+1]=E.v,S+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<3;ga++)E=ea[ga],oa[qa]=E.u,oa[qa+1]=E.v,qa+=2;Fa&&(ra[ua]=na,ra[ua+1]=na+1,ra[ua+2]=na+2,ua+=3,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+2,Aa[Y+4]=na+1,Aa[Y+5]=na+2,Y+=6,na+=3)}else if(B instanceof
-THREE.Face4){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,va=Ka[B.d].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,pa[V+9]=va.x,pa[V+10]=va.y,pa[V+11]=va.z,V+=12;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c],C.array[J+3]=C.value[B.d]):C.boundTo==="faces"?
-(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.array[J+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.array[J+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c],va=C.value[B.d]):C.boundTo==="faces"?(va=M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(Z=C.value[O],I=C.value[O+1],M=C.value[O+2],va=C.value[O+3],C.offsetSrc+=
-4),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.array[J+6]=va.x,C.array[J+7]=va.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b,C.array[J+9]=va.r,C.array[J+10]=va.g,C.array[J+11]=va.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+
-6]=M.x,C.array[J+7]=M.y,C.array[J+8]=M.z,C.array[J+9]=va.x,C.array[J+10]=va.y,C.array[J+11]=va.z),C.offset+=12):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.array[J+12]=va.x,C.array[J+13]=va.y,C.array[J+14]=va.z,C.array[J+15]=va.w,C.offset+=16));if(Ga){J=0;for(C=La.length;J<C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,
-M=La[J].vertices[B.c].position,va=La[J].vertices[B.d].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z,O[aa+9]=va.x,O[aa+10]=va.y,O[aa+11]=va.z;aa+=12}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Q=Ma[B.d],ha[P]=J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,ha[P+12]=Q.x,ha[P+13]=Q.y,ha[P+14]=Q.z,ha[P+15]=Q.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],
-Q=Ua[B.d],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,da[P+12]=Q.x,da[P+13]=Q.y,da[P+14]=Q.z,da[P+15]=Q.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Q=Sa[B.d],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=O.y,ca[P+10]=O.z,ca[P+11]=1,ca[P+12]=Q.x,ca[P+13]=Q.y,ca[P+14]=Q.z,ca[P+15]=1,J=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],ia[P]=J.x,ia[P+1]=J.y,ia[P+
-2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,ia[P+12]=B.x,ia[P+13]=B.y,ia[P+14]=B.z,ia[P+15]=1,P+=16;if(Ia&&H)ma.length==4&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2],ma=ma[3]):ma=C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,fa[T+9]=ma.r,fa[T+10]=ma.g,fa[T+11]=ma.b,T+=12;if(ya&&sa.hasTangents)ma=ga[0],L=ga[1],B=ga[2],ga=ga[3],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,
-$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,$[R+10]=B.z,$[R+11]=B.w,$[R+12]=ga.x,$[R+13]=ga.y,$[R+14]=ga.z,$[R+15]=ga.w,R+=16;if(Da&&A)if(E.length==4&&Ha)for(ga=0;ga<4;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<4;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<4;ga++)E=x[ga],wa[S]=E.u,wa[S+1]=E.v,S+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<4;ga++)E=ea[ga],oa[qa]=E.u,oa[qa+1]=E.v,qa+=2;Fa&&(ra[ua]=na,ra[ua+1]=
-na+1,ra[ua+2]=na+3,ra[ua+3]=na+1,ra[ua+4]=na+2,ra[ua+5]=na+3,ua+=6,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+3,Aa[Y+4]=na+1,Aa[Y+5]=na+2,Aa[Y+6]=na+2,Aa[Y+7]=na+3,Y+=8,na+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,pa,y));if(ja)for(X in ja)C=ja[X],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Ga){J=0;for(C=La.length;J<C;J++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[J]),o.bufferData(o.ARRAY_BUFFER,
-la[J],y)}Ia&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));Da&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,za,y));ya&&sa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,y));Ea&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ea&&qa>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,oa,y));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
-t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,y));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
-ha,y));z&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;D(m)}else if(h instanceof THREE.Ribbon){k=
-h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=h.vertices;p=h.colors;u=w.length;t=p.length;H=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
-y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=h.vertices;p=h.colors;u=w.length;t=p.length;H=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+1]=color.g,
-y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=F(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,D(k)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
-o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ia}};
+o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(k in b.attributes)v[k]!==void 0&&v[k]>=0&&o.enableVertexAttribArray(v[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)y="morphTarget"+k,v[y]>=0&&(o.enableVertexAttribArray(v[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){U(b);
+this.clear(c,e,f)};this.render=function(b,c,p,H){var ea,Z,F,D,G,ka,B,ma,K=b.lights,ga=b.fog;fa=-1;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);THREE.Matrix4.makeInvert(c.matrixWorld,c.matrixWorldInverse);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Fa);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(b);
+U(p);(this.autoClear||H)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(H=0;H<G;H++)if(ea=b.__webglObjects[H],B=ea.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||v(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),w(ea),ea.render=!0,this.sortObjects)ea.object.renderDepth?ea.z=ea.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),ea.z=Da.z)}else ea.render=!1;else ea.render=!1;this.sortObjects&&
+b.__webglObjects.sort(z);ka=b.__webglObjectsImmediate.length;for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(ea));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);L(b.overrideMaterial.blending);for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render)B=ea.object,ma=ea.buffer,k(B),f(c,K,ga,b.overrideMaterial,ma,B);for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(oa=-1,
+k(B),Z=e(c,K,ga,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(c){h(c,Z,b.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(H=G-1;H>=0;H--)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible){oa=
+-1;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),
+f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible){oa=-1;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}}b.__webglSprites.length&&A(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&I(p)};this.initWebGLObjects=
+function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==
+void 0&&K(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=
+o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,x=void 0,v=x=void 0,H=void 0,y=void 0,z=y=p=0,A=x=u=void 0,x=t=A=u=w=void 0,v=n.geometry,H=v.faces,A=m.faces,w=0,u=A.length;w<u;w++)x=A[w],x=H[x],x instanceof THREE.Face3?(p+=3,y+=1,z+=3):x instanceof THREE.Face4&&(p+=4,y+=2,z+=
+4);for(var w=m,u=n,ea=A=H=void 0,Z=void 0,ea=void 0,x=[],H=0,A=u.materials.length;H<A;H++)if(ea=u.materials[H],ea instanceof THREE.MeshFaceMaterial){ea=0;for(l=w.materials.length;ea<l;ea++)(Z=w.materials[ea])&&x.push(Z)}else(Z=ea)&&x.push(Z);w=x;m.__materials=w;a:{H=u=void 0;A=w.length;for(u=0;u<A;u++)if(H=w[u],H.map||H.lightMap||H instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{A=H=void 0;x=w.length;for(H=0;H<x;H++)if(A=w[H],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=
+A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{x=H=void 0;ea=w.length;for(H=0;H<ea;H++)if(x=w[H],x.vertexColors){x=x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(p*3);if(A)m.__normalArray=new Float32Array(p*3);if(v.hasTangents)m.__tangentArray=new Float32Array(p*4);if(x)m.__colorArray=new Float32Array(p*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>
+1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];v=0;for(H=m.numMorphTargets;v<H;v++)m.__morphTargetsArrays.push(new Float32Array(p*
+3))}m.__needsSmoothNormals=A==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=x;m.__normalType=A;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=z*2;v=0;for(H=w.length;v<H;v++)if(u=w[v],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){x=u.attributes[a];A={};for(t in x)A[t]=x[t];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,y=1,A.type==="v2"?y=2:A.type==="v3"?y=3:A.type===
+"v4"?y=4:A.type==="c"&&(y=3),A.size=y,A.array=new Float32Array(p*y),A.buffer=o.createBuffer(),A.buffer.belongsToAttribute=a,x.needsUpdate=!0,A.__original=x;m.__webglCustomAttributes[a]=A}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),
+W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=
+!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;z=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(z=n.materials[t],z.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes=
+{};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(p*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],N(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,N(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?
+f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,
+1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,t=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],t=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=m,y=o.DYNAMIC_DRAW,
+z=!h.dynamic,t.__inittedArrays){var E=w=v=void 0,B=void 0,ka=E=void 0,ma=void 0,L=void 0,ga=void 0,I=Z=ea=x=A=H=u=void 0,M=void 0,ua=void 0,J=B=ga=B=L=ma=void 0,C=void 0,O=C=J=ma=void 0,Q=void 0,X=O=C=J=E=E=ka=ga=B=O=C=J=Q=O=C=J=Q=O=C=J=void 0,na=0,V=0,va=0,S=0,qa=0,U=0,R=0,Y=0,T=0,P=0,aa=0,O=J=0,O=void 0,pa=t.__vertexArray,wa=t.__uvArray,oa=t.__uv2Array,za=t.__normalArray,$=t.__tangentArray,fa=t.__colorArray,ca=t.__skinVertexAArray,ia=t.__skinVertexBArray,da=t.__skinIndexArray,ha=t.__skinWeightArray,
+la=t.__morphTargetsArrays,ja=t.__webglCustomAttributes,C=void 0,ra=t.__faceArray,Aa=t.__lineArray,Ha=t.__needsSmoothNormals,H=t.__vertexColorType,u=t.__uvType,A=t.__normalType,sa=k.geometry,Ca=sa.__dirtyVertices,Fa=sa.__dirtyElements,Ea=sa.__dirtyUvs,Da=sa.__dirtyNormals,ya=sa.__dirtyTangents,Ia=sa.__dirtyColors,Ga=sa.__dirtyMorphTargets,Ka=sa.vertices,cb=t.faces,fb=sa.faces,db=sa.faceVertexUvs[0],eb=sa.faceVertexUvs[1],Sa=sa.skinVerticesA,Ta=sa.skinVerticesB,Ua=sa.skinIndices,Ma=sa.skinWeights,La=
+sa.morphTargets;if(ja)for(X in ja)ja[X].offset=0,ja[X].offsetSrc=0;v=0;for(w=cb.length;v<w;v++)if(E=cb[v],B=fb[E],db&&(x=db[E]),eb&&(ea=eb[E]),E=B.vertexNormals,ka=B.normal,ma=B.vertexColors,L=B.color,ga=B.vertexTangents,B instanceof THREE.Face3){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,V+=9;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===
+1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c]):C.boundTo==="faces"?(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c]):C.boundTo==="faces"?(M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo===
+"faceVertices"&&(Z=C.value[O],I=C.value[O+1],M=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+6]=M.x,C.array[J+
+7]=M.y,C.array[J+8]=M.z),C.offset+=9):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.offset+=12));if(Ga){J=0;for(C=La.length;J<C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,M=La[J].vertices[B.c].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z;aa+=
+9}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ha[P]=J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=
+O.y,ca[P+10]=O.z,ca[P+11]=1,J=Ta[B.a],C=Ta[B.b],O=Ta[B.c],ia[P]=J.x,ia[P+1]=J.y,ia[P+2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,P+=12;if(Ia&&H)ma.length==3&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2]):C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,T+=9;if(ya&&sa.hasTangents)ma=ga[0],L=ga[1],B=ga[2],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=
+L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,$[R+10]=B.z,$[R+11]=B.w,R+=12;if(Da&&A)if(E.length==3&&Ha)for(ga=0;ga<3;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<3;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<3;ga++)E=x[ga],wa[va]=E.u,wa[va+1]=E.v,va+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<3;ga++)E=ea[ga],oa[S]=E.u,oa[S+1]=E.v,S+=2;Fa&&(ra[qa]=na,ra[qa+1]=na+1,ra[qa+2]=na+2,qa+=3,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+2,Aa[Y+4]=na+
+1,Aa[Y+5]=na+2,Y+=6,na+=3)}else if(B instanceof THREE.Face4){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,ua=Ka[B.d].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,pa[V+9]=ua.x,pa[V+10]=ua.y,pa[V+11]=ua.z,V+=12;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c],
+C.array[J+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.array[J+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.array[J+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c],ua=C.value[B.d]):C.boundTo==="faces"?(ua=M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(Z=C.value[O],I=
+C.value[O+1],M=C.value[O+2],ua=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.array[J+6]=ua.x,C.array[J+7]=ua.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b,C.array[J+9]=ua.r,C.array[J+10]=ua.g,C.array[J+11]=ua.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=
+Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+6]=M.x,C.array[J+7]=M.y,C.array[J+8]=M.z,C.array[J+9]=ua.x,C.array[J+10]=ua.y,C.array[J+11]=ua.z),C.offset+=12):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.array[J+12]=ua.x,C.array[J+13]=ua.y,C.array[J+14]=ua.z,C.array[J+15]=ua.w,C.offset+=16));if(Ga){J=0;for(C=La.length;J<
+C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,M=La[J].vertices[B.c].position,ua=La[J].vertices[B.d].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z,O[aa+9]=ua.x,O[aa+10]=ua.y,O[aa+11]=ua.z;aa+=12}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Q=Ma[B.d],ha[P]=J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,ha[P+12]=Q.x,
+ha[P+13]=Q.y,ha[P+14]=Q.z,ha[P+15]=Q.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Q=Ua[B.d],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,da[P+12]=Q.x,da[P+13]=Q.y,da[P+14]=Q.z,da[P+15]=Q.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Q=Sa[B.d],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=O.y,ca[P+10]=O.z,ca[P+11]=1,ca[P+12]=Q.x,ca[P+13]=Q.y,ca[P+14]=Q.z,ca[P+15]=
+1,J=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],ia[P]=J.x,ia[P+1]=J.y,ia[P+2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,ia[P+12]=B.x,ia[P+13]=B.y,ia[P+14]=B.z,ia[P+15]=1,P+=16;if(Ia&&H)ma.length==4&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2],ma=ma[3]):ma=C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,fa[T+9]=ma.r,fa[T+10]=ma.g,fa[T+11]=ma.b,T+=12;if(ya&&sa.hasTangents)ma=
+ga[0],L=ga[1],B=ga[2],ga=ga[3],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,$[R+10]=B.z,$[R+11]=B.w,$[R+12]=ga.x,$[R+13]=ga.y,$[R+14]=ga.z,$[R+15]=ga.w,R+=16;if(Da&&A)if(E.length==4&&Ha)for(ga=0;ga<4;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<4;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<4;ga++)E=x[ga],wa[va]=E.u,wa[va+1]=E.v,va+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<
+4;ga++)E=ea[ga],oa[S]=E.u,oa[S+1]=E.v,S+=2;Fa&&(ra[qa]=na,ra[qa+1]=na+1,ra[qa+2]=na+3,ra[qa+3]=na+1,ra[qa+4]=na+2,ra[qa+5]=na+3,qa+=6,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+3,Aa[Y+4]=na+1,Aa[Y+5]=na+2,Aa[Y+6]=na+2,Aa[Y+7]=na+3,Y+=8,na+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,pa,y));if(ja)for(X in ja)C=ja[X],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Ga){J=0;for(C=La.length;J<C;J++)o.bindBuffer(o.ARRAY_BUFFER,
+t.__webglMorphTargetsBuffers[J]),o.bufferData(o.ARRAY_BUFFER,la[J],y)}Ia&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));Da&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,za,y));ya&&sa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,y));Ea&&va>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ea&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),
+o.bufferData(o.ARRAY_BUFFER,oa,y));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,y));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,
+da,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));z&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=
+!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=k.vertices;p=k.colors;u=w.length;t=p.length;H=k.__vertexArray;y=k.__colorArray;A=k.__dirtyColors;if(k.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+
+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=k.vertices;p=k.colors;u=w.length;t=p.length;H=k.__vertexArray;y=k.__colorArray;A=k.__dirtyColors;if(k.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);
+o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,t=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||t)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),
+b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ia}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
@@ -350,8 +348,8 @@ E=w.vertexColors;w instanceof THREE.Face3?z=new THREE.Face3(w.a+h,w.b+h,w.c+h):w
 x;p++){e=k[p];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));v.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],t,u,v=n.vertexNormals,p=n.vertexColors;n instanceof THREE.Face3?t=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(t=new THREE.Face4(n.a,n.b,n.c,n.d));t.normal.copy(n.normal);f=0;
 for(m=v.length;f<m;f++)u=v[f],t.vertexNormals.push(u.clone());t.color.copy(n.color);f=0;for(m=p.length;f<m;f++)u=p[f],t.vertexColors.push(u.clone());t.materials=n.materials.slice();t.centroid.copy(n.centroid);c.faces.push(t)}b=0;for(e=k.length;b<e;b++){h=k[b];t=[];f=0;for(m=h.length;f<m;f++)t.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(t)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
 f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,
-m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var k=c+Math.floor((f-c)/2);return u[k]>
-b?e(c,k-1):u[k]<b?e(k+1,f):k}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,t=0,u=[],v,p,x,w;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(f instanceof THREE.Face4)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,w=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(v,p,w),f._area2=THREE.GeometryUtils.triangleArea(p,x,w),f._area=f._area1+f._area2;t+=f._area;
+m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return u[h]>
+b?e(c,h-1):u[h]<b?e(h+1,f):h}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,t=0,u=[],v,p,x,w;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(f instanceof THREE.Face4)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,w=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(v,p,w),f._area2=THREE.GeometryUtils.triangleArea(p,x,w),f._area=f._area1+f._area2;t+=f._area;
 u[h]=t}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*t,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
 (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
@@ -446,8 +444,8 @@ b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){sw
 Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
 this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
-THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var k={name:c,fps:0.6,length:f,hierarchy:[]},h,m=e.getControlPointsArray(),n=e.getLength(),A=m.length,E=0;h=A-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:m[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<A-1;h++)E=f*n.chunks[h]/n.total,e.keys[h]={time:E,pos:m[h]};k.hierarchy[0]=
-e;THREE.AnimationHandler.add(k);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,k=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),k.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return k}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),A=m.length,E=0;k=A-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<A-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=
+e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
 c=this.verticalAngleMap.dstRange;var f=c[1]-c[0];this.phi=e(((this.phi-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;f=c[1]-c[0];this.theta=e(((this.theta-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(b){this.domElement===
@@ -489,10 +487,10 @@ this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[p].positio
 1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),F=v[0][n].clone(),D=v[0][n+1].clone(),G=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,p,x,[z,y,A])),this.faceVertexUvs[0].push([F,D,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[t][n+1],p=u[t][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),F=v[t][n+1].clone(),D=v[t][n].clone(),
 G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,p,x,[z,y,A])),this.faceVertexUvs[0].push([F,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);k.set(b.x-c.x,b.y-c.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(e).addSelf(h);o.copy(c).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ja=I;la=I-1;la<0&&(la=b.length-
-1);for(var e=0,c=w+v*2,e=0;e<c;e++){var f=$*e,k=$*(e+1),m=da+ja+f,h=da+ja+k,o=m,f=da+la+f,k=da+la+k,p=h;o+=U;f+=U;k+=U;p+=U;M.faces.push(new THREE.Face4(o,f,k,p,null,null,G));G&&(o=e/c,f=(e+1)/c,k=n+t*2,m=(M.vertices[m].position.z+t)/k,h=(M.vertices[h].position.z+t)/k,M.faceVertexUvs[0].push([new THREE.UV(m,o),new THREE.UV(h,o),new THREE.UV(h,f),new THREE.UV(m,f)]))}}}function k(b,e,c){M.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=U;e+=U;c+=U;M.faces.push(new THREE.Face3(b,
-e,c,null,null,D));if(D){var f=K.maxY,k=K.maxX,m=M.vertices[e].position.x,e=M.vertices[e].position.y,h=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[b].position.x/k,M.vertices[b].position.y/f),new THREE.UV(m/k,e/f),new THREE.UV(h/k,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
+n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ja=I;la=I-1;la<0&&(la=b.length-
+1);for(var e=0,c=w+v*2,e=0;e<c;e++){var f=$*e,h=$*(e+1),k=da+ja+f,m=da+ja+h,o=k,f=da+la+f,h=da+la+h,p=m;o+=U;f+=U;h+=U;p+=U;M.faces.push(new THREE.Face4(o,f,h,p,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(M.vertices[k].position.z+t)/h,m=(M.vertices[m].position.z+t)/h,M.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){M.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=U;e+=U;c+=U;M.faces.push(new THREE.Face3(b,
+e,c,null,null,D));if(D){var f=K.maxY,h=K.maxX,k=M.vertices[e].position.x,e=M.vertices[e].position.y,m=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[b].position.x/h,M.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
 !0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,K=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,p=!1;p||(u=t=v=0);var N,L,B,M=this,U=this.vertices.length;z&&b.addWrapPath(z);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();L=0;for(B=x.length;L<B;L++)N=x[L],THREE.Shape.Utils.isClockWise(N)&&
 (x[L]=N.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);F=z;L=0;for(B=x.length;L<B;L++)N=x[L],z=z.concat(N);var I,S,Q,Y,W,o,$=z.length,T=y.length,ha=[];I=0;S=F.length;ja=S-1;for(la=I+1;I<S;I++,ja++,la++)ja==S&&(ja=0),la==S&&(la=0),ha[I]=f(F[I],F[ja],F[la]);var fa=[],oa,ca=ha.concat();L=0;for(B=x.length;L<B;L++){N=x[L];oa=[];I=0;S=N.length;ja=S-1;for(la=I+1;I<S;I++,ja++,la++)ja==S&&(ja=0),la==S&&(la=0),oa[I]=f(N[I],N[ja],N[la]);fa.push(oa);ca=ca.concat(oa)}for(Q=0;Q<v;Q++){Y=Q/v;W=t*(1-Y);
 Y=u*Math.sin(Y*Math.PI/2);I=0;for(S=F.length;I<S;I++)o=e(F[I],ha[I],Y),k(o.x,o.y,-W);L=0;for(B=x.length;L<B;L++){N=x[L];oa=fa[L];I=0;for(S=N.length;I<S;I++)o=e(N[I],oa[I],Y),k(o.x,o.y,-W)}}Y=u;for(I=0;I<$;I++)o=p?e(z[I],ca[I],Y):z[I],E?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(Q=1;Q<=w;Q++)for(I=0;I<$;I++)o=p?e(z[I],ca[I],Y):z[I],E?k(o.x,o.y+A[Q-1].y,A[Q-1].x):k(o.x,o.y,n/w*Q);for(Q=v-1;Q>=0;Q--){Y=Q/v;W=t*(1-Y);Y=u*Math.sin(Y*Math.PI/2);I=0;for(S=F.length;I<S;I++)o=e(F[I],ha[I],Y),k(o.x,o.y,n+W);
@@ -525,21 +523,21 @@ K=void 0,N=void 0,L=void 0,B=void 0,M=void 0,U=void 0,D=x[E[w]].x,G=x[E[w]].y,K=
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,t=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[k]);t.normal.addSelf(c[m]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
 this.faceVertexUvs[0].push([b[h].clone(),b[k].clone(),b[m].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,k,m){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(k*(2+c)*0.5*Math.cos(b),k*(2+c)*Math.sin(b)*0.5,m*k*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
+THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,h,k){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,k*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var t=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(t,m,this.q,this.p,this.radius,this.heightScale),t=n(t+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=t.x-h.x;e.y=t.y-h.y;e.z=t.z-h.z;f.x=t.x+h.x;f.y=t.y+h.y;f.z=t.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();t=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=t*f.x+m*k.x;h.y+=t*f.y+m*k.y;h.z+=t*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
 h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,t,u,v])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c-- >0;)this.smooth(b)};
 THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,t){var w=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){w.vertexColors=[];for(var o,u,v,x=0;x<4;x++){v=t[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y<v.length;y++)u=n.vertexColors[v[y]-1],o.r+=u.r,o.g+=u.g,o.b+=u.b;o.r/=v.length;o.g/=v.length;o.b/=v.length;w.vertexColors[x]=o}}h.push(w);(!m.supportUVs||p.length!=0)&&k.push([p[b],p[e],p[c],p[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,
 e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,t=n.concat(),u=[],v={},p=[],x,w,z,y,A,E=b.faceVertexUvs[0];x=0;for(w=E.length;x<w;x++){z=0;for(y=E[x].length;z<y;z++)A=f[x]["abcd".charAt(z)],p[A]||(p[A]=E[x][z])}var F;x=0;for(w=f.length;x<w;x++)if(A=f[x],u.push(A.centroid),t.push(new THREE.Vertex(A.centroid)),m.supportUVs&&p.length!=0){F=new THREE.UV;if(A instanceof THREE.Face3)F.u=p[A.a].u+p[A.b].u+p[A.c].u,F.v=p[A.a].v+p[A.b].v+p[A.c].v,F.u/=3,F.v/=3;else if(A instanceof THREE.Face4)F.u=p[A.a].u+
-p[A.b].u+p[A.c].u+p[A.d].u,F.v=p[A.a].v+p[A.b].v+p[A.c].v+p[A.d].v,F.u/=4,F.v/=4;p.push(F)}y=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,m,h,n={};f=0;for(k=b.faces.length;f<k;f++)m=b.faces[f],m instanceof THREE.Face3?(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.a),c(n,h,f)):m instanceof THREE.Face4&&(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.d),c(n,h,f),h=e(m.d,m.a),c(n,h,f));return n}(b);var D,G,K=0,E=n.length,N;for(x in y)if(A=y[x],F=A[0],D=
+p[A.b].u+p[A.c].u+p[A.d].u,F.v=p[A.a].v+p[A.b].v+p[A.c].v+p[A.d].v,F.u/=4,F.v/=4;p.push(F)}y=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,K=0,E=n.length,N;for(x in y)if(A=y[x],F=A[0],D=
 A[1],N=x.split("_"),w=N[0],N=N[1],G=new THREE.Vector3,A.length!=2?(G.addSelf(n[w].position),G.addSelf(n[N].position),G.multiplyScalar(0.5)):(G.addSelf(u[F]),G.addSelf(u[D]),G.addSelf(n[w].position),G.addSelf(n[N].position),G.multiplyScalar(0.25)),v[x]=E+f.length+K,t.push(new THREE.Vertex(G)),K++,m.supportUVs&&p.length!=0)F=new THREE.UV,F.u=p[w].u+p[N].u,F.v=p[w].v+p[N].v,F.u/=2,F.v/=2,p.push(F);x=0;for(w=u.length;x<w;x++)A=f[x],F=E+x,A instanceof THREE.Face3?(D=e(A.a,A.b),N=e(A.b,A.c),K=e(A.c,A.a),
 c(F,v[D],A.b,v[N],A,["123","12","2","23"]),c(F,v[N],A.c,v[K],A,["123","23","3","31"]),c(F,v[K],A.a,v[D],A,["123","31","1","12"])):A instanceof THREE.Face4?(D=e(A.a,A.b),N=e(A.b,A.c),K=e(A.c,A.d),G=e(A.d,A.a),c(F,v[D],A.b,v[N],A,["1234","12","2","23"]),c(F,v[N],A.c,v[K],A,["1234","23","3","34"]),c(F,v[K],A.d,v[G],A,["1234","34","4","41"]),c(F,v[G],A.a,v[D],A,["1234","41","1","12"])):console.log("face should be a face!",A);var f=t,L={},B={},t=function(b,e){L[b]===void 0&&(L[b]=[]);L[b].push(e)},v=function(b,
 e){B[b]===void 0&&(B[b]={});B[b][e]=null};for(x in y)A=y[x],N=x.split("_"),w=N[0],N=N[1],t(w,[w,N]),t(N,[w,N]),F=A[0],D=A[1],v(w,F),D?v(w,D):v(w,F),v(N,F),D?v(N,D):v(N,F);t=new THREE.Vector3;v=new THREE.Vector3;x=0;for(w=n.length;x<w;x++)if(L[x]!==void 0){t.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);E=0;for(z in B[x])t.addSelf(u[z]),E++;t.divideScalar(E);E=L[x].length;for(z=0;z<E;z++)A=L[x][z],A=n[A[0]].position.clone().addSelf(n[A[1]].position).divideScalar(2),v.addSelf(A);v.divideScalar(E);
 y.addSelf(n[x].position);y.multiplyScalar(E-3);y.addSelf(t);y.addSelf(v.multiplyScalar(2));y.divideScalar(E);f[x].position=y}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?"":b.join("/")+"/"},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
-b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,m,h,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=k;if(m){b[e].repeat.set(m[0],m[1]);if(m[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
-if(m[1]!=1)b[e].wrapT=THREE.RepeatWrapping}h&&b[e].offset.set(h[0],h[1]);if(n){m={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(m[n[0]]!==void 0)b[e].wrapS=m[n[0]];if(m[n[1]]!==void 0)b[e].wrapT=m[n[1]]}f(b[e],c+"/"+k)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var m,n,t;n="MeshLambertMaterial";m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
+b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
+if(h[1]!=1)b[e].wrapT=THREE.RepeatWrapping}m&&b[e].offset.set(m[0],m[1]);if(n){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[n[0]]!==void 0)b[e].wrapS=h[n[0]];if(h[n[1]]!==void 0)b[e].wrapT=h[n[1]]}f(b[e],c+"/"+k)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var m,n,t;n="MeshLambertMaterial";m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")m.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")m.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")m.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)m.transparent=b.transparent;if(b.depthTest!==void 0)m.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(b.vertexColors)m.vertexColors=THREE.VertexColors;if(b.colorDiffuse)m.color=k(b.colorDiffuse);
 else if(b.DbgColor)m.color=b.DbgColor;if(b.colorSpecular)m.specular=k(b.colorSpecular);if(b.colorAmbient)m.ambient=k(b.colorAmbient);if(b.transparency)m.opacity=b.transparency;if(b.specularCoef)m.shininess=b.specularCoef;b.mapDiffuse&&c&&h(m,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(m,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(m,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
 b.mapSpecular&&c&&h(m,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var u=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(u.uniforms),p=m.color;n=m.specular;t=m.ambient;var x=m.shininess;v.tNormal.texture=m.normalMap;if(b.mapNormalFactor)v.uNormalScale.value=b.mapNormalFactor;if(m.map)v.tDiffuse.texture=m.map,v.enableDiffuse.value=!0;if(m.specularMap)v.tSpecular.texture=m.specularMap,v.enableSpecular.value=!0;if(m.lightMap)v.tAO.texture=
@@ -549,24 +547,24 @@ THREE.BinaryLoader.prototype.load=function(b){var c=b.model,e=b.callback,f=b.tex
 c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,t=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(t==0&&(t=m.getResponseHeader("Content-Length")),k({total:t,loaded:m.responseText.length})):m.readyState==2&&(t=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=v(b,e),k=v(b,e+1),h=v(b,e+2),m=v(b,e+3),n=(m<<1&255|h>>7)-127;f|=(h&127)<<16|k<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=v(b,e),f=v(b,e+1),k=v(b,e+2);return(v(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=v(b,e);return(v(b,e+1)<<8)+c}function u(b,e){var c=v(b,e);return c>127?c-256:c}function v(b,e){return b.charCodeAt(e)&255}function p(e){var c,
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=v(b,e),h=v(b,e+1),k=v(b,e+2),m=v(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=v(b,e),f=v(b,e+1),k=v(b,e+2);return(v(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=v(b,e);return(v(b,e+1)<<8)+c}function u(b,e){var c=v(b,e);return c>127?c-256:c}function v(b,e){return b.charCodeAt(e)&255}function p(e){var c,
 f,k;c=h(b,e);f=h(b,e+N);k=h(b,e+L);e=t(b,e+B);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+N);k=h(b,e+L);m=t(b,e+B);o=h(b,e+M);p=h(b,e+U);e=h(b,e+I);m=E.materials[m];var w=G[p*3],u=G[p*3+1];p=G[p*3+2];var v=G[e*3],x=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(w,u,p),new THREE.Vector3(v,x,e)],null,m))}function w(e){var c,f,k,m;c=h(b,e);f=h(b,e+S);k=h(b,e+Q);m=h(b,
 e+Y);e=t(b,e+W);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function z(e){var c,f,k,m,p,w,u,v;c=h(b,e);f=h(b,e+S);k=h(b,e+Q);m=h(b,e+Y);p=t(b,e+W);w=h(b,e+o);u=h(b,e+$);v=h(b,e+T);e=h(b,e+ha);p=E.materials[p];var x=G[u*3],y=G[u*3+1];u=G[u*3+2];var H=G[v*3],A=G[v*3+1];v=G[v*3+2];var ea=G[e*3],z=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[w*3],G[w*3+1],G[w*3+2]),new THREE.Vector3(x,y,u),new THREE.Vector3(H,A,v),new THREE.Vector3(ea,z,e)],null,p))}
 function y(e){var c,f,k,m;c=h(b,e);f=h(b,e+fa);k=h(b,e+oa);e=K[c*2];m=K[c*2+1];c=K[f*2];var o=E.faceVertexUvs[0];f=K[f*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function A(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+ca);k=h(b,e+ja);m=h(b,e+la);e=K[c*2];o=K[c*2+1];c=K[f*2];p=K[f*2+1];f=K[k*2];var t=E.faceVertexUvs[0];k=K[k*2+1];var w=K[m*2];m=K[m*2+1];var u=[];u.push(new THREE.UV(e,o));u.push(new THREE.UV(c,p));u.push(new THREE.UV(f,
 k));u.push(new THREE.UV(w,m));t.push(u)}var E=this,F=0,D,G=[],K=[],N,L,B,M,U,I,S,Q,Y,W,o,$,T,ha,fa,oa,ca,ja,la,da,X,V,aa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:v(b,F+8),vertex_coordinate_bytes:v(b,F+9),normal_coordinate_bytes:v(b,F+10),uv_coordinate_bytes:v(b,F+11),vertex_index_bytes:v(b,F+12),normal_index_bytes:v(b,F+13),uv_index_bytes:v(b,F+14),material_index_bytes:v(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
 F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;N=D.vertex_index_bytes;L=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;M=D.vertex_index_bytes*3+D.material_index_bytes;U=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;S=D.vertex_index_bytes;
 Q=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;$=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ha=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;fa=D.uv_index_bytes;oa=D.uv_index_bytes*2;ca=D.uv_index_bytes;ja=D.uv_index_bytes*2;la=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
-4+D.material_index_bytes;da=D.ntri_flat*e;X=D.ntri_smooth*(e+D.normal_index_bytes*3);V=D.ntri_flat_uv*(e+D.uv_index_bytes*3);aa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,k,h,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),k=c(b,e+D.vertex_coordinate_bytes),h=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-k,h)));return D.nvertices*n}(F);F+=function(e){for(var c,f,k,h=D.normal_coordinate_bytes*3,m=e+D.nnormals*h;e<m;e+=h)c=u(b,e),f=u(b,e+D.normal_coordinate_bytes),k=u(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,k/127);return D.nnormals*h}(F);F+=function(e){for(var f,k,h=D.uv_coordinate_bytes*2,n=e+D.nuvs*h;e<n;e+=h)f=c(b,e),k=c(b,e+D.uv_coordinate_bytes),K.push(f,k);return D.nuvs*h}(F);da=F+da;X=da+X;V=X+V;aa=V+aa;ia=aa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
-f=c+D.uv_index_bytes*3,k=b+D.ntri_flat_uv*f;for(e=b;e<k;e+=f)p(e),y(e+c);return k-b})(X);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,k=b+D.ntri_smooth_uv*f;for(e=b;e<k;e+=f)x(e),y(e+c);return k-b})(V);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,k=b+D.nquad_flat_uv*f;for(e=b;e<k;e+=f)w(e),A(e+c);return k-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
-4,f=c+D.uv_index_bytes*4,k=b+D.nquad_smooth_uv*f;for(e=b;e<k;e+=f)z(e),A(e+c);return k-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)p(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(da);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)w(e);return f-b})(aa);(function(b){var e,
+4+D.material_index_bytes;da=D.ntri_flat*e;X=D.ntri_smooth*(e+D.normal_index_bytes*3);V=D.ntri_flat_uv*(e+D.uv_index_bytes*3);aa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=u(b,e),f=u(b,e+D.normal_coordinate_bytes),h=u(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),K.push(f,h);return D.nuvs*k}(F);da=F+da;X=da+X;V=X+V;aa=V+aa;ia=aa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)p(e),y(e+c);return h-b})(X);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),y(e+c);return h-b})(V);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)w(e),A(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)z(e),A(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)p(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(da);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)w(e);return f-b})(aa);(function(b){var e,
 c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)z(e);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
 THREE.ColladaLoader=function(){function b(b,f,h){X=b;f=f||ia;h!==void 0&&(b=h.split("/"),b.pop(),Ea=b.length<1?"":b.join("/")+"/");ma=c("//dae:library_images/dae:image",m,"image");wa=c("//dae:library_materials/dae:material",B,"material");Ca=c("//dae:library_effects/dae:effect",Q,"effect");qa=c("//dae:library_geometries/dae:geometry",A,"geometry");na=c("//dae:library_controllers/dae:controller",n,"controller");ga=c("//dae:library_animations/dae:animation",W,"animation");Fa=c(".//dae:library_visual_scenes/dae:visual_scene",
 v,"visual_scene");Da=[];Ga=[];(b=X.evaluate(".//dae:scene/dae:instance_visual_scene",X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),aa=Fa[b]):aa=null;V=new THREE.Object3D;for(b=0;b<aa.nodes.length;b++)V.add(k(aa.nodes[b]));e();for(var o in ga);o={scene:V,morphs:Da,skins:Ga,dae:{images:ma,materials:wa,effects:Ca,geometries:qa,controllers:na,animations:ga,visualScenes:Fa,scene:aa}};f&&f(o);return o}function c(b,e,c){for(var b=X.evaluate(b,
-X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},k=b.iterateNext(),h=0;k;){k=(new e).parse(k);if(k.id.length==0)k.id=c+h++;f[k.id]=k;k=b.iterateNext()}return f}function e(){var b=1E6,e=-b,c=0,f;for(f in ga)for(var k=ga[f],h=0;h<k.sampler.length;h++){var m=k.sampler[h];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function f(b,e,c,k){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var h=
-b.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&b.world.copy(h)}k&&b.world.multiply(k,b.world);e.push(b);for(k=0;k<b.nodes.length;k++)f(b.nodes[k],e,c,b.world)}function h(b,c,k){var h=na[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=e(),c=aa.getChildById(c.skeleton[0],!0)||aa.getChildBySid(c.skeleton[0],!0),n,o,p,t,w=new THREE.Vector3,
-u;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var v=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,v,k);n=v;o=h.skin;for(t=0;t<n.length;t++)if(p=n[t],u=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y<o.weights.length;y++)for(var A=
-0;A<o.weights[y].length;A++){var z=o.weights[y][A];z.joint==u&&p.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<v.length;n++)if(v[n].type=="JOINT")for(o=0;o<v[n].weights.length;o++)p=v[n].weights[o],t=p.index,p=p.weight,u=b.vertices[t],t=x[t],w.x=u.position.x,w.y=u.position.y,w.z=u.position.z,v[n].skinningMatrix.multiplyVector3(w),t.position.x+=w.x*p,t.position.y+=w.y*p,t.position.z+=w.z*p;b.morphTargets.push({name:"target_"+k,vertices:x})}}}function k(b){var e=
+X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function e(){var b=1E6,e=-b,c=0,f;for(f in ga)for(var h=ga[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function f(b,e,c,h){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=
+b.channels[0].sampler.output[c];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);e.push(b);for(h=0;h<b.nodes.length;h++)f(b.nodes[h],e,c,b.world)}function h(b,c,h){var k=na[c.url];if(!k||!k.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=e(),c=aa.getChildById(c.skeleton[0],!0)||aa.getChildBySid(c.skeleton[0],!0),n,o,p,t,w=new THREE.Vector3,
+u;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var v=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,v,h);n=v;o=k.skin;for(t=0;t<n.length;t++)if(p=n[t],u=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y<o.weights.length;y++)for(var A=
+0;A<o.weights[y].length;A++){var z=o.weights[y][A];z.joint==u&&p.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<v.length;n++)if(v[n].type=="JOINT")for(o=0;o<v[n].weights.length;o++)p=v[n].weights[o],t=p.index,p=p.weight,u=b.vertices[t],t=x[t],w.x=u.position.x,w.y=u.position.y,w.z=u.position.z,v[n].skinningMatrix.multiplyVector3(w),t.position.x+=w.x*p,t.position.y+=w.y*p,t.position.z+=w.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function k(b){var e=
 new THREE.Object3D,c,f,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=na[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(na[n.skin.source]&&(f=n=na[n.skin.source],n.morph&&qa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);
 break;case "morph":if(qa[n.morph.source])o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),f=b.controllers[m];console.log("ColladaLoader: Morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=qa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=Ca[wa[u.target].instance_effect.url].shader;v.material.opacity=
 !v.material.opacity?1:v.material.opacity;u=p[u.symbol]=v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(c!==void 0)h(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=na[c.url],o.skinInstanceController=c,o.name="skin_"+Ga.length,Ga.push(o);else if(f!==void 0){p=n;t=f instanceof w?
@@ -578,41 +576,41 @@ b;this.effect=e;this.material=null}function I(b){this.effect=b;this.format=this.
 this.sid=null}function $(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function T(b){var e=b.getAttribute("id");if(ra[e]!=void 0)return ra[e];ra[e]=(new L(e)).parse(b);return ra[e]}function ha(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function fa(b){for(var b=ca(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function oa(b){for(var b=ca(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],
 10));return e}function ca(b){return b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function la(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function da(b,e){var c="";c+=la(b.x,e)+",";c+=la(b.y,e)+",";c+=la(b.z,e);return c}var X=null,V=null,aa,ia=null,ra={},ma={},ga={},na={},qa={},
 wa={},Ca={},Fa,Ea,Da,Ga,ya=THREE.SmoothShading;m.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};n.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=c.nodeName;break;case "morph":this.morph=
-(new t).parse(c),this.type=c.nodeName}}return this};t.prototype.parse=function(b){var e={},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var k=b.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "source":k=(new L).parse(k);e[k.id]=k;break;case "targets":c=this.parseInputs(k);break;default:console.log(k.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],k=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=
-k.read();break;case "MORPH_WEIGHT":this.weights=k.read()}return this};t.prototype.parseInputs=function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new N).parse(f))}}return e};u.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var k=0;k<b.childNodes.length;k++){var h=b.childNodes[k];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
-fa(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new L).parse(h);e[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":f=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};u.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=
-(new N).parse(f),k=e[f.source];if(f.semantic=="JOINT")this.joints=k.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=k.read()}}};u.prototype.parseWeights=function(b,e){for(var c,f,k=[],h=0;h<b.childNodes.length;h++){var m=b.childNodes[h];if(m.nodeType==1)switch(m.nodeName){case "input":k.push((new N).parse(m));break;case "v":c=oa(m.textContent);break;case "vcount":f=oa(m.textContent)}}for(h=m=0;h<f.length;h++){for(var n=f[h],o=[],p=0;p<n;p++){for(var t={},u=0;u<k.length;u++){var w=
-k[u],v=c[m+w.offset];switch(w.semantic){case "JOINT":t.joint=v;break;case "WEIGHT":t.weight=e[w.source].data[v]}}o.push(t);m+=k.length}for(p=0;p<o.length;p++)o[p].index=h;this.weights.push(o)}};v.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};v.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};v.prototype.parse=function(b){this.id=
-b.getAttribute("id");this.name=b.getAttribute("name");this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var k=f.shift(),h=k.indexOf(".")>=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();
-for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(k==b)return c.info={sid:k,dotSyntax:h,arrSyntax:m,arrIndices:n},c}return null};p.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};p.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};p.prototype.getTransformBySid=
+(new t).parse(c),this.type=c.nodeName}}return this};t.prototype.parse=function(b){var e={},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new L).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=
+h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};t.prototype.parseInputs=function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new N).parse(f))}}return e};u.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=
+fa(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new L).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};u.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=
+(new N).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":c=oa(m.textContent);break;case "vcount":f=oa(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var w=
+h[u],v=c[m+w.offset];switch(w.semantic){case "JOINT":t.joint=v;break;case "WEIGHT":t.weight=e[w.source].data[v]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};v.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};v.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};v.prototype.parse=function(b){this.id=
+b.getAttribute("id");this.name=b.getAttribute("name");this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();
+for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};p.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};p.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};p.prototype.getTransformBySid=
 function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==b)return this.transforms[e];return null};p.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==
 1)switch(e.nodeName){case "node":this.nodes.push((new p).parse(e));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=X.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(e));break;
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(e));break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in ga)for(var k=ga[f],h=0;h<k.channel.length;h++){var m=k.channel[h],n=k.sampler[h];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=
-1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var k={},o=h=void 0,h=0;h<this.channels.length;h++)o=this.channels[h],k[o.sid]=o;m=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(n=this.transforms[h],o=k[n.sid],o!==void 0){for(var t=o.sampler,u,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(e));break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in ga)for(var h=ga[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=
+1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var t=o.sampler,u,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?
 m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=fa(b.textContent);this.updateMatrix();return this};
 x.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
 this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};w.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=X.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null))for(var f=c.iterateNext();f;)this.instance_material.push((new z).parse(f)),f=c.iterateNext()}}return this};z.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=X.evaluate(".//dae:instance_material",
-c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=b.iterateNext();break}}return this};A.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new E(this)).parse(c)}}return this};E.prototype.parse=function(b){function e(b,c){var f=da(b.position);k[f]===void 0&&(k[f]={v:b,index:c});return k[f]}this.primitives=[];var c;for(c=
-0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":T(f);break;case "vertices":this.vertices=(new K).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ra[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[c],f[c+
-1],f[c+2]));e(h,b);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,k);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,e,c){var f=0,k,h,m=b.p,n=b.inputs,o,p,t,u=0,w=3,v=[];for(k=0;k<n.length;k++)switch(o=n[k],
-o.semantic){case "TEXCOORD":v.push(o.set)}for(;f<m.length;){var x=[],y=[],A={},z=[];b.vcount&&(w=b.vcount[u++]);for(k=0;k<w;k++)for(h=0;h<n.length;h++)switch(o=n[h],source=ra[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":A[o.set]===void 0&&(A[o.set]=[]);A[o.set].push(new THREE.UV(source.data[t],
-source.data[t+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;w==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],z.length?z:new THREE.Color):w==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],z.length?z:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(h=0;h<v.length;h++)k=A[v[h]],e.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*w}};F.prototype=new D;F.prototype.constructor=F;D.prototype.setVertices=
+c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=b.iterateNext();break}}return this};A.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new E(this)).parse(c)}}return this};E.prototype.parse=function(b){function e(b,c){var f=da(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=
+0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":T(f);break;case "vertices":this.vertices=(new K).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ra[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+
+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,w=3,v=[];for(h=0;h<n.length;h++)switch(o=n[h],
+o.semantic){case "TEXCOORD":v.push(o.set)}for(;f<m.length;){var x=[],y=[],A={},z=[];b.vcount&&(w=b.vcount[u++]);for(h=0;h<w;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=ra[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":A[o.set]===void 0&&(A[o.set]=[]);A[o.set].push(new THREE.UV(source.data[t],
+source.data[t+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;w==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],z.length?z:new THREE.Color):w==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],z.length?z:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<v.length;k++)h=A[v[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*w}};F.prototype=new D;F.prototype.constructor=F;D.prototype.setVertices=
 function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};D.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ja(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[e]));break;case "vcount":this.vcount=oa(c.textContent);break;case "p":this.p=oa(c.textContent)}}return this};G.prototype.parse=
 function(b){this.params=[];this.source=b.getAttribute("source");this.count=ja(b,"count",0);this.stride=ja(b,"stride",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};K.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new N).parse(b.childNodes[e]),this.input[input.semantic]=
-input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ja(b,"set",-1);this.offset=ja(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};L.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ca(c.textContent),k=[],h=0;h<f.length;h++)k.push(f[h]=="true"||f[h]=="1"?
-!0:!1);this.data=k;this.type=c.nodeName;break;case "float_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=oa(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ca(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(c.childNodes[f]);break}}}return this};L.prototype.read=function(){var b=[],e=this.accessor.params[0];
+input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ja(b,"set",-1);this.offset=ja(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};L.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ca(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?
+!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=oa(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ca(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(c.childNodes[f]);break}}}return this};L.prototype.read=function(){var b=[],e=this.accessor.params[0];
 switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+e.type+".")}return b};B.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName==
 "instance_effect"){this.instance_effect=(new Y).parse(b.childNodes[e]);break}return this};M.prototype.isColor=function(){return this.texture==null};M.prototype.isTexture=function(){return this.texture!=null};M.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=fa(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
-this.texcoord=c.getAttribute("texcoord")}}return this};U.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=X.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var k=f.iterateNext(),h=[];k;)h.push(k),k=f.iterateNext();
-f=h;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};U.prototype.create=function(){var b={},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof M)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ma[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),
+this.texcoord=c.getAttribute("texcoord")}}return this};U.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=X.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();
+f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};U.prototype.create=function(){var b={},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof M)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ma[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),
 b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=ya;return this.material=new THREE.MeshLambertMaterial(b)};I.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
 c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};S.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
 break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Q.prototype.parseNewparam=
 function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new I(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new S(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};Q.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);
 break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};Q.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new U(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};W.prototype.parse=function(b){this.id=b.getAttribute("id");
 this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new L).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new $(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=
-e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,k,h;if(c)e=b.split("."),b=e.shift(),h=e.shift();else if(f){k=b.split("(");b=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=k;this.member=h;return this};$.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new N).parse(c))}}return this};
+e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};$.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new N).parse(c))}}return this};
 $.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=
 Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
 200))ia=c,b(f.responseXML,void 0,e)};f.open("GET",e,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){ya=b},applySkin:h,geometries:qa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;

+ 15 - 17
build/custom/ThreeCanvas.js

@@ -54,17 +54,17 @@ 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,d=this.children.length;a<d;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=m[h]=m[h]||new THREE.RenderableVertex;h++;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,f=b.z+b.w,g=-a.z+a.w,j=-b.z+b.w;return e>=0&&f>=0&&g>=0&&j>=0?!0:e<0&&f<0||g<0&&j<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(d=Math.min(d,g/(g-j))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,m=[],k,l,i=[],n,j=[],r,t,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector4,s=new THREE.Vector4,
-o=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,g){var j,h;f=B.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){h=j[a];var i;if(!(i=!h.visible))if(i=h instanceof THREE.Mesh)if(i=h.frustumCulled){a:{i=void 0;for(var k=h.matrixWorld,m=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),l=0;l<6;l++)if(i=D[l].x*k.n14+D[l].y*k.n24+D[l].z*k.n34+D[l].w,i<=m){i=!1;break a}i=!0}i=
-!i}if(!i)i=e[f]=e[f]||new THREE.RenderableObject,f++,d=i,O.copy(h.position),o.multiplyVector3(O),d.object=h,d.z=O.z,B.push(d)}g&&B.sort(b);return B};this.projectScene=function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,ba,W;M=t=n=l=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;
-ba=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=ba.length;B<V;B++){E=ba[B];if(E instanceof THREE.Face3)if(y=m[E.a],L=m[E.b],H=m[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-
-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[l]=i[l]||new THREE.RenderableFace3,l++,k=z,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=m[E.a],L=m[E.b],H=m[E.c],z=m[E.d],y.visible&&L.visible&&H.visible&&z.visible&&(q.doubleSided||q.flipSided!=((z.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(z.positionScreen.y-y.positionScreen.y)*
-(L.positionScreen.x-y.positionScreen.x)<0||(L.positionScreen.x-H.positionScreen.x)*(z.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(z.positionScreen.x-H.positionScreen.x)<0)))W=j[n]=j[n]||new THREE.RenderableFace4,n++,k=W,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H),k.v4.copy(z);else continue;k.normalWorld.copy(E.normal);G.multiplyVector3(k.normalWorld);k.centroidWorld.copy(E.centroid);v.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);
-H=E.vertexNormals;y=0;for(L=H.length;y<L;y++)z=k.vertexNormalsWorld[y],z.copy(H[y]),G.multiplyVector3(z);y=0;for(L=Z.length;y<L;y++)if(W=Z[y][B]){H=0;for(z=W.length;H<z;H++)k.uvs[y][H]=W[H]}k.meshMaterials=O;k.faceMaterials=E.materials;k.overdraw=ea;k.z=k.centroidScreen.z;N.push(k)}}else if(q instanceof THREE.Line){C.multiply(o,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),
-C.multiplyVector4(y.positionScreen),L=m[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[t]=w[t]||new THREE.RenderableLine,t++,r=v,r.v1.positionScreen.copy(T),r.v2.positionScreen.copy(U),r.z=Math.max(T.z,U.z),r.materials=q.materials,N.push(r)}else if(q instanceof THREE.Particle&&(s.set(q.matrixWorld.n14,q.matrixWorld.n24,q.matrixWorld.n34,1),o.multiplyVector4(s),s.z/=s.w,s.z>0&&s.z<1))v=R[M]=R[M]||new THREE.RenderableParticle,M++,u=
-v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=m[h]=m[h]||new THREE.RenderableVertex;h++;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,f=b.z+b.w,g=-a.z+a.w,j=-b.z+b.w;return e>=0&&f>=0&&g>=0&&j>=0?!0:e<0&&f<0||g<0&&j<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(d=Math.min(d,g/(g-j))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,m=[],k,l,i=[],n,j=[],r,t,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector3,s=new THREE.Vector4,
+o=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){THREE.Matrix4.makeInvert(b.matrixWorld,b.matrixWorldInverse);o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,g){var j,h;f=B.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){h=j[a];var i;if(!(i=!h.visible))if(i=h instanceof THREE.Mesh)if(i=h.frustumCulled){a:{i=void 0;for(var k=h.matrixWorld,m=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),l=0;l<6;l++)if(i=D[l].x*
+k.n14+D[l].y*k.n24+D[l].z*k.n34+D[l].w,i<=m){i=!1;break a}i=!0}i=!i}if(!i)i=e[f]=e[f]||new THREE.RenderableObject,f++,d=i,O.copy(h.position),o.multiplyVector3(O),d.object=h,d.z=O.z,B.push(d)}g&&B.sort(b);return B};this.projectScene=function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,ba,W;M=t=n=l=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);THREE.Matrix4.makeInvert(e.matrixWorld,e.matrixWorldInverse);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-
+o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,
+G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;ba=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=ba.length;B<V;B++){E=ba[B];if(E instanceof THREE.Face3)if(y=
+m[E.a],L=m[E.b],H=m[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[l]=i[l]||new THREE.RenderableFace3,l++,k=z,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=m[E.a],L=m[E.b],H=m[E.c],z=m[E.d],y.visible&&L.visible&&H.visible&&z.visible&&(q.doubleSided||q.flipSided!=((z.positionScreen.x-
+y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(z.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0||(L.positionScreen.x-H.positionScreen.x)*(z.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(z.positionScreen.x-H.positionScreen.x)<0)))W=j[n]=j[n]||new THREE.RenderableFace4,n++,k=W,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H),k.v4.copy(z);else continue;k.normalWorld.copy(E.normal);G.multiplyVector3(k.normalWorld);k.centroidWorld.copy(E.centroid);
+v.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);H=E.vertexNormals;y=0;for(L=H.length;y<L;y++)z=k.vertexNormalsWorld[y],z.copy(H[y]),G.multiplyVector3(z);y=0;for(L=Z.length;y<L;y++)if(W=Z[y][B]){H=0;for(z=W.length;H<z;H++)k.uvs[y][H]=W[H]}k.meshMaterials=O;k.faceMaterials=E.materials;k.overdraw=ea;k.z=k.centroidScreen.z;N.push(k)}}else if(q instanceof THREE.Line){C.multiply(o,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);
+C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),C.multiplyVector4(y.positionScreen),L=m[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[t]=w[t]||new THREE.RenderableLine,t++,r=v,r.v1.positionScreen.copy(T),r.v2.positionScreen.copy(U),r.z=Math.max(T.z,U.z),r.materials=q.materials,N.push(r)}else if(q instanceof THREE.Particle&&(s.set(q.matrixWorld.n14,q.matrixWorld.n24,q.matrixWorld.n34,
+1),o.multiplyVector4(s),s.z/=s.w,s.z>0&&s.z<1))v=R[M]=R[M]||new THREE.RenderableParticle,M++,u=v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;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,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
@@ -84,12 +84,10 @@ D[c].addSelf(U);D[d].addSelf(U)}var b,c,d,f,e,g,h,m,k,l,i,n,j,r,t,w,u,M,R,B,N,O,
 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=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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.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)};
-THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+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.projectionMatrix=new THREE.Matrix4;this.matrixWorldInverse=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.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;

+ 15 - 17
build/custom/ThreeDOM.js

@@ -54,17 +54,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},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,d=this.children.length;a<d;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=k[h]=k[h]||new THREE.RenderableVertex;h++;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,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,j,l=[],n,m=[],p,q,s=[],r,J,M=[],C=[],D=[],H=new THREE.Vector4,v=new THREE.Vector4,
-o=new THREE.Matrix4,K=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,f){var h,i;e=C.length=0;h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh)if(j=i.frustumCulled){a:{j=void 0;for(var k=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*k.n14+z[m].y*k.n24+z[m].z*k.n34+z[m].w,j<=l){j=!1;break a}j=!0}j=
-!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,H.copy(i.position),o.multiplyVector3(H),d.object=i,d.z=H.z,C.push(d)}f&&C.sort(b);return C};this.projectScene=function(d,e,g){var C=e.near,H=e.far,O,I,x,B,t,y,w,A,G,u,L,V,X,Y,N,W,P;J=q=n=j=D.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(O=0;O<6;O++)G=z[O],G.divideScalar(Math.sqrt(G.x*G.x+G.y*G.y+G.z*G.z));G=this.projectObjects(d,e,!0);d=0;for(O=G.length;d<O;d++)if(u=G[d].object,u.visible)if(L=u.matrixWorld,V=u.matrixRotationWorld,X=u.materials,Y=u.overdraw,h=0,u instanceof THREE.Mesh){N=u.geometry;B=N.vertices;W=
-N.faces;N=N.faceVertexUvs;I=0;for(x=B.length;I<x;I++)f=a(),f.positionWorld.copy(B[I].position),L.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen),f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>C&&f.positionScreen.z<H;B=0;for(I=W.length;B<I;B++){x=W[B];if(x instanceof THREE.Face3)if(t=k[x.a],y=k[x.b],w=k[x.c],t.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-
-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(w.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0))A=l[j]=l[j]||new THREE.RenderableFace3,j++,i=A,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=k[x.a],y=k[x.b],w=k[x.c],A=k[x.d],t.visible&&y.visible&&w.visible&&A.visible&&(u.doubleSided||u.flipSided!=((A.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(A.positionScreen.y-t.positionScreen.y)*
-(y.positionScreen.x-t.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-w.positionScreen.x)<0)))P=m[n]=m[n]||new THREE.RenderableFace4,n++,i=P,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);
-w=x.vertexNormals;t=0;for(y=w.length;t<y;t++)A=i.vertexNormalsWorld[t],A.copy(w[t]),V.multiplyVector3(A);t=0;for(y=N.length;t<y;t++)if(P=N[t][B]){w=0;for(A=P.length;w<A;w++)i.uvs[t][w]=P[w]}i.meshMaterials=X;i.faceMaterials=x.materials;i.overdraw=Y;i.z=i.centroidScreen.z;D.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;t=a();t.positionScreen.copy(B[0].position);K.multiplyVector4(t.positionScreen);I=1;for(x=B.length;I<x;I++)if(t=a(),t.positionScreen.copy(B[I].position),
-K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.positionScreen),c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),L=s[q]=s[q]||new THREE.RenderableLine,q++,p=L,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(F),p.z=Math.max(E.z,F.z),p.materials=u.materials,D.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=
-L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=k[h]=k[h]||new THREE.RenderableVertex;h++;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,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,j,l=[],n,m=[],p,q,s=[],r,J,M=[],C=[],D=[],H=new THREE.Vector3,v=new THREE.Vector4,
+o=new THREE.Matrix4,K=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(a,b){THREE.Matrix4.makeInvert(b.matrixWorld,b.matrixWorldInverse);o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,f){var h,i;e=C.length=0;h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh)if(j=i.frustumCulled){a:{j=void 0;for(var k=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*
+k.n14+z[m].y*k.n24+z[m].z*k.n34+z[m].w,j<=l){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,H.copy(i.position),o.multiplyVector3(H),d.object=i,d.z=H.z,C.push(d)}f&&C.sort(b);return C};this.projectScene=function(d,e,g){var C=e.near,H=e.far,O,I,x,B,t,y,w,A,G,u,L,V,X,Y,N,W,P;J=q=n=j=D.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);THREE.Matrix4.makeInvert(e.matrixWorld,e.matrixWorldInverse);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-
+o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(O=0;O<6;O++)G=z[O],G.divideScalar(Math.sqrt(G.x*G.x+G.y*G.y+G.z*G.z));G=this.projectObjects(d,e,!0);d=0;for(O=G.length;d<O;d++)if(u=G[d].object,u.visible)if(L=u.matrixWorld,
+V=u.matrixRotationWorld,X=u.materials,Y=u.overdraw,h=0,u instanceof THREE.Mesh){N=u.geometry;B=N.vertices;W=N.faces;N=N.faceVertexUvs;I=0;for(x=B.length;I<x;I++)f=a(),f.positionWorld.copy(B[I].position),L.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen),f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>C&&f.positionScreen.z<H;B=0;for(I=W.length;B<I;B++){x=W[B];if(x instanceof THREE.Face3)if(t=
+k[x.a],y=k[x.b],w=k[x.c],t.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(w.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0))A=l[j]=l[j]||new THREE.RenderableFace3,j++,i=A,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=k[x.a],y=k[x.b],w=k[x.c],A=k[x.d],t.visible&&y.visible&&w.visible&&A.visible&&(u.doubleSided||u.flipSided!=((A.positionScreen.x-
+t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(A.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-w.positionScreen.x)<0)))P=m[n]=m[n]||new THREE.RenderableFace4,n++,i=P,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);
+L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);w=x.vertexNormals;t=0;for(y=w.length;t<y;t++)A=i.vertexNormalsWorld[t],A.copy(w[t]),V.multiplyVector3(A);t=0;for(y=N.length;t<y;t++)if(P=N[t][B]){w=0;for(A=P.length;w<A;w++)i.uvs[t][w]=P[w]}i.meshMaterials=X;i.faceMaterials=x.materials;i.overdraw=Y;i.z=i.centroidScreen.z;D.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;t=a();t.positionScreen.copy(B[0].position);
+K.multiplyVector4(t.positionScreen);I=1;for(x=B.length;I<x;I++)if(t=a(),t.positionScreen.copy(B[I].position),K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.positionScreen),c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),L=s[q]=s[q]||new THREE.RenderableLine,q++,p=L,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(F),p.z=Math.max(E.z,F.z),p.materials=u.materials,D.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,
+1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;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,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
@@ -73,12 +73,10 @@ c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;r
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
-THREE.Camera=function(){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)};
-THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
+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.projectionMatrix=new THREE.Matrix4;this.matrixWorldInverse=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.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;
 THREE.Bone.prototype.supr=THREE.Object3D.prototype;

+ 15 - 17
build/custom/ThreeSVG.js

@@ -54,17 +54,17 @@ 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,d=this.children.length;a<d;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=k[i]=k[i]||new THREE.RenderableVertex;i++;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,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;return e>=0&&f>=0&&g>=0&&i>=0?!0:e<0&&f<0||g<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,i,k=[],h,j,m=[],n,l=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector4,y=new THREE.Vector4,
-o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,g){var i,k;f=t.length=0;i=a.objects;a=0;for(c=i.length;a<c;a++){k=i[a];var h;if(!(h=!k.visible))if(h=k instanceof THREE.Mesh)if(h=k.frustumCulled){a:{h=void 0;for(var j=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),l=0;l<6;l++)if(h=D[l].x*j.n14+D[l].y*j.n24+D[l].z*j.n34+D[l].w,h<=m){h=!1;break a}h=!0}h=
-!h}if(!h)h=e[f]=e[f]||new THREE.RenderableObject,f++,d=h,z.copy(k.position),o.multiplyVector3(z),d.object=k,d.z=z.z,t.push(d)}g&&t.sort(b);return t};this.projectScene=function(d,e,f){var t=e.near,S=e.far,z,P,I,L,r,J,H,s,x,B,Q,U,W,X,R,V,T;C=q=n=j=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(z=0;z<6;z++)x=D[z],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(z=x.length;d<z;d++)if(B=x[d].object,B.visible)if(Q=B.matrixWorld,U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){R=B.geometry;L=R.vertices;V=
-R.faces;R=R.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),Q.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<S;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(r=k[I.a],J=k[I.b],H=k[I.c],r.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-
-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0))s=m[j]=m[j]||new THREE.RenderableFace3,j++,h=s,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[I.a],J=k[I.b],H=k[I.c],s=k[I.d],r.visible&&J.visible&&H.visible&&s.visible&&(B.doubleSided||B.flipSided!=((s.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(s.positionScreen.y-r.positionScreen.y)*
-(J.positionScreen.x-r.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(s.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(s.positionScreen.x-H.positionScreen.x)<0)))T=l[n]=l[n]||new THREE.RenderableFace4,n++,h=T,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H),h.v4.copy(s);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);
-H=I.vertexNormals;r=0;for(J=H.length;r<J;r++)s=h.vertexNormalsWorld[r],s.copy(H[r]),U.multiplyVector3(s);r=0;for(J=R.length;r<J;r++)if(T=R[r][L]){H=0;for(s=T.length;H<s;H++)h.uvs[r][H]=T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),
-E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=
-Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;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,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;return e>=0&&f>=0&&g>=0&&i>=0?!0:e<0&&f<0||g<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,i,k=[],h,j,m=[],n,l=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector3,y=new THREE.Vector4,
+o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){THREE.Matrix4.makeInvert(b.matrixWorld,b.matrixWorldInverse);o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.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,g){var i,k;f=t.length=0;i=a.objects;a=0;for(c=i.length;a<c;a++){k=i[a];var h;if(!(h=!k.visible))if(h=k instanceof THREE.Mesh)if(h=k.frustumCulled){a:{h=void 0;for(var j=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),l=0;l<6;l++)if(h=D[l].x*
+j.n14+D[l].y*j.n24+D[l].z*j.n34+D[l].w,h<=m){h=!1;break a}h=!0}h=!h}if(!h)h=e[f]=e[f]||new THREE.RenderableObject,f++,d=h,z.copy(k.position),o.multiplyVector3(z),d.object=k,d.z=z.z,t.push(d)}g&&t.sort(b);return t};this.projectScene=function(d,e,f){var t=e.near,S=e.far,z,P,I,L,r,J,H,s,x,B,Q,U,W,X,R,V,T;C=q=n=j=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);THREE.Matrix4.makeInvert(e.matrixWorld,e.matrixWorldInverse);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-
+o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(z=0;z<6;z++)x=D[z],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(z=x.length;d<z;d++)if(B=x[d].object,B.visible)if(Q=B.matrixWorld,
+U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){R=B.geometry;L=R.vertices;V=R.faces;R=R.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),Q.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<S;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(r=
+k[I.a],J=k[I.b],H=k[I.c],r.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0))s=m[j]=m[j]||new THREE.RenderableFace3,j++,h=s,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[I.a],J=k[I.b],H=k[I.c],s=k[I.d],r.visible&&J.visible&&H.visible&&s.visible&&(B.doubleSided||B.flipSided!=((s.positionScreen.x-
+r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(s.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(s.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(s.positionScreen.x-H.positionScreen.x)<0)))T=l[n]=l[n]||new THREE.RenderableFace4,n++,h=T,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H),h.v4.copy(s);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);
+Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);H=I.vertexNormals;r=0;for(J=H.length;r<J;r++)s=h.vertexNormalsWorld[r],s.copy(H[r]),U.multiplyVector3(s);r=0;for(J=R.length;r<J;r++)if(T=R[r][L]){H=0;for(s=T.length;H<s;H++)h.uvs[r][H]=T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);
+E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,
+1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;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,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
@@ -84,12 +84,10 @@ D[c].addSelf(G);D[d].addSelf(G)}var b,c,d,f,e,g,i,k,h,j,m,n,l,p,q,v,u,C,K,t,w,z,
 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=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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.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)};
-THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+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.projectionMatrix=new THREE.Matrix4;this.matrixWorldInverse=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.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;

+ 166 - 166
build/custom/ThreeWebGL.js

@@ -1,102 +1,101 @@
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,h,i;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),h=b*6-e,b=d*(1-c),i=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=i;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=i;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
-d;this.g=b;this.b=i;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var d,h,i;if(e==0)this.r=this.g=this.b=0;else switch(d=Math.floor(b*6),h=b*6-d,b=e*(1-c),i=e*(1-c*h),c=e*(1-c*(1-h)),d){case 1:this.r=i;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=i;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=
+e;this.g=b;this.b=i;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
 THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
 divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
-equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0};
-THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
+equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.x=b||0;this.y=c||0;this.z=e||0};
+THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
 addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},
 divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},
 cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);
-Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e!==void 0?e:1};
-THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
+Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,e,d){this.x=b||0;this.y=c||0;this.z=e||0;this.w=d!==void 0?d:1};
+THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,d){this.x=b;this.y=c;this.z=e;this.w=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
 c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(e,this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e;e=d.clone().subSelf(b).dot(c);if(e<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
-d=d.clone().subSelf(c),h=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(h),i=d.dot(d),d=d.dot(h),h=1/(b*i-c*c),i=(i*e-c*d)*h,b=(b*d-c*e)*h;return i>0&&b>0&&i+b<1}for(var e,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];e={distance:i,point:b.position,face:null,object:b};h.push(e)}else if(b instanceof THREE.Mesh){i=c(this.origin,
-this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var k,n,p,q,m,r,t,A,y=b.geometry,E=y.vertices,i=0,j=y.faces.length;i<j;i++)if(e=y.faces[i],t=this.origin.clone(),A=this.direction.clone(),q=b.matrixWorld,k=q.multiplyVector3(e.centroid.clone()).subSelf(t),r=k.dot(A),!(r<=0)&&(k=q.multiplyVector3(E[e.a].position.clone()),n=q.multiplyVector3(E[e.b].position.clone()),p=q.multiplyVector3(E[e.c].position.clone()),
-q=e instanceof THREE.Face4?q.multiplyVector3(E[e.d].position.clone()):null,m=b.matrixRotationWorld.multiplyVector3(e.normal.clone()),r=A.dot(m),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=m.dot((new THREE.Vector3).sub(k,t))/r,t=t.addSelf(A.multiplyScalar(r)),e instanceof THREE.Face3)d(t,k,n,p)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:b},h.push(e));else if(e instanceof THREE.Face4&&(d(t,k,n,q)||d(t,n,p,q)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:b},h.push(e)}return h}};
-THREE.Rectangle=function(){function b(){i=e-c;j=h-d}var c,d,e,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(i,j,q,m){k=!1;c=i;d=j;e=q;h=m;b()};this.addPoint=function(i,j){k?(k=!1,c=i,d=j,e=i,h=j):(c=c<i?c:i,d=d<j?d:j,e=e>i?e:i,h=h>j?h:j);b()};this.add3Points=
-function(i,j,q,m,r,t){k?(k=!1,c=i<q?i<r?i:r:q<r?q:r,d=j<m?j<t?j:t:m<t?m:t,e=i>q?i>r?i:r:q>r?q:r,h=j>m?j>t?j:t:m>t?m:t):(c=i<q?i<r?i<c?i:c:r<c?r:c:q<r?q<c?q:c:r<c?r:c,d=j<m?j<t?j<d?j:d:t<d?t:d:m<t?m<d?m:d:t<d?t:d,e=i>q?i>r?i>e?i:e:r>e?r:e:q>r?q>e?q:e:r>e?r:e,h=j>m?j>t?j>h?j:h:t>h?t:h:m>t?m>h?m:h:t>h?t:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),d=i.getTop(),e=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),d=d<i.getTop()?d:i.getTop(),e=e>i.getRight()?e:i.getRight(),h=h>
-i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;d-=i;e+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e<i.getRight()?e:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,d=[];c=0;for(e=b.length;c<e;c++)Array.prototype.push.apply(d,this.intersectObject(b[c]));d.sort(function(b,c){return b.distance-c.distance});return d},intersectObject:function(b){function c(b,c,e){var d;d=e.clone().subSelf(b).dot(c);if(d<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(d));return e.distanceTo(b)}function e(b,c,e,d){var d=d.clone().subSelf(c),
+e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=d.dot(d),c=d.dot(e),d=d.dot(h),i=e.dot(e),e=e.dot(h),h=1/(b*i-c*c),i=(i*d-c*e)*h,b=(b*e-c*d)*h;return i>0&&b>0&&i+b<1}for(var d,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];d={distance:i,point:b.position,face:null,object:b};h.push(d)}else if(b instanceof THREE.Mesh){i=c(this.origin,
+this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var k,n,p,q,m,r,t,A,y=b.geometry,E=y.vertices,i=0,j=y.faces.length;i<j;i++)if(d=y.faces[i],t=this.origin.clone(),A=this.direction.clone(),q=b.matrixWorld,k=q.multiplyVector3(d.centroid.clone()).subSelf(t),r=k.dot(A),!(r<=0)&&(k=q.multiplyVector3(E[d.a].position.clone()),n=q.multiplyVector3(E[d.b].position.clone()),p=q.multiplyVector3(E[d.c].position.clone()),
+q=d instanceof THREE.Face4?q.multiplyVector3(E[d.d].position.clone()):null,m=b.matrixRotationWorld.multiplyVector3(d.normal.clone()),r=A.dot(m),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=m.dot((new THREE.Vector3).sub(k,t))/r,t=t.addSelf(A.multiplyScalar(r)),d instanceof THREE.Face3)e(t,k,n,p)&&(d={distance:this.origin.distanceTo(t),point:t,face:d,object:b},h.push(d));else if(d instanceof THREE.Face4&&(e(t,k,n,q)||e(t,n,p,q)))d={distance:this.origin.distanceTo(t),point:t,face:d,object:b},h.push(d)}return h}};
+THREE.Rectangle=function(){function b(){i=d-c;j=h-e}var c,e,d,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return d};this.getBottom=function(){return h};this.set=function(i,j,q,m){k=!1;c=i;e=j;d=q;h=m;b()};this.addPoint=function(i,j){k?(k=!1,c=i,e=j,d=i,h=j):(c=c<i?c:i,e=e<j?e:j,d=d>i?d:i,h=h>j?h:j);b()};this.add3Points=
+function(i,j,q,m,r,t){k?(k=!1,c=i<q?i<r?i:r:q<r?q:r,e=j<m?j<t?j:t:m<t?m:t,d=i>q?i>r?i:r:q>r?q:r,h=j>m?j>t?j:t:m>t?m:t):(c=i<q?i<r?i<c?i:c:r<c?r:c:q<r?q<c?q:c:r<c?r:c,e=j<m?j<t?j<e?j:e:t<e?t:e:m<t?m<e?m:e:t<e?t:e,d=i>q?i>r?i>d?i:d:r>d?r:d:q>r?q>d?q:d:r>d?r:d,h=j>m?j>t?j>h?j:h:t>h?t:h:m>t?m>h?m:h:t>h?t:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),e=i.getTop(),d=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),e=e<i.getTop()?e:i.getTop(),d=d>i.getRight()?d:i.getRight(),h=h>
+i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;e-=i;d+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();e=e>i.getTop()?e:i.getTop();d=d<i.getRight()?d:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=function(b){return Math.min(d,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){k=!0;h=d=e=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,e,h,i,j,k,n,p,q,m,r,t,A,y){this.set(b!==void 0?b:1,c||0,d||0,e||0,h||0,i!==void 0?i:1,j||0,k||0,n||0,p||0,q!==void 0?q:1,m||0,r||0,t||0,A||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,i,j,k,n,p,q,m,r,t,A,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=q;this.n34=m;this.n41=r;this.n42=t;this.n43=A;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
-c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;e.cross(d,i).normalize();e.length()===0&&(i.x+=1.0E-4,e.cross(d,i).normalize());h.cross(i,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=i.x;this.n21=e.y;this.n22=h.y;this.n23=i.y;this.n31=e.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;
-b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+
-d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,E=b.n43,F=b.n44,wa=c.n11,xa=
-c.n12,qa=c.n13,ra=c.n14,ja=c.n21,G=c.n22,v=c.n23,U=c.n24,L=c.n31,ka=c.n32,Z=c.n33,ya=c.n34,W=c.n41,M=c.n42,f=c.n43,ua=c.n44;this.n11=d*wa+e*ja+h*L+i*W;this.n12=d*xa+e*G+h*ka+i*M;this.n13=d*qa+e*v+h*Z+i*f;this.n14=d*ra+e*U+h*ya+i*ua;this.n21=j*wa+k*ja+n*L+p*W;this.n22=j*xa+k*G+n*ka+p*M;this.n23=j*qa+k*v+n*Z+p*f;this.n24=j*ra+k*U+n*ya+p*ua;this.n31=q*wa+m*ja+r*L+t*W;this.n32=q*xa+m*G+r*ka+t*M;this.n33=q*qa+m*v+r*Z+t*f;this.n34=q*ra+m*U+r*ya+t*ua;this.n41=A*wa+y*ja+E*L+F*W;this.n42=A*xa+y*G+E*ka+F*M;
-this.n43=A*qa+y*v+E*Z+F*f;this.n44=A*ra+y*U+E*ya+F*ua;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=
-b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,i=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,q=this.n33,m=this.n34,r=this.n41,t=this.n42,A=this.n43,y=this.n44;return e*j*p*r-d*k*p*r-e*i*q*r+c*k*q*r+d*i*m*r-c*j*m*r-e*j*n*t+d*k*n*t+e*h*q*t-b*k*q*t-d*h*m*t+b*j*m*t+e*i*n*A-c*k*n*A-e*h*p*A+b*k*p*A+c*h*m*A-b*i*m*A-
-d*i*n*y+c*j*n*y+d*h*p*y-b*j*p*y-c*h*q*y+b*i*q*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;
+THREE.Matrix4=function(b,c,e,d,h,i,j,k,n,p,q,m,r,t,A,y){this.set(b!==void 0?b:1,c||0,e||0,d||0,h||0,i!==void 0?i:1,j||0,k||0,n||0,p||0,q!==void 0?q:1,m||0,r||0,t||0,A||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,d,h,i,j,k,n,p,q,m,r,t,A,y){this.n11=b;this.n12=c;this.n13=e;this.n14=d;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=q;this.n34=m;this.n41=r;this.n42=t;this.n43=A;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+c,e){var d=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;d.cross(e,i).normalize();d.length()===0&&(i.x+=1.0E-4,d.cross(e,i).normalize());h.cross(i,d).normalize();this.n11=d.x;this.n12=h.x;this.n13=i.x;this.n21=d.y;this.n22=h.y;this.n23=i.y;this.n31=d.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,d=b.z,h=1/(this.n41*c+this.n42*e+this.n43*d+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*d+this.n14)*h;
+b.y=(this.n21*c+this.n22*e+this.n23*d+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*d+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,d=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*d+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*d+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*d+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*d+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,d=b.z;b.x=c*this.n11+e*this.n12+d*this.n13;b.y=c*this.n21+e*this.n22+d*this.n23;b.z=c*this.n31+
+e*this.n32+d*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,d=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,E=b.n43,F=b.n44,wa=c.n11,xa=
+c.n12,qa=c.n13,ra=c.n14,ja=c.n21,G=c.n22,v=c.n23,U=c.n24,L=c.n31,ka=c.n32,Z=c.n33,ya=c.n34,W=c.n41,M=c.n42,f=c.n43,ua=c.n44;this.n11=e*wa+d*ja+h*L+i*W;this.n12=e*xa+d*G+h*ka+i*M;this.n13=e*qa+d*v+h*Z+i*f;this.n14=e*ra+d*U+h*ya+i*ua;this.n21=j*wa+k*ja+n*L+p*W;this.n22=j*xa+k*G+n*ka+p*M;this.n23=j*qa+k*v+n*Z+p*f;this.n24=j*ra+k*U+n*ya+p*ua;this.n31=q*wa+m*ja+r*L+t*W;this.n32=q*xa+m*G+r*ka+t*M;this.n33=q*qa+m*v+r*Z+t*f;this.n34=q*ra+m*U+r*ya+t*ua;this.n41=A*wa+y*ja+E*L+F*W;this.n42=A*xa+y*G+E*ka+F*M;
+this.n43=A*qa+y*v+E*Z+F*f;this.n44=A*ra+y*U+E*ya+F*ua;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=
+b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,d=this.n14,h=this.n21,i=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,q=this.n33,m=this.n34,r=this.n41,t=this.n42,A=this.n43,y=this.n44;return d*j*p*r-e*k*p*r-d*i*q*r+c*k*q*r+e*i*m*r-c*j*m*r-d*j*n*t+e*k*n*t+d*h*q*t-b*k*q*t-e*h*m*t+b*j*m*t+d*i*n*A-c*k*n*A-d*h*p*A+b*k*p*A+c*h*m*A-b*i*m*A-
+e*i*n*y+c*j*n*y+e*h*p*y-b*j*p*y-c*h*q*y+b*i*q*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;
 b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
 flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=
-this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),
-b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,i=b.x,j=b.y,k=b.z,n=h*i,p=h*j;this.set(n*i+d,n*j-e*k,n*k+e*j,0,n*j+e*k,p*j+d,p*k-e*i,0,n*k-e*j,p*k+e*i,h*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,h=b.z,i=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=
-j*k,p=j*h,q=e*k,m=e*h;this.n11=n+m*d;this.n12=q*d-p;this.n13=i*e;this.n21=i*h;this.n22=i*k;this.n23=-d;this.n31=p*d-q;this.n32=m+n*d;this.n33=i*j;break;case "ZXY":n=j*k;p=j*h;q=e*k;m=e*h;this.n11=n-m*d;this.n12=-i*h;this.n13=q+p*d;this.n21=p+q*d;this.n22=i*k;this.n23=m-n*d;this.n31=-i*e;this.n32=d;this.n33=i*j;break;case "ZYX":n=i*k;p=i*h;q=d*k;m=d*h;this.n11=j*k;this.n12=q*e-p;this.n13=n*e+m;this.n21=j*h;this.n22=m*e+n;this.n23=p*e-q;this.n31=-e;this.n32=d*j;this.n33=i*j;break;case "YZX":n=i*j;p=
-i*e;q=d*j;m=d*e;this.n11=j*k;this.n12=m-n*h;this.n13=q*h+p;this.n21=h;this.n22=i*k;this.n23=-d*k;this.n31=-e*k;this.n32=p*h+q;this.n33=n-m*h;break;case "XZY":n=i*j;p=i*e;q=d*j;m=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=n*h+m;this.n22=i*k;this.n23=p*h-q;this.n31=q*h-p;this.n32=d*k;this.n33=m*h+n;break;default:n=i*k,p=i*h,q=d*k,m=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=p+q*e,this.n22=n-m*e,this.n23=-d*j,this.n31=m-n*e,this.n32=q+p*e,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=
-b.x,d=b.y,e=b.z,h=b.w,i=c+c,j=d+d,k=e+e,b=c*i,n=c*j;c*=k;var p=d*j;d*=k;e*=k;i*=h;j*=h;h*=k;this.n11=1-(p+e);this.n12=n-h;this.n13=c+j;this.n21=n+h;this.n22=1-(b+e);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
-e.identity();e.setRotationFromQuaternion(c);h.setScale(d.x,d.y,d.z);this.multiply(e,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();
-d.y=h.length();d.z=i.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*h;this.n23=
+this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),
+b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),d=Math.sin(c),h=1-e,i=b.x,j=b.y,k=b.z,n=h*i,p=h*j;this.set(n*i+e,n*j-d*k,n*k+d*j,0,n*j+d*k,p*j+e,p*k-d*i,0,n*k-d*j,p*k+d*i,h*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,d=b.y,h=b.z,i=Math.cos(e),e=Math.sin(e),j=Math.cos(d),d=Math.sin(d),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=
+j*k,p=j*h,q=d*k,m=d*h;this.n11=n+m*e;this.n12=q*e-p;this.n13=i*d;this.n21=i*h;this.n22=i*k;this.n23=-e;this.n31=p*e-q;this.n32=m+n*e;this.n33=i*j;break;case "ZXY":n=j*k;p=j*h;q=d*k;m=d*h;this.n11=n-m*e;this.n12=-i*h;this.n13=q+p*e;this.n21=p+q*e;this.n22=i*k;this.n23=m-n*e;this.n31=-i*d;this.n32=e;this.n33=i*j;break;case "ZYX":n=i*k;p=i*h;q=e*k;m=e*h;this.n11=j*k;this.n12=q*d-p;this.n13=n*d+m;this.n21=j*h;this.n22=m*d+n;this.n23=p*d-q;this.n31=-d;this.n32=e*j;this.n33=i*j;break;case "YZX":n=i*j;p=
+i*d;q=e*j;m=e*d;this.n11=j*k;this.n12=m-n*h;this.n13=q*h+p;this.n21=h;this.n22=i*k;this.n23=-e*k;this.n31=-d*k;this.n32=p*h+q;this.n33=n-m*h;break;case "XZY":n=i*j;p=i*d;q=e*j;m=e*d;this.n11=j*k;this.n12=-h;this.n13=d*k;this.n21=n*h+m;this.n22=i*k;this.n23=p*h-q;this.n31=q*h-p;this.n32=e*k;this.n33=m*h+n;break;default:n=i*k,p=i*h,q=e*k,m=e*h,this.n11=j*k,this.n12=-j*h,this.n13=d,this.n21=p+q*d,this.n22=n-m*d,this.n23=-e*j,this.n31=m-n*d,this.n32=q+p*d,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=
+b.x,e=b.y,d=b.z,h=b.w,i=c+c,j=e+e,k=d+d,b=c*i,n=c*j;c*=k;var p=e*j;e*=k;d*=k;i*=h;j*=h;h*=k;this.n11=1-(p+d);this.n12=n-h;this.n13=c+j;this.n21=n+h;this.n22=1-(b+d);this.n23=e-i;this.n31=c-j;this.n32=e+i;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var d=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
+d.identity();d.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(d,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var d=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=d.length();
+e.y=h.length();e.z=i.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=e.x;d.n21/=e.x;d.n31/=e.x;d.n12/=e.y;d.n22/=e.y;d.n32/=e.y;d.n13/=e.z;d.n23/=e.z;d.n33/=e.z;c.setFromRotationMatrix(d);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,d=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*d;this.n22=b.n22*d;this.n32=b.n32*d;this.n13=b.n13*h;this.n23=
 b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,E=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*t*y-p*r*y+p*m*E-k*t*E-n*m*F+k*r*F;c.n12=i*r*y-h*t*y-i*m*E+e*t*E+h*m*F-e*r*F;c.n13=h*p*y-i*n*y+i*k*E-e*p*E-h*k*F+e*n*F;c.n14=i*n*m-h*p*m-i*k*r+e*p*r+h*k*t-e*n*t;c.n21=p*r*A-n*t*A-p*q*E+j*t*E+n*q*F-j*r*F;c.n22=h*t*A-i*r*A+i*q*E-d*t*E-h*q*F+d*r*F;c.n23=i*n*A-h*p*A-i*j*E+d*p*E+h*j*F-d*n*F;c.n24=
-h*p*q-i*n*q+i*j*r-d*p*r-h*j*t+d*n*t;c.n31=k*t*A-p*m*A+p*q*y-j*t*y-k*q*F+j*m*F;c.n32=i*m*A-e*t*A-i*q*y+d*t*y+e*q*F-d*m*F;c.n33=h*p*A-i*k*A+i*j*y-d*p*y-e*j*F+d*k*F;c.n34=i*k*q-e*p*q-i*j*m+d*p*m+e*j*t-d*k*t;c.n41=n*m*A-k*r*A-n*q*y+j*r*y+k*q*E-j*m*E;c.n42=e*r*A-h*m*A+h*q*y-d*r*y-e*q*E+d*m*E;c.n43=h*k*A-e*n*A-h*j*y+d*n*y+e*j*E-d*k*E;c.n44=e*n*q-h*k*q+h*j*m-d*n*m-e*j*r+d*k*r;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*i;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*q;d[8]=b*m;return c};
-THREE.Matrix4.makeFrustum=function(b,c,d,e,h,i){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+h)/(i-h);j.n34=-2*i*h/(i-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)};
-THREE.Matrix4.makeOrtho=function(b,c,d,e,h,i){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-e;p=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+e)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((i+h)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,d=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,q=b.n31,m=b.n32,r=b.n33,t=b.n34,A=b.n41,y=b.n42,E=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*t*y-p*r*y+p*m*E-k*t*E-n*m*F+k*r*F;c.n12=i*r*y-h*t*y-i*m*E+d*t*E+h*m*F-d*r*F;c.n13=h*p*y-i*n*y+i*k*E-d*p*E-h*k*F+d*n*F;c.n14=i*n*m-h*p*m-i*k*r+d*p*r+h*k*t-d*n*t;c.n21=p*r*A-n*t*A-p*q*E+j*t*E+n*q*F-j*r*F;c.n22=h*t*A-i*r*A+i*q*E-e*t*E-h*q*F+e*r*F;c.n23=i*n*A-h*p*A-i*j*E+e*p*E+h*j*F-e*n*F;c.n24=
+h*p*q-i*n*q+i*j*r-e*p*r-h*j*t+e*n*t;c.n31=k*t*A-p*m*A+p*q*y-j*t*y-k*q*F+j*m*F;c.n32=i*m*A-d*t*A-i*q*y+e*t*y+d*q*F-e*m*F;c.n33=h*p*A-i*k*A+i*j*y-e*p*y-d*j*F+e*k*F;c.n34=i*k*q-d*p*q-i*j*m+e*p*m+d*j*t-e*k*t;c.n41=n*m*A-k*r*A-n*q*y+j*r*y+k*q*E-j*m*E;c.n42=d*r*A-h*m*A+h*q*y-e*r*y-d*q*E+e*m*E;c.n43=h*k*A-d*n*A-h*j*y+e*n*y+d*j*E-e*k*E;c.n44=d*n*q-h*k*q+h*j*m-e*n*m-d*j*r+e*k*r;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,d=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=b.n22*b.n11-b.n21*b.n12,b=b.n11*d+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*d;e[1]=b*h;e[2]=b*i;e[3]=b*j;e[4]=b*k;e[5]=b*n;e[6]=b*p;e[7]=b*q;e[8]=b*m;return c};
+THREE.Matrix4.makeFrustum=function(b,c,e,d,h,i){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(d-e);j.n23=(d+e)/(d-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+h)/(i-h);j.n34=-2*i*h/(i-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,d){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,d)};
+THREE.Matrix4.makeOrtho=function(b,c,e,d,h,i){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=e-d;p=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((e+d)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((i+h)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.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(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.remove(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var d,e,h;d=0;for(e=this.children.length;d<e;d++){h=this.children[d];if(h.name===
-b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
+-1){b.parent!==void 0&&b.parent.remove(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,e=this.children.indexOf(b);if(e!==-1){b.parent=void 0;for(this.children.splice(e,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var e,d,h;e=0;for(d=this.children.length;e<d;e++){h=this.children[e];if(h.name===
+b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
+this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,d=this.children.length;b<d;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=n[k]=n[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,f=1,e=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return e>=0&&i>=0&&h>=0&&j>=0?!0:e<0&&i<0||h<0&&j<0?!1:(e<0?d=Math.max(d,e/(e-i)):i<0&&(f=Math.min(f,e/(e-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(f=Math.min(f,h/(h-j))),f<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-f),!0))}var e,h,i=[],j,k,n=[],p,q,m=[],r,t=[],A,y,E=[],F,wa,xa=[],qa=[],ra=[],ja=new THREE.Vector4,
-G=new THREE.Vector4,v=new THREE.Matrix4,U=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.pickingRay=function(b,c){var d;
-b.z=-1;d=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(d,c);d.subSelf(b).normalize();return new THREE.Ray(b,d)};this.projectObjects=function(b,d,j){var f,k;h=qa.length=0;f=b.objects;b=0;for(d=f.length;b<d;b++){k=f[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh)if(p=k.frustumCulled){a:{p=void 0;for(var n=k.matrixWorld,t=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++)if(p=L[q].x*n.n14+L[q].y*n.n24+L[q].z*n.n34+
-L[q].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=i[h]=i[h]||new THREE.RenderableObject,h++,e=p,ja.copy(k.position),v.multiplyVector3(ja),e.object=k,e.z=ja.z,qa.push(e)}j&&qa.sort(c);return qa};this.projectScene=function(e,i,h){var f=i.near,qa=i.far,ja,va,V,S,J,$,N,la,sa,Q,Aa,Ma,Sa,Ia,Ba,Ea,za;wa=y=r=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);e.update(void 0,!1,i);v.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);L[1].set(v.n41+v.n11,
-v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);L[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);L[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);L[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);L[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(e,i,!0);e=0;for(ja=sa.length;e<ja;e++)if(Q=sa[e].object,Q.visible)if(Aa=Q.matrixWorld,Ma=Q.matrixRotationWorld,Sa=Q.materials,
-Ia=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;S=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(V=S.length;va<V;va++)j=b(),j.positionWorld.copy(S[va].position),Aa.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),v.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>f&&j.positionScreen.z<qa;S=0;for(va=Ea.length;S<va;S++){V=Ea[S];if(V instanceof THREE.Face3)if(J=n[V.a],$=n[V.b],
-N=n[V.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0))la=m[q]=m[q]||new THREE.RenderableFace3,q++,p=la,p.v1.copy(J),p.v2.copy($),p.v3.copy(N);else continue;else if(V instanceof THREE.Face4)if(J=n[V.a],$=n[V.b],N=n[V.c],la=n[V.d],J.visible&&$.visible&&N.visible&&la.visible&&(Q.doubleSided||Q.flipSided!=((la.positionScreen.x-
-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(la.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(la.positionScreen.y-N.positionScreen.y)-($.positionScreen.y-N.positionScreen.y)*(la.positionScreen.x-N.positionScreen.x)<0)))za=t[r]=t[r]||new THREE.RenderableFace4,r++,p=za,p.v1.copy(J),p.v2.copy($),p.v3.copy(N),p.v4.copy(la);else continue;p.normalWorld.copy(V.normal);Ma.multiplyVector3(p.normalWorld);p.centroidWorld.copy(V.centroid);
-Aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);N=V.vertexNormals;J=0;for($=N.length;J<$;J++)la=p.vertexNormalsWorld[J],la.copy(N[J]),Ma.multiplyVector3(la);J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][S]){N=0;for(la=za.length;N<la;N++)p.uvs[J][N]=za[N]}p.meshMaterials=Sa;p.faceMaterials=V.materials;p.overdraw=Ia;p.z=p.centroidScreen.z;ra.push(p)}}else if(Q instanceof THREE.Line){U.multiply(v,Aa);S=Q.geometry.vertices;J=b();J.positionScreen.copy(S[0].position);
-U.multiplyVector4(J.positionScreen);va=1;for(V=S.length;va<V;va++)if(J=b(),J.positionScreen.copy(S[va].position),U.multiplyVector4(J.positionScreen),$=n[k-2],ka.copy(J.positionScreen),Z.copy($.positionScreen),d(ka,Z))ka.multiplyScalar(1/ka.w),Z.multiplyScalar(1/Z.w),Aa=E[y]=E[y]||new THREE.RenderableLine,y++,A=Aa,A.v1.positionScreen.copy(ka),A.v2.positionScreen.copy(Z),A.z=Math.max(ka.z,Z.z),A.materials=Q.materials,ra.push(A)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,
-Q.matrixWorld.n34,1),v.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=Aa,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=Q.rotation.z,F.scale.x=Q.scale.x*Math.abs(F.x-(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=Q.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=Q.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,d=b.x*c,e=b.y*c,h=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),i=Math.cos(d),d=Math.sin(d),j=b*c,k=e*h;this.w=j*i-k*d;this.x=j*d+k*i;this.y=e*c*i+b*h*d;this.z=b*h*i-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
-this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
+THREE.Projector=function(){function b(){var b=n[k]=n[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,d=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return d>=0&&i>=0&&h>=0&&j>=0?!0:d<0&&i<0||h<0&&j<0?!1:(d<0?e=Math.max(e,d/(d-i)):i<0&&(f=Math.min(f,d/(d-i))),h<0?e=Math.max(e,h/(h-j)):j<0&&(f=Math.min(f,h/(h-j))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var d,h,i=[],j,k,n=[],p,q,m=[],r,t=[],A,y,E=[],F,wa,xa=[],qa=[],ra=[],ja=new THREE.Vector3,
+G=new THREE.Vector4,v=new THREE.Matrix4,U=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){THREE.Matrix4.makeInvert(c.matrixWorld,c.matrixWorldInverse);v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);
+return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,j){var f,k;h=qa.length=0;f=b.objects;b=0;for(e=f.length;b<e;b++){k=f[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh)if(p=k.frustumCulled){a:{p=void 0;for(var n=k.matrixWorld,t=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++)if(p=
+L[q].x*n.n14+L[q].y*n.n24+L[q].z*n.n34+L[q].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=i[h]=i[h]||new THREE.RenderableObject,h++,d=p,ja.copy(k.position),v.multiplyVector3(ja),d.object=k,d.z=ja.z,qa.push(d)}j&&qa.sort(c);return qa};this.projectScene=function(d,i,h){var f=i.near,qa=i.far,ja,va,V,S,J,$,N,la,sa,Q,Aa,Ma,Sa,Ia,Ba,Ea,za;wa=y=r=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);d.update(void 0,!1,i);THREE.Matrix4.makeInvert(i.matrixWorld,i.matrixWorldInverse);v.multiply(i.projectionMatrix,
+i.matrixWorldInverse);L[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);L[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);L[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);L[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);L[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);L[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(d,i,!0);d=0;for(ja=sa.length;d<
+ja;d++)if(Q=sa[d].object,Q.visible)if(Aa=Q.matrixWorld,Ma=Q.matrixRotationWorld,Sa=Q.materials,Ia=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;S=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(V=S.length;va<V;va++)j=b(),j.positionWorld.copy(S[va].position),Aa.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),v.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>f&&j.positionScreen.z<
+qa;S=0;for(va=Ea.length;S<va;S++){V=Ea[S];if(V instanceof THREE.Face3)if(J=n[V.a],$=n[V.b],N=n[V.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0))la=m[q]=m[q]||new THREE.RenderableFace3,q++,p=la,p.v1.copy(J),p.v2.copy($),p.v3.copy(N);else continue;else if(V instanceof THREE.Face4)if(J=n[V.a],$=n[V.b],N=n[V.c],la=n[V.d],J.visible&&
+$.visible&&N.visible&&la.visible&&(Q.doubleSided||Q.flipSided!=((la.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(la.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(la.positionScreen.y-N.positionScreen.y)-($.positionScreen.y-N.positionScreen.y)*(la.positionScreen.x-N.positionScreen.x)<0)))za=t[r]=t[r]||new THREE.RenderableFace4,r++,p=za,p.v1.copy(J),p.v2.copy($),p.v3.copy(N),p.v4.copy(la);else continue;
+p.normalWorld.copy(V.normal);Ma.multiplyVector3(p.normalWorld);p.centroidWorld.copy(V.centroid);Aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);N=V.vertexNormals;J=0;for($=N.length;J<$;J++)la=p.vertexNormalsWorld[J],la.copy(N[J]),Ma.multiplyVector3(la);J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][S]){N=0;for(la=za.length;N<la;N++)p.uvs[J][N]=za[N]}p.meshMaterials=Sa;p.faceMaterials=V.materials;p.overdraw=Ia;p.z=p.centroidScreen.z;ra.push(p)}}else if(Q instanceof
+THREE.Line){U.multiply(v,Aa);S=Q.geometry.vertices;J=b();J.positionScreen.copy(S[0].position);U.multiplyVector4(J.positionScreen);va=1;for(V=S.length;va<V;va++)if(J=b(),J.positionScreen.copy(S[va].position),U.multiplyVector4(J.positionScreen),$=n[k-2],ka.copy(J.positionScreen),Z.copy($.positionScreen),e(ka,Z))ka.multiplyScalar(1/ka.w),Z.multiplyScalar(1/Z.w),Aa=E[y]=E[y]||new THREE.RenderableLine,y++,A=Aa,A.v1.positionScreen.copy(ka),A.v2.positionScreen.copy(Z),A.z=Math.max(ka.z,Z.z),A.materials=
+Q.materials,ra.push(A)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),v.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=Aa,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=Q.rotation.z,F.scale.x=Q.scale.x*Math.abs(F.x-(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=Q.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=Q.materials,ra.push(F);h&&
+ra.sort(c);return ra}};THREE.Quaternion=function(b,c,e,d){this.set(b||0,c||0,e||0,d!==void 0?d:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,d){this.x=b;this.y=c;this.z=e;this.w=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,d=b.y*c,h=b.z*c,b=Math.cos(d),d=Math.sin(d),c=Math.cos(-h),h=Math.sin(-h),i=Math.cos(e),e=Math.sin(e),j=b*c,k=d*h;this.w=j*i-k*e;this.x=j*e+k*i;this.y=d*c*i+b*h*e;this.z=b*h*i-d*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,d=Math.sin(e);
+this.x=b.x*d;this.y=b.y*d;this.z=b.z*d;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,d=this.y,e=this.z,h=this.w,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+d*k-e*j;this.y=d*b+h*j+e*i-c*k;this.z=e*b+h*k+c*j-d*i;this.w=h*b-c*i-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,i=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*h-k*e,q=n*e+k*d-i*h,m=n*h+i*e-j*d,d=-i*
-d-j*e-k*h;c.x=p*n+d*-i+q*-k-m*-j;c.y=q*n+d*-j+m*-i-p*-k;c.z=m*n+d*-k+p*-j-q*-i;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var i=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};
-THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,h,i){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,d,e,h,i,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
+this.x,e=this.y,d=this.z,h=this.w,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+e*k-d*j;this.y=e*b+h*j+d*i-c*k;this.z=d*b+h*k+c*j-e*i;this.w=h*b-c*i-e*j-d*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,d=b.y,h=b.z,i=this.x,j=this.y,k=this.z,n=this.w,p=n*e+j*h-k*d,q=n*d+k*e-i*h,m=n*h+i*d-j*e,e=-i*
+e-j*d-k*h;c.x=p*n+e*-i+q*-k-m*-j;c.y=q*n+e*-j+m*-i-p*-k;c.z=m*n+e*-k+p*-j-q*-i;return c}};THREE.Quaternion.slerp=function(b,c,e,d){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-d)*i)/j;d=Math.sin(d*i)/j;e.w=b.w*h+c.w*d;e.x=b.x*h+c.x*d;e.y=b.y*h+c.y*d;e.z=b.z*h+c.z*d;return e};
+THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,d,h,i){this.a=b;this.b=c;this.c=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,e,d,h,i,j){this.a=b;this.b=c;this.c=e;this.d=d;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,e=this.vertices.length;d<e;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(e=this.faces.length;d<e;d++){var h=this.faces[d];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
-c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-d,e,h,i,j,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){i=this.faces[e];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],d=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,d.position),n.sub(c.position,d.position),k.crossSelf(n);k.isZero()||k.normalize();i.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
-Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof
-THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,i,h){k=b.vertices[f].position;n=b.vertices[c].position;p=b.vertices[d].position;q=j[e];m=j[i];r=j[h];t=n.x-k.x;A=p.x-k.x;y=n.y-k.y;E=p.y-k.y;F=n.z-k.z;wa=p.z-k.z;xa=m.u-q.u;qa=r.u-q.u;ra=m.v-q.v;ja=r.v-q.v;G=1/(xa*ja-qa*ra);ka.set((ja*t-ra*A)*G,(ja*y-ra*E)*G,(ja*F-ra*wa)*G);Z.set((xa*A-qa*t)*G,(xa*E-qa*y)*G,(xa*wa-qa*F)*G);U[f].addSelf(ka);U[c].addSelf(ka);
-U[d].addSelf(ka);L[f].addSelf(Z);L[c].addSelf(Z);L[d].addSelf(Z)}var c,d,e,h,i,j,k,n,p,q,m,r,t,A,y,E,F,wa,xa,qa,ra,ja,G,v,U=[],L=[],ka=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,W=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),
-b(this,i.a,i.b,i.d,0,1,3));var f=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(e=0;e<i.vertexNormals.length;e++)M.copy(i.vertexNormals[e]),h=i[f[e]],v=U[h],ya.copy(v),ya.subSelf(M.multiplyScalar(M.dot(v))).normalize(),W.cross(i.vertexNormals[e],v),h=W.dot(L[h]),h=h<0?-1:1,i.vertexTangents[e]=new THREE.Vector4(ya.x,ya.y,ya.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
-this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],d=[],e,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)e=this.vertices[i].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),
-b[e]===void 0?(b[e]=i,c.push(this.vertices[i]),d[i]=c.length-1):d[i]=d[b[e]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,e,i,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*i+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,i,j,k,n,p,q,m,r;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);j=h-i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>this.points.length-2?i:i+1;d[3]=i>this.points.length-3?i:i+2;p=this.points[d[0]];q=this.points[d[1]];
-m=this.points[d[2]];r=this.points[d[3]];k=j*j;n=j*k;e.x=c(p.x,q.x,m.x,r.x,j,k,n);e.y=c(p.y,q.y,m.y,r.y,j,k,n);e.z=c(p.z,q.z,m.z,r.z,j,k,n);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
-k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(j[c]=k,e=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,e,i,h,j,k=[],p=new THREE.Vector3,n=this.getLength();k.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=n.chunks[c]-n.chunks[c-1];j=Math.ceil(b*d/n.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)e=i+d*(1/j)*(h-i),position=this.getPoint(e),k.push(p.copy(position).clone());
-k.push(p.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,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(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
-THREE.OrthographicCamera=function(b,c,d,e,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=d;this.bottom=e;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(b,c,d,e){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=d!==void 0?d:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,d,e,h,i){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=i;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var e=0,d=this.vertices.length;e<d;e++)b.multiplyVector3(this.vertices[e].position);e=0;for(d=this.faces.length;e<d;e++){var h=this.faces[e];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<
+c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
+e,d,h,i,j,k=new THREE.Vector3,n=new THREE.Vector3;d=0;for(h=this.faces.length;d<h;d++){i=this.faces[d];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(e=i.vertexNormals.length;c<e;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],e=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,e.position),n.sub(c.position,e.position),k.crossSelf(n);k.isZero()||k.normalize();i.normal.copy(k)}},computeVertexNormals:function(){var b,c,e,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
+Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)d[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
+THREE.Face3?(d[e.a].addSelf(e.normal),d[e.b].addSelf(e.normal),d[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(d[e.a].addSelf(e.normal),d[e.b].addSelf(e.normal),d[e.c].addSelf(e.normal),d[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(d[e.a]),e.vertexNormals[1].copy(d[e.b]),e.vertexNormals[2].copy(d[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(d[e.a]),
+e.vertexNormals[1].copy(d[e.b]),e.vertexNormals[2].copy(d[e.c]),e.vertexNormals[3].copy(d[e.d]))},computeTangents:function(){function b(b,f,c,e,d,i,h){k=b.vertices[f].position;n=b.vertices[c].position;p=b.vertices[e].position;q=j[d];m=j[i];r=j[h];t=n.x-k.x;A=p.x-k.x;y=n.y-k.y;E=p.y-k.y;F=n.z-k.z;wa=p.z-k.z;xa=m.u-q.u;qa=r.u-q.u;ra=m.v-q.v;ja=r.v-q.v;G=1/(xa*ja-qa*ra);ka.set((ja*t-ra*A)*G,(ja*y-ra*E)*G,(ja*F-ra*wa)*G);Z.set((xa*A-qa*t)*G,(xa*E-qa*y)*G,(xa*wa-qa*F)*G);U[f].addSelf(ka);U[c].addSelf(ka);
+U[e].addSelf(ka);L[f].addSelf(Z);L[c].addSelf(Z);L[e].addSelf(Z)}var c,e,d,h,i,j,k,n,p,q,m,r,t,A,y,E,F,wa,xa,qa,ra,ja,G,v,U=[],L=[],ka=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,W=new THREE.Vector3,M=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)U[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),
+b(this,i.a,i.b,i.d,0,1,3));var f=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){i=this.faces[c];for(d=0;d<i.vertexNormals.length;d++)M.copy(i.vertexNormals[d]),h=i[f[d]],v=U[h],ya.copy(v),ya.subSelf(M.multiplyScalar(M.dot(v))).normalize(),W.cross(i.vertexNormals[d],v),h=W.dot(L[h]),h=h<0?-1:1,i.vertexTangents[d]=new THREE.Vector4(ya.x,ya.y,ya.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
+this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],d,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)d=this.vertices[i].position,d=[Math.round(d.x*h),Math.round(d.y*h),Math.round(d.z*h)].join("_"),
+b[d]===void 0?(b[d]=i,c.push(this.vertices[i]),e[i]=c.length-1):e[i]=e[b[d]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
+THREE.Spline=function(b){function c(b,c,e,d,i,h,j){b=(e-b)*0.5;d=(d-c)*0.5;return(2*(c-e)+b+d)*j+(-3*(c-e)-2*b-d)*h+b*i+c}this.points=b;var e=[],d={x:0,y:0,z:0},h,i,j,k,n,p,q,m,r;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);j=h-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;p=this.points[e[0]];q=this.points[e[1]];
+m=this.points[e[2]];r=this.points[e[3]];k=j*j;n=j*k;d.x=c(p.x,q.x,m.x,r.x,j,k,n);d.y=c(p.y,q.y,m.y,r.y,j,k,n);d.z=c(p.z,q.z,m.z,r.z,j,k,n);return d};this.getControlPointsArray=function(){var b,c,e=this.points.length,d=[];for(b=0;b<e;b++)c=this.points[b],d[b]=[c.x,c.y,c.z];return d};this.getLength=function(b){var c,e,d=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);e=this.points.length*b;i.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
+k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=d&&(j[c]=k,d=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,e,d,i,h,j,k=[],p=new THREE.Vector3,n=this.getLength();k.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=n.chunks[c]-n.chunks[c-1];j=Math.ceil(b*e/n.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<j-1;e++)d=i+e*(1/j)*(h-i),position=this.getPoint(d),k.push(p.copy(position).clone());
+k.push(p.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,e,d){this.vertices=[b,c];this.vertexIndices=[e,d];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.projectionMatrix=new THREE.Matrix4;this.matrixWorldInverse=new THREE.Matrix4};
+THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,c,e,d,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=d;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
+THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(b,c,e,d){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=e!==void 0?e:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
+THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,e,d,h,i){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=d;this.width=h;this.height=i;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,d=b*e,b=Math.abs(b*c-d),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*b/this.fullWidth,d+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
+THREE.DirectionalLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,e,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0;this.castShadow=d!==void 0?d:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.Material=function(b){this.name="";this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
 b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
@@ -115,27 +114,27 @@ THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
 void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(b,c,d,e,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,e,d,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,e,h,i,j,k,n){THREE.Texture.call(this,null,h,i,j,k,n);this.image={data:b,width:c,height:d};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(b,c,e,d,h,i,j,k,n){THREE.Texture.call(this,null,h,i,j,k,n);this.image={data:b,width:c,height:e};this.format=d!==void 0?d:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
-THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
+THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
-d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
+e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
-c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,h,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(i[0],i[1],i[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
-e=this.bones[d],h.parent===-1?this.addChild(e):this.bones[h.parent].addChild(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var d,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<h;d++)b=this.children[d],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(d=0;d<h;d++)this.children[d].update(this.skinMatrix,
+c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,d,h,i,j,k;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],i=h.pos,j=h.rotq,k=h.scl,d=this.addBone(),d.name=h.name,d.position.set(i[0],i[1],i[2]),d.quaternion.set(j[0],j[1],j[2],j[3]),d.useQuaternion=!0,k!==void 0?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
+d=this.bones[e],h.parent===-1?this.addChild(d):this.bones[h.parent].addChild(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var d,h=this.children.length;for(d=0;d<h;d++)b=this.children[d],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
-d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
-THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.add(b)};
-THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
-this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;d=new THREE.Vector3(e.x,
+e.y,e.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(d));d=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(d));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.add(b)};
+THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(b>=this.LODs[d].visibleAtDistance)this.LODs[d-1].object3D.visible=!1,
+this.LODs[d].object3D.visible=!0;else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
 THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map);this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:
 !this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
@@ -144,7 +143,7 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUp
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
-THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=d!==void 0?d:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
+THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -158,7 +157,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
-THREE.UniformsUtils={merge:function(b){var c,d,e,h={};for(c=0;c<b.length;c++)for(d in e=this.clone(b[c]),e)h[d]=e[d];return h},clone:function(b){var c,d,e,h={};for(c in b)for(d in h[c]={},b[c])e=b[c][d],h[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return h}};
+THREE.UniformsUtils={merge:function(b){var c,e,d,h={};for(c=0;c<b.length;c++)for(e in d=this.clone(b[c]),d)h[e]=d[e];return h},clone:function(b){var c,e,d,h={};for(c in b)for(e in h[c]={},b[c])d=b[c][e],h[c][e]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return h}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
 value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -177,25 +176,25 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.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(b){function c(b,c,d){var e,i,h,j=b.vertices,T=j.length,x=b.colors,k=x.length,D=b.__vertexArray,p=b.__colorArray,n=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,m=b.__webglCustomAttributes,r,t;if(m)for(r in m)m[r].offset=0;if(d.sortParticles){Fa.multiplySelf(d.matrixWorld);for(e=0;e<T;e++)i=j[e].position,Ka.copy(i),Fa.multiplyVector3(Ka),n[e]=[Ka.z,e];n.sort(function(b,c){return c[0]-b[0]});for(e=0;e<T;e++)i=j[n[e][1]].position,h=e*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;
-for(e=0;e<k;e++)h=e*3,color=x[n[e][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m){e=m[r];x=e.value.length;for(h=0;h<x;h++){index=n[h][1];k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")t=e.value[index];e.size===2?(e.array[k]=t.x,e.array[k+1]=t.y):e.size===3?e.type==="c"?(e.array[k]=t.r,e.array[k+1]=t.g,e.array[k+2]=t.b):(e.array[k]=t.x,e.array[k+1]=t.y,e.array[k+2]=t.z):(e.array[k]=
-t.x,e.array[k+1]=t.y,e.array[k+2]=t.z,e.array[k+3]=t.w)}e.offset+=e.size}}}else{if(C)for(e=0;e<T;e++)i=j[e].position,h=e*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;if(q)for(e=0;e<k;e++)color=x[e],h=e*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m)if(e=m[r],e.__original.needsUpdate){x=e.value.length;for(h=0;h<x;h++){k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")t=e.value[h];e.size===2?(e.array[k]=
-t.x,e.array[k+1]=t.y):e.size===3?e.type==="c"?(e.array[k]=t.r,e.array[k+1]=t.g,e.array[k+2]=t.b):(e.array[k]=t.x,e.array[k+1]=t.y,e.array[k+2]=t.z):(e.array[k]=t.x,e.array[k+1]=t.y,e.array[k+2]=t.z,e.array[k+3]=t.w)}e.offset+=e.size}}}if(C||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(q||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(m)for(r in m)if(e=m[r],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
-e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,i){e.program||M.initMaterial(e,c,d,i);if(e.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,j=h.uniforms,x=e.uniforms;h!=Xa&&(f.useProgram(h),Xa=h,k=!0);if(e.id!=V)V=e.id,k=!0;if(k){f.uniformMatrix4fv(j.projectionMatrix,!1,Ua);if(d&&e.fog)if(x.fogColor.value=d.color,d instanceof
-THREE.Fog)x.fogNear.value=d.near,x.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)x.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,D,n=0,q=0,C=0,m,t,r,u=Za,H=u.directional.colors,A=u.directional.positions,z=u.point.colors,y=u.point.positions,F=u.point.distances,E=0,K=0,d=p=r=0,k=c.length;d<k;d++)if(p=c[d],D=p.color,m=p.position,t=p.intensity,r=p.distance,p instanceof THREE.AmbientLight)n+=D.r,q+=D.g,C+=D.b;else if(p instanceof
-THREE.DirectionalLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,A[r]=m.x,A[r+1]=m.y,A[r+2]=m.z,E+=1;else if(p instanceof THREE.SpotLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,D=1/m.length(),A[r]=m.x*D,A[r+1]=m.y*D,A[r+2]=m.z*D,E+=1;else if(p instanceof THREE.PointLight)p=K*3,z[p]=D.r*t,z[p+1]=D.g*t,z[p+2]=D.b*t,y[p]=m.x,y[p+1]=m.y,y[p+2]=m.z,F[K]=r,K+=1;d=E*3;for(k=H.length;d<k;d++)H[d]=0;d=K*3;for(k=z.length;d<k;d++)z[d]=0;u.point.length=K;u.directional.length=E;u.ambient[0]=n;u.ambient[1]=
-q;u.ambient[2]=C;c=Za;x.enableLighting.value=c.directional.length+c.point.length;x.ambientLightColor.value=c.ambient;x.directionalLightColor.value=c.directional.colors;x.directionalLightDirection.value=c.directional.positions;x.pointLightColor.value=c.point.colors;x.pointLightPosition.value=c.point.positions;x.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)x.diffuse.value=e.color,x.opacity.value=
-e.opacity,(x.map.texture=e.map)&&x.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),x.lightMap.texture=e.lightMap,x.envMap.texture=e.envMap,x.reflectivity.value=e.reflectivity,x.refractionRatio.value=e.refractionRatio,x.combine.value=e.combine,x.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)x.diffuse.value=e.color,x.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)x.psColor.value=
-e.color,x.opacity.value=e.opacity,x.size.value=e.size,x.scale.value=Ca.height/2,x.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)x.ambient.value=e.ambient,x.specular.value=e.specular,x.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)x.mNear.value=b.near,x.mFar.value=b.far,x.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)x.opacity.value=e.opacity;if(i.receiveShadow&&!e._shadowPass&&x.shadowMatrix){for(c=0;c<Ta.length;c++)x.shadowMatrix.value[c]=
-Ta[c],x.shadowMap.texture[c]=M.shadowMap[c];x.shadowDarkness.value=M.shadowMapDarkness;x.shadowBias.value=M.shadowMapBias}c=e.uniformsList;x=0;for(d=c.length;x<d;x++)if(q=h.uniforms[c[x][1]])if(n=c[x][0],C=n.type,k=n.value,C=="i")f.uniform1i(q,k);else if(C=="f")f.uniform1f(q,k);else if(C=="v2")f.uniform2f(q,k.x,k.y);else if(C=="v3")f.uniform3f(q,k.x,k.y,k.z);else if(C=="v4")f.uniform4f(q,k.x,k.y,k.z,k.w);else if(C=="c")f.uniform3f(q,k.r,k.g,k.b);else if(C=="fv1")f.uniform1fv(q,k);else if(C=="fv")f.uniform3fv(q,
+THREE.WebGLRenderer=function(b){function c(b,c,e){var d,i,h,j=b.vertices,T=j.length,x=b.colors,k=x.length,D=b.__vertexArray,p=b.__colorArray,n=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,m=b.__webglCustomAttributes,r,t;if(m)for(r in m)m[r].offset=0;if(e.sortParticles){Fa.multiplySelf(e.matrixWorld);for(d=0;d<T;d++)i=j[d].position,Ka.copy(i),Fa.multiplyVector3(Ka),n[d]=[Ka.z,d];n.sort(function(b,f){return f[0]-b[0]});for(d=0;d<T;d++)i=j[n[d][1]].position,h=d*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;
+for(d=0;d<k;d++)h=d*3,color=x[n[d][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m){d=m[r];x=d.value.length;for(h=0;h<x;h++){index=n[h][1];k=d.offset;if(d.size===1){if(d.boundTo===void 0||d.boundTo==="vertices")d.array[k]=d.value[index]}else{if(d.boundTo===void 0||d.boundTo==="vertices")t=d.value[index];d.size===2?(d.array[k]=t.x,d.array[k+1]=t.y):d.size===3?d.type==="c"?(d.array[k]=t.r,d.array[k+1]=t.g,d.array[k+2]=t.b):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z):(d.array[k]=
+t.x,d.array[k+1]=t.y,d.array[k+2]=t.z,d.array[k+3]=t.w)}d.offset+=d.size}}}else{if(C)for(d=0;d<T;d++)i=j[d].position,h=d*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;if(q)for(d=0;d<k;d++)color=x[d],h=d*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(r in m)if(d=m[r],d.__original.needsUpdate){x=d.value.length;for(h=0;h<x;h++){k=d.offset;if(d.size===1){if(d.boundTo===void 0||d.boundTo==="vertices")d.array[k]=d.value[h]}else{if(d.boundTo===void 0||d.boundTo==="vertices")t=d.value[h];d.size===2?(d.array[k]=
+t.x,d.array[k+1]=t.y):d.size===3?d.type==="c"?(d.array[k]=t.r,d.array[k+1]=t.g,d.array[k+2]=t.b):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z):(d.array[k]=t.x,d.array[k+1]=t.y,d.array[k+2]=t.z,d.array[k+3]=t.w)}d.offset+=d.size}}}if(C||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(q||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(m)for(r in m)if(d=m[r],d.__original.needsUpdate||e.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
+d.buffer),f.bufferData(f.ARRAY_BUFFER,d.array,c)}function e(b,c,e,d,i){d.program||M.initMaterial(d,c,e,i);if(d.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=d.program,j=h.uniforms,x=d.uniforms;h!=Xa&&(f.useProgram(h),Xa=h,k=!0);if(d.id!=V)V=d.id,k=!0;if(k){f.uniformMatrix4fv(j.projectionMatrix,!1,Ua);if(e&&d.fog)if(x.fogColor.value=e.color,e instanceof
+THREE.Fog)x.fogNear.value=e.near,x.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)x.fogDensity.value=e.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var p,D,n=0,q=0,C=0,m,t,r,u=Za,H=u.directional.colors,A=u.directional.positions,z=u.point.colors,y=u.point.positions,F=u.point.distances,E=0,K=0,e=p=r=0,k=c.length;e<k;e++)if(p=c[e],D=p.color,m=p.position,t=p.intensity,r=p.distance,p instanceof THREE.AmbientLight)n+=D.r,q+=D.g,C+=D.b;else if(p instanceof
+THREE.DirectionalLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,A[r]=m.x,A[r+1]=m.y,A[r+2]=m.z,E+=1;else if(p instanceof THREE.SpotLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,D=1/m.length(),A[r]=m.x*D,A[r+1]=m.y*D,A[r+2]=m.z*D,E+=1;else if(p instanceof THREE.PointLight)p=K*3,z[p]=D.r*t,z[p+1]=D.g*t,z[p+2]=D.b*t,y[p]=m.x,y[p+1]=m.y,y[p+2]=m.z,F[K]=r,K+=1;e=E*3;for(k=H.length;e<k;e++)H[e]=0;e=K*3;for(k=z.length;e<k;e++)z[e]=0;u.point.length=K;u.directional.length=E;u.ambient[0]=n;u.ambient[1]=
+q;u.ambient[2]=C;c=Za;x.enableLighting.value=c.directional.length+c.point.length;x.ambientLightColor.value=c.ambient;x.directionalLightColor.value=c.directional.colors;x.directionalLightDirection.value=c.directional.positions;x.pointLightColor.value=c.point.colors;x.pointLightPosition.value=c.point.positions;x.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)x.diffuse.value=d.color,x.opacity.value=
+d.opacity,(x.map.texture=d.map)&&x.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),x.lightMap.texture=d.lightMap,x.envMap.texture=d.envMap,x.reflectivity.value=d.reflectivity,x.refractionRatio.value=d.refractionRatio,x.combine.value=d.combine,x.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)x.diffuse.value=d.color,x.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)x.psColor.value=
+d.color,x.opacity.value=d.opacity,x.size.value=d.size,x.scale.value=Ca.height/2,x.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)x.ambient.value=d.ambient,x.specular.value=d.specular,x.shininess.value=d.shininess;else if(d instanceof THREE.MeshDepthMaterial)x.mNear.value=b.near,x.mFar.value=b.far,x.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)x.opacity.value=d.opacity;if(i.receiveShadow&&!d._shadowPass&&x.shadowMatrix){for(c=0;c<Ta.length;c++)x.shadowMatrix.value[c]=
+Ta[c],x.shadowMap.texture[c]=M.shadowMap[c];x.shadowDarkness.value=M.shadowMapDarkness;x.shadowBias.value=M.shadowMapBias}c=d.uniformsList;x=0;for(e=c.length;x<e;x++)if(q=h.uniforms[c[x][1]])if(n=c[x][0],C=n.type,k=n.value,C=="i")f.uniform1i(q,k);else if(C=="f")f.uniform1f(q,k);else if(C=="v2")f.uniform2f(q,k.x,k.y);else if(C=="v3")f.uniform3f(q,k.x,k.y,k.z);else if(C=="v4")f.uniform4f(q,k.x,k.y,k.z,k.w);else if(C=="c")f.uniform3f(q,k.r,k.g,k.b);else if(C=="fv1")f.uniform1fv(q,k);else if(C=="fv")f.uniform3fv(q,
 k);else if(C=="v3v"){if(!n._array)n._array=new Float32Array(3*k.length);C=0;for(m=k.length;C<m;C++)u=C*3,n._array[u]=k[C].x,n._array[u+1]=k[C].y,n._array[u+2]=k[C].z;f.uniform3fv(q,n._array)}else if(C=="m4"){if(!n._array)n._array=new Float32Array(16);k.flattenToArray(n._array);f.uniformMatrix4fv(q,!1,n._array)}else if(C=="m4v"){if(!n._array)n._array=new Float32Array(16*k.length);C=0;for(m=k.length;C<m;C++)k[C].flattenToArrayOffset(n._array,C*16);f.uniformMatrix4fv(q,!1,n._array)}else if(C=="t"){if(f.uniform1i(q,
 k),q=n.texture)if(q.image instanceof Array&&q.image.length==6){if(n=q,n.image.length==6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+k);f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(k=0;k<6;k++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,n.image[k]);v(f.TEXTURE_CUBE_MAP,n,n.image[0]);n.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else q instanceof
-THREE.WebGLRenderTargetCube?(n=q,f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.__webglTexture)):U(q,k)}else if(C=="tv"){if(!n._array){n._array=[];C=0;for(m=n.texture.length;C<m;C++)n._array[C]=k+C}f.uniform1iv(q,n._array);C=0;for(m=n.texture.length;C<m;C++)(q=n.texture[C])&&U(q,n._array[C])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Va);e.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Va),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||i.receiveShadow)&&
-j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function e(b,c,e,i,h,j){if(i.opacity!=0){var k,e=d(b,c,e,i,j),b=e.attributes,c=!1,e=h.id*16777215+e.id*2+(i.wireframe?1:0);e!=S&&(S=e,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){e=i.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
-f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0)):e.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,x=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<x.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x[n]]),f.vertexAttribPointer(e["morphTarget"+n],3,f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[x[n]],n++;else{var x=[],q=-1,
-m=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(x[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!x[t]&&p[t]>q&&(m=t,q=p[m]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m]);f.vertexAttribPointer(e["morphTarget"+n],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=q;x[m]=1;q=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
-0&&(e=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,e.buffer),f.vertexAttribPointer(b[k],e.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,
+THREE.WebGLRenderTargetCube?(n=q,f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.__webglTexture)):U(q,k)}else if(C=="tv"){if(!n._array){n._array=[];C=0;for(m=n.texture.length;C<m;C++)n._array[C]=k+C}f.uniform1iv(q,n._array);C=0;for(m=n.texture.length;C<m;C++)(q=n.texture[C])&&U(q,n._array[C])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&j.cameraPosition!==null&&f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(d instanceof
+THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Va);d.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Va),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||i.receiveShadow)&&
+j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function d(b,c,d,i,h,j){if(i.opacity!=0){var k,d=e(b,c,d,i,j),b=d.attributes,c=!1,d=h.id*16777215+d.id*2+(i.wireframe?1:0);d!=S&&(S=d,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){d=i.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
+f.vertexAttribPointer(d.position,3,f.FLOAT,!1,0,0)):d.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(d.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,x=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<x.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x[n]]),f.vertexAttribPointer(d["morphTarget"+n],3,f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[x[n]],n++;else{var x=[],q=-1,
+m=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(x[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!x[t]&&p[t]>q&&(m=t,q=p[m]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m]);f.vertexAttribPointer(d["morphTarget"+n],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=q;x[m]=1;q=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
+0&&(d=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,d.buffer),f.vertexAttribPointer(b[k],d.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,
 h.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,
 f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(i.wireframe?(f.lineWidth(i.wireframeLinewidth),c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,
 f.UNSIGNED_SHORT,0)):(c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(i.linewidth),f.drawArrays(j,0,h.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),M.info.render.calls++):
@@ -205,13 +204,13 @@ b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,i,j,k,x,n,p,q,m,C=b.coun
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=aa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
 Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=aa[d].x*c.n14+aa[d].y*c.n24+aa[d].z*c.n34+aa[d].w,b<=f)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,f,d=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=d.materials.length;b<c;b++)f=d.materials[b],f.transparent?m(h,f):m(e,f)}function t(b){var c,f,d,e,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
 0;for(f=i.materials.length;c<f;c++)(e=i.materials[c])&&(e.transparent?m(k,e):m(j,e))}else(e=c)&&(e.transparent?m(k,e):m(j,e))}function A(b,c){return c.z-b.z}function y(b){var c,k,n,I=0,m,t,r,x,u=b.lights;X||(X=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=u.length;c<k;c++)if(n=u[c],n instanceof THREE.SpotLight&&n.castShadow){V=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ta[I]||(Ta[I]=new THREE.Matrix4);m=M.shadowMap[I];t=Ta[I];X.position.copy(n.position);X.lookAt(n.target.position);X.update(void 0,!0);b.update(void 0,!1,X);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(X.projectionMatrix);t.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Va);X.projectionMatrix.flattenToArray(Ua);Fa.multiply(X.projectionMatrix,X.matrixWorldInverse);p(Fa);
-M.initWebGLObjects(b);L(m);f.clearColor(1,1,1,1);M.clear();f.clearColor(ha.r,ha.g,ha.b,Ga);t=b.__webglObjects.length;n=b.__webglObjectsImmediate.length;for(m=0;m<t;m++)r=b.__webglObjects[m],x=r.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||q(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),F(x,X,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(m=0;m<t;m++)if(r=b.__webglObjects[m],r.render)x=r.object,buffer=r.buffer,i(x),r=x.customDepthMaterial?
-x.customDepthMaterial:x.geometry.morphTargets.length?$a:Wa,e(X,u,null,r,buffer,x);for(m=0;m<n;m++)r=b.__webglObjectsImmediate[m],x=r.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),S=-1,F(x,X,!1),i(x),program=d(X,u,null,Wa,x),x.immediateRenderCallback?x.immediateRenderCallback(program,f,aa):x.render(function(b){h(b,program,Wa.shading)}));I++}}function E(b,c){var d,e,h;d=u.attributes;var i=u.uniforms,j=za/Ea,k,x=[],n=Ea*0.5,m=za*0.5,p=!0;f.useProgram(u.program);
-Xa=u.program;S=sa=la=-1;ab||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),ab=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(i.projectionMatrix,!1,Ua);f.activeTexture(f.TEXTURE0);f.uniform1i(i.map,0);d=0;for(e=b.__webglSprites.length;d<
-e;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(i.useScreenCoordinates,1),f.uniform3f(i.screenPosition,(h.position.x-n)/n,(m-h.position.y)/
-m,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(i.useScreenCoordinates,0),f.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),x[0]=k*j*h.scale.x,x[1]=k*h.scale.y,f.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(i.alignment,h.alignment.x,h.alignment.y),f.uniform1f(i.opacity,h.opacity),f.uniform3f(i.color,h.color.r,h.color.g,
-h.color.b),f.uniform1f(i.rotation,h.rotation),f.uniform2fv(i.scale,x),h.mergeWith3D&&!p?(f.enable(f.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(f.disable(f.DEPTH_TEST),p=!1),G(h.blending),U(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(Q)}function F(b,c,f){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);f&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ta[I]||(Ta[I]=new THREE.Matrix4);m=M.shadowMap[I];t=Ta[I];X.position.copy(n.position);X.lookAt(n.target.position);X.update(void 0,!0);b.update(void 0,!1,X);THREE.Matrix4.makeInvert(X.matrixWorld,X.matrixWorldInverse);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(X.projectionMatrix);t.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Va);X.projectionMatrix.flattenToArray(Ua);
+Fa.multiply(X.projectionMatrix,X.matrixWorldInverse);p(Fa);M.initWebGLObjects(b);L(m);f.clearColor(1,1,1,1);M.clear();f.clearColor(ha.r,ha.g,ha.b,Ga);t=b.__webglObjects.length;n=b.__webglObjectsImmediate.length;for(m=0;m<t;m++)r=b.__webglObjects[m],x=r.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||q(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),F(x,X,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(m=0;m<t;m++)if(r=b.__webglObjects[m],
+r.render)x=r.object,buffer=r.buffer,i(x),r=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?$a:Wa,d(X,u,null,r,buffer,x);for(m=0;m<n;m++)r=b.__webglObjectsImmediate[m],x=r.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),S=-1,F(x,X,!1),i(x),program=e(X,u,null,Wa,x),x.immediateRenderCallback?x.immediateRenderCallback(program,f,aa):x.render(function(b){h(b,program,Wa.shading)}));I++}}function E(b,c){var d,e,h;d=u.attributes;
+var i=u.uniforms,j=za/Ea,k,x=[],n=Ea*0.5,m=za*0.5,p=!0;f.useProgram(u.program);Xa=u.program;S=sa=la=-1;ab||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),ab=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(i.projectionMatrix,!1,Ua);
+f.activeTexture(f.TEXTURE0);f.uniform1i(i.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(i.useScreenCoordinates,
+1),f.uniform3f(i.screenPosition,(h.position.x-n)/n,(m-h.position.y)/m,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(i.useScreenCoordinates,0),f.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),x[0]=k*j*h.scale.x,x[1]=k*h.scale.y,f.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(i.alignment,h.alignment.x,h.alignment.y),
+f.uniform1f(i.opacity,h.opacity),f.uniform3f(i.color,h.color.r,h.color.g,h.color.b),f.uniform1f(i.rotation,h.rotation),f.uniform2fv(i.scale,x),h.mergeWith3D&&!p?(f.enable(f.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(f.disable(f.DEPTH_TEST),p=!1),G(h.blending),U(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(Q)}function F(b,c,f){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);f&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 function wa(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var f;for(f=b.length-1;f>=0;f--)b[f].object==c&&b.splice(f,1)}function ra(b){function c(b){var e=[];f=0;for(d=b.length;f<d;f++)b[f]==void 0?e.push("undefined"):e.push(b[f].id);
 return e.join("_")}var f,d,e,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)i=b.faces[e],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]=
 {faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(e),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,f){b.push({buffer:c,object:f,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=la){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);
@@ -247,51 +246,52 @@ d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_W
 f.getError()+"]");r.uniforms={};r.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)e.push(u);u=e;e=0;for(n=u.length;e<n;e++)m=u[e],r.uniforms[m]=f.getUniformLocation(r,m);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(C in c)e.push(C);
 C=e;u=0;for(c=C.length;u<c;u++)d=C[u],r.attributes[d]=f.getAttribLocation(r,d);r.id=ua.length;ua.push({program:r,code:k});M.info.memory.programs=ua.length;C=r}b.program=C;C=b.program.attributes;C.position>=0&&f.enableVertexAttribArray(C.position);C.color>=0&&f.enableVertexAttribArray(C.color);C.normal>=0&&f.enableVertexAttribArray(C.normal);C.tangent>=0&&f.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(f.enableVertexAttribArray(C.skinVertexA),
 f.enableVertexAttribArray(C.skinVertexB),f.enableVertexAttribArray(C.skinIndex),f.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&f.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(f.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){L(b);
-this.clear(c,d,f)};this.render=function(b,c,m,u){var I,Ja,v,T,x,J,D,Qa,Ra=b.lights,C=b.fog;V=-1;this.shadowMapEnabled&&y(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Va);c.projectionMatrix.flattenToArray(Ua);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);L(m);(this.autoClear||u)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(u=0;u<x;u++)if(I=b.__webglObjects[u],D=I.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||q(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),t(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ka.copy(D.position),Fa.multiplyVector3(Ka),I.z=Ka.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(A);J=b.__webglObjectsImmediate.length;for(u=
-0;u<J;u++)I=b.__webglObjectsImmediate[u],D=I.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),r(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render)D=I.object,Qa=I.buffer,i(D),e(c,Ra,C,b.overrideMaterial,Qa,D);for(u=0;u<J;u++)I=b.__webglObjectsImmediate[u],D=I.object,D.visible&&(S=-1,i(D),Ja=d(c,Ra,C,b.overrideMaterial,D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,
-f,aa):D.render(function(c){h(c,Ja,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(u=x-1;u>=0;u--)if(I=b.__webglObjects[u],I.render){D=I.object;Qa=I.buffer;v=I.opaque;i(D);for(I=0;I<v.count;I++)T=v.list[I],j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),e(c,Ra,C,T,Qa,D)}for(u=0;u<J;u++)if(I=b.__webglObjectsImmediate[u],D=I.object,D.visible){S=-1;v=I.opaque;i(D);for(I=0;I<v.count;I++)T=v.list[I],j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,
-T.polygonOffsetFactor,T.polygonOffsetUnits),Ja=d(c,Ra,C,T,D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,f,aa):D.render(function(b){h(b,Ja,T.shading)})}for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render){D=I.object;Qa=I.buffer;v=I.transparent;i(D);for(I=0;I<v.count;I++)T=v.list[I],G(T.blending),j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),e(c,Ra,C,T,Qa,D)}for(u=0;u<J;u++)if(I=b.__webglObjectsImmediate[u],D=I.object,D.visible){S=-1;v=I.transparent;
-i(D);for(I=0;I<v.count;I++)T=v.list[I],G(T.blending),j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),Ja=d(c,Ra,C,T,D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,f,aa):D.render(function(b){h(b,Ja,T.shading)})}}b.__webglSprites.length&&E(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&ka(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];
-for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=
-f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=
-[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,u=r=void 0,t=void 0,v=void 0,A=v=n=0,y=r=q=void 0,r=m=y=q=p=void 0,u=k.geometry,t=u.faces,y=j.faces,p=0,q=y.length;p<q;p++)r=y[p],r=t[r],r instanceof THREE.Face3?(n+=3,v+=1,A+=3):r instanceof THREE.Face4&&(n+=4,v+=2,A+=4);for(var p=j,q=k,F=y=t=void 0,H=void 0,F=void 0,r=[],t=0,y=q.materials.length;t<y;t++)if(F=q.materials[t],F instanceof THREE.MeshFaceMaterial){F=
-0;for(l=p.materials.length;F<l;F++)(H=p.materials[F])&&r.push(H)}else(H=F)&&r.push(H);p=r;j.__materials=p;a:{t=q=void 0;y=p.length;for(q=0;q<y;q++)if(t=p[q],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=t=void 0;r=p.length;for(t=0;t<r;t++)if(y=p[t],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{r=t=void 0;F=p.length;
-for(t=0;t<F;t++)if(r=p[t],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(n*3);if(y)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(r)j.__colorArray=new Float32Array(n*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=
-new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=r;j.__normalType=
-y;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;u=0;for(t=p.length;u<t;u++)if(q=p[u],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){r=q.attributes[a];y={};for(m in r)y[m]=r[m];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,v=1,y.type==="v2"?v=2:y.type==="v3"?v=3:y.type==="v4"?v=4:y.type==="c"&&(v=3),y.size=v,y.array=new Float32Array(n*v),y.buffer=f.createBuffer(),
-y.buffer.belongsToAttribute=a,r.needsUpdate=!0,y.__original=r;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),
-j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=
-i;j.__webglVertexBuffer=f.createBuffer();j.__webglColorBuffer=f.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;A=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(A=k.materials[m],A.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in A.attributes){originalAttribute=A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
-originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=
-!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(e.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(e.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
-e.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(e.__webglObjects,d);else if(d instanceof THREE.Sprite){e=e.__webglSprites;h=d;i=void 0;for(i=e.length-1;i>=0;i--)e[i]==h&&e.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&qa(e.__webglObjectsImmediate,d);d.__webglActive=
-!1;b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=f.DYNAMIC_DRAW,A=!h.dynamic,m.__inittedArrays){var E=p=u=void 0,z=void 0,J=E=void 0,G=void 0,Q=void 0,K=void 0,O=H=F=r=
-y=t=q=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,B=o=s=G=void 0,R=void 0,V=B=o=s=E=E=J=K=z=B=o=s=R=B=o=s=R=B=o=s=void 0,ia=0,N=0,Z=0,$=0,W=0,S=0,Y=0,U=0,ma=0,w=0,na=0,B=s=0,B=void 0,oa=m.__vertexArray,ka=m.__uvArray,la=m.__uv2Array,X=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,
-t=m.__vertexColorType,q=m.__uvType,y=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ea=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ca=ta.vertices,Ga=m.faces,Ma=ta.faces,Ia=ta.faceVertexUvs[0],Ka=ta.faceVertexUvs[1],Na=ta.skinVerticesA,Oa=ta.skinVerticesB,Pa=ta.skinIndices,La=ta.skinWeights,Ha=ta.morphTargets;if(aa)for(V in aa)aa[V].offset=0,aa[V].offsetSrc=0;u=0;for(p=Ga.length;u<p;u++)if(E=Ga[u],z=Ma[E],Ia&&(r=Ia[E]),
-Ka&&(F=Ka[E]),E=z.vertexNormals,J=z.normal,G=z.vertexColors,Q=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):
-o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=B,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c]):o.boundTo==="faces"?(P=O=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],O=o.value[B+1],P=o.value[B+2],o.offsetSrc+=3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,
-o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+
-4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Fa){s=0;for(o=Ha.length;s<o;s++)H=Ha[s].vertices[z.a].position,O=Ha[s].vertices[z.b].position,P=Ha[s].vertices[z.c].position,B=sa[s],B[na]=H.x,B[na+1]=H.y,B[na+2]=H.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z;na+=9}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
-ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,
-ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=Q,pa[ma]=z.r,pa[ma+1]=z.g,pa[ma+2]=z.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=o.r,pa[ma+7]=o.g,pa[ma+8]=o.b,ma+=9;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,Y+=12;if(Aa&&y)if(E.length==3&&
-ya)for(K=0;K<3;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<3;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<3;K++)E=r[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<3;K++)E=F[K],la[$]=E.u,la[$+1]=E.v,$+=2;za&&(ha[W]=ia,ha[W+1]=ia+1,ha[W+2]=ia+2,W+=3,Da[U]=ia,Da[U+1]=ia+1,Da[U+2]=ia,Da[U+3]=ia+2,Da[U+4]=ia+1,Da[U+5]=ia+2,U+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,L=Ca[z.d].position,
-oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=B,o.array[s+3]=B,o.offsetSrc++):o.boundTo===
-"faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.array[s+3]=o.value[B+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=P=O=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],O=o.value[B+1],P=o.value[B+2],L=o.value[B+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=
-P.x,o.array[s+5]=P.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z,o.array[s+9]=L.x,o.array[s+10]=L.y,o.array[s+11]=L.z),
-o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Fa){s=0;for(o=Ha.length;s<o;s++)H=Ha[s].vertices[z.a].position,O=Ha[s].vertices[z.b].position,P=Ha[s].vertices[z.c].position,L=Ha[s].vertices[z.d].position,B=sa[s],B[na]=H.x,B[na+1]=H.y,B[na+2]=
-H.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z,B[na+9]=L.x,B[na+10]=L.y,B[na+11]=L.z;na+=12}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],R=La[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,
-fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,fa[w+12]=R.x,fa[w+13]=R.y,fa[w+14]=R.z,fa[w+15]=R.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],R=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,da[w+12]=R.x,da[w+13]=R.y,da[w+14]=R.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,ea[w+
-11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=Q,pa[ma]=z.r,pa[ma+1]=z.g,pa[ma+2]=z.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=o.r,pa[ma+7]=o.g,pa[ma+8]=o.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,
-ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&y)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<4;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<4;K++)E=r[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<4;K++)E=F[K],la[$]=E.u,la[$+1]=E.v,$+=2;za&&(ha[W]=ia,ha[W+1]=ia+1,ha[W+2]=ia+3,ha[W+3]=ia+1,ha[W+4]=ia+2,ha[W+5]=ia+3,W+=6,Da[U]=ia,Da[U+1]=ia+1,Da[U+2]=ia,Da[U+3]=ia+3,Da[U+4]=ia+1,Da[U+5]=ia+2,Da[U+
-6]=ia+2,Da[U+7]=ia+3,U+=8,ia+=4)}va&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,oa,v));if(aa)for(V in aa)o=aa[V],o.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,o.buffer),f.bufferData(f.ARRAY_BUFFER,o.array,v));if(Fa){s=0;for(o=Ha.length;s<o;s++)f.bindBuffer(f.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),f.bufferData(f.ARRAY_BUFFER,sa[s],v)}Ea&&ma>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,pa,v));Aa&&(f.bindBuffer(f.ARRAY_BUFFER,
-m.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,X,v));Ba&&ta.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,ca,v));ua&&Z>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ka,v));ua&&$>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,la,v));za&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,v),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
-f.bufferData(f.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,da,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ea,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,fa,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ga,v));A&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
-delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=A=void 0;p=i.vertices;n=
-i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
-if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=A=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
-v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,f.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
-THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
-THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
-THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
+this.clear(c,d,f)};this.render=function(b,c,m,u){var I,Ja,v,T,x,J,D,Qa,Ra=b.lights,C=b.fog;V=-1;this.shadowMapEnabled&&y(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);THREE.Matrix4.makeInvert(c.matrixWorld,c.matrixWorldInverse);c.matrixWorldInverse.flattenToArray(Va);c.projectionMatrix.flattenToArray(Ua);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);
+L(m);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(u=0;u<x;u++)if(I=b.__webglObjects[u],D=I.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||q(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),t(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ka.copy(D.position),Fa.multiplyVector3(Ka),I.z=Ka.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(A);
+J=b.__webglObjectsImmediate.length;for(u=0;u<J;u++)I=b.__webglObjectsImmediate[u],D=I.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),r(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render)D=I.object,Qa=I.buffer,i(D),d(c,Ra,C,b.overrideMaterial,Qa,D);for(u=0;u<J;u++)I=b.__webglObjectsImmediate[u],D=I.object,D.visible&&(S=-1,i(D),Ja=e(c,Ra,C,b.overrideMaterial,
+D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,f,aa):D.render(function(c){h(c,Ja,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(u=x-1;u>=0;u--)if(I=b.__webglObjects[u],I.render){D=I.object;Qa=I.buffer;v=I.opaque;i(D);for(I=0;I<v.count;I++)T=v.list[I],j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),d(c,Ra,C,T,Qa,D)}for(u=0;u<J;u++)if(I=b.__webglObjectsImmediate[u],D=I.object,D.visible){S=-1;v=I.opaque;i(D);for(I=0;I<v.count;I++)T=
+v.list[I],j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),Ja=e(c,Ra,C,T,D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,f,aa):D.render(function(b){h(b,Ja,T.shading)})}for(u=0;u<x;u++)if(I=b.__webglObjects[u],I.render){D=I.object;Qa=I.buffer;v=I.transparent;i(D);for(I=0;I<v.count;I++)T=v.list[I],G(T.blending),j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),d(c,Ra,C,T,Qa,D)}for(u=0;u<J;u++)if(I=b.__webglObjectsImmediate[u],
+D=I.object,D.visible){S=-1;v=I.transparent;i(D);for(I=0;I<v.count;I++)T=v.list[I],G(T.blending),j(T.depthTest),k(T.depthWrite),n(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),Ja=e(c,Ra,C,T,D),D.immediateRenderCallback?D.immediateRenderCallback(Ja,f,aa):D.render(function(b){h(b,Ja,T.shading)})}}b.__webglSprites.length&&E(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&ka(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
+[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=
+j;k.__webglVertexBuffer=f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=
+void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,u=r=void 0,t=void 0,v=void 0,A=v=n=0,y=r=q=void 0,r=m=y=q=p=void 0,u=k.geometry,t=u.faces,y=j.faces,p=0,q=y.length;p<q;p++)r=y[p],r=t[r],r instanceof THREE.Face3?(n+=3,v+=1,A+=3):r instanceof THREE.Face4&&(n+=4,v+=2,A+=4);for(var p=j,q=k,F=y=t=void 0,H=void 0,F=void 0,r=[],t=0,y=q.materials.length;t<
+y;t++)if(F=q.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<l;F++)(H=p.materials[F])&&r.push(H)}else(H=F)&&r.push(H);p=r;j.__materials=p;a:{t=q=void 0;y=p.length;for(q=0;q<y;q++)if(t=p[q],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=t=void 0;r=p.length;for(t=0;t<r;t++)if(y=p[t],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:
+THREE.FlatShading;break a}y=!1}a:{r=t=void 0;F=p.length;for(t=0;t<F;t++)if(r=p[t],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(n*3);if(y)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(r)j.__colorArray=new Float32Array(n*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&
+k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;
+j.__uvType=q;j.__vertexColorType=r;j.__normalType=y;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;u=0;for(t=p.length;u<t;u++)if(q=p[u],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){r=q.attributes[a];y={};for(m in r)y[m]=r[m];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,v=1,y.type==="v2"?v=2:y.type==="v3"?v=3:y.type==="v4"?v=4:y.type==="c"&&(v=3),y.size=v,y.array=
+new Float32Array(n*v),y.buffer=f.createBuffer(),y.buffer.belongsToAttribute=a,r.needsUpdate=!0,y.__original=r;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,
+j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=f.createBuffer(),j.__webglColorBuffer=f.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&
+(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=f.createBuffer();j.__webglColorBuffer=f.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;A=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(A=k.materials[m],A.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in A.attributes){originalAttribute=
+A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
+originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(e.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(e.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],
+count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(e.__webglObjects,d);else if(d instanceof THREE.Sprite){e=e.__webglSprites;h=d;i=void 0;for(i=e.length-1;i>=0;i--)e[i]==h&&e.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&
+qa(e.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=f.DYNAMIC_DRAW,A=!h.dynamic,m.__inittedArrays){var E=p=u=void 0,z=void 0,
+J=E=void 0,G=void 0,Q=void 0,K=void 0,O=H=F=r=y=t=q=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,B=o=s=G=void 0,R=void 0,V=B=o=s=E=E=J=K=z=B=o=s=R=B=o=s=R=B=o=s=void 0,ia=0,N=0,Z=0,$=0,W=0,S=0,Y=0,U=0,ma=0,w=0,na=0,B=s=0,B=void 0,oa=m.__vertexArray,ka=m.__uvArray,la=m.__uv2Array,X=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,
+ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,t=m.__vertexColorType,q=m.__uvType,y=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ea=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ca=ta.vertices,Ga=m.faces,Ma=ta.faces,Ia=ta.faceVertexUvs[0],Ka=ta.faceVertexUvs[1],Na=ta.skinVerticesA,Oa=ta.skinVerticesB,Pa=ta.skinIndices,La=ta.skinWeights,Ha=ta.morphTargets;if(aa)for(V in aa)aa[V].offset=0,aa[V].offsetSrc=
+0;u=0;for(p=Ga.length;u<p;u++)if(E=Ga[u],z=Ma[E],Ia&&(r=Ia[E]),Ka&&(F=Ka[E]),E=z.vertexNormals,J=z.normal,G=z.vertexColors,Q=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],
+o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=B,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c]):o.boundTo==="faces"?(P=O=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],O=o.value[B+1],P=o.value[B+2],o.offsetSrc+=
+3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=
+H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Fa){s=0;for(o=Ha.length;s<o;s++)H=Ha[s].vertices[z.a].position,O=Ha[s].vertices[z.b].position,P=Ha[s].vertices[z.c].position,B=sa[s],B[na]=H.x,B[na+1]=H.y,B[na+2]=H.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z;na+=9}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],ga[w]=s.x,ga[w+1]=s.y,
+ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],ea[w]=s.x,
+ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=Q,pa[ma]=z.r,pa[ma+1]=z.g,pa[ma+2]=z.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=o.r,pa[ma+7]=o.g,pa[ma+8]=o.b,ma+=9;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,
+ca[Y+11]=z.w,Y+=12;if(Aa&&y)if(E.length==3&&ya)for(K=0;K<3;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<3;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<3;K++)E=r[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<3;K++)E=F[K],la[$]=E.u,la[$+1]=E.v,$+=2;za&&(ha[W]=ia,ha[W+1]=ia+1,ha[W+2]=ia+2,W+=3,Da[U]=ia,Da[U+1]=ia+1,Da[U+2]=ia,Da[U+3]=ia+2,Da[U+4]=ia+1,Da[U+5]=ia+2,U+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,
+P=Ca[z.c].position,L=Ca[z.d].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)s=o.offset,B=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(B=o.value[B],o.array[s]=B,o.array[s+1]=B,o.array[s+2]=
+B,o.array[s+3]=B,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[B],o.array[s+1]=o.value[B+1],o.array[s+2]=o.value[B+2],o.array[s+3]=o.value[B+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=P=O=H=B=o.value[B],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[B],O=o.value[B+1],P=o.value[B+2],L=o.value[B+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+
+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z,o.array[s+9]=
+L.x,o.array[s+10]=L.y,o.array[s+11]=L.z),o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Fa){s=0;for(o=Ha.length;s<o;s++)H=Ha[s].vertices[z.a].position,O=Ha[s].vertices[z.b].position,P=Ha[s].vertices[z.c].position,L=Ha[s].vertices[z.d].position,
+B=sa[s],B[na]=H.x,B[na+1]=H.y,B[na+2]=H.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z,B[na+9]=L.x,B[na+10]=L.y,B[na+11]=L.z;na+=12}if(La.length)s=La[z.a],o=La[z.b],B=La[z.c],R=La[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=B.x,ga[w+9]=B.y,ga[w+10]=B.z,ga[w+11]=B.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],B=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=
+o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=B.x,fa[w+9]=B.y,fa[w+10]=B.z,fa[w+11]=B.w,fa[w+12]=R.x,fa[w+13]=R.y,fa[w+14]=R.z,fa[w+15]=R.w,s=Na[z.a],o=Na[z.b],B=Na[z.c],R=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=B.x,da[w+9]=B.y,da[w+10]=B.z,da[w+11]=1,da[w+12]=R.x,da[w+13]=R.y,da[w+14]=R.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],B=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+
+8]=B.x,ea[w+9]=B.y,ea[w+10]=B.z,ea[w+11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=Q,pa[ma]=z.r,pa[ma+1]=z.g,pa[ma+2]=z.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=o.r,pa[ma+7]=o.g,pa[ma+8]=o.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,
+ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&y)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<4;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<4;K++)E=r[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<4;K++)E=F[K],la[$]=E.u,la[$+1]=E.v,$+=2;za&&(ha[W]=ia,ha[W+1]=ia+1,ha[W+2]=ia+3,ha[W+3]=ia+1,ha[W+4]=ia+2,ha[W+5]=ia+3,W+=6,Da[U]=ia,Da[U+1]=ia+1,Da[U+2]=ia,Da[U+
+3]=ia+3,Da[U+4]=ia+1,Da[U+5]=ia+2,Da[U+6]=ia+2,Da[U+7]=ia+3,U+=8,ia+=4)}va&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,oa,v));if(aa)for(V in aa)o=aa[V],o.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,o.buffer),f.bufferData(f.ARRAY_BUFFER,o.array,v));if(Fa){s=0;for(o=Ha.length;s<o;s++)f.bindBuffer(f.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),f.bufferData(f.ARRAY_BUFFER,sa[s],v)}Ea&&ma>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,
+pa,v));Aa&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,X,v));Ba&&ta.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,ca,v));ua&&Z>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ka,v));ua&&$>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,la,v));za&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,v),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+m.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,da,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ea,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,fa,v),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ga,v));A&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
+delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=
+A=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof
+THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=f.DYNAMIC_DRAW;k=u=A=A=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(A=0;A<q;A++)u=p[A].position,k=A*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;f.bindBuffer(f.ARRAY_BUFFER,i.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,t,j)}if(y){for(A=0;A<m;A++)color=n[A],k=A*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,i.__webglColorBuffer);
+f.bufferData(f.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,f.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=
+function(){return cb}};
+THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
+THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
+THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
 THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;

+ 1 - 35
src/cameras/Camera.js

@@ -14,8 +14,8 @@ THREE.Camera = function () {
 
 	THREE.Object3D.call( this );
 
-	this.matrixWorldInverse = new THREE.Matrix4();
 	this.projectionMatrix = new THREE.Matrix4();
+	this.matrixWorldInverse = new THREE.Matrix4();
 
 };
 
@@ -34,38 +34,4 @@ THREE.Camera.prototype.lookAt = function ( vector ) {
 
 	}
 
-}
-
-THREE.Camera.prototype.update = function ( parentMatrixWorld, forceUpdate, camera ) {
-
-	this.matrixAutoUpdate && this.updateMatrix();
-
-	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
-
-		if ( parentMatrixWorld ) {
-
-			this.matrixWorld.multiply( parentMatrixWorld, this.matrix );
-
-		} else {
-
-			this.matrixWorld.copy( this.matrix );
-
-		}
-
-		this.matrixWorldNeedsUpdate = false;
-		forceUpdate = true;
-
-		THREE.Matrix4.makeInvert( this.matrixWorld, this.matrixWorldInverse );
-
-	}
-
-
-	// update children
-
-	for ( var i = 0; i < this.children.length; i ++ ) {
-
-		this.children[ i ].update( this.matrixWorld, forceUpdate, camera );
-
-	}
-
 };

+ 10 - 4
src/core/Projector.js

@@ -14,8 +14,9 @@ THREE.Projector = function() {
 
 	_objectList = [], _renderList = [],
 
-	_vector3 = new THREE.Vector4(),
+	_vector3 = new THREE.Vector3(),
 	_vector4 = new THREE.Vector4(),
+
 	_projScreenMatrix = new THREE.Matrix4(),
 	_projScreenObjectMatrix = new THREE.Matrix4(),
 
@@ -36,11 +37,13 @@ THREE.Projector = function() {
 
 	this.projectVector = function ( vector, camera ) {
 
+		THREE.Matrix4.makeInvert( camera.matrixWorld, camera.matrixWorldInverse );
+
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
 		_projScreenMatrix.multiplyVector3( vector );
 
 		return vector;
-		
+
 	};
 
 	this.unprojectVector = function ( vector, camera ) {
@@ -49,7 +52,7 @@ THREE.Projector = function() {
 		_projScreenMatrix.multiplyVector3( vector );
 
 		return vector;
-		
+
 	};
 
 	/**
@@ -73,7 +76,7 @@ THREE.Projector = function() {
 		end.subSelf( vector ).normalize();
 
 		return new THREE.Ray( vector, end );
-		
+
 	};
 
 	this.projectObjects = function ( scene, camera, sort ) {
@@ -131,7 +134,10 @@ THREE.Projector = function() {
 
 		scene.update( undefined, false, camera );
 
+		THREE.Matrix4.makeInvert( camera.matrixWorld, camera.matrixWorldInverse );
+
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
+
 		computeFrustum( _projScreenMatrix );
 
 		objects = this.projectObjects( scene, camera, true );

+ 0 - 499
src/renderers/Projector.js

@@ -1,499 +0,0 @@
-/**
- * @author mr.doob / http://mrdoob.com/
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author julianwa / https://github.com/julianwa
- */
-
-THREE.Projector = function() {
-
-	var _object, _objectCount, _objectPool = [],
-	_vertex, _vertexCount, _vertexPool = [],
-	_face, _face3Count, _face3Pool = [], _face4Count, _face4Pool = [],
-	_line, _lineCount, _linePool = [],
-	_particle, _particleCount, _particlePool = [],
-
-	_objectList = [], _renderList = [],
-
-	_vector3 = new THREE.Vector4(),
-	_vector4 = new THREE.Vector4(),
-	_projScreenMatrix = new THREE.Matrix4(),
-	_projScreenObjectMatrix = new THREE.Matrix4(),
-
-	_frustum = [
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4()
-	 ],
-
-	_clippedVertex1PositionScreen = new THREE.Vector4(),
-	_clippedVertex2PositionScreen = new THREE.Vector4(),
-
-	_face3VertexNormals;
-
-
-	this.projectVector = function ( vector, camera ) {
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.unprojectVector = function ( vector, camera ) {
-
-		_projScreenMatrix.multiply( camera.matrixWorld, THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
-		_projScreenMatrix.multiplyVector3( vector );
-
-		return vector;
-
-	};
-
-	this.projectObjects = function ( scene, camera, sort ) {
-
-		var o, ol, objects, object, matrix;
-
-		_objectList.length = 0;
-		_objectCount = 0;
-
-		objects = scene.objects;
-
-		for ( o = 0, ol = objects.length; o < ol; o ++ ) {
-
-			object = objects[ o ];
-
-			if ( !object.visible || ( object instanceof THREE.Mesh && !( object.frustumCulled && isInFrustum( object ) ) ) ) continue;
-
-			_object = getNextObjectInPool();
-
-			_vector3.copy( object.position );
-			_projScreenMatrix.multiplyVector3( _vector3 );
-
-			_object.object = object;
-			_object.z = _vector3.z;
-
-			_objectList.push( _object );
-
-		}
-
-		sort && _objectList.sort( painterSort );
-
-		return _objectList;
-
-	};
-
-	// TODO: Rename to projectElements?
-
-	this.projectScene = function ( scene, camera, sort ) {
-
-		var near = camera.near, far = camera.far,
-		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, objects, object,
-		objectMatrix, objectMatrixRotation, objectMaterials, objectOverdraw,
-		geometry, vertices, vertex, vertexPositionScreen,
-		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
-		v1, v2, v3, v4;
-
-		_renderList.length = 0;
-
-		_face3Count = 0;
-		_face4Count = 0;
-		_lineCount = 0;
-		_particleCount = 0;
-
-		camera.matrixAutoUpdate && camera.update( undefined, true );
-
-		scene.update( undefined, false, camera );
-
-		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
-		computeFrustum( _projScreenMatrix );
-
-		objects = this.projectObjects( scene, camera, true );
-
-		for ( o = 0, ol = objects.length; o < ol; o++ ) {
-
-			object = objects[ o ].object;
-
-			if ( !object.visible ) continue;
-
-			objectMatrix = object.matrixWorld;
-			objectMatrixRotation = object.matrixRotationWorld;
-
-			objectMaterials = object.materials;
-			objectOverdraw = object.overdraw;
-
-			_vertexCount = 0;
-
-			if ( object instanceof THREE.Mesh ) {
-
-				geometry = object.geometry;
-				vertices = geometry.vertices;
-				faces = geometry.faces;
-				faceVertexUvs = geometry.faceVertexUvs;
-
-				for ( v = 0, vl = vertices.length; v < vl; v ++ ) {
-
-					_vertex = getNextVertexInPool();
-					_vertex.positionWorld.copy( vertices[ v ].position );
-
-					objectMatrix.multiplyVector3( _vertex.positionWorld );
-
-					_vertex.positionScreen.copy( _vertex.positionWorld );
-					_projScreenMatrix.multiplyVector4( _vertex.positionScreen );
-
-					_vertex.positionScreen.x /= _vertex.positionScreen.w;
-					_vertex.positionScreen.y /= _vertex.positionScreen.w;
-
-					_vertex.visible = _vertex.positionScreen.z > near && _vertex.positionScreen.z < far;
-
-				}
-
-				for ( f = 0, fl = faces.length; f < fl; f ++ ) {
-
-					face = faces[ f ];
-
-					if ( face instanceof THREE.Face3 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-
-						if ( v1.visible && v2.visible && v3.visible &&
-							( object.doubleSided || ( object.flipSided !=
-							( v3.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-							( v3.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ) ) ) {
-
-							_face = getNextFace3InPool();
-
-							_face.v1.copy( v1 );
-							_face.v2.copy( v2 );
-							_face.v3.copy( v3 );
-
-						} else {
-
-							continue;
-
-						}
-
-					} else if ( face instanceof THREE.Face4 ) {
-
-						v1 = _vertexPool[ face.a ];
-						v2 = _vertexPool[ face.b ];
-						v3 = _vertexPool[ face.c ];
-						v4 = _vertexPool[ face.d ];
-
-						if ( v1.visible && v2.visible && v3.visible && v4.visible &&
-							( object.doubleSided || ( object.flipSided !=
-							( ( v4.positionScreen.x - v1.positionScreen.x ) * ( v2.positionScreen.y - v1.positionScreen.y ) -
-							( v4.positionScreen.y - v1.positionScreen.y ) * ( v2.positionScreen.x - v1.positionScreen.x ) < 0 ||
-							( v2.positionScreen.x - v3.positionScreen.x ) * ( v4.positionScreen.y - v3.positionScreen.y ) -
-							( v2.positionScreen.y - v3.positionScreen.y ) * ( v4.positionScreen.x - v3.positionScreen.x ) < 0 ) ) ) ) {
-
-							_face = getNextFace4InPool();
-
-							_face.v1.copy( v1 );
-							_face.v2.copy( v2 );
-							_face.v3.copy( v3 );
-							_face.v4.copy( v4 );
-
-						} else {
-
-							continue;
-
-						}
-
-					}
-
-					_face.normalWorld.copy( face.normal );
-					objectMatrixRotation.multiplyVector3( _face.normalWorld );
-
-					_face.centroidWorld.copy( face.centroid );
-					objectMatrix.multiplyVector3( _face.centroidWorld );
-
-					_face.centroidScreen.copy( _face.centroidWorld );
-					_projScreenMatrix.multiplyVector3( _face.centroidScreen );
-
-					faceVertexNormals = face.vertexNormals;
-
-					for ( n = 0, nl = faceVertexNormals.length; n < nl; n ++ ) {
-
-						normal = _face.vertexNormalsWorld[ n ];
-						normal.copy( faceVertexNormals[ n ] );
-						objectMatrixRotation.multiplyVector3( normal );
-
-					}
-
-					for ( c = 0, cl = faceVertexUvs.length; c < cl; c ++ ) {
-
-						uvs = faceVertexUvs[ c ][ f ];
-
-						if ( !uvs ) continue;
-
-						for ( u = 0, ul = uvs.length; u < ul; u ++ ) {
-
-							_face.uvs[ c ][ u ] = uvs[ u ];
-
-						}
-
-					}
-
-					_face.meshMaterials = objectMaterials;
-					_face.faceMaterials = face.materials;
-					_face.overdraw = objectOverdraw;
-
-					_face.z = _face.centroidScreen.z;
-
-					_renderList.push( _face );
-
-				}
-
-			} else if ( object instanceof THREE.Line ) {
-
-				_projScreenObjectMatrix.multiply( _projScreenMatrix, objectMatrix );
-
-				vertices = object.geometry.vertices;
-
-				v1 = getNextVertexInPool();
-				v1.positionScreen.copy( vertices[ 0 ].position );
-				_projScreenObjectMatrix.multiplyVector4( v1.positionScreen );
-
-				for ( v = 1, vl = vertices.length; v < vl; v++ ) {
-
-					v1 = getNextVertexInPool();
-					v1.positionScreen.copy( vertices[ v ].position );
-					_projScreenObjectMatrix.multiplyVector4( v1.positionScreen );
-
-					v2 = _vertexPool[ _vertexCount - 2 ];
-
-					_clippedVertex1PositionScreen.copy( v1.positionScreen );
-					_clippedVertex2PositionScreen.copy( v2.positionScreen );
-
-					if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) ) {
-
-						// Perform the perspective divide
-						_clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w );
-						_clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w );
-
-						_line = getNextLineInPool();
-						_line.v1.positionScreen.copy( _clippedVertex1PositionScreen );
-						_line.v2.positionScreen.copy( _clippedVertex2PositionScreen );
-
-						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
-
-						_line.materials = object.materials;
-
-						_renderList.push( _line );
-
-					}
-				}
-
-			} else if ( object instanceof THREE.Particle ) {
-
-				_vector4.set( object.matrixWorld.n14, object.matrixWorld.n24, object.matrixWorld.n34, 1 );
-				_projScreenMatrix.multiplyVector4( _vector4 );
-
-				_vector4.z /= _vector4.w;
-
-				if ( _vector4.z > 0 && _vector4.z < 1 ) {
-
-					_particle = getNextParticleInPool();
-					_particle.x = _vector4.x / _vector4.w;
-					_particle.y = _vector4.y / _vector4.w;
-					_particle.z = _vector4.z;
-
-					_particle.rotation = object.rotation.z;
-
-					_particle.scale.x = object.scale.x * Math.abs( _particle.x - ( _vector4.x + camera.projectionMatrix.n11 ) / ( _vector4.w + camera.projectionMatrix.n14 ) );
-					_particle.scale.y = object.scale.y * Math.abs( _particle.y - ( _vector4.y + camera.projectionMatrix.n22 ) / ( _vector4.w + camera.projectionMatrix.n24 ) );
-
-					_particle.materials = object.materials;
-
-					_renderList.push( _particle );
-
-				}
-
-			}
-
-		}
-
-		sort && _renderList.sort( painterSort );
-
-		return _renderList;
-
-	};
-
-	// Pools
-
-	function getNextObjectInPool() {
-
-		var object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject();
-
-		_objectCount ++;
-
-		return object;
-
-	}
-
-	function getNextVertexInPool() {
-
-		var vertex = _vertexPool[ _vertexCount ] = _vertexPool[ _vertexCount ] || new THREE.RenderableVertex();
-
-		_vertexCount ++;
-
-		return vertex;
-
-	}
-
-	function getNextFace3InPool() {
-
-		var face = _face3Pool[ _face3Count ] = _face3Pool[ _face3Count ] || new THREE.RenderableFace3();
-
-		_face3Count ++;
-
-		return face;
-
-	}
-
-	function getNextFace4InPool() {
-
-		var face = _face4Pool[ _face4Count ] = _face4Pool[ _face4Count ] || new THREE.RenderableFace4();
-
-		_face4Count ++;
-
-		return face;
-
-	}
-
-	function getNextLineInPool() {
-
-		var line = _linePool[ _lineCount ] = _linePool[ _lineCount ] || new THREE.RenderableLine();
-
-		_lineCount ++;
-
-		return line;
-
-	}
-
-	function getNextParticleInPool() {
-
-		var particle = _particlePool[ _particleCount ] = _particlePool[ _particleCount ] || new THREE.RenderableParticle();
-		_particleCount ++;
-		return particle;
-
-	}
-
-	//
-
-	function painterSort( a, b ) {
-
-		return b.z - a.z;
-
-	}
-
-	function computeFrustum( m ) {
-
-		_frustum[ 0 ].set( m.n41 - m.n11, m.n42 - m.n12, m.n43 - m.n13, m.n44 - m.n14 );
-		_frustum[ 1 ].set( m.n41 + m.n11, m.n42 + m.n12, m.n43 + m.n13, m.n44 + m.n14 );
-		_frustum[ 2 ].set( m.n41 + m.n21, m.n42 + m.n22, m.n43 + m.n23, m.n44 + m.n24 );
-		_frustum[ 3 ].set( m.n41 - m.n21, m.n42 - m.n22, m.n43 - m.n23, m.n44 - m.n24 );
-		_frustum[ 4 ].set( m.n41 - m.n31, m.n42 - m.n32, m.n43 - m.n33, m.n44 - m.n34 );
-		_frustum[ 5 ].set( m.n41 + m.n31, m.n42 + m.n32, m.n43 + m.n33, m.n44 + m.n34 );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			var plane = _frustum[ i ];
-			plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
-
-		}
-
-	}
-
-	function isInFrustum( object ) {
-
-		var distance, matrix = object.matrixWorld,
-		radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			distance = _frustum[ i ].x * matrix.n14 + _frustum[ i ].y * matrix.n24 + _frustum[ i ].z * matrix.n34 + _frustum[ i ].w;
-			if ( distance <= radius ) return false;
-
-		}
-
-		return true;
-
-	};
-
-	function clipLine( s1, s2 ) {
-
-		var alpha1 = 0, alpha2 = 1,
-
-		// Calculate the boundary coordinate of each vertex for the near and far clip planes,
-		// Z = -1 and Z = +1, respectively.
-		bc1near =  s1.z + s1.w,
-		bc2near =  s2.z + s2.w,
-		bc1far =  - s1.z + s1.w,
-		bc2far =  - s2.z + s2.w;
-
-		if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) {
-
-			// Both vertices lie entirely within all clip planes.
-			return true;
-
-		} else if ( ( bc1near < 0 && bc2near < 0) || (bc1far < 0 && bc2far < 0 ) ) {
-
-			// Both vertices lie entirely outside one of the clip planes.
-			return false;
-
-		} else {
-
-			// The line segment spans at least one clip plane.
-
-			if ( bc1near < 0 ) {
-
-				// v1 lies outside the near plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) );
-
-			} else if ( bc2near < 0 ) {
-
-				// v2 lies outside the near plane, v1 inside
-				alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) );
-
-			}
-
-			if ( bc1far < 0 ) {
-
-				// v1 lies outside the far plane, v2 inside
-				alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) );
-
-			} else if ( bc2far < 0 ) {
-
-				// v2 lies outside the far plane, v2 inside
-				alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) );
-
-			}
-
-			if ( alpha2 < alpha1 ) {
-
-				// The line segment spans two boundaries, but is outside both of them.
-				// (This can't happen when we're only clipping against just near/far but good
-				//  to leave the check here for future usage if other clip planes are added.)
-				return false;
-
-			} else {
-
-				// Update the s1 and s2 vertices to match the clipped line segment.
-				s1.lerpSelf( s2, alpha1 );
-				s2.lerpSelf( s1, 1 - alpha2 );
-
-				return true;
-
-			}
-
-		}
-
-	}
-
-};

+ 11 - 4
src/renderers/WebGLRenderer.js

@@ -3523,12 +3523,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				scene.update( undefined, false, _cameraLight );
 
+				THREE.Matrix4.makeInvert( _cameraLight.matrixWorld, _cameraLight.matrixWorldInverse );
+
 				// compute shadow matrix
 
-				shadowMatrix.set( 0.5, 0.0, 0.0, 0.5,
-								  0.0, 0.5, 0.0, 0.5,
-								  0.0, 0.0, 0.5, 0.5,
-								  0.0, 0.0, 0.0, 1.0 );
+				shadowMatrix.set(
+					0.5, 0.0, 0.0, 0.5,
+					0.0, 0.5, 0.0, 0.5,
+					0.0, 0.0, 0.5, 0.5,
+					0.0, 0.0, 0.0, 1.0
+				);
 
 				shadowMatrix.multiplySelf( _cameraLight.projectionMatrix );
 				shadowMatrix.multiplySelf( _cameraLight.matrixWorldInverse );
@@ -3539,6 +3543,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_cameraLight.projectionMatrix.flattenToArray( _projectionMatrixArray );
 
 				_projScreenMatrix.multiply( _cameraLight.projectionMatrix, _cameraLight.matrixWorldInverse );
+
 				computeFrustum( _projScreenMatrix );
 
 				_this.initWebGLObjects( scene );
@@ -3712,6 +3717,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		scene.update( undefined, false, camera );
 
+		THREE.Matrix4.makeInvert( camera.matrixWorld, camera.matrixWorldInverse );
+
 		camera.matrixWorldInverse.flattenToArray( _viewMatrixArray );
 		camera.projectionMatrix.flattenToArray( _projectionMatrixArray );