Browse Source

Updated builds.

Mr.doob 13 năm trước cách đây
mục cha
commit
a7c804b817
3 tập tin đã thay đổi với 529 bổ sung520 xóa
  1. 383 380
      build/Three.js
  2. 142 138
      build/custom/ThreeExtras.js
  3. 4 2
      src/extras/modifiers/SubdivisionModifier.js

+ 383 - 380
build/Three.js

@@ -17,62 +17,62 @@ c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,e){var e=e.clone().subSelf(b),
 c=c.clone().subSelf(b),h=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(h),k=c.dot(c),c=c.dot(h),h=1/(a*k-b*b),k=(k*e-b*c)*h,a=(a*c-b*e)*h;return k>0&&a>0&&k+a<1}for(var e,h=[],k=0,f=a.children.length;k<f;k++)Array.prototype.push.apply(h,this.intersectObject(a.children[k]));if(a instanceof THREE.Particle){k=c(this.origin,this.direction,a.matrixWorld.getPosition());if(k===null||k>a.scale.x)return[];e={distance:k,point:a.position,face:null,object:a};h.push(e)}else if(a instanceof THREE.Mesh){k=
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(k===null||k>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return h;var l,n,u,t,p,w,v,z,x=a.geometry,y=x.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);k=0;for(f=x.faces.length;k<f;k++)if(e=x.faces[k],v=this.origin.clone(),z=this.direction.clone(),t=a.matrixWorld,l=t.multiplyVector3(e.centroid.clone()).subSelf(v),w=l.dot(z),!(w<=0)&&(l=t.multiplyVector3(y[e.a].position.clone()),n=t.multiplyVector3(y[e.b].position.clone()),
-u=t.multiplyVector3(y[e.c].position.clone()),t=e instanceof THREE.Face4?t.multiplyVector3(y[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),w=z.dot(p),a.doubleSided||(a.flipSided?w>0:w<0)))if(w=p.dot((new THREE.Vector3).sub(l,v))/w,v=v.addSelf(z.multiplyScalar(w)),e instanceof THREE.Face3)b(v,l,n,u)&&(e={distance:this.origin.distanceTo(v),point:v,face:e,object:a},h.push(e));else if(e instanceof THREE.Face4&&(b(v,l,n,t)||b(v,n,u,t)))e={distance:this.origin.distanceTo(v),
-point:v,face:e,object:a},h.push(e)}return h}};
-THREE.Rectangle=function(){function a(){k=e-c;f=h-b}var c,b,e,h,k,f,l=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return k};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(k,f,t,p){l=!1;c=k;b=f;e=t;h=p;a()};this.addPoint=function(k,f){l?(l=!1,c=k,b=f,e=k,h=f):(c=c<k?c:k,b=b<f?b:f,e=e>k?e:k,h=h>f?h:f);a()};this.add3Points=
-function(k,f,t,p,w,v){l?(l=!1,c=k<t?k<w?k:w:t<w?t:w,b=f<p?f<v?f:v:p<v?p:v,e=k>t?k>w?k:w:t>w?t:w,h=f>p?f>v?f:v:p>v?p:v):(c=k<t?k<w?k<c?k:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,b=f<p?f<v?f<b?f:b:v<b?v:b:p<v?p<b?p:b:v<b?v:b,e=k>t?k>w?k>e?k:e:w>e?w:e:t>w?t>e?t:e:w>e?w:e,h=f>p?f>v?f>h?f:h:v>h?v:h:p>v?p>h?p:h:v>h?v:h);a()};this.addRectangle=function(k){l?(l=!1,c=k.getLeft(),b=k.getTop(),e=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),b=b<k.getTop()?b:k.getTop(),e=e>k.getRight()?e:k.getRight(),h=h>
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(k===null||k>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return h;var l,n,t,p,v,x,u,y,w=a.geometry,B=w.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);k=0;for(f=w.faces.length;k<f;k++)if(e=w.faces[k],u=this.origin.clone(),y=this.direction.clone(),p=a.matrixWorld,l=p.multiplyVector3(e.centroid.clone()).subSelf(u),x=l.dot(y),!(x<=0)&&(l=p.multiplyVector3(B[e.a].position.clone()),n=p.multiplyVector3(B[e.b].position.clone()),
+t=p.multiplyVector3(B[e.c].position.clone()),p=e instanceof THREE.Face4?p.multiplyVector3(B[e.d].position.clone()):null,v=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),x=y.dot(v),a.doubleSided||(a.flipSided?x>0:x<0)))if(x=v.dot((new THREE.Vector3).sub(l,u))/x,u=u.addSelf(y.multiplyScalar(x)),e instanceof THREE.Face3)b(u,l,n,t)&&(e={distance:this.origin.distanceTo(u),point:u,face:e,object:a},h.push(e));else if(e instanceof THREE.Face4&&(b(u,l,n,p)||b(u,n,t,p)))e={distance:this.origin.distanceTo(u),
+point:u,face:e,object:a},h.push(e)}return h}};
+THREE.Rectangle=function(){function a(){k=e-c;f=h-b}var c,b,e,h,k,f,l=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return k};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(k,f,p,v){l=!1;c=k;b=f;e=p;h=v;a()};this.addPoint=function(k,f){l?(l=!1,c=k,b=f,e=k,h=f):(c=c<k?c:k,b=b<f?b:f,e=e>k?e:k,h=h>f?h:f);a()};this.add3Points=
+function(k,f,p,v,x,u){l?(l=!1,c=k<p?k<x?k:x:p<x?p:x,b=f<v?f<u?f:u:v<u?v:u,e=k>p?k>x?k:x:p>x?p:x,h=f>v?f>u?f:u:v>u?v:u):(c=k<p?k<x?k<c?k:c:x<c?x:c:p<x?p<c?p:c:x<c?x:c,b=f<v?f<u?f<b?f:b:u<b?u:b:v<u?v<b?v:b:u<b?u:b,e=k>p?k>x?k>e?k:e:x>e?x:e:p>x?p>e?p:e:x>e?x:e,h=f>v?f>u?f>h?f:h:u>h?u:h:v>u?v>h?v:h:u>h?u:h);a()};this.addRectangle=function(k){l?(l=!1,c=k.getLeft(),b=k.getTop(),e=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),b=b<k.getTop()?b:k.getTop(),e=e>k.getRight()?e:k.getRight(),h=h>
 k.getBottom()?h:k.getBottom());a()};this.inflate=function(k){c-=k;b-=k;e+=k;h+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();e=e<k.getRight()?e:k.getRight();h=h<k.getBottom()?h:k.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(h,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){l=!0;h=e=b=c=0;a()};this.isEmpty=function(){return l}};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,h){return e+(a-c)*(h-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,e,h,k,f,l,n,u,t,p,w,v,z,x){this.set(a!==void 0?a:1,c||0,b||0,e||0,h||0,k!==void 0?k:1,f||0,l||0,n||0,u||0,t!==void 0?t:1,p||0,w||0,v||0,z||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,h,k,f,l,n,u,t,p,w,v,z,x){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=h;this.n22=k;this.n23=f;this.n24=l;this.n31=n;this.n32=u;this.n33=t;this.n34=p;this.n41=w;this.n42=v;this.n43=z;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-c,b){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(a,c).normalize();if(k.length()===0)k.z=1;e.cross(b,k).normalize();e.length()===0&&(k.x+=1.0E-4,e.cross(b,k).normalize());h.cross(k,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=k.x;this.n21=e.y;this.n22=h.y;this.n23=k.y;this.n31=e.z;this.n32=h.z;this.n33=k.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,h=a.n13,k=a.n14,f=a.n21,l=a.n22,n=a.n23,u=a.n24,t=a.n31,p=a.n32,w=a.n33,v=a.n34,z=a.n41,x=a.n42,y=a.n43,
-G=a.n44,A=c.n11,B=c.n12,D=c.n13,O=c.n14,I=c.n21,H=c.n22,P=c.n23,Q=c.n24,M=c.n31,K=c.n32,N=c.n33,ea=c.n34,Y=c.n41,S=c.n42,o=c.n43,$=c.n44;this.n11=b*A+e*I+h*M+k*Y;this.n12=b*B+e*H+h*K+k*S;this.n13=b*D+e*P+h*N+k*o;this.n14=b*O+e*Q+h*ea+k*$;this.n21=f*A+l*I+n*M+u*Y;this.n22=f*B+l*H+n*K+u*S;this.n23=f*D+l*P+n*N+u*o;this.n24=f*O+l*Q+n*ea+u*$;this.n31=t*A+p*I+w*M+v*Y;this.n32=t*B+p*H+w*K+v*S;this.n33=t*D+p*P+w*N+v*o;this.n34=t*O+p*Q+w*ea+v*$;this.n41=z*A+x*I+y*M+G*Y;this.n42=z*B+x*H+y*K+G*S;this.n43=z*
-D+x*P+y*N+G*o;this.n44=z*O+x*Q+y*ea+G*$;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
+THREE.Matrix4=function(a,c,b,e,h,k,f,l,n,t,p,v,x,u,y,w){this.set(a!==void 0?a:1,c||0,b||0,e||0,h||0,k!==void 0?k:1,f||0,l||0,n||0,t||0,p!==void 0?p:1,v||0,x||0,u||0,y||0,w!==void 0?w:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,h,k,f,l,n,t,p,v,x,u,y,w){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=h;this.n22=k;this.n23=f;this.n24=l;this.n31=n;this.n32=t;this.n33=p;this.n34=v;this.n41=x;this.n42=u;this.n43=y;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+c,b){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(a,c).normalize();if(k.length()===0)k.z=1;e.cross(b,k).normalize();e.length()===0&&(k.x+=1.0E-4,e.cross(b,k).normalize());h.cross(k,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=k.x;this.n21=e.y;this.n22=h.y;this.n23=k.y;this.n31=e.z;this.n32=h.z;this.n33=k.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,h=a.n13,k=a.n14,f=a.n21,l=a.n22,n=a.n23,t=a.n24,p=a.n31,v=a.n32,x=a.n33,u=a.n34,y=a.n41,w=a.n42,B=a.n43,
+A=a.n44,E=c.n11,z=c.n12,D=c.n13,M=c.n14,I=c.n21,C=c.n22,P=c.n23,K=c.n24,O=c.n31,N=c.n32,H=c.n33,W=c.n34,Z=c.n41,U=c.n42,o=c.n43,ca=c.n44;this.n11=b*E+e*I+h*O+k*Z;this.n12=b*z+e*C+h*N+k*U;this.n13=b*D+e*P+h*H+k*o;this.n14=b*M+e*K+h*W+k*ca;this.n21=f*E+l*I+n*O+t*Z;this.n22=f*z+l*C+n*N+t*U;this.n23=f*D+l*P+n*H+t*o;this.n24=f*M+l*K+n*W+t*ca;this.n31=p*E+v*I+x*O+u*Z;this.n32=p*z+v*C+x*N+u*U;this.n33=p*D+v*P+x*H+u*o;this.n34=p*M+v*K+x*W+u*ca;this.n41=y*E+w*I+B*O+A*Z;this.n42=y*z+w*C+B*N+A*U;this.n43=y*
+D+w*P+B*H+A*o;this.n44=y*M+w*K+B*W+A*ca;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
 this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,h=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*h;a.y=this.n21*
 c+this.n22*b+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*h;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
-a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,h=this.n21,k=this.n22,f=this.n23,l=this.n24,n=this.n31,u=this.n32,t=this.n33,p=this.n34,w=this.n41,v=this.n42,z=this.n43,x=this.n44;return e*f*u*w-b*l*u*w-e*k*t*w+c*l*t*w+b*k*p*w-c*f*p*w-e*f*n*v+b*l*n*v+e*h*t*v-a*l*t*v-b*h*p*v+a*f*p*v+e*k*n*z-c*l*n*z-e*h*u*z+a*l*u*z+c*h*p*z-a*k*p*z-b*k*n*x+c*f*n*x+b*h*u*x-a*f*u*x-c*h*t*x+a*k*t*
-x},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
+a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,h=this.n21,k=this.n22,f=this.n23,l=this.n24,n=this.n31,t=this.n32,p=this.n33,v=this.n34,x=this.n41,u=this.n42,y=this.n43,w=this.n44;return e*f*t*x-b*l*t*x-e*k*p*x+c*l*p*x+b*k*v*x-c*f*v*x-e*f*n*u+b*l*n*u+e*h*p*u-a*l*p*u-b*h*v*u+a*f*v*u+e*k*n*y-c*l*n*y-e*h*t*y+a*l*t*y+c*h*v*y-a*k*v*y-b*k*n*w+c*f*n*w+b*h*t*w-a*f*t*w-c*h*p*w+a*k*p*
+w},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
 a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
 a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;
 a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),h=1-b,k=a.x,f=a.y,l=a.z,n=h*k,u=h*f;this.set(n*k+b,n*f-e*l,n*l+e*f,0,n*f+e*l,u*f+b,u*l-e*k,0,n*l-e*f,u*l+e*k,h*l*l+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,h=a.n14,k=a.n21,f=a.n22,l=a.n23,n=a.n24,u=a.n31,t=a.n32,p=a.n33,w=a.n34,v=a.n41,z=a.n42,x=a.n43,y=a.n44;this.n11=l*w*z-n*p*z+n*t*x-f*w*x-l*t*y+f*p*y;this.n12=h*p*z-e*w*z-h*t*x+b*w*x+e*t*y-b*p*y;this.n13=e*n*z-h*l*z+h*f*x-b*n*x-e*f*y+b*l*y;this.n14=h*l*t-e*n*t-h*f*p+b*n*p+e*f*w-b*l*w;this.n21=n*p*v-l*w*v-n*u*x+k*w*x+l*u*y-k*p*y;this.n22=e*w*v-h*p*v+
-h*u*x-c*w*x-e*u*y+c*p*y;this.n23=h*l*v-e*n*v-h*k*x+c*n*x+e*k*y-c*l*y;this.n24=e*n*u-h*l*u+h*k*p-c*n*p-e*k*w+c*l*w;this.n31=f*w*v-n*t*v+n*u*z-k*w*z-f*u*y+k*t*y;this.n32=h*t*v-b*w*v-h*u*z+c*w*z+b*u*y-c*t*y;this.n33=e*n*v-h*f*v+h*k*z-c*n*z-b*k*y+c*f*y;this.n34=h*f*u-b*n*u-h*k*t+c*n*t+b*k*w-c*f*w;this.n41=l*t*v-f*p*v-l*u*z+k*p*z+f*u*x-k*t*x;this.n42=b*p*v-e*t*v+e*u*z-c*p*z-b*u*x+c*t*x;this.n43=e*f*v-b*l*v-e*k*z+c*l*z+b*k*x-c*f*x;this.n44=b*l*u-e*f*u+e*k*t-c*l*t-b*k*p+c*f*p;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,h=a.z,k=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),l=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=f*l,u=f*h,t=e*l,p=e*h;this.n11=n+p*b;this.n12=t*b-u;this.n13=k*e;this.n21=k*h;this.n22=k*l;this.n23=-b;this.n31=u*b-t;this.n32=p+n*b;this.n33=k*f;break;case "ZXY":n=f*l;u=f*h;t=e*l;p=e*h;this.n11=n-p*b;this.n12=-k*h;this.n13=t+u*b;this.n21=u+t*b;this.n22=k*l;this.n23=p-n*b;this.n31=-k*e;this.n32=b;this.n33=k*f;break;case "ZYX":n=
-k*l;u=k*h;t=b*l;p=b*h;this.n11=f*l;this.n12=t*e-u;this.n13=n*e+p;this.n21=f*h;this.n22=p*e+n;this.n23=u*e-t;this.n31=-e;this.n32=b*f;this.n33=k*f;break;case "YZX":n=k*f;u=k*e;t=b*f;p=b*e;this.n11=f*l;this.n12=p-n*h;this.n13=t*h+u;this.n21=h;this.n22=k*l;this.n23=-b*l;this.n31=-e*l;this.n32=u*h+t;this.n33=n-p*h;break;case "XZY":n=k*f;u=k*e;t=b*f;p=b*e;this.n11=f*l;this.n12=-h;this.n13=e*l;this.n21=n*h+p;this.n22=k*l;this.n23=u*h-t;this.n31=t*h-u;this.n32=b*l;this.n33=p*h+n;break;default:n=k*l,u=k*
-h,t=b*l,p=b*h,this.n11=f*l,this.n12=-f*h,this.n13=e,this.n21=u+t*e,this.n22=n-p*e,this.n23=-b*f,this.n31=p-n*e,this.n32=t+u*e,this.n33=k*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,h=a.w,k=c+c,f=b+b,l=e+e,a=c*k,n=c*f;c*=l;var u=b*f;b*=l;e*=l;k*=h;f*=h;h*=l;this.n11=1-(u+e);this.n12=n-h;this.n13=c+f;this.n21=n+h;this.n22=1-(a+e);this.n23=b-k;this.n31=c-f;this.n32=b+k;this.n33=1-(a+u);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),h=1-b,k=a.x,f=a.y,l=a.z,n=h*k,t=h*f;this.set(n*k+b,n*f-e*l,n*l+e*f,0,n*f+e*l,t*f+b,t*l-e*k,0,n*l-e*f,t*l+e*k,h*l*l+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,h=a.n14,k=a.n21,f=a.n22,l=a.n23,n=a.n24,t=a.n31,p=a.n32,v=a.n33,x=a.n34,u=a.n41,y=a.n42,w=a.n43,B=a.n44;this.n11=l*x*y-n*v*y+n*p*w-f*x*w-l*p*B+f*v*B;this.n12=h*v*y-e*x*y-h*p*w+b*x*w+e*p*B-b*v*B;this.n13=e*n*y-h*l*y+h*f*w-b*n*w-e*f*B+b*l*B;this.n14=h*l*p-e*n*p-h*f*v+b*n*v+e*f*x-b*l*x;this.n21=n*v*u-l*x*u-n*t*w+k*x*w+l*t*B-k*v*B;this.n22=e*x*u-h*v*u+
+h*t*w-c*x*w-e*t*B+c*v*B;this.n23=h*l*u-e*n*u-h*k*w+c*n*w+e*k*B-c*l*B;this.n24=e*n*t-h*l*t+h*k*v-c*n*v-e*k*x+c*l*x;this.n31=f*x*u-n*p*u+n*t*y-k*x*y-f*t*B+k*p*B;this.n32=h*p*u-b*x*u-h*t*y+c*x*y+b*t*B-c*p*B;this.n33=e*n*u-h*f*u+h*k*y-c*n*y-b*k*B+c*f*B;this.n34=h*f*t-b*n*t-h*k*p+c*n*p+b*k*x-c*f*x;this.n41=l*p*u-f*v*u-l*t*y+k*v*y+f*t*w-k*p*w;this.n42=b*v*u-e*p*u+e*t*y-c*v*y-b*t*w+c*p*w;this.n43=e*f*u-b*l*u-e*k*y+c*l*y+b*k*w-c*f*w;this.n44=b*l*t-e*f*t+e*k*p-c*l*p-b*k*v+c*f*v;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,h=a.z,k=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),l=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=f*l,t=f*h,p=e*l,v=e*h;this.n11=n+v*b;this.n12=p*b-t;this.n13=k*e;this.n21=k*h;this.n22=k*l;this.n23=-b;this.n31=t*b-p;this.n32=v+n*b;this.n33=k*f;break;case "ZXY":n=f*l;t=f*h;p=e*l;v=e*h;this.n11=n-v*b;this.n12=-k*h;this.n13=p+t*b;this.n21=t+p*b;this.n22=k*l;this.n23=v-n*b;this.n31=-k*e;this.n32=b;this.n33=k*f;break;case "ZYX":n=
+k*l;t=k*h;p=b*l;v=b*h;this.n11=f*l;this.n12=p*e-t;this.n13=n*e+v;this.n21=f*h;this.n22=v*e+n;this.n23=t*e-p;this.n31=-e;this.n32=b*f;this.n33=k*f;break;case "YZX":n=k*f;t=k*e;p=b*f;v=b*e;this.n11=f*l;this.n12=v-n*h;this.n13=p*h+t;this.n21=h;this.n22=k*l;this.n23=-b*l;this.n31=-e*l;this.n32=t*h+p;this.n33=n-v*h;break;case "XZY":n=k*f;t=k*e;p=b*f;v=b*e;this.n11=f*l;this.n12=-h;this.n13=e*l;this.n21=n*h+v;this.n22=k*l;this.n23=t*h-p;this.n31=p*h-t;this.n32=b*l;this.n33=v*h+n;break;default:n=k*l,t=k*
+h,p=b*l,v=b*h,this.n11=f*l,this.n12=-f*h,this.n13=e,this.n21=t+p*e,this.n22=n-v*e,this.n23=-b*f,this.n31=v-n*e,this.n32=p+t*e,this.n33=k*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,h=a.w,k=c+c,f=b+b,l=e+e,a=c*k,n=c*f;c*=l;var t=b*f;b*=l;e*=l;k*=h;f*=h;h*=l;this.n11=1-(t+e);this.n12=n-h;this.n13=c+f;this.n21=n+h;this.n22=1-(a+e);this.n23=b-k;this.n31=c-f;this.n32=b+k;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
 a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);h.setScale(b.x,b.y,b.z);this.multiply(e,h);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=h.length();b.z=k.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,u=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*u;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*h;b[2]=a*k;b[3]=a*f;b[4]=a*l;b[5]=a*n;b[6]=a*u;b[7]=a*t;b[8]=a*p;return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*t;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*h;b[2]=a*k;b[3]=a*f;b[4]=a*l;b[5]=a*n;b[6]=a*t;b[7]=a*p;b[8]=a*v;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,e,h,k){var f;f=new THREE.Matrix4;f.n11=2*h/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*h/(e-b);f.n23=(e+b)/(e-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(k+h)/(k-h);f.n34=-2*k*h/(k-h);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,e){var h,a=b*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,b,e)};
-THREE.Matrix4.makeOrtho=function(a,c,b,e,h,k){var f,l,n,u;f=new THREE.Matrix4;l=c-a;n=b-e;u=k-h;f.n11=2/l;f.n12=0;f.n13=0;f.n14=-((c+a)/l);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/u;f.n34=-((k+h)/u);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,c,b,e,h,k){var f,l,n,t;f=new THREE.Matrix4;l=c-a;n=b-e;t=k-h;f.n11=2/l;f.n12=0;f.n13=0;f.n14=-((c+a)/l);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/t;f.n34=-((k+h)/t);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,h;b=0;for(e=this.children.length;b<e;b++){h=this.children[b];if(h.name===a)return h;
 if(c&&(h=h.getChildByName(a,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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=f[k]=f[k]||new THREE.RenderableObject;k++;return a}function c(){var a=u[n]=u[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,k=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,l=-b.z+b.w;return k>=0&&h>=0&&f>=0&&l>=0?!0:k<0&&h<0||f<0&&l<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(e=Math.min(e,k/(k-h))),f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var h,k,f=[],l,n,u=[],
-t,p,w=[],v,z=[],x,y,G=[],A,B,D=[],O={objects:[],sprites:[],lights:[],elements:[]},I=new THREE.Vector3,H=new THREE.Vector4,P=new THREE.Matrix4,Q=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,N=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=M[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);P.multiply(b.projectionMatrix,b.matrixWorldInverse);P.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-P.multiply(b.matrixWorld,b.projectionMatrixInverse);P.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.projectGraph=function(c,e){k=0;O.objects.length=0;O.sprites.length=0;O.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
-k=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),l=0;l<6;l++)if(c=M[l].x*e.n14+M[l].y*e.n24+M[l].z*e.n34+M[l].w,c<=k){c=!1;break a}c=!0}c?(P.multiplyVector3(I.copy(b.position)),h=a(),h.object=b,h.z=I.z,O.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(P.multiplyVector3(I.copy(b.position)),h=a(),h.object=b,h.z=I.z,O.sprites.push(h)):b instanceof THREE.Light&&O.lights.push(b);c=0;for(e=b.children.length;c<e;c++)f(b.children[c])}};f(c);e&&
-O.objects.sort(b);return O};this.projectScene=function(a,k,h){var f=k.near,I=k.far,T,M,W,C,da,V,X,la,fa,Z,ja,aa,ia,ga,ha,na;B=y=v=p=0;O.elements.length=0;k.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(k));a.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);P.multiply(k.projectionMatrix,k.matrixWorldInverse);this.computeFrustum(P);O=this.projectGraph(a,!1);a=0;for(T=O.objects.length;a<T;a++)if(fa=O.objects[a].object,Z=fa.matrixWorld,
-aa=fa.material,n=0,fa instanceof THREE.Mesh){ja=fa.geometry;ia=fa.geometry.materials;C=ja.vertices;ga=ja.faces;ha=ja.faceVertexUvs;ja=fa.matrixRotationWorld.extractRotation(Z);M=0;for(W=C.length;M<W;M++)l=c(),l.positionWorld.copy(C[M].position),Z.multiplyVector3(l.positionWorld),l.positionScreen.copy(l.positionWorld),P.multiplyVector4(l.positionScreen),l.positionScreen.x/=l.positionScreen.w,l.positionScreen.y/=l.positionScreen.w,l.visible=l.positionScreen.z>f&&l.positionScreen.z<I;C=0;for(M=ga.length;C<
-M;C++){W=ga[C];if(W instanceof THREE.Face3)if(da=u[W.a],V=u[W.b],X=u[W.c],da.visible&&V.visible&&X.visible&&(fa.doubleSided||fa.flipSided!=(X.positionScreen.x-da.positionScreen.x)*(V.positionScreen.y-da.positionScreen.y)-(X.positionScreen.y-da.positionScreen.y)*(V.positionScreen.x-da.positionScreen.x)<0))la=w[p]=w[p]||new THREE.RenderableFace3,p++,t=la,t.v1.copy(da),t.v2.copy(V),t.v3.copy(X);else continue;else if(W instanceof THREE.Face4)if(da=u[W.a],V=u[W.b],X=u[W.c],la=u[W.d],da.visible&&V.visible&&
-X.visible&&la.visible&&(fa.doubleSided||fa.flipSided!=((la.positionScreen.x-da.positionScreen.x)*(V.positionScreen.y-da.positionScreen.y)-(la.positionScreen.y-da.positionScreen.y)*(V.positionScreen.x-da.positionScreen.x)<0||(V.positionScreen.x-X.positionScreen.x)*(la.positionScreen.y-X.positionScreen.y)-(V.positionScreen.y-X.positionScreen.y)*(la.positionScreen.x-X.positionScreen.x)<0)))na=z[v]=z[v]||new THREE.RenderableFace4,v++,t=na,t.v1.copy(da),t.v2.copy(V),t.v3.copy(X),t.v4.copy(la);else continue;
-t.normalWorld.copy(W.normal);ja.multiplyVector3(t.normalWorld);t.centroidWorld.copy(W.centroid);Z.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);P.multiplyVector3(t.centroidScreen);X=W.vertexNormals;da=0;for(V=X.length;da<V;da++)la=t.vertexNormalsWorld[da],la.copy(X[da]),ja.multiplyVector3(la);da=0;for(V=ha.length;da<V;da++)if(na=ha[da][C]){X=0;for(la=na.length;X<la;X++)t.uvs[da][X]=na[X]}t.material=aa;t.faceMaterial=W.materialIndex!==null?ia[W.materialIndex]:null;t.z=t.centroidScreen.z;
-O.elements.push(t)}}else if(fa instanceof THREE.Line){Q.multiply(P,Z);C=fa.geometry.vertices;da=c();da.positionScreen.copy(C[0].position);Q.multiplyVector4(da.positionScreen);M=1;for(W=C.length;M<W;M++)if(da=c(),da.positionScreen.copy(C[M].position),Q.multiplyVector4(da.positionScreen),V=u[n-2],K.copy(da.positionScreen),N.copy(V.positionScreen),e(K,N))K.multiplyScalar(1/K.w),N.multiplyScalar(1/N.w),fa=G[y]=G[y]||new THREE.RenderableLine,y++,x=fa,x.v1.positionScreen.copy(K),x.v2.positionScreen.copy(N),
-x.z=Math.max(K.z,N.z),x.material=aa,O.elements.push(x)}a=0;for(T=O.sprites.length;a<T;a++)if(fa=O.sprites[a].object,Z=fa.matrixWorld,fa instanceof THREE.Particle&&(H.set(Z.n14,Z.n24,Z.n34,1),P.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))f=D[B]=D[B]||new THREE.RenderableParticle,B++,A=f,A.x=H.x/H.w,A.y=H.y/H.w,A.z=H.z,A.rotation=fa.rotation.z,A.scale.x=fa.scale.x*Math.abs(A.x-(H.x+k.projectionMatrix.n11)/(H.w+k.projectionMatrix.n14)),A.scale.y=fa.scale.y*Math.abs(A.y-(H.y+k.projectionMatrix.n22)/(H.w+
-k.projectionMatrix.n24)),A.material=fa.material,O.elements.push(A);h&&O.elements.sort(b);return O}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
+THREE.Projector=function(){function a(){var a=f[k]=f[k]||new THREE.RenderableObject;k++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,k=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,l=-b.z+b.w;return k>=0&&h>=0&&f>=0&&l>=0?!0:k<0&&h<0||f<0&&l<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(e=Math.min(e,k/(k-h))),f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var h,k,f=[],l,n,t=[],
+p,v,x=[],u,y=[],w,B,A=[],E,z,D=[],M={objects:[],sprites:[],lights:[],elements:[]},I=new THREE.Vector3,C=new THREE.Vector4,P=new THREE.Matrix4,K=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,H=new THREE.Vector4;this.computeFrustum=function(a){O[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);O[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);O[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);O[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);O[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);O[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=O[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);P.multiply(b.projectionMatrix,b.matrixWorldInverse);P.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+P.multiply(b.matrixWorld,b.projectionMatrixInverse);P.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.projectGraph=function(c,e){k=0;M.objects.length=0;M.sprites.length=0;M.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
+k=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),l=0;l<6;l++)if(c=O[l].x*e.n14+O[l].y*e.n24+O[l].z*e.n34+O[l].w,c<=k){c=!1;break a}c=!0}c?(P.multiplyVector3(I.copy(b.position)),h=a(),h.object=b,h.z=I.z,M.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(P.multiplyVector3(I.copy(b.position)),h=a(),h.object=b,h.z=I.z,M.sprites.push(h)):b instanceof THREE.Light&&M.lights.push(b);c=0;for(e=b.children.length;c<e;c++)f(b.children[c])}};f(c);e&&
+M.objects.sort(b);return M};this.projectScene=function(a,k,h){var f=k.near,I=k.far,X,O,L,Q,ia,da,$,ma,fa,aa,ka,ea,ja,ga,pa,ta;z=B=u=v=0;M.elements.length=0;k.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(k));a.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);P.multiply(k.projectionMatrix,k.matrixWorldInverse);this.computeFrustum(P);M=this.projectGraph(a,!1);a=0;for(X=M.objects.length;a<X;a++)if(fa=M.objects[a].object,aa=fa.matrixWorld,
+ea=fa.material,n=0,fa instanceof THREE.Mesh){ka=fa.geometry;ja=fa.geometry.materials;Q=ka.vertices;ga=ka.faces;pa=ka.faceVertexUvs;ka=fa.matrixRotationWorld.extractRotation(aa);O=0;for(L=Q.length;O<L;O++)l=c(),l.positionWorld.copy(Q[O].position),aa.multiplyVector3(l.positionWorld),l.positionScreen.copy(l.positionWorld),P.multiplyVector4(l.positionScreen),l.positionScreen.x/=l.positionScreen.w,l.positionScreen.y/=l.positionScreen.w,l.visible=l.positionScreen.z>f&&l.positionScreen.z<I;Q=0;for(O=ga.length;Q<
+O;Q++){L=ga[Q];if(L instanceof THREE.Face3)if(ia=t[L.a],da=t[L.b],$=t[L.c],ia.visible&&da.visible&&$.visible&&(fa.doubleSided||fa.flipSided!=($.positionScreen.x-ia.positionScreen.x)*(da.positionScreen.y-ia.positionScreen.y)-($.positionScreen.y-ia.positionScreen.y)*(da.positionScreen.x-ia.positionScreen.x)<0))ma=x[v]=x[v]||new THREE.RenderableFace3,v++,p=ma,p.v1.copy(ia),p.v2.copy(da),p.v3.copy($);else continue;else if(L instanceof THREE.Face4)if(ia=t[L.a],da=t[L.b],$=t[L.c],ma=t[L.d],ia.visible&&
+da.visible&&$.visible&&ma.visible&&(fa.doubleSided||fa.flipSided!=((ma.positionScreen.x-ia.positionScreen.x)*(da.positionScreen.y-ia.positionScreen.y)-(ma.positionScreen.y-ia.positionScreen.y)*(da.positionScreen.x-ia.positionScreen.x)<0||(da.positionScreen.x-$.positionScreen.x)*(ma.positionScreen.y-$.positionScreen.y)-(da.positionScreen.y-$.positionScreen.y)*(ma.positionScreen.x-$.positionScreen.x)<0)))ta=y[u]=y[u]||new THREE.RenderableFace4,u++,p=ta,p.v1.copy(ia),p.v2.copy(da),p.v3.copy($),p.v4.copy(ma);
+else continue;p.normalWorld.copy(L.normal);ka.multiplyVector3(p.normalWorld);p.centroidWorld.copy(L.centroid);aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);P.multiplyVector3(p.centroidScreen);$=L.vertexNormals;ia=0;for(da=$.length;ia<da;ia++)ma=p.vertexNormalsWorld[ia],ma.copy($[ia]),ka.multiplyVector3(ma);ia=0;for(da=pa.length;ia<da;ia++)if(ta=pa[ia][Q]){$=0;for(ma=ta.length;$<ma;$++)p.uvs[ia][$]=ta[$]}p.material=ea;p.faceMaterial=L.materialIndex!==null?ja[L.materialIndex]:
+null;p.z=p.centroidScreen.z;M.elements.push(p)}}else if(fa instanceof THREE.Line){K.multiply(P,aa);Q=fa.geometry.vertices;ia=c();ia.positionScreen.copy(Q[0].position);K.multiplyVector4(ia.positionScreen);O=1;for(L=Q.length;O<L;O++)if(ia=c(),ia.positionScreen.copy(Q[O].position),K.multiplyVector4(ia.positionScreen),da=t[n-2],N.copy(ia.positionScreen),H.copy(da.positionScreen),e(N,H))N.multiplyScalar(1/N.w),H.multiplyScalar(1/H.w),fa=A[B]=A[B]||new THREE.RenderableLine,B++,w=fa,w.v1.positionScreen.copy(N),
+w.v2.positionScreen.copy(H),w.z=Math.max(N.z,H.z),w.material=ea,M.elements.push(w)}a=0;for(X=M.sprites.length;a<X;a++)if(fa=M.sprites[a].object,aa=fa.matrixWorld,fa instanceof THREE.Particle&&(C.set(aa.n14,aa.n24,aa.n34,1),P.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))f=D[z]=D[z]||new THREE.RenderableParticle,z++,E=f,E.x=C.x/C.w,E.y=C.y/C.w,E.z=C.z,E.rotation=fa.rotation.z,E.scale.x=fa.scale.x*Math.abs(E.x-(C.x+k.projectionMatrix.n11)/(C.w+k.projectionMatrix.n14)),E.scale.y=fa.scale.y*Math.abs(E.y-
+(C.y+k.projectionMatrix.n22)/(C.w+k.projectionMatrix.n24)),E.material=fa.material,M.elements.push(E);h&&M.elements.sort(b);return M}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,h=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(b),b=Math.sin(b),f=a*c,l=e*h;this.w=f*k-l*b;this.x=f*b+l*k;this.y=e*c*k+a*h*b;this.z=a*h*k-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-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 c=
-this.x,b=this.y,e=this.z,h=this.w,k=a.x,f=a.y,l=a.z,a=a.w;this.x=c*a+h*k+b*l-e*f;this.y=b*a+h*f+e*k-c*l;this.z=e*a+h*l+c*f-b*k;this.w=h*a-c*k-b*f-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,h=a.z,k=this.x,f=this.y,l=this.z,n=this.w,u=n*b+f*h-l*e,t=n*e+l*b-k*h,p=n*h+k*e-f*b,b=-k*
-b-f*e-l*h;c.x=u*n+b*-k+t*-l-p*-f;c.y=t*n+b*-f+p*-k-u*-l;c.z=p*n+b*-l+u*-f-t*-k;return c}};
+this.x,b=this.y,e=this.z,h=this.w,k=a.x,f=a.y,l=a.z,a=a.w;this.x=c*a+h*k+b*l-e*f;this.y=b*a+h*f+e*k-c*l;this.z=e*a+h*l+c*f-b*k;this.w=h*a-c*k-b*f-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,h=a.z,k=this.x,f=this.y,l=this.z,n=this.w,t=n*b+f*h-l*e,p=n*e+l*b-k*h,v=n*h+k*e-f*b,b=-k*
+b-f*e-l*h;c.x=t*n+b*-k+p*-l-v*-f;c.y=p*n+b*-f+v*-k-t*-l;c.z=v*n+b*-l+t*-f-p*-k;return c}};
 THREE.Quaternion.slerp=function(a,c,b,e){var h=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;h<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,h=-h):b.copy(c);if(Math.abs(h)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var k=Math.acos(h),h=Math.sqrt(1-h*h);if(Math.abs(h)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*k)/h;e=Math.sin(e*k)/h;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,e,h,k){this.a=a;this.b=c;this.c=b;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.materialIndex=k;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,e,h,k,f){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
@@ -83,15 +83,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,e,h,k,f,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){k=this.faces[e];if(a&&k.vertexNormals.length){l.set(0,0,0);c=0;for(b=k.vertexNormals.length;c<b;c++)l.addSelf(k.vertexNormals[c]);l.divideScalar(3)}else c=this.vertices[k.a],b=this.vertices[k.b],f=this.vertices[k.c],l.sub(f.position,b.position),n.sub(c.position,b.position),l.crossSelf(n);l.isZero()||l.normalize();k.normal.copy(l)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,k,h,o){l=a.vertices[b].position;n=a.vertices[c].position;u=a.vertices[e].position;t=f[k];p=f[h];w=f[o];v=n.x-l.x;z=u.x-l.x;x=n.y-l.y;y=u.y-l.y;G=n.z-l.z;A=u.z-l.z;B=p.u-t.u;D=w.u-t.u;O=p.v-t.v;I=w.v-t.v;H=1/(B*I-D*O);K.set((I*v-O*z)*H,(I*x-O*y)*H,(I*G-O*A)*H);N.set((B*z-D*v)*H,(B*y-D*x)*H,(B*A-D*G)*H);Q[b].addSelf(K);Q[c].addSelf(K);Q[e].addSelf(K);M[b].addSelf(N);
-M[c].addSelf(N);M[e].addSelf(N)}var c,b,e,h,k,f,l,n,u,t,p,w,v,z,x,y,G,A,B,D,O,I,H,P,Q=[],M=[],K=new THREE.Vector3,N=new THREE.Vector3,ea=new THREE.Vector3,Y=new THREE.Vector3,S=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)Q[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)k=this.faces[c],f=this.faceVertexUvs[0][c],k instanceof THREE.Face3?a(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(a(this,k.a,k.b,k.c,0,1,2),a(this,k.a,k.b,k.d,0,1,3));var o=["a",
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){k=this.faces[c];for(e=0;e<k.vertexNormals.length;e++)S.copy(k.vertexNormals[e]),h=k[o[e]],P=Q[h],ea.copy(P),ea.subSelf(S.multiplyScalar(S.dot(P))).normalize(),Y.cross(k.vertexNormals[e],P),h=Y.dot(M[h]),h=h<0?-1:1,k.vertexTangents[e]=new THREE.Vector4(ea.x,ea.y,ea.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,k,h,o){l=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;p=f[k];v=f[h];x=f[o];u=n.x-l.x;y=t.x-l.x;w=n.y-l.y;B=t.y-l.y;A=n.z-l.z;E=t.z-l.z;z=v.u-p.u;D=x.u-p.u;M=v.v-p.v;I=x.v-p.v;C=1/(z*I-D*M);N.set((I*u-M*y)*C,(I*w-M*B)*C,(I*A-M*E)*C);H.set((z*y-D*u)*C,(z*B-D*w)*C,(z*E-D*A)*C);K[b].addSelf(N);K[c].addSelf(N);K[e].addSelf(N);O[b].addSelf(H);
+O[c].addSelf(H);O[e].addSelf(H)}var c,b,e,h,k,f,l,n,t,p,v,x,u,y,w,B,A,E,z,D,M,I,C,P,K=[],O=[],N=new THREE.Vector3,H=new THREE.Vector3,W=new THREE.Vector3,Z=new THREE.Vector3,U=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,O[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)k=this.faces[c],f=this.faceVertexUvs[0][c],k instanceof THREE.Face3?a(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(a(this,k.a,k.b,k.c,0,1,2),a(this,k.a,k.b,k.d,0,1,3));var o=["a","b",
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){k=this.faces[c];for(e=0;e<k.vertexNormals.length;e++)U.copy(k.vertexNormals[e]),h=k[o[e]],P=K[h],W.copy(P),W.subSelf(U.multiplyScalar(U.dot(P))).normalize(),Z.cross(k.vertexNormals[e],P),h=Z.dot(O[h]),h=h<0?-1:1,k.vertexTangents[e]=new THREE.Vector4(W.x,W.y,W.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];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,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,h=Math.pow(10,4),k,f;k=0;for(f=this.vertices.length;k<f;k++)e=this.vertices[k].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),a[e]===void 0?(a[e]=k,c.push(this.vertices[k]),
 b[k]=c.length-1):b[k]=b[a[e]];k=0;for(f=this.faces.length;k<f;k++)if(a=this.faces[k],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function c(a,b,c,e,k,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*k+b}this.points=a;var b=[],e={x:0,y:0,z:0},h,k,f,l,n,u,t,p,w;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){h=(this.points.length-1)*a;k=Math.floor(h);f=h-k;b[0]=k===0?k:k-1;b[1]=k;b[2]=k>this.points.length-2?k:k+1;b[3]=k>this.points.length-3?k:k+2;u=this.points[b[0]];t=this.points[b[1]];
-p=this.points[b[2]];w=this.points[b[3]];l=f*f;n=f*l;e.x=c(u.x,t.x,p.x,w.x,f,l,n);e.y=c(u.y,t.y,p.y,w.y,f,l,n);e.z=c(u.z,t.z,p.z,w.z,f,l,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,k=new THREE.Vector3,h=new THREE.Vector3,f=[],l=0;f[0]=0;a||(a=100);c=this.points.length*a;k.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),h.copy(position),
-l+=h.distanceTo(k),k.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(f[b]=l,e=b);f[f.length]=l;return{chunks:f,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,k,h,f,l=[],n=new THREE.Vector3,u=this.getLength();l.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=u.chunks[b]-u.chunks[b-1];f=Math.ceil(a*c/u.total);k=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<f-1;c++)e=k+c*(1/f)*(h-k),position=this.getPoint(e),l.push(n.copy(position).clone());
+THREE.Spline=function(a){function c(a,b,c,e,k,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*k+b}this.points=a;var b=[],e={x:0,y:0,z:0},h,k,f,l,n,t,p,v,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){h=(this.points.length-1)*a;k=Math.floor(h);f=h-k;b[0]=k===0?k:k-1;b[1]=k;b[2]=k>this.points.length-2?k:k+1;b[3]=k>this.points.length-3?k:k+2;t=this.points[b[0]];p=this.points[b[1]];
+v=this.points[b[2]];x=this.points[b[3]];l=f*f;n=f*l;e.x=c(t.x,p.x,v.x,x.x,f,l,n);e.y=c(t.y,p.y,v.y,x.y,f,l,n);e.z=c(t.z,p.z,v.z,x.z,f,l,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,k=new THREE.Vector3,h=new THREE.Vector3,f=[],l=0;f[0]=0;a||(a=100);c=this.points.length*a;k.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),h.copy(position),
+l+=h.distanceTo(k),k.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(f[b]=l,e=b);f[f.length]=l;return{chunks:f,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,k,h,f,l=[],n=new THREE.Vector3,t=this.getLength();l.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=t.chunks[b]-t.chunks[b-1];f=Math.ceil(a*c/t.total);k=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<f-1;c++)e=k+c*(1/f)*(h-k),position=this.getPoint(e),l.push(n.copy(position).clone());
 l.push(n.copy(this.points[b]).clone())}this.points=l}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,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;this.projectionMatrixInverse=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,c,b,e,h,k){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;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;
@@ -149,47 +149,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,h,k;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;h=b/2;k=e/2};this.render=function(b,e){var n,u,t,p,w,v,z,x;a=c.projectScene(b,e);n=0;for(u=a.length;n<u;n++)if(w=a[n],w instanceof THREE.RenderableParticle){z=w.x*h+h;x=w.y*k+k;t=0;for(p=w.material.length;t<p;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=x+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(A!=a)x.globalAlpha=A=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)x.strokeStyle=D=a}function h(a){if(O!=a)x.fillStyle=O=a}var k=this,f,l,n,u=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),G=0,A=1,B=0,D=null,O=null,I=null,H=null,P=null,Q,M,K,N,ea=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,S,o,$,T,oa,W,C,da,V,X,la,fa,Z=new THREE.Color,ja=new THREE.Color,aa=new THREE.Color,ia=new THREE.Color,ga=new THREE.Color,ha=[],na,qa,pa,sa,va,Da,Ba,Ea,Ca,F,ca=new THREE.Rectangle,ka=new THREE.Rectangle,J=new THREE.Rectangle,ua=!1,ra=new THREE.Color,wa=new THREE.Color,ta=new THREE.Color,ma=new THREE.Vector3,Fa,Aa,Ga,za,U,Ia,a=16;Fa=document.createElement("canvas");
-Fa.width=Fa.height=2;Aa=Fa.getContext("2d");Aa.fillStyle="rgba(0,0,0,1)";Aa.fillRect(0,0,2,2);Ga=Aa.getImageData(0,0,2,2);za=Ga.data;U=document.createElement("canvas");U.width=U.height=a;Ia=U.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;w=b;v=Math.floor(p/2);z=Math.floor(w/2);t.width=p;t.height=w;ca.set(-v,-z,v,z);ka.set(-v,-z,v,z);A=1;B=0;P=H=
-I=O=D=null};this.setClearColor=function(a,b){y.copy(a);G=b;ka.set(-v,-z,v,z)};this.setClearColorHex=function(a,b){y.setHex(a);G=b;ka.set(-v,-z,v,z)};this.clear=function(){x.setTransform(1,0,0,-1,v,z);ka.isEmpty()||(ka.minSelf(ca),ka.inflate(2),G<1&&x.clearRect(Math.floor(ka.getX()),Math.floor(ka.getY()),Math.floor(ka.getWidth()),Math.floor(ka.getHeight())),G>0&&(b(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+G+")"),x.fillRect(Math.floor(ka.getX()),
-Math.floor(ka.getY()),Math.floor(ka.getWidth()),Math.floor(ka.getHeight()))),ka.empty())};this.render=function(a,t){function p(a){var b,c,e,k;ra.setRGB(0,0,0);wa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],k=e.color,e instanceof THREE.AmbientLight?(ra.r+=k.r,ra.g+=k.g,ra.b+=k.b):e instanceof THREE.DirectionalLight?(wa.r+=k.r,wa.g+=k.g,wa.b+=k.b):e instanceof THREE.PointLight&&(ta.r+=k.r,ta.g+=k.g,ta.b+=k.b)}function w(a,b,c,e){var k,h,f,o,l,n;k=0;for(h=a.length;k<h;k++)f=a[k],
-o=f.color,f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),n=c.dot(l),n<=0||(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),n=c.dot(ma.sub(l,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(l)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function y(a,k,f){c(f.opacity);b(f.blending);var o,l,n,u,t,p;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)u=f.map.image,t=u.width>>
-1,p=u.height>>1,f=k.scale.x*v,n=k.scale.y*z,o=f*t,l=n*p,J.set(a.x-o,a.y-l,a.x+o,a.y+l),ca.intersects(J)&&(x.save(),x.translate(a.x,a.y),x.rotate(-k.rotation),x.scale(f,-n),x.translate(-t,-p),x.drawImage(u,0,0),x.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,l=k.scale.y*z,J.set(a.x-o,a.y-l,a.x+o,a.y+l),ca.intersects(J)&&(e(f.color.getContextStyle()),h(f.color.getContextStyle()),x.save(),x.translate(a.x,a.y),x.rotate(-k.rotation),x.scale(o,l),f.program(x),x.restore()))}function ab(a,
-k,h,f){c(f.opacity);b(f.blending);x.beginPath();x.moveTo(a.positionScreen.x,a.positionScreen.y);x.lineTo(k.positionScreen.x,k.positionScreen.y);x.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(I!=a)x.lineWidth=I=a;a=f.linecap;if(H!=a)x.lineCap=H=a;a=f.linejoin;if(P!=a)x.lineJoin=P=a;e(f.color.getContextStyle());x.stroke();J.inflate(f.linewidth*2)}}function A(a,e,f,h,l,u,v,p){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);b(p.blending);S=a.positionScreen.x;o=a.positionScreen.y;
-$=e.positionScreen.x;T=e.positionScreen.y;oa=f.positionScreen.x;W=f.positionScreen.y;G(S,o,$,T,oa,W);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Wa(S,o,$,T,oa,W,sa[h].u,sa[h].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,ma.copy(v.vertexNormalsWorld[h]),va=(ma.x*a.n11+ma.y*a.n12+ma.z*a.n13)*0.5+0.5,Da=-(ma.x*a.n21+ma.y*a.n22+ma.z*a.n23)*0.5+
-0.5,ma.copy(v.vertexNormalsWorld[l]),Ba=(ma.x*a.n11+ma.y*a.n12+ma.z*a.n13)*0.5+0.5,Ea=-(ma.x*a.n21+ma.y*a.n22+ma.z*a.n23)*0.5+0.5,ma.copy(v.vertexNormalsWorld[u]),Ca=(ma.x*a.n11+ma.y*a.n12+ma.z*a.n13)*0.5+0.5,F=-(ma.x*a.n21+ma.y*a.n22+ma.z*a.n23)*0.5+0.5,Wa(S,o,$,T,oa,W,va,Da,Ba,Ea,Ca,F,p.envMap)}else p.wireframe?La(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):O(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
-(sa=v.uvs[0],Wa(S,o,$,T,oa,W,sa[h].u,sa[h].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map)),b(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ja.r=aa.r=ia.r=ra.r,ja.g=aa.g=ia.g=ra.g,ja.b=aa.b=ia.b=ra.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ja),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],aa),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),ja.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ja.b=
-Math.max(0,Math.min(p.color.b*ja.b,1)),aa.r=Math.max(0,Math.min(p.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(p.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(p.color.b*aa.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),ga.r=(aa.r+ia.r)*0.5,ga.g=(aa.g+ia.g)*0.5,ga.b=(aa.b+ia.b)*0.5,pa=Ua(ja,aa,ia,ga),Sa(S,o,$,T,oa,W,0,0,1,0,0,1,pa)):(Z.r=ra.r,Z.g=ra.g,Z.b=ra.b,w(n,v.centroidWorld,v.normalWorld,Z),Z.r=Math.max(0,Math.min(p.color.r*
-Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),p.wireframe?La(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):O(Z)):p.wireframe?La(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):O(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=t.near,qa=t.far,ja.r=ja.g=ja.b=1-Na(a.positionScreen.z,na,qa),aa.r=aa.g=aa.b=1-Na(e.positionScreen.z,na,qa),ia.r=ia.g=ia.b=1-Na(f.positionScreen.z,na,qa),ga.r=(aa.r+ia.r)*0.5,ga.g=(aa.g+
-ia.g)*0.5,ga.b=(aa.b+ia.b)*0.5,pa=Ua(ja,aa,ia,ga),Sa(S,o,$,T,oa,W,0,0,1,0,0,1,pa);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(v.normalWorld.x),Z.g=Ta(v.normalWorld.y),Z.b=Ta(v.normalWorld.z),p.wireframe?La(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):O(Z)}function B(a,e,f,h,l,u,p,v,xa){k.info.render.vertices+=4;k.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,h,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(S=a.positionScreen.x,o=a.positionScreen.y,
-$=e.positionScreen.x,T=e.positionScreen.y,oa=f.positionScreen.x,W=f.positionScreen.y,C=h.positionScreen.x,da=h.positionScreen.y,V=l.positionScreen.x,X=l.positionScreen.y,la=u.positionScreen.x,fa=u.positionScreen.y,v instanceof THREE.MeshBasicMaterial)D(S,o,$,T,oa,W,C,da),v.wireframe?La(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):O(v.color);else if(v instanceof THREE.MeshLambertMaterial)ua?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ja.r=aa.r=
-ia.r=ga.r=ra.r,ja.g=aa.g=ia.g=ga.g=ra.g,ja.b=aa.b=ia.b=ga.b=ra.b,w(n,p.v1.positionWorld,p.vertexNormalsWorld[0],ja),w(n,p.v2.positionWorld,p.vertexNormalsWorld[1],aa),w(n,p.v4.positionWorld,p.vertexNormalsWorld[3],ia),w(n,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),ja.r=Math.max(0,Math.min(v.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(v.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(v.color.b*ja.b,1)),aa.r=Math.max(0,Math.min(v.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*aa.g,1)),aa.b=Math.max(0,
-Math.min(v.color.b*aa.b,1)),ia.r=Math.max(0,Math.min(v.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(v.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(v.color.b*ia.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),pa=Ua(ja,aa,ia,ga),G(S,o,$,T,C,da),Sa(S,o,$,T,C,da,0,0,1,0,0,1,pa),G(V,X,oa,W,la,fa),Sa(V,X,oa,W,la,fa,1,0,1,1,0,1,pa)):(Z.r=ra.r,Z.g=ra.g,Z.b=ra.b,w(n,p.centroidWorld,p.normalWorld,Z),Z.r=Math.max(0,Math.min(v.color.r*
-Z.r,1)),Z.g=Math.max(0,Math.min(v.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(v.color.b*Z.b,1)),D(S,o,$,T,oa,W,C,da),v.wireframe?La(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):O(Z)):(D(S,o,$,T,oa,W,C,da),v.wireframe?La(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):O(v.color));else if(v instanceof THREE.MeshNormalMaterial)Z.r=Ta(p.normalWorld.x),Z.g=Ta(p.normalWorld.y),Z.b=Ta(p.normalWorld.z),D(S,o,$,T,oa,W,C,da),v.wireframe?La(Z,v.wireframeLinewidth,v.wireframeLinecap,
-v.wireframeLinejoin):O(Z);else if(v instanceof THREE.MeshDepthMaterial)na=t.near,qa=t.far,ja.r=ja.g=ja.b=1-Na(a.positionScreen.z,na,qa),aa.r=aa.g=aa.b=1-Na(e.positionScreen.z,na,qa),ia.r=ia.g=ia.b=1-Na(h.positionScreen.z,na,qa),ga.r=ga.g=ga.b=1-Na(f.positionScreen.z,na,qa),pa=Ua(ja,aa,ia,ga),G(S,o,$,T,C,da),Sa(S,o,$,T,C,da,0,0,1,0,0,1,pa),G(V,X,oa,W,la,fa),Sa(V,X,oa,W,la,fa,1,0,1,1,0,1,pa)}function G(a,b,c,e,k,f){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(k,f);x.lineTo(a,b);x.closePath()}
-function D(a,b,c,e,k,f,h,o){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(k,f);x.lineTo(h,o);x.lineTo(a,b);x.closePath()}function La(a,b,c,k){if(I!=b)x.lineWidth=I=b;if(H!=c)x.lineCap=H=c;if(P!=k)x.lineJoin=P=k;e(a.getContextStyle());x.stroke();J.inflate(b*2)}function O(a){h(a.getContextStyle());x.fill()}function Wa(a,b,c,e,k,f,o,l,n,v,p,u,t){if(t.image.width!=0){if(t.needsUpdate==!0||ha[t.id]==void 0){var xa=t.wrapS==THREE.RepeatWrapping,w=t.wrapT==THREE.RepeatWrapping;ha[t.id]=x.createPattern(t.image,
-xa&&w?"repeat":xa&&!w?"repeat-x":!xa&&w?"repeat-y":"no-repeat");t.needsUpdate=!1}h(ha[t.id]);var xa=t.offset.x/t.repeat.x,w=t.offset.y/t.repeat.y,F=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,o=(o+xa)*F,l=(l+w)*t,n=(n+xa)*F,v=(v+w)*t,p=(p+xa)*F,u=(u+w)*t;c-=a;e-=b;k-=a;f-=b;n-=o;v-=l;p-=o;u-=l;xa=1/(n*u-p*v);t=(u*c-v*k)*xa;v=(u*e-v*f)*xa;c=(n*k-p*c)*xa;e=(n*f-p*e)*xa;a=a-t*o-c*l;b=b-v*o-e*l;x.save();x.transform(t,v,c,e,a,b);x.fill();x.restore()}}function Sa(a,b,c,e,k,f,h,o,l,n,v,
-p,u){var t,xa;t=u.width-1;xa=u.height-1;h*=t;o*=xa;l*=t;n*=xa;v*=t;p*=xa;c-=a;e-=b;k-=a;f-=b;l-=h;n-=o;v-=h;p-=o;xa=1/(l*p-v*n);t=(p*c-n*k)*xa;n=(p*e-n*f)*xa;c=(l*k-v*c)*xa;e=(l*f-v*e)*xa;a=a-t*h-c*o;b=b-n*h-e*o;x.save();x.transform(t,n,c,e,a,b);x.clip();x.drawImage(u,0,0);x.restore()}function Ua(a,b,c,e){var k=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),v=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);za[0]=k<0?0:k>255?255:
-k;za[1]=f<0?0:f>255?255:f;za[2]=a<0?0:a>255?255:a;za[4]=h<0?0:h>255?255:h;za[5]=o<0?0:o>255?255:o;za[6]=b<0?0:b>255?255:b;za[8]=l<0?0:l>255?255:l;za[9]=n<0?0:n>255?255:n;za[10]=c<0?0:c>255?255:c;za[12]=v<0?0:v>255?255:v;za[13]=p<0?0:p>255?255:p;za[14]=e<0?0:e>255?255:e;Aa.putImageData(Ga,0,0);Ia.drawImage(Fa,0,0);return U}function Na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,b){var c=b.x-a.x,e=b.y-a.y,k=c*c+e*e;k!=0&&(k=1/Math.sqrt(k),c*=
-k,e*=k,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Va,Xa,ya,Ha;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,z);k.info.render.vertices=0;k.info.render.faces=0;f=u.projectScene(a,t,this.sortElements);l=f.elements;n=f.lights;(ua=n.length>0)&&p(n);Va=0;for(Xa=l.length;Va<Xa;Va++)if(ya=l[Va],Ha=ya.material,Ha=Ha instanceof THREE.MeshFaceMaterial?ya.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){J.empty();if(ya instanceof THREE.RenderableParticle)Q=ya,Q.x*=v,Q.y*=z,y(Q,ya,Ha,a);else if(ya instanceof THREE.RenderableLine)Q=
-ya.v1,M=ya.v2,Q.positionScreen.x*=v,Q.positionScreen.y*=z,M.positionScreen.x*=v,M.positionScreen.y*=z,J.addPoint(Q.positionScreen.x,Q.positionScreen.y),J.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(J)&&ab(Q,M,ya,Ha,a);else if(ya instanceof THREE.RenderableFace3)Q=ya.v1,M=ya.v2,K=ya.v3,Q.positionScreen.x*=v,Q.positionScreen.y*=z,M.positionScreen.x*=v,M.positionScreen.y*=z,K.positionScreen.x*=v,K.positionScreen.y*=z,Ha.overdraw&&(Ma(Q.positionScreen,M.positionScreen),Ma(M.positionScreen,
-K.positionScreen),Ma(K.positionScreen,Q.positionScreen)),J.add3Points(Q.positionScreen.x,Q.positionScreen.y,M.positionScreen.x,M.positionScreen.y,K.positionScreen.x,K.positionScreen.y),ca.intersects(J)&&A(Q,M,K,0,1,2,ya,Ha,a);else if(ya instanceof THREE.RenderableFace4)Q=ya.v1,M=ya.v2,K=ya.v3,N=ya.v4,Q.positionScreen.x*=v,Q.positionScreen.y*=z,M.positionScreen.x*=v,M.positionScreen.y*=z,K.positionScreen.x*=v,K.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,ea.positionScreen.copy(M.positionScreen),
-Y.positionScreen.copy(N.positionScreen),Ha.overdraw&&(Ma(Q.positionScreen,M.positionScreen),Ma(M.positionScreen,N.positionScreen),Ma(N.positionScreen,Q.positionScreen),Ma(K.positionScreen,ea.positionScreen),Ma(K.positionScreen,Y.positionScreen)),J.addPoint(Q.positionScreen.x,Q.positionScreen.y),J.addPoint(M.positionScreen.x,M.positionScreen.y),J.addPoint(K.positionScreen.x,K.positionScreen.y),J.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(J)&&B(Q,M,K,N,ea,Y,ya,Ha,a);ka.addRectangle(J)}x.setTransform(1,
-0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,e){var k,f,h,l,n,v;k=0;for(f=a.length;k<f;k++)h=a[k],l=h.color,h instanceof THREE.DirectionalLight?(n=h.matrixWorld.getPosition(),v=c.dot(n),v<=0||(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)):h instanceof THREE.PointLight&&(n=h.matrixWorld.getPosition(),v=c.dot(Q.sub(n,b).normalize()),v<=0||(v*=h.distance==0?1:1-Math.min(b.distanceTo(n)/h.distance,1),v!=0&&(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)))}function c(a){M[a]==null&&(M[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),S==0&&M[a].setAttribute("shape-rendering","crispEdges"));return M[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,h,k,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,t,p,w,v,z,x,y,G=new THREE.Rectangle,A=new THREE.Rectangle,B=!1,D=new THREE.Color,O=new THREE.Color,I=new THREE.Color,H=new THREE.Color,P,Q=new THREE.Vector3,M=[],K=[],N,ea,Y,S=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":S=1;break;case "low":S=0}};this.setSize=function(a,b){u=a;t=b;p=u/2;w=t/2;n.setAttribute("viewBox",-p+" "+-w+" "+u+" "+t);n.setAttribute("width",u);n.setAttribute("height",t);G.set(-p,-w,p,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,u){var t,Q,M,C;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;h=l.projectScene(o,u,this.sortElements);k=h.elements;
-f=h.lights;Y=ea=0;if(B=f.length>0){O.setRGB(0,0,0);I.setRGB(0,0,0);H.setRGB(0,0,0);t=0;for(Q=f.length;t<Q;t++)C=f[t],M=C.color,C instanceof THREE.AmbientLight?(O.r+=M.r,O.g+=M.g,O.b+=M.b):C instanceof THREE.DirectionalLight?(I.r+=M.r,I.g+=M.g,I.b+=M.b):C instanceof THREE.PointLight&&(H.r+=M.r,H.g+=M.g,H.b+=M.b)}t=0;for(Q=k.length;t<Q;t++)if(M=k[t],C=M.material,C=C instanceof THREE.MeshFaceMaterial?M.faceMaterial:C,!(C==null||C.opacity==0))if(A.empty(),M instanceof THREE.RenderableParticle)v=M,v.x*=
-p,v.y*=-w,m=0,ml=M.materials.length;else if(M instanceof THREE.RenderableLine){if(v=M.v1,z=M.v2,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),G.intersects(A)){M=v;var da=z,V=Y++;K[V]==null&&(K[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),S==0&&K[V].setAttribute("shape-rendering","crispEdges"));N=K[V];N.setAttribute("x1",M.positionScreen.x);
-N.setAttribute("y1",M.positionScreen.y);N.setAttribute("x2",da.positionScreen.x);N.setAttribute("y2",da.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),n.appendChild(N))}}else if(M instanceof THREE.RenderableFace3){if(v=M.v1,z=M.v2,x=M.v3,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=
-p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),G.intersects(A)){var da=v,V=z,X=x;e.info.render.vertices+=3;e.info.render.faces++;N=c(ea++);N.setAttribute("d","M "+da.positionScreen.x+" "+da.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
-D.copy(C.color):C instanceof THREE.MeshLambertMaterial?B?(D.r=O.r,D.g=O.g,D.b=O.b,a(f,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(C.color.r*D.r,1)),D.g=Math.max(0,Math.min(C.color.g*D.g,1)),D.b=Math.max(0,Math.min(C.color.b*D.b,1))):D.copy(C.color):C instanceof THREE.MeshDepthMaterial?(P=1-C.__2near/(C.__farPlusNear-M.z*C.__farMinusNear),D.setRGB(P,P,P)):C instanceof THREE.MeshNormalMaterial&&D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));C.wireframe?N.setAttribute("style",
-"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+C.opacity);n.appendChild(N)}}else if(M instanceof THREE.RenderableFace4&&(v=M.v1,z=M.v2,x=M.v3,y=M.v4,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=
--w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),G.intersects(A))){var da=v,V=z,X=x,la=y;e.info.render.vertices+=4;e.info.render.faces++;N=c(ea++);N.setAttribute("d","M "+da.positionScreen.x+" "+da.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+
-" L "+la.positionScreen.x+","+la.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?D.copy(C.color):C instanceof THREE.MeshLambertMaterial?B?(D.r=O.r,D.g=O.g,D.b=O.b,a(f,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(C.color.r*D.r,1)),D.g=Math.max(0,Math.min(C.color.g*D.g,1)),D.b=Math.max(0,Math.min(C.color.b*D.b,1))):D.copy(C.color):C instanceof THREE.MeshDepthMaterial?(P=1-C.__2near/(C.__farPlusNear-M.z*C.__farMinusNear),D.setRGB(P,P,P)):C instanceof THREE.MeshNormalMaterial&&
-D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));C.wireframe?N.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+C.opacity);n.appendChild(N)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,h,k;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;h=b/2;k=e/2};this.render=function(b,e){var n,t,p,v,x,u,y,w;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){y=x.x*h+h;w=x.y*k+k;p=0;for(v=x.material.length;p<v;p++)if(u=x.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=w+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(E!=a)w.globalAlpha=E=a}function b(a){if(z!=a){switch(a){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}z=a}}function e(a){if(D!=a)w.strokeStyle=D=a}function h(a){if(M!=a)w.fillStyle=M=a}var k=this,f,l,n,t=new THREE.Projector,a=a||{},p=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+v,x,u,y,w=p.getContext("2d"),B=new THREE.Color(0),A=0,E=1,z=0,D=null,M=null,I=null,C=null,P=null,K,O,N,H,W=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,U,o,ca,X,oa,L,Q,ia,da,$,ma,fa,aa=new THREE.Color,ka=new THREE.Color,ea=new THREE.Color,ja=new THREE.Color,ga=new THREE.Color,pa=[],ta,qa,la,ua,wa,Da,Ba,Ea,Ca,G,T=new THREE.Rectangle,ha=new THREE.Rectangle,V=new THREE.Rectangle,va=!1,ra=new THREE.Color,xa=new THREE.Color,sa=new THREE.Color,na=new THREE.Vector3,Fa,ya,Ga,Aa,Y,Ia,a=16;Fa=document.createElement("canvas");
+Fa.width=Fa.height=2;ya=Fa.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);Ga=ya.getImageData(0,0,2,2);Aa=Ga.data;Y=document.createElement("canvas");Y.width=Y.height=a;Ia=Y.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){v=a;x=b;u=Math.floor(v/2);y=Math.floor(x/2);p.width=v;p.height=x;T.set(-u,-y,u,y);ha.set(-u,-y,u,y);E=1;z=0;P=C=
+I=M=D=null};this.setClearColor=function(a,b){B.copy(a);A=b;ha.set(-u,-y,u,y)};this.setClearColorHex=function(a,b){B.setHex(a);A=b;ha.set(-u,-y,u,y)};this.clear=function(){w.setTransform(1,0,0,-1,u,y);ha.isEmpty()||(ha.minSelf(T),ha.inflate(2),A<1&&w.clearRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight())),A>0&&(b(THREE.NormalBlending),c(1),h("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+A+")"),w.fillRect(Math.floor(ha.getX()),
+Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight()))),ha.empty())};this.render=function(a,p){function v(a){var b,c,e,k;ra.setRGB(0,0,0);xa.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],k=e.color,e instanceof THREE.AmbientLight?(ra.r+=k.r,ra.g+=k.g,ra.b+=k.b):e instanceof THREE.DirectionalLight?(xa.r+=k.r,xa.g+=k.g,xa.b+=k.b):e instanceof THREE.PointLight&&(sa.r+=k.r,sa.g+=k.g,sa.b+=k.b)}function x(a,b,c,e){var k,h,f,o,l,n;k=0;for(h=a.length;k<h;k++)f=a[k],
+o=f.color,f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),n=c.dot(l),n<=0||(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),n=c.dot(na.sub(l,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(l)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function B(a,k,f){c(f.opacity);b(f.blending);var o,l,n,t,p,R;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)t=f.map.image,p=t.width>>
+1,R=t.height>>1,f=k.scale.x*u,n=k.scale.y*y,o=f*p,l=n*R,V.set(a.x-o,a.y-l,a.x+o,a.y+l),T.intersects(V)&&(w.save(),w.translate(a.x,a.y),w.rotate(-k.rotation),w.scale(f,-n),w.translate(-p,-R),w.drawImage(t,0,0),w.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,l=k.scale.y*y,V.set(a.x-o,a.y-l,a.x+o,a.y+l),T.intersects(V)&&(e(f.color.getContextStyle()),h(f.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-k.rotation),w.scale(o,l),f.program(w),w.restore()))}function A(a,
+k,h,f){c(f.opacity);b(f.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(I!=a)w.lineWidth=I=a;a=f.linecap;if(C!=a)w.lineCap=C=a;a=f.linejoin;if(P!=a)w.lineJoin=P=a;e(f.color.getContextStyle());w.stroke();V.inflate(f.linewidth*2)}}function z(a,e,f,h,l,t,u,R){k.info.render.vertices+=3;k.info.render.faces++;c(R.opacity);b(R.blending);U=a.positionScreen.x;o=a.positionScreen.y;
+ca=e.positionScreen.x;X=e.positionScreen.y;oa=f.positionScreen.x;L=f.positionScreen.y;Ta(U,o,ca,X,oa,L);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(ua=u.uvs[0],Xa(U,o,ca,X,oa,L,ua[h].u,ua[h].v,ua[l].u,ua[l].v,ua[t].u,ua[t].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=p.matrixWorldInverse,na.copy(u.vertexNormalsWorld[h]),wa=(na.x*a.n11+na.y*a.n12+na.z*a.n13)*0.5+0.5,Da=-(na.x*a.n21+na.y*a.n22+na.z*a.n23)*
+0.5+0.5,na.copy(u.vertexNormalsWorld[l]),Ba=(na.x*a.n11+na.y*a.n12+na.z*a.n13)*0.5+0.5,Ea=-(na.x*a.n21+na.y*a.n22+na.z*a.n23)*0.5+0.5,na.copy(u.vertexNormalsWorld[t]),Ca=(na.x*a.n11+na.y*a.n12+na.z*a.n13)*0.5+0.5,G=-(na.x*a.n21+na.y*a.n22+na.z*a.n23)*0.5+0.5,Xa(U,o,ca,X,oa,L,wa,Da,Ba,Ea,Ca,G,R.envMap)}else R.wireframe?D(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&!R.wireframe&&(R.map.mapping instanceof THREE.UVMapping&&
+(ua=u.uvs[0],Xa(U,o,ca,X,oa,L,ua[h].u,ua[h].v,ua[l].u,ua[l].v,ua[t].u,ua[t].v,R.map)),b(THREE.SubtractiveBlending)),va?!R.wireframe&&R.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(ka.r=ea.r=ja.r=ra.r,ka.g=ea.g=ja.g=ra.g,ka.b=ea.b=ja.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],ka),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],ea),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ja),ka.r=Math.max(0,Math.min(R.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(R.color.g*ka.g,1)),ka.b=
+Math.max(0,Math.min(R.color.b*ka.b,1)),ea.r=Math.max(0,Math.min(R.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(R.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(R.color.b*ea.b,1)),ja.r=Math.max(0,Math.min(R.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(R.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(R.color.b*ja.b,1)),ga.r=(ea.r+ja.r)*0.5,ga.g=(ea.g+ja.g)*0.5,ga.b=(ea.b+ja.b)*0.5,la=Ua(ka,ea,ja,ga),Ra(U,o,ca,X,oa,L,0,0,1,0,0,1,la)):(aa.r=ra.r,aa.g=ra.g,aa.b=ra.b,x(n,u.centroidWorld,u.normalWorld,aa),aa.r=Math.max(0,
+Math.min(R.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(R.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(R.color.b*aa.b,1)),R.wireframe?D(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(aa)):R.wireframe?D(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(R.color);else if(R instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,qa),ea.r=ea.g=ea.b=1-Ma(e.positionScreen.z,ta,qa),ja.r=ja.g=ja.b=1-Ma(f.positionScreen.z,ta,qa),ga.r=
+(ea.r+ja.r)*0.5,ga.g=(ea.g+ja.g)*0.5,ga.b=(ea.b+ja.b)*0.5,la=Ua(ka,ea,ja,ga),Ra(U,o,ca,X,oa,L,0,0,1,0,0,1,la);else if(R instanceof THREE.MeshNormalMaterial)aa.r=Sa(u.normalWorld.x),aa.g=Sa(u.normalWorld.y),aa.b=Sa(u.normalWorld.z),R.wireframe?D(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(aa)}function E(a,e,f,h,l,t,u,R,v){k.info.render.vertices+=4;k.info.render.faces++;c(R.opacity);b(R.blending);if(R.map||R.envMap)z(a,e,h,0,1,3,u,R,v),z(l,f,t,1,2,3,u,R,v);else if(U=a.positionScreen.x,
+o=a.positionScreen.y,ca=e.positionScreen.x,X=e.positionScreen.y,oa=f.positionScreen.x,L=f.positionScreen.y,Q=h.positionScreen.x,ia=h.positionScreen.y,da=l.positionScreen.x,$=l.positionScreen.y,ma=t.positionScreen.x,fa=t.positionScreen.y,R instanceof THREE.MeshBasicMaterial)Va(U,o,ca,X,oa,L,Q,ia),R.wireframe?D(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(R.color);else if(R instanceof THREE.MeshLambertMaterial)va?!R.wireframe&&R.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==
+4?(ka.r=ea.r=ja.r=ga.r=ra.r,ka.g=ea.g=ja.g=ga.g=ra.g,ka.b=ea.b=ja.b=ga.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],ka),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],ea),x(n,u.v4.positionWorld,u.vertexNormalsWorld[3],ja),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),ka.r=Math.max(0,Math.min(R.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(R.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(R.color.b*ka.b,1)),ea.r=Math.max(0,Math.min(R.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(R.color.g*ea.g,1)),
+ea.b=Math.max(0,Math.min(R.color.b*ea.b,1)),ja.r=Math.max(0,Math.min(R.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(R.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(R.color.b*ja.b,1)),ga.r=Math.max(0,Math.min(R.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(R.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(R.color.b*ga.b,1)),la=Ua(ka,ea,ja,ga),Ta(U,o,ca,X,Q,ia),Ra(U,o,ca,X,Q,ia,0,0,1,0,0,1,la),Ta(da,$,oa,L,ma,fa),Ra(da,$,oa,L,ma,fa,1,0,1,1,0,1,la)):(aa.r=ra.r,aa.g=ra.g,aa.b=ra.b,x(n,u.centroidWorld,u.normalWorld,aa),
+aa.r=Math.max(0,Math.min(R.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(R.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(R.color.b*aa.b,1)),Va(U,o,ca,X,oa,L,Q,ia),R.wireframe?D(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(aa)):(Va(U,o,ca,X,oa,L,Q,ia),R.wireframe?D(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(R.color));else if(R instanceof THREE.MeshNormalMaterial)aa.r=Sa(u.normalWorld.x),aa.g=Sa(u.normalWorld.y),aa.b=Sa(u.normalWorld.z),Va(U,o,ca,X,oa,L,Q,ia),
+R.wireframe?D(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):M(aa);else if(R instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,qa),ea.r=ea.g=ea.b=1-Ma(e.positionScreen.z,ta,qa),ja.r=ja.g=ja.b=1-Ma(h.positionScreen.z,ta,qa),ga.r=ga.g=ga.b=1-Ma(f.positionScreen.z,ta,qa),la=Ua(ka,ea,ja,ga),Ta(U,o,ca,X,Q,ia),Ra(U,o,ca,X,Q,ia,0,0,1,0,0,1,la),Ta(da,$,oa,L,ma,fa),Ra(da,$,oa,L,ma,fa,1,0,1,1,0,1,la)}function Ta(a,b,c,e,k,f){w.beginPath();w.moveTo(a,
+b);w.lineTo(c,e);w.lineTo(k,f);w.lineTo(a,b);w.closePath()}function Va(a,b,c,e,k,f,h,o){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(k,f);w.lineTo(h,o);w.lineTo(a,b);w.closePath()}function D(a,b,c,k){if(I!=b)w.lineWidth=I=b;if(C!=c)w.lineCap=C=c;if(P!=k)w.lineJoin=P=k;e(a.getContextStyle());w.stroke();V.inflate(b*2)}function M(a){h(a.getContextStyle());w.fill()}function Xa(a,b,c,e,k,f,o,l,n,R,u,t,p){if(p.image.width!=0){if(p.needsUpdate==!0||pa[p.id]==void 0){var v=p.wrapS==THREE.RepeatWrapping,
+x=p.wrapT==THREE.RepeatWrapping;pa[p.id]=w.createPattern(p.image,v&&x?"repeat":v&&!x?"repeat-x":!v&&x?"repeat-y":"no-repeat");p.needsUpdate=!1}h(pa[p.id]);var v=p.offset.x/p.repeat.x,x=p.offset.y/p.repeat.y,G=(p.image.width-1)*p.repeat.x,p=(p.image.height-1)*p.repeat.y,o=(o+v)*G,l=(l+x)*p,n=(n+v)*G,R=(R+x)*p,u=(u+v)*G,t=(t+x)*p;c-=a;e-=b;k-=a;f-=b;n-=o;R-=l;u-=o;t-=l;v=1/(n*t-u*R);p=(t*c-R*k)*v;R=(t*e-R*f)*v;c=(n*k-u*c)*v;e=(n*f-u*e)*v;a=a-p*o-c*l;b=b-R*o-e*l;w.save();w.transform(p,R,c,e,a,b);w.fill();
+w.restore()}}function Ra(a,b,c,e,k,f,h,o,l,n,R,u,t){var p,v;p=t.width-1;v=t.height-1;h*=p;o*=v;l*=p;n*=v;R*=p;u*=v;c-=a;e-=b;k-=a;f-=b;l-=h;n-=o;R-=h;u-=o;v=1/(l*u-R*n);p=(u*c-n*k)*v;n=(u*e-n*f)*v;c=(l*k-R*c)*v;e=(l*f-R*e)*v;a=a-p*h-c*o;b=b-n*h-e*o;w.save();w.transform(p,n,c,e,a,b);w.clip();w.drawImage(t,0,0);w.restore()}function Ua(a,b,c,e){var k=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),R=~~(e.r*255),u=~~(e.g*255),
+e=~~(e.b*255);Aa[0]=k<0?0:k>255?255:k;Aa[1]=f<0?0:f>255?255:f;Aa[2]=a<0?0:a>255?255:a;Aa[4]=h<0?0:h>255?255:h;Aa[5]=o<0?0:o>255?255:o;Aa[6]=b<0?0:b>255?255:b;Aa[8]=l<0?0:l>255?255:l;Aa[9]=n<0?0:n>255?255:n;Aa[10]=c<0?0:c>255?255:c;Aa[12]=R<0?0:R>255?255:R;Aa[13]=u<0?0:u>255?255:u;Aa[14]=e<0?0:e>255?255:e;ya.putImageData(Ga,0,0);Ia.drawImage(Fa,0,0);return Y}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Sa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function La(a,b){var c=b.x-a.x,e=b.y-a.y,
+k=c*c+e*e;k!=0&&(k=1/Math.sqrt(k),c*=k,e*=k,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Wa,Ya,za,Ha;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,y);k.info.render.vertices=0;k.info.render.faces=0;f=t.projectScene(a,p,this.sortElements);l=f.elements;n=f.lights;(va=n.length>0)&&v(n);Wa=0;for(Ya=l.length;Wa<Ya;Wa++)if(za=l[Wa],Ha=za.material,Ha=Ha instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){V.empty();if(za instanceof THREE.RenderableParticle)K=za,K.x*=u,K.y*=y,B(K,za,
+Ha,a);else if(za instanceof THREE.RenderableLine)K=za.v1,O=za.v2,K.positionScreen.x*=u,K.positionScreen.y*=y,O.positionScreen.x*=u,O.positionScreen.y*=y,V.addPoint(K.positionScreen.x,K.positionScreen.y),V.addPoint(O.positionScreen.x,O.positionScreen.y),T.intersects(V)&&A(K,O,za,Ha,a);else if(za instanceof THREE.RenderableFace3)K=za.v1,O=za.v2,N=za.v3,K.positionScreen.x*=u,K.positionScreen.y*=y,O.positionScreen.x*=u,O.positionScreen.y*=y,N.positionScreen.x*=u,N.positionScreen.y*=y,Ha.overdraw&&(La(K.positionScreen,
+O.positionScreen),La(O.positionScreen,N.positionScreen),La(N.positionScreen,K.positionScreen)),V.add3Points(K.positionScreen.x,K.positionScreen.y,O.positionScreen.x,O.positionScreen.y,N.positionScreen.x,N.positionScreen.y),T.intersects(V)&&z(K,O,N,0,1,2,za,Ha,a);else if(za instanceof THREE.RenderableFace4)K=za.v1,O=za.v2,N=za.v3,H=za.v4,K.positionScreen.x*=u,K.positionScreen.y*=y,O.positionScreen.x*=u,O.positionScreen.y*=y,N.positionScreen.x*=u,N.positionScreen.y*=y,H.positionScreen.x*=u,H.positionScreen.y*=
+y,W.positionScreen.copy(O.positionScreen),Z.positionScreen.copy(H.positionScreen),Ha.overdraw&&(La(K.positionScreen,O.positionScreen),La(O.positionScreen,H.positionScreen),La(H.positionScreen,K.positionScreen),La(N.positionScreen,W.positionScreen),La(N.positionScreen,Z.positionScreen)),V.addPoint(K.positionScreen.x,K.positionScreen.y),V.addPoint(O.positionScreen.x,O.positionScreen.y),V.addPoint(N.positionScreen.x,N.positionScreen.y),V.addPoint(H.positionScreen.x,H.positionScreen.y),T.intersects(V)&&
+E(K,O,N,H,W,Z,za,Ha,a);ha.addRectangle(V)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,e){var k,f,h,l,n,u;k=0;for(f=a.length;k<f;k++)h=a[k],l=h.color,h instanceof THREE.DirectionalLight?(n=h.matrixWorld.getPosition(),u=c.dot(n),u<=0||(u*=h.intensity,e.r+=l.r*u,e.g+=l.g*u,e.b+=l.b*u)):h instanceof THREE.PointLight&&(n=h.matrixWorld.getPosition(),u=c.dot(K.sub(n,b).normalize()),u<=0||(u*=h.distance==0?1:1-Math.min(b.distanceTo(n)/h.distance,1),u!=0&&(u*=h.intensity,e.r+=l.r*u,e.g+=l.g*u,e.b+=l.b*u)))}function c(a){O[a]==null&&(O[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),U==0&&O[a].setAttribute("shape-rendering","crispEdges"));return O[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,h,k,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,p,v,x,u,y,w,B,A=new THREE.Rectangle,E=new THREE.Rectangle,z=!1,D=new THREE.Color,M=new THREE.Color,I=new THREE.Color,C=new THREE.Color,P,K=new THREE.Vector3,O=[],N=[],H,W,Z,U=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":U=1;break;case "low":U=0}};this.setSize=function(a,b){t=a;p=b;v=t/2;x=p/2;n.setAttribute("viewBox",-v+" "+-x+" "+t+" "+p);n.setAttribute("width",t);n.setAttribute("height",p);A.set(-v,-x,v,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,t){var p,K,L,Q;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;h=l.projectScene(o,t,this.sortElements);k=h.elements;
+f=h.lights;Z=W=0;if(z=f.length>0){M.setRGB(0,0,0);I.setRGB(0,0,0);C.setRGB(0,0,0);p=0;for(K=f.length;p<K;p++)Q=f[p],L=Q.color,Q instanceof THREE.AmbientLight?(M.r+=L.r,M.g+=L.g,M.b+=L.b):Q instanceof THREE.DirectionalLight?(I.r+=L.r,I.g+=L.g,I.b+=L.b):Q instanceof THREE.PointLight&&(C.r+=L.r,C.g+=L.g,C.b+=L.b)}p=0;for(K=k.length;p<K;p++)if(L=k[p],Q=L.material,Q=Q instanceof THREE.MeshFaceMaterial?L.faceMaterial:Q,!(Q==null||Q.opacity==0))if(E.empty(),L instanceof THREE.RenderableParticle)u=L,u.x*=
+v,u.y*=-x,m=0,ml=L.materials.length;else if(L instanceof THREE.RenderableLine){if(u=L.v1,y=L.v2,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(E)){L=u;var O=y,da=Z++;N[da]==null&&(N[da]=document.createElementNS("http://www.w3.org/2000/svg","line"),U==0&&N[da].setAttribute("shape-rendering","crispEdges"));H=N[da];H.setAttribute("x1",L.positionScreen.x);
+H.setAttribute("y1",L.positionScreen.y);H.setAttribute("x2",O.positionScreen.x);H.setAttribute("y2",O.positionScreen.y);Q instanceof THREE.LineBasicMaterial&&(H.setAttribute("style","fill: none; stroke: "+Q.color.getContextStyle()+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin),n.appendChild(H))}}else if(L instanceof THREE.RenderableFace3){if(u=L.v1,y=L.v2,w=L.v3,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=
+v,y.positionScreen.y*=-x,w.positionScreen.x*=v,w.positionScreen.y*=-x,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(w.positionScreen.x,w.positionScreen.y),A.intersects(E)){var O=u,da=y,$=w;e.info.render.vertices+=3;e.info.render.faces++;H=c(W++);H.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+da.positionScreen.x+" "+da.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");Q instanceof THREE.MeshBasicMaterial?
+D.copy(Q.color):Q instanceof THREE.MeshLambertMaterial?z?(D.r=M.r,D.g=M.g,D.b=M.b,a(f,L.centroidWorld,L.normalWorld,D),D.r=Math.max(0,Math.min(Q.color.r*D.r,1)),D.g=Math.max(0,Math.min(Q.color.g*D.g,1)),D.b=Math.max(0,Math.min(Q.color.b*D.b,1))):D.copy(Q.color):Q instanceof THREE.MeshDepthMaterial?(P=1-Q.__2near/(Q.__farPlusNear-L.z*Q.__farMinusNear),D.setRGB(P,P,P)):Q instanceof THREE.MeshNormalMaterial&&D.setRGB(b(L.normalWorld.x),b(L.normalWorld.y),b(L.normalWorld.z));Q.wireframe?H.setAttribute("style",
+"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):H.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+Q.opacity);n.appendChild(H)}}else if(L instanceof THREE.RenderableFace4&&(u=L.v1,y=L.v2,w=L.v3,B=L.v4,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,w.positionScreen.x*=v,w.positionScreen.y*=
+-x,B.positionScreen.x*=v,B.positionScreen.y*=-x,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),A.intersects(E))){var O=u,da=y,$=w,ma=B;e.info.render.vertices+=4;e.info.render.faces++;H=c(W++);H.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+da.positionScreen.x+" "+da.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+
+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");Q instanceof THREE.MeshBasicMaterial?D.copy(Q.color):Q instanceof THREE.MeshLambertMaterial?z?(D.r=M.r,D.g=M.g,D.b=M.b,a(f,L.centroidWorld,L.normalWorld,D),D.r=Math.max(0,Math.min(Q.color.r*D.r,1)),D.g=Math.max(0,Math.min(Q.color.g*D.g,1)),D.b=Math.max(0,Math.min(Q.color.b*D.b,1))):D.copy(Q.color):Q instanceof THREE.MeshDepthMaterial?(P=1-Q.__2near/(Q.__farPlusNear-L.z*Q.__farMinusNear),D.setRGB(P,P,P)):Q instanceof THREE.MeshNormalMaterial&&
+D.setRGB(b(L.normalWorld.x),b(L.normalWorld.y),b(L.normalWorld.z));Q.wireframe?H.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):H.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+Q.opacity);n.appendChild(H)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -224,123 +224,122 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,k,h,f=a.vertices,l=f.length,n=a.colors,v=n.length,p=a.__vertexArray,u=a.__colorArray,t=a.__sortArray,x=a.__dirtyVertices,w=a.__dirtyColors,F=a.__webglCustomAttributesList,y;if(F){h=0;for(e=F.length;h<e;h++)F[h].offset=0}if(c.sortParticles){sa.multiplySelf(c.matrixWorld);for(e=
-0;e<l;e++)k=f[e].position,Ba.copy(k),sa.multiplyVector3(Ba),t[e]=[Ba.z,e];t.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)k=f[t[e][1]].position,h=e*3,p[h]=k.x,p[h+1]=k.y,p[h+2]=k.z;for(e=0;e<v;e++)h=e*3,color=n[t[e][1]],u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++){l=F[h];v=l.value.length;for(n=0;n<v;n++){index=t[n][1];f=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[f]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=
-l.value[index];l.size===2?(l.array[f]=y.x,l.array[f+1]=y.y):l.size===3?l.type==="c"?(l.array[f]=y.r,l.array[f+1]=y.g,l.array[f+2]=y.b):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z,l.array[f+3]=y.w)}l.offset+=l.size}}}}else{if(x)for(e=0;e<l;e++)k=f[e].position,h=e*3,p[h]=k.x,p[h+1]=k.y,p[h+2]=k.z;if(w)for(e=0;e<v;e++)color=n[e],h=e*3,u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate){v=
-l.value.length;for(n=0;n<v;n++){f=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[f]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=l.value[n];l.size===2?(l.array[f]=y.x,l.array[f+1]=y.y):l.size===3?l.type==="c"?(l.array[f]=y.r,l.array[f+1]=y.g,l.array[f+2]=y.b):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z,l.array[f+3]=y.w)}l.offset+=l.size}}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),
-o.bufferData(o.ARRAY_BUFFER,p,b);if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,b);if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,l.buffer),o.bufferData(o.ARRAY_BUFFER,l.array,b)}}function e(a,b,c,e,k){e.program||S.initMaterial(e,b,c,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var h=0,f=S.maxMorphTargets;h<
-f;h++)k.__webglMorphTargetInfluences[h]=0}var l=!1,h=e.program,f=h.uniforms,n=e.uniforms;h!==T&&(o.useProgram(h),T=h,l=!0);if(e.id!==W)W=e.id,l=!0;if(l){o.uniformMatrix4fv(f.projectionMatrix,!1,va);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var v,p,u=0,t=0,x=0,w,F,y,z=Ea,ka=z.directional.colors,
-ca=z.directional.positions,A=z.point.colors,B=z.point.positions,G=z.point.distances,D=0,J=0,c=v=y=0,l=b.length;c<l;c++)if(v=b[c],p=v.color,w=v.position,F=v.intensity,y=v.distance,v instanceof THREE.AmbientLight)S.gammaInput?(u+=p.r*p.r,t+=p.g*p.g,x+=p.b*p.b):(u+=p.r,t+=p.g,x+=p.b);else if(v instanceof THREE.DirectionalLight)y=D*3,S.gammaInput?(ka[y]=p.r*p.r*F*F,ka[y+1]=p.g*p.g*F*F,ka[y+2]=p.b*p.b*F*F):(ka[y]=p.r*F,ka[y+1]=p.g*F,ka[y+2]=p.b*F),ca[y]=w.x,ca[y+1]=w.y,ca[y+2]=w.z,D+=1;else if(v instanceof
-THREE.SpotLight)y=D*3,S.gammaInput?(ka[y]=p.r*p.r*F*F,ka[y+1]=p.g*p.g*F*F,ka[y+2]=p.b*p.b*F*F):(ka[y]=p.r*F,ka[y+1]=p.g*F,ka[y+2]=p.b*F),p=1/w.length(),ca[y]=w.x*p,ca[y+1]=w.y*p,ca[y+2]=w.z*p,D+=1;else if(v instanceof THREE.PointLight)v=J*3,S.gammaInput?(A[v]=p.r*p.r*F*F,A[v+1]=p.g*p.g*F*F,A[v+2]=p.b*p.b*F*F):(A[v]=p.r*F,A[v+1]=p.g*F,A[v+2]=p.b*F),B[v]=w.x,B[v+1]=w.y,B[v+2]=w.z,G[J]=y,J+=1;c=D*3;for(l=ka.length;c<l;c++)ka[c]=0;c=J*3;for(l=A.length;c<l;c++)A[c]=0;z.point.length=J;z.directional.length=
-D;z.ambient[0]=u;z.ambient[1]=t;z.ambient[2]=x;b=Ea;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
-e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
-if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=Ca.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
-THREE.MeshLambertMaterial)S.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<ta.length;b++)n.shadowMatrix.value[b]=ta[b],n.shadowMap.texture[b]=S.shadowMap[b];n.shadowDarkness.value=S.shadowMapDarkness;n.shadowBias.value=S.shadowMapBias}b=
-e.uniformsList;n=0;for(c=b.length;n<c;n++)if(t=h.uniforms[b[n][1]])if(u=b[n][0],x=u.type,l=u.value,x==="i")o.uniform1i(t,l);else if(x==="f")o.uniform1f(t,l);else if(x==="v2")o.uniform2f(t,l.x,l.y);else if(x==="v3")o.uniform3f(t,l.x,l.y,l.z);else if(x==="v4")o.uniform4f(t,l.x,l.y,l.z,l.w);else if(x==="c")o.uniform3f(t,l.r,l.g,l.b);else if(x==="fv1")o.uniform1fv(t,l);else if(x==="fv")o.uniform3fv(t,l);else if(x==="v3v"){if(!u._array)u._array=new Float32Array(3*l.length);x=0;for(w=l.length;x<w;x++)z=
-x*3,u._array[z]=l[x].x,u._array[z+1]=l[x].y,u._array[z+2]=l[x].z;o.uniform3fv(t,u._array)}else if(x==="m4"){if(!u._array)u._array=new Float32Array(16);l.flattenToArray(u._array);o.uniformMatrix4fv(t,!1,u._array)}else if(x==="m4v"){if(!u._array)u._array=new Float32Array(16*l.length);x=0;for(w=l.length;x<w;x++)l[x].flattenToArrayOffset(u._array,x*16);o.uniformMatrix4fv(t,!1,u._array)}else if(x==="t"){if(o.uniform1i(t,l),t=u.texture)if(t.image instanceof Array&&t.image.length===6){if(u=t,u.image.length===
-6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+l);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(l=0;l<6;l++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,u.image[l]);H(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(u=t,o.activeTexture(o.TEXTURE0+
-l),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):P(t,l)}else if(x==="tv"){if(!u._array){u._array=[];x=0;for(w=u.texture.length;x<w;x++)u._array[x]=l+x}o.uniform1iv(t,u._array);x=0;for(w=u.texture.length;x<w;x++)(t=u.texture[x])&&P(t,u._array[x])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&f.cameraPosition!==null&&o.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
-e instanceof THREE.ShaderMaterial||e.skinning)&&f.viewMatrix!==null&&o.uniformMatrix4fv(f.viewMatrix,!1,Da);e.skinning&&(o.uniformMatrix4fv(f.cameraInverseMatrix,!1,Da),o.uniformMatrix4fv(f.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(f.modelViewMatrix,!1,k._modelViewMatrixArray);f.normalMatrix&&o.uniformMatrix3fv(f.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&f.objectMatrix!==null&&o.uniformMatrix4fv(f.objectMatrix,
-!1,k._objectMatrixArray);return h}function h(a,b,c,k,f,h){if(k.opacity!==0){var l,n,c=e(a,b,c,k,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(k.wireframe?1:0);c!==C&&(C=c,b=!0);if(!k.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=k.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,
-3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var v=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<v.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v[l]]),o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[v[l]],l++}else{var v=[],p=-1,u=0;n=h.morphTargetInfluences;var t,
-x=n.length;l=0;for(h.morphTargetBase!==-1&&(v[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(t=0;t<x;t++)!v[t]&&n[t]>p&&(u=t,p=n[u]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=p;v[u]=1;p=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){l=0;for(n=
-f.__webglCustomAttributesList.length;l<n;l++)c=f.__webglCustomAttributesList[l],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
-f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
-0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?
-(o.lineWidth(k.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(h,
-0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),S.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function k(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,k,f,h,l,n,v,p,u,t,x=a.count*3;for(t=0;t<x;t+=9)c=a.normalArray,e=c[t],k=c[t+1],f=c[t+2],h=c[t+3],n=c[t+4],p=c[t+5],l=c[t+6],v=c[t+7],u=c[t+8],e=(e+h+l)/3,k=(k+n+v)/3,f=(f+p+u)/3,c[t]=e,c[t+1]=k,c[t+2]=f,c[t+3]=e,c[t+4]=k,c[t+5]=f,c[t+6]=e,c[t+7]=k,c[t+8]=f}o.bufferData(o.ARRAY_BUFFER,
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function f(a){if(V!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),V=a.doubleSided;if(X!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),X=a.flipSided}function l(a){fa!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),fa=a)}function n(a){Z!==a&&(o.depthMask(a),Z=a)}function u(a,
-b,c){ja!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ja=a);if(a&&(aa!==b||ia!==c))o.polygonOffset(b,c),aa=b,ia=c}function t(a){pa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);pa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);pa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);pa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);pa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);pa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+
-a.n34);for(var b,a=0;a<6;a++)b=pa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=pa[e].x*b.n14+pa[e].y*b.n24+pa[e].z*b.n34+pa[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,u,x,w,F,y=a.lights;wa||(wa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){W=
--1;S.shadowMap[v]||(S.shadowMap[v]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[v]||(ta[v]=new THREE.Matrix4);u=S.shadowMap[v];x=ta[v];wa.position.copy(n.position);wa.lookAt(n.target.position);wa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(wa));this.autoUpdateScene&&a.updateMatrixWorld();wa.matrixWorldInverse.getInverse(wa.matrixWorld);x.set(0.5,0,0,0.5,0,0.5,
-0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Da);wa.projectionMatrix.flattenToArray(va);sa.multiply(wa.projectionMatrix,wa.matrixWorldInverse);t(sa);M(u);o.clearColor(1,1,1,1);S.clear();o.clearColor(J.r,J.g,J.b,ua);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<x;u++)w=a.__webglObjects[u],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||p(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),
-G(F,wa,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);I(THREE.NormalBlending);for(u=0;u<x;u++)if(w=a.__webglObjects[u],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Aa:Fa,h(wa,y,null,w,buffer,F);for(u=0;u<n;u++)w=a.__webglObjectsImmediate[u],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),C=-1,G(F,wa,!1),f(F),program=e(wa,y,null,Fa,F),F.immediateRenderCallback?F.immediateRenderCallback(program,
-o,pa):F.render(function(a){k(a,program,Fa.shading)}));v++}}function y(a,b){var c,e,k;c=U.attributes;var f=U.uniforms,h=qa/na,l,n=[],v=na*0.5,u=qa*0.5,p=!0;o.useProgram(U.program);T=U.program;C=fa=la=-1;Ia||(o.enableVertexAttribArray(U.attributes.position),o.enableVertexAttribArray(U.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
-8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,U.elementBuffer);o.uniformMatrix4fv(f.projectionMatrix,!1,va);o.activeTexture(o.TEXTURE0);o.uniform1i(f.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(k=a.__webglSprites[c],k.visible&&k.opacity!==0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)k=a.__webglSprites[c],k.visible&&
-k.opacity!==0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(o.uniform1i(f.useScreenCoordinates,1),o.uniform3f(f.screenPosition,(k.position.x-v)/v,(u-k.position.y)/u,Math.max(0,Math.min(1,k.position.z)))):(o.uniform1i(f.useScreenCoordinates,0),o.uniform1i(f.affectedByDistance,k.affectedByDistance?1:0),o.uniformMatrix4fv(f.modelViewMatrix,!1,k._modelViewMatrixArray)),l=k.map.image.width/(k.scaleByViewport?qa:1),n[0]=l*h*k.scale.x,n[1]=l*k.scale.y,o.uniform2f(f.uvScale,k.uvScale.x,
-k.uvScale.y),o.uniform2f(f.uvOffset,k.uvOffset.x,k.uvOffset.y),o.uniform2f(f.alignment,k.alignment.x,k.alignment.y),o.uniform1f(f.opacity,k.opacity),o.uniform3f(f.color,k.color.r,k.color.g,k.color.b),o.uniform1f(f.rotation,k.rotation),o.uniform2fv(f.scale,n),k.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!k.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),I(k.blending),P(k.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Z)}function G(a,
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function B(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function O(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
-function I(a){if(a!==la){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}la=a}}function H(a,b,c){(c.width&c.width-
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ea(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ea(b.minFilter)))}function P(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=o.createTexture(),S.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);H(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function Q(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
-a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):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,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function M(a){var b=a instanceof THREE.WebGLRenderTargetCube;
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);H(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),
-null);var e=a,k=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,k,e.__webglTexture,0);Q(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),H(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),Q(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,k=e=0):(b=null,c=na,a=qa,e=ga,k=ha);b!==oa&&(o.bindFramebuffer(o.FRAMEBUFFER,
-b),o.viewport(e,k,c,a),oa=b)}function K(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function N(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
-o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ea(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(a){switch(a){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 S=this,o,$=[],T=null,oa=null,W=-1,C=null,da=0,V=null,X=null,la=null,fa=null,Z=null,ja=null,aa=null,ia=null,ga=0,ha=0,na=0,qa=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,va=new Float32Array(16),
-Da=new Float32Array(16),Ba=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ca=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.stencil!==void 0?a.stencil:!0,ca=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ka=a.antialias!==void 0?a.antialias:!1,J=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ua=a.clearAlpha!==void 0?a.clearAlpha:0,ra=a.maxLights!==
-void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var wa,ta=[],a=THREE.ShaderLib.depthRGBA,ma=THREE.UniformsUtils.clone(a.uniforms),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ma}),Aa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ma,morphTargets:!0});Fa._shadowPass=!0;Aa._shadowPass=!0;try{if(!(o=Ca.getContext("experimental-webgl",
-{antialias:ka,stencil:F,preserveDrawingBuffer:ca})))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(Ga){console.error(Ga)}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(J.r,J.g,J.b,ua);this.context=o;var za=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);F=0;U.vertices[F++]=-1;U.vertices[F++]=-1;U.vertices[F++]=0;U.vertices[F++]=1;U.vertices[F++]=1;U.vertices[F++]=-1;U.vertices[F++]=1;U.vertices[F++]=1;U.vertices[F++]=1;U.vertices[F++]=1;U.vertices[F++]=1;U.vertices[F++]=0;U.vertices[F++]=-1;U.vertices[F++]=1;U.vertices[F++]=0;F=U.vertices[F++]=
-0;U.faces[F++]=0;U.faces[F++]=1;U.faces[F++]=2;U.faces[F++]=0;U.faces[F++]=2;U.faces[F++]=3;U.vertexBuffer=o.createBuffer();U.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,U.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,U.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,U.faces,o.STATIC_DRAW);U.program=o.createProgram();o.attachShader(U.program,N("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(U.program,N("vertex",
-THREE.ShaderLib.sprite.vertexShader));o.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=o.getAttribLocation(U.program,"position");U.attributes.uv=o.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=o.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=o.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=o.getUniformLocation(U.program,"rotation");U.uniforms.scale=o.getUniformLocation(U.program,"scale");U.uniforms.alignment=o.getUniformLocation(U.program,
-"alignment");U.uniforms.color=o.getUniformLocation(U.program,"color");U.uniforms.map=o.getUniformLocation(U.program,"map");U.uniforms.opacity=o.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=o.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=o.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=o.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=o.getUniformLocation(U.program,"modelViewMatrix");
-U.uniforms.projectionMatrix=o.getUniformLocation(U.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){Ca.width=a;Ca.height=b;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;na=c;qa=e;o.viewport(ga,ha,na,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){J.setHex(a);ua=b;o.clearColor(J.r,J.g,J.b,ua)};this.setClearColor=
-function(a,b){J.copy(a);ua=b;o.clearColor(J.r,J.g,J.b,ua)};this.getClearColor=function(){return J};this.getClearAlpha=function(){return ua};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
-a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);
-o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
-a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,b,c,e){var k,f,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?
-l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var v,u,p;v=p=n=0;for(u=b.length;v<u;v++)h=b[v],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&n++;n+p<=ra?v=p:(v=Math.ceil(ra*p/(n+p)),n=ra-v);h={directional:v,point:n};n=p=0;for(v=
-b.length;n<v;n++)u=b[n],u instanceof THREE.SpotLight&&u.castShadow&&p++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var x;a:{v=a.fragmentShader;u=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,
-shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},F,e=[];l?e.push(l):(e.push(v),e.push(u));for(F in c)e.push(F),e.push(c[F]);l=e.join();F=0;for(e=$.length;F<e;F++)if($[F].code===l){x=$[F].program;break a}F=o.createProgram();e=[za?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":
-"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(F,N("fragment",h+v));o.attachShader(F,
-N("vertex",e+u));o.linkProgram(F);o.getProgramParameter(F,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(F,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");F.uniforms={};F.attributes={};var w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n)e.push(w);w=e;e=0;for(n=w.length;e<n;e++)v=w[e],F.uniforms[v]=o.getUniformLocation(F,
-v);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)e.push("morphTarget"+w);for(x in b)e.push(x);x=e;w=0;for(b=x.length;w<b;w++)c=x[w],F.attributes[c]=o.getAttribLocation(F,c);F.id=$.length;$.push({program:F,code:l});S.info.memory.programs=$.length;x=F}a.program=x;x=a.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);
-x.tangent>=0&&o.enableVertexAttribArray(x.tangent);a.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(a.attributes)for(f in a.attributes)x[f]!==void 0&&x[f]>=0&&o.enableVertexAttribArray(x[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)w="morphTarget"+f,x[w]>=0&&(o.enableVertexAttribArray(x[w]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(k in a.uniforms)a.uniformsList.push([a.uniforms[k],k])};this.clearTarget=function(a,b,c,e){M(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ka,ca,A,B,D,J,ga,ra=a.lights,Q=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Da);b.projectionMatrix.flattenToArray(va);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);t(sa);M(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(D=a.__webglObjects[F],J=D.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||p(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
-G(J,b,!0),v(D),D.render=!0,this.sortObjects)J.renderDepth?D.z=J.renderDepth:(Ba.copy(J.position),sa.multiplyVector3(Ba),D.z=Ba.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],J=D.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),G(J,b,!0),w(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);I(a.overrideMaterial.blending);for(F=0;F<A;F++)if(D=
-a.__webglObjects[F],D.render)J=D.object,ga=D.buffer,f(J),h(b,ra,Q,a.overrideMaterial,ga,J);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],J=D.object,J.visible&&(C=-1,f(J),ka=e(b,ra,Q,a.overrideMaterial,J),J.immediateRenderCallback?J.immediateRenderCallback(ka,o,pa):J.render(function(b){k(b,ka,a.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(J=D.object,ga=D.buffer,ca=D.opaque))f(J),l(ca.depthTest),n(ca.depthWrite),u(ca.polygonOffset,
-ca.polygonOffsetFactor,ca.polygonOffsetUnits),h(b,ra,Q,ca,ga,J);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],J=D.object,J.visible&&(C=-1,ca=D.opaque))f(J),l(ca.depthTest),n(ca.depthWrite),u(ca.polygonOffset,ca.polygonOffsetFactor,ca.polygonOffsetUnits),ka=e(b,ra,Q,ca,J),J.immediateRenderCallback?J.immediateRenderCallback(ka,o,pa):J.render(function(a){k(a,ka,ca.shading)});for(F=0;F<A;F++)if(D=a.__webglObjects[F],D.render&&(J=D.object,ga=D.buffer,ca=D.transparent))f(J),I(ca.blending),l(ca.depthTest),
-n(ca.depthWrite),u(ca.polygonOffset,ca.polygonOffsetFactor,ca.polygonOffsetUnits),h(b,ra,Q,ca,ga,J);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],J=D.object,J.visible&&(C=-1,ca=D.transparent))f(J),I(ca.blending),l(ca.depthTest),n(ca.depthWrite),u(ca.polygonOffset,ca.polygonOffsetFactor,ca.polygonOffsetUnits),ka=e(b,ra,Q,ca,J),J.immediateRenderCallback?J.immediateRenderCallback(ka,o,pa):J.render(function(a){k(a,ka,ca.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&
-c.minFilter!==THREE.LinearFilter&&K(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],k=a,f=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
-e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var l=h,n=void 0,v=void 0,u=void 0,p=void 0,t=u=void 0,F=void 0,x={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(v=l.faces.length;n<v;n++)u=l.faces[n],p=u.materialIndex,t=p!==void 0?p:-1,x[t]===void 0&&(x[t]={hash:t,counter:0}),F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w}),u=u instanceof THREE.Face3?3:4,l.geometryGroups[F].vertices+
-u>65535&&(x[t].counter+=1,F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w})),l.geometryGroups[F].faces.push(n),l.geometryGroups[F].vertices+=u;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=da++,l.geometryGroupsList.push(l.geometryGroups[n])}for(f in h.geometryGroups)if(l=h.geometryGroups[f],!l.__webglVertexBuffer){n=l;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){p=v=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<
-p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}S.info.memory.geometries++;for(var p=e,y=u=x=void 0,t=y=w=y=void 0,F=t=n=0,z=u=void 0,ka=void 0,u=v=w=x=void 0,w=p.geometry,z=w.faces,ka=l.faces,x=0,u=ka.length;x<u;x++)y=ka[x],y=z[y],y instanceof THREE.Face3?(n+=3,t+=1,F+=3):y instanceof THREE.Face4&&(n+=4,t+=2,F+=4);x=c(p,l);u=x.map||x.lightMap||x instanceof THREE.ShaderMaterial?!0:!1;ka=x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial?!1:x&&x.shading!==
-void 0&&x.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=x.vertexColors?x.vertexColors:!1;l.__vertexArray=new Float32Array(n*3);if(ka)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(z)l.__colorArray=new Float32Array(n*3);if(u){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)l.__skinVertexAArray=
-new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(t*3);l.__lineArray=new Uint16Array(F*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(y=l.numMorphTargets;w<y;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ka===THREE.SmoothShading;l.__uvType=u;l.__vertexColorType=z;l.__normalType=ka;l.__webglFaceCount=t*3;l.__webglLineCount=F*2;if(x.attributes){if(l.__webglCustomAttributesList===
-void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in x.attributes){u=x.attributes[p];w={};for(v in u)w[v]=u[v];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,t=1,w.type==="v2"?t=2:w.type==="v3"?t=3:w.type==="v4"?t=4:w.type==="c"&&(t=3),w.size=t,w.array=new Float32Array(n*t),w.buffer=o.createBuffer(),w.buffer.belongsToAttribute=p,u.needsUpdate=!0,w.__original=u;l.__webglCustomAttributesList.push(w)}}l.__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)l=h,l.__webglVertexBuffer=o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=
-o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=o.createBuffer();l.__webglColorBuffer=o.createBuffer();S.info.geometries++;l=h;v=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=
-new Float32Array(n*3);l.__sortArray=[];l.__webglParticleCount=n;v=v.material;if(v.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in v.attributes){originalAttribute=v.attributes[p];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
-"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)l=h.geometryGroups[f],O(k.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof
-THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,O(k.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?k.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&k.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];k=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof
-THREE.Line)D(k.__webglObjects,e);else if(e instanceof THREE.Sprite){k=k.__webglSprites;f=e;for(h=k.length-1;h>=0;h--)k[h]===f&&k.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&D(k.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(k=a.__webglObjects.length;e<k;e++)if(h=a.__webglObjects[e].object,f=h.geometry,l=t=p=void 0,h instanceof THREE.Mesh){n=0;for(v=f.geometryGroupsList.length;n<v;n++)if(p=f.geometryGroupsList[n],l=c(h,p),t=l.attributes&&
-A(l),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!f.dynamic,p.__inittedArrays){var ca=w=x=void 0,J=void 0,G=ca=void 0,ga=void 0,M=void 0,ra=void 0,Q=y=ka=z=u=void 0,K=void 0,I=void 0,ha=void 0,N=void 0,C=J=ra=J=M=ga=void 0,H=void 0,L=H=C=ga=void 0,E=void 0,L=H=C=ca=ca=G=H=C=J=L=H=C=E=L=H=C=E=L=H=C=void 0,ua=0,na=0,wa=0,ea=0,T=0,U=0,P=0,qa=0,Z=0,R=0,Y=0,ma=L=0,ma=void 0,fa=p.__vertexArray,ia=
-p.__uvArray,ja=p.__uv2Array,pa=p.__normalArray,aa=p.__tangentArray,W=p.__colorArray,ta=p.__skinVertexAArray,$=p.__skinVertexBArray,V=p.__skinIndexArray,X=p.__skinWeightArray,oa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Aa=p.__faceArray,la=p.__lineArray,Fa=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ka=p.__normalType,va=h.geometry,Da=va.__dirtyVertices,za=va.__dirtyElements,Ga=va.__dirtyUvs,Ba=va.__dirtyNormals,Ea=va.__dirtyTangents,Ia=va.__dirtyColors,Ca=va.__dirtyMorphTargets,
-Oa=va.vertices,Ya=p.faces,bb=va.faces,Za=va.faceVertexUvs[0],$a=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,Ka=va.skinWeights,Ja=va.morphTargets;if(sa){C=0;for(H=sa.length;C<H;C++)sa[C].offset=0,sa[C].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(ca=Ya[x],J=bb[ca],Za&&(y=Za[ca]),$a&&(Q=$a[ca]),ca=J.vertexNormals,G=J.normal,ga=J.vertexColors,M=J.color,ra=J.vertexTangents,J instanceof THREE.Face3){if(Da)K=Oa[J.a].position,I=Oa[J.b].position,ha=Oa[J.c].position,fa[na]=
-K.x,fa[na+1]=K.y,fa[na+2]=K.z,fa[na+3]=I.x,fa[na+4]=I.y,fa[na+5]=I.z,fa[na+6]=ha.x,fa[na+7]=ha.y,fa[na+8]=ha.z,na+=9;if(sa){C=0;for(H=sa.length;C<H;C++)if(E=sa[C],E.__original.needsUpdate)L=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[L]=E.value[J.a],E.array[L+1]=E.value[J.b],E.array[L+2]=E.value[J.c]):E.boundTo==="faces"?(ma=E.value[ma],E.array[L]=ma,E.array[L+1]=ma,E.array[L+2]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[L]=E.value[ma],E.array[L+
-1]=E.value[ma+1],E.array[L+2]=E.value[ma+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(K=E.value[J.a],I=E.value[J.b],ha=E.value[J.c]):E.boundTo==="faces"?(ha=I=K=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(K=E.value[ma],I=E.value[ma+1],ha=E.value[ma+2],E.offsetSrc+=3),E.size===2?(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=I.x,E.array[L+3]=I.y,E.array[L+4]=ha.x,E.array[L+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[L]=K.r,E.array[L+1]=K.g,E.array[L+
-2]=K.b,E.array[L+3]=I.r,E.array[L+4]=I.g,E.array[L+5]=I.b,E.array[L+6]=ha.r,E.array[L+7]=ha.g,E.array[L+8]=ha.b):(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=K.z,E.array[L+3]=I.x,E.array[L+4]=I.y,E.array[L+5]=I.z,E.array[L+6]=ha.x,E.array[L+7]=ha.y,E.array[L+8]=ha.z),E.offset+=9):(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=K.z,E.array[L+3]=K.w,E.array[L+4]=I.x,E.array[L+5]=I.y,E.array[L+6]=I.z,E.array[L+7]=I.w,E.array[L+8]=ha.x,E.array[L+9]=ha.y,E.array[L+10]=ha.z,E.array[L+11]=ha.w,E.offset+=
-12))}if(Ca){C=0;for(H=Ja.length;C<H;C++)K=Ja[C].vertices[J.a].position,I=Ja[C].vertices[J.b].position,ha=Ja[C].vertices[J.c].position,L=oa[C],L[Y]=K.x,L[Y+1]=K.y,L[Y+2]=K.z,L[Y+3]=I.x,L[Y+4]=I.y,L[Y+5]=I.z,L[Y+6]=ha.x,L[Y+7]=ha.y,L[Y+8]=ha.z;Y+=9}if(Ka.length)C=Ka[J.a],H=Ka[J.b],L=Ka[J.c],X[R]=C.x,X[R+1]=C.y,X[R+2]=C.z,X[R+3]=C.w,X[R+4]=H.x,X[R+5]=H.y,X[R+6]=H.z,X[R+7]=H.w,X[R+8]=L.x,X[R+9]=L.y,X[R+10]=L.z,X[R+11]=L.w,C=Ra[J.a],H=Ra[J.b],L=Ra[J.c],V[R]=C.x,V[R+1]=C.y,V[R+2]=C.z,V[R+3]=C.w,V[R+4]=
-H.x,V[R+5]=H.y,V[R+6]=H.z,V[R+7]=H.w,V[R+8]=L.x,V[R+9]=L.y,V[R+10]=L.z,V[R+11]=L.w,C=Pa[J.a],H=Pa[J.b],L=Pa[J.c],ta[R]=C.x,ta[R+1]=C.y,ta[R+2]=C.z,ta[R+3]=1,ta[R+4]=H.x,ta[R+5]=H.y,ta[R+6]=H.z,ta[R+7]=1,ta[R+8]=L.x,ta[R+9]=L.y,ta[R+10]=L.z,ta[R+11]=1,C=Qa[J.a],H=Qa[J.b],L=Qa[J.c],$[R]=C.x,$[R+1]=C.y,$[R+2]=C.z,$[R+3]=1,$[R+4]=H.x,$[R+5]=H.y,$[R+6]=H.z,$[R+7]=1,$[R+8]=L.x,$[R+9]=L.y,$[R+10]=L.z,$[R+11]=1,R+=12;if(Ia&&z)ga.length===3&&z===THREE.VertexColors?(J=ga[0],C=ga[1],H=ga[2]):H=C=J=M,W[Z]=J.r,
-W[Z+1]=J.g,W[Z+2]=J.b,W[Z+3]=C.r,W[Z+4]=C.g,W[Z+5]=C.b,W[Z+6]=H.r,W[Z+7]=H.g,W[Z+8]=H.b,Z+=9;if(Ea&&va.hasTangents)ga=ra[0],M=ra[1],J=ra[2],aa[P]=ga.x,aa[P+1]=ga.y,aa[P+2]=ga.z,aa[P+3]=ga.w,aa[P+4]=M.x,aa[P+5]=M.y,aa[P+6]=M.z,aa[P+7]=M.w,aa[P+8]=J.x,aa[P+9]=J.y,aa[P+10]=J.z,aa[P+11]=J.w,P+=12;if(Ba&&ka)if(ca.length===3&&Fa)for(C=0;C<3;C++)G=ca[C],pa[U]=G.x,pa[U+1]=G.y,pa[U+2]=G.z,U+=3;else for(C=0;C<3;C++)pa[U]=G.x,pa[U+1]=G.y,pa[U+2]=G.z,U+=3;if(Ga&&y!==void 0&&u)for(C=0;C<3;C++)ca=y[C],ia[wa]=ca.u,
-ia[wa+1]=ca.v,wa+=2;if(Ga&&Q!==void 0&&u)for(C=0;C<3;C++)ca=Q[C],ja[ea]=ca.u,ja[ea+1]=ca.v,ea+=2;za&&(Aa[T]=ua,Aa[T+1]=ua+1,Aa[T+2]=ua+2,T+=3,la[qa]=ua,la[qa+1]=ua+1,la[qa+2]=ua,la[qa+3]=ua+2,la[qa+4]=ua+1,la[qa+5]=ua+2,qa+=6,ua+=3)}else if(J instanceof THREE.Face4){if(Da)K=Oa[J.a].position,I=Oa[J.b].position,ha=Oa[J.c].position,N=Oa[J.d].position,fa[na]=K.x,fa[na+1]=K.y,fa[na+2]=K.z,fa[na+3]=I.x,fa[na+4]=I.y,fa[na+5]=I.z,fa[na+6]=ha.x,fa[na+7]=ha.y,fa[na+8]=ha.z,fa[na+9]=N.x,fa[na+10]=N.y,fa[na+
-11]=N.z,na+=12;if(sa){C=0;for(H=sa.length;C<H;C++)if(E=sa[C],E.__original.needsUpdate)L=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[L]=E.value[J.a],E.array[L+1]=E.value[J.b],E.array[L+2]=E.value[J.c],E.array[L+3]=E.value[J.d]):E.boundTo==="faces"?(ma=E.value[ma],E.array[L]=ma,E.array[L+1]=ma,E.array[L+2]=ma,E.array[L+3]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[L]=E.value[ma],E.array[L+1]=E.value[ma+1],E.array[L+2]=E.value[ma+2],E.array[L+3]=
-E.value[ma+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(K=E.value[J.a],I=E.value[J.b],ha=E.value[J.c],N=E.value[J.d]):E.boundTo==="faces"?(N=ha=I=K=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(K=E.value[ma],I=E.value[ma+1],ha=E.value[ma+2],N=E.value[ma+3],E.offsetSrc+=4),E.size===2?(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=I.x,E.array[L+3]=I.y,E.array[L+4]=ha.x,E.array[L+5]=ha.y,E.array[L+6]=N.x,E.array[L+7]=N.y,E.offset+=8):E.size===3?(E.type==="c"?
-(E.array[L]=K.r,E.array[L+1]=K.g,E.array[L+2]=K.b,E.array[L+3]=I.r,E.array[L+4]=I.g,E.array[L+5]=I.b,E.array[L+6]=ha.r,E.array[L+7]=ha.g,E.array[L+8]=ha.b,E.array[L+9]=N.r,E.array[L+10]=N.g,E.array[L+11]=N.b):(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=K.z,E.array[L+3]=I.x,E.array[L+4]=I.y,E.array[L+5]=I.z,E.array[L+6]=ha.x,E.array[L+7]=ha.y,E.array[L+8]=ha.z,E.array[L+9]=N.x,E.array[L+10]=N.y,E.array[L+11]=N.z),E.offset+=12):(E.array[L]=K.x,E.array[L+1]=K.y,E.array[L+2]=K.z,E.array[L+3]=K.w,E.array[L+
-4]=I.x,E.array[L+5]=I.y,E.array[L+6]=I.z,E.array[L+7]=I.w,E.array[L+8]=ha.x,E.array[L+9]=ha.y,E.array[L+10]=ha.z,E.array[L+11]=ha.w,E.array[L+12]=N.x,E.array[L+13]=N.y,E.array[L+14]=N.z,E.array[L+15]=N.w,E.offset+=16))}if(Ca){C=0;for(H=Ja.length;C<H;C++)K=Ja[C].vertices[J.a].position,I=Ja[C].vertices[J.b].position,ha=Ja[C].vertices[J.c].position,N=Ja[C].vertices[J.d].position,L=oa[C],L[Y]=K.x,L[Y+1]=K.y,L[Y+2]=K.z,L[Y+3]=I.x,L[Y+4]=I.y,L[Y+5]=I.z,L[Y+6]=ha.x,L[Y+7]=ha.y,L[Y+8]=ha.z,L[Y+9]=N.x,L[Y+
-10]=N.y,L[Y+11]=N.z;Y+=12}if(Ka.length)C=Ka[J.a],H=Ka[J.b],L=Ka[J.c],E=Ka[J.d],X[R]=C.x,X[R+1]=C.y,X[R+2]=C.z,X[R+3]=C.w,X[R+4]=H.x,X[R+5]=H.y,X[R+6]=H.z,X[R+7]=H.w,X[R+8]=L.x,X[R+9]=L.y,X[R+10]=L.z,X[R+11]=L.w,X[R+12]=E.x,X[R+13]=E.y,X[R+14]=E.z,X[R+15]=E.w,C=Ra[J.a],H=Ra[J.b],L=Ra[J.c],E=Ra[J.d],V[R]=C.x,V[R+1]=C.y,V[R+2]=C.z,V[R+3]=C.w,V[R+4]=H.x,V[R+5]=H.y,V[R+6]=H.z,V[R+7]=H.w,V[R+8]=L.x,V[R+9]=L.y,V[R+10]=L.z,V[R+11]=L.w,V[R+12]=E.x,V[R+13]=E.y,V[R+14]=E.z,V[R+15]=E.w,C=Pa[J.a],H=Pa[J.b],L=
-Pa[J.c],E=Pa[J.d],ta[R]=C.x,ta[R+1]=C.y,ta[R+2]=C.z,ta[R+3]=1,ta[R+4]=H.x,ta[R+5]=H.y,ta[R+6]=H.z,ta[R+7]=1,ta[R+8]=L.x,ta[R+9]=L.y,ta[R+10]=L.z,ta[R+11]=1,ta[R+12]=E.x,ta[R+13]=E.y,ta[R+14]=E.z,ta[R+15]=1,C=Qa[J.a],H=Qa[J.b],L=Qa[J.c],J=Qa[J.d],$[R]=C.x,$[R+1]=C.y,$[R+2]=C.z,$[R+3]=1,$[R+4]=H.x,$[R+5]=H.y,$[R+6]=H.z,$[R+7]=1,$[R+8]=L.x,$[R+9]=L.y,$[R+10]=L.z,$[R+11]=1,$[R+12]=J.x,$[R+13]=J.y,$[R+14]=J.z,$[R+15]=1,R+=16;if(Ia&&z)ga.length===4&&z===THREE.VertexColors?(J=ga[0],C=ga[1],H=ga[2],ga=ga[3]):
-ga=H=C=J=M,W[Z]=J.r,W[Z+1]=J.g,W[Z+2]=J.b,W[Z+3]=C.r,W[Z+4]=C.g,W[Z+5]=C.b,W[Z+6]=H.r,W[Z+7]=H.g,W[Z+8]=H.b,W[Z+9]=ga.r,W[Z+10]=ga.g,W[Z+11]=ga.b,Z+=12;if(Ea&&va.hasTangents)ga=ra[0],M=ra[1],J=ra[2],ra=ra[3],aa[P]=ga.x,aa[P+1]=ga.y,aa[P+2]=ga.z,aa[P+3]=ga.w,aa[P+4]=M.x,aa[P+5]=M.y,aa[P+6]=M.z,aa[P+7]=M.w,aa[P+8]=J.x,aa[P+9]=J.y,aa[P+10]=J.z,aa[P+11]=J.w,aa[P+12]=ra.x,aa[P+13]=ra.y,aa[P+14]=ra.z,aa[P+15]=ra.w,P+=16;if(Ba&&ka)if(ca.length===4&&Fa)for(C=0;C<4;C++)G=ca[C],pa[U]=G.x,pa[U+1]=G.y,pa[U+2]=
-G.z,U+=3;else for(C=0;C<4;C++)pa[U]=G.x,pa[U+1]=G.y,pa[U+2]=G.z,U+=3;if(Ga&&y!==void 0&&u)for(C=0;C<4;C++)ca=y[C],ia[wa]=ca.u,ia[wa+1]=ca.v,wa+=2;if(Ga&&Q!==void 0&&u)for(C=0;C<4;C++)ca=Q[C],ja[ea]=ca.u,ja[ea+1]=ca.v,ea+=2;za&&(Aa[T]=ua,Aa[T+1]=ua+1,Aa[T+2]=ua+3,Aa[T+3]=ua+1,Aa[T+4]=ua+2,Aa[T+5]=ua+3,T+=6,la[qa]=ua,la[qa+1]=ua+1,la[qa+2]=ua,la[qa+3]=ua+3,la[qa+4]=ua+1,la[qa+5]=ua+2,la[qa+6]=ua+2,la[qa+7]=ua+3,qa+=8,ua+=4)}Da&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,
-fa,t));if(sa){C=0;for(H=sa.length;C<H;C++)E=sa[C],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,t))}if(Ca){C=0;for(H=Ja.length;C<H;C++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[C]),o.bufferData(o.ARRAY_BUFFER,oa[C],t)}Ia&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,W,t));Ba&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,pa,t));Ea&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,aa,t));Ga&&wa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ia,t));Ga&&ea>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,t));za&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,la,t));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),
-o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,$,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,V,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,X,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,
-delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;l.attributes&&B(l)}else if(h instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=h.vertices;v=h.colors;u=w.length;p=v.length;z=h.__vertexArray;t=h.__colorArray;ka=h.__dirtyColors;if(h.__dirtyVertices){for(F=
-0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ka){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(h instanceof THREE.Line){if(f.__dirtyVertices||f.__dirtyColors){h=f;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=h.vertices;v=h.colors;u=w.length;p=v.length;
-z=h.__vertexArray;t=h.__colorArray;ka=h.__dirtyColors;if(h.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ka){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)l=c(h,p),t=l.attributes&&
-A(l),(f.__dirtyVertices||f.__dirtyColors||h.sortParticles||t)&&b(f,o.DYNAMIC_DRAW,h),f.__dirtyVertices=!1,f.__dirtyColors=!1,l.attributes&&B(l)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="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 za}};
+THREE.WebGLRenderer=function(a){function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,k,h,f=a.vertices,l=f.length,n=a.colors,u=n.length,t=a.__vertexArray,p=a.__colorArray,v=a.__sortArray,w=a.__dirtyVertices,x=a.__dirtyColors,G=a.__webglCustomAttributesList,y;if(G){h=0;for(e=G.length;h<e;h++)G[h].offset=0}if(c.sortParticles){ua.multiplySelf(c.matrixWorld);for(e=
+0;e<l;e++)k=f[e].position,Ba.copy(k),ua.multiplyVector3(Ba),v[e]=[Ba.z,e];v.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)k=f[v[e][1]].position,h=e*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;for(e=0;e<u;e++)h=e*3,color=n[v[e][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(G){h=0;for(e=G.length;h<e;h++){l=G[h];u=l.value.length;for(n=0;n<u;n++){index=v[n][1];f=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[f]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=
+l.value[index];l.size===2?(l.array[f]=y.x,l.array[f+1]=y.y):l.size===3?l.type==="c"?(l.array[f]=y.r,l.array[f+1]=y.g,l.array[f+2]=y.b):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z,l.array[f+3]=y.w)}l.offset+=l.size}}}}else{if(w)for(e=0;e<l;e++)k=f[e].position,h=e*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(x)for(e=0;e<u;e++)color=n[e],h=e*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(G){h=0;for(e=G.length;h<e;h++)if(l=G[h],l.__original.needsUpdate){u=
+l.value.length;for(n=0;n<u;n++){f=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[f]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=l.value[n];l.size===2?(l.array[f]=y.x,l.array[f+1]=y.y):l.size===3?l.type==="c"?(l.array[f]=y.r,l.array[f+1]=y.g,l.array[f+2]=y.b):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z):(l.array[f]=y.x,l.array[f+1]=y.y,l.array[f+2]=y.z,l.array[f+3]=y.w)}l.offset+=l.size}}}}if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),
+o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,p,b);if(G){h=0;for(e=G.length;h<e;h++)if(l=G[h],l.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,l.buffer),o.bufferData(o.ARRAY_BUFFER,l.array,b)}}function e(a,b,c,e,k){e.program||U.initMaterial(e,b,c,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(U.maxMorphTargets);for(var h=0,f=U.maxMorphTargets;h<
+f;h++)k.__webglMorphTargetInfluences[h]=0}var l=!1,h=e.program,f=h.uniforms,n=e.uniforms;h!==X&&(o.useProgram(h),X=h,l=!0);if(e.id!==L)L=e.id,l=!0;if(l){o.uniformMatrix4fv(f.projectionMatrix,!1,wa);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var u,t,p=0,v=0,w=0,x,G,y,ha=Ea,B=ha.directional.colors,
+A=ha.directional.positions,z=ha.point.colors,T=ha.point.positions,E=ha.point.distances,D=0,V=0,c=u=y=0,l=b.length;c<l;c++)if(u=b[c],t=u.color,x=u.position,G=u.intensity,y=u.distance,u instanceof THREE.AmbientLight)U.gammaInput?(p+=t.r*t.r,v+=t.g*t.g,w+=t.b*t.b):(p+=t.r,v+=t.g,w+=t.b);else if(u instanceof THREE.DirectionalLight)y=D*3,U.gammaInput?(B[y]=t.r*t.r*G*G,B[y+1]=t.g*t.g*G*G,B[y+2]=t.b*t.b*G*G):(B[y]=t.r*G,B[y+1]=t.g*G,B[y+2]=t.b*G),A[y]=x.x,A[y+1]=x.y,A[y+2]=x.z,D+=1;else if(u instanceof THREE.SpotLight)y=
+D*3,U.gammaInput?(B[y]=t.r*t.r*G*G,B[y+1]=t.g*t.g*G*G,B[y+2]=t.b*t.b*G*G):(B[y]=t.r*G,B[y+1]=t.g*G,B[y+2]=t.b*G),t=1/x.length(),A[y]=x.x*t,A[y+1]=x.y*t,A[y+2]=x.z*t,D+=1;else if(u instanceof THREE.PointLight)u=V*3,U.gammaInput?(z[u]=t.r*t.r*G*G,z[u+1]=t.g*t.g*G*G,z[u+2]=t.b*t.b*G*G):(z[u]=t.r*G,z[u+1]=t.g*G,z[u+2]=t.b*G),T[u]=x.x,T[u+1]=x.y,T[u+2]=x.z,E[V]=y,V+=1;c=D*3;for(l=B.length;c<l;c++)B[c]=0;c=V*3;for(l=z.length;c<l;c++)z[c]=0;ha.point.length=V;ha.directional.length=D;ha.ambient[0]=p;ha.ambient[1]=
+v;ha.ambient[2]=w;b=Ea;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,U.gammaInput?
+n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
+THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=Ca.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)U.gammaInput?
+n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<sa.length;b++)n.shadowMatrix.value[b]=sa[b],n.shadowMap.texture[b]=U.shadowMap[b];n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=e.uniformsList;n=0;for(c=
+b.length;n<c;n++)if(v=h.uniforms[b[n][1]])if(p=b[n][0],w=p.type,l=p.value,w==="i")o.uniform1i(v,l);else if(w==="f")o.uniform1f(v,l);else if(w==="v2")o.uniform2f(v,l.x,l.y);else if(w==="v3")o.uniform3f(v,l.x,l.y,l.z);else if(w==="v4")o.uniform4f(v,l.x,l.y,l.z,l.w);else if(w==="c")o.uniform3f(v,l.r,l.g,l.b);else if(w==="fv1")o.uniform1fv(v,l);else if(w==="fv")o.uniform3fv(v,l);else if(w==="v3v"){if(!p._array)p._array=new Float32Array(3*l.length);w=0;for(x=l.length;w<x;w++)ha=w*3,p._array[ha]=l[w].x,
+p._array[ha+1]=l[w].y,p._array[ha+2]=l[w].z;o.uniform3fv(v,p._array)}else if(w==="m4"){if(!p._array)p._array=new Float32Array(16);l.flattenToArray(p._array);o.uniformMatrix4fv(v,!1,p._array)}else if(w==="m4v"){if(!p._array)p._array=new Float32Array(16*l.length);w=0;for(x=l.length;w<x;w++)l[w].flattenToArrayOffset(p._array,w*16);o.uniformMatrix4fv(v,!1,p._array)}else if(w==="t"){if(o.uniform1i(v,l),v=p.texture)if(v.image instanceof Array&&v.image.length===6){if(p=v,p.image.length===6)if(p.needsUpdate){if(!p.image.__webglTextureCube)p.image.__webglTextureCube=
+o.createTexture();o.activeTexture(o.TEXTURE0+l);o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(l=0;l<6;l++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,p.image[l]);C(o.TEXTURE_CUBE_MAP,p,p.image[0]);p.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(p=v,o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,p.__webglTexture)):P(v,l)}else if(w===
+"tv"){if(!p._array){p._array=[];w=0;for(x=p.texture.length;w<x;w++)p._array[w]=l+w}o.uniform1iv(v,p._array);w=0;for(x=p.texture.length;w<x;w++)(v=p.texture[w])&&P(v,p._array[w])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&f.cameraPosition!==null&&o.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&f.viewMatrix!==null&&
+o.uniformMatrix4fv(f.viewMatrix,!1,Da);e.skinning&&(o.uniformMatrix4fv(f.cameraInverseMatrix,!1,Da),o.uniformMatrix4fv(f.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(f.modelViewMatrix,!1,k._modelViewMatrixArray);f.normalMatrix&&o.uniformMatrix3fv(f.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&f.objectMatrix!==null&&o.uniformMatrix4fv(f.objectMatrix,!1,k._objectMatrixArray);return h}function h(a,b,c,k,f,h){if(k.opacity!==
+0){var l,n,c=e(a,b,c,k,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(k.wireframe?1:0);c!==Q&&(Q=c,b=!0);if(!k.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=k.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),
+o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var u=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<u.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[u[l]]),o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[u[l]],l++}else{var u=[],t=-1,p=0;n=h.morphTargetInfluences;var v,w=n.length;l=0;for(h.morphTargetBase!==-1&&(u[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(v=
+0;v<w;v++)!u[v]&&n[v]>t&&(p=v,t=n[p]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p]);o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;u[p]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){l=0;for(n=f.__webglCustomAttributesList.length;l<n;l++)c=f.__webglCustomAttributesList[l],a[c.buffer.belongsToAttribute]>=
+0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
+f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,
+o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,
+o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(h,0,f.__webglLineCount),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):
+h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.info.render.calls++)}}function k(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,k,f,h,l,n,u,t,p,v,w=a.count*3;for(v=0;v<w;v+=9)c=a.normalArray,e=c[v],k=c[v+1],f=c[v+2],h=c[v+3],n=c[v+4],t=c[v+5],l=c[v+6],u=c[v+7],p=c[v+8],e=(e+h+l)/3,k=(k+n+u)/3,f=(f+t+p)/3,c[v]=e,c[v+1]=k,c[v+2]=f,c[v+3]=e,c[v+4]=k,c[v+5]=f,c[v+6]=e,c[v+7]=k,c[v+8]=f}o.bufferData(o.ARRAY_BUFFER,a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
+0,a.count);a.count=0}function f(a){if(da!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),da=a.doubleSided;if($!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),$=a.flipSided}function l(a){fa!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),fa=a)}function n(a){aa!==a&&(o.depthMask(a),aa=a)}function t(a,b,c){ka!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ka=a);if(a&&(ea!==b||ja!==c))o.polygonOffset(b,c),ea=b,ja=c}function p(a){la[0].set(a.n41-
+a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);la[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);la[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);la[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);la[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);la[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=la[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function v(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
+Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=la[e].x*b.n14+la[e].y*b.n24+la[e].z*b.n34+la[e].w,a<=c)return!1;return!0}function x(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function u(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a,b){return b.z-a.z}function w(a){var b,c,n,u=0,t,w,x,G,y=a.lights;xa||(xa=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){L=-1;U.shadowMap[u]||(U.shadowMap[u]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+sa[u]||(sa[u]=new THREE.Matrix4);t=U.shadowMap[u];w=sa[u];xa.position.copy(n.position);xa.lookAt(n.target.position);xa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(xa));this.autoUpdateScene&&a.updateMatrixWorld();xa.matrixWorldInverse.getInverse(xa.matrixWorld);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(xa.projectionMatrix);w.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Da);xa.projectionMatrix.flattenToArray(wa);ua.multiply(xa.projectionMatrix,
+xa.matrixWorldInverse);p(ua);O(t);o.clearColor(1,1,1,1);U.clear();o.clearColor(V.r,V.g,V.b,va);w=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(t=0;t<w;t++)x=a.__webglObjects[t],G=x.object,G.visible&&G.castShadow?!(G instanceof THREE.Mesh)||!G.frustumCulled||v(G)?(G.matrixWorld.flattenToArray(G._objectMatrixArray),A(G,xa,!1),x.render=!0):x.render=!1:x.render=!1;l(!0);I(THREE.NormalBlending);for(t=0;t<w;t++)if(x=a.__webglObjects[t],x.render)G=x.object,buffer=x.buffer,f(G),x=G.customDepthMaterial?
+G.customDepthMaterial:G.geometry.morphTargets.length?ya:Fa,h(xa,y,null,x,buffer,G);for(t=0;t<n;t++)x=a.__webglObjectsImmediate[t],G=x.object,G.visible&&G.castShadow&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),Q=-1,A(G,xa,!1),f(G),program=e(xa,y,null,Fa,G),G.immediateRenderCallback?G.immediateRenderCallback(program,o,la):G.render(function(a){k(a,program,Fa.shading)}));u++}}function B(a,b){var c,e,k;c=Y.attributes;var f=Y.uniforms,h=qa/ta,l,n=[],u=ta*0.5,t=qa*0.5,p=!0;o.useProgram(Y.program);
+X=Y.program;Q=fa=ma=-1;Ia||(o.enableVertexAttribArray(Y.attributes.position),o.enableVertexAttribArray(Y.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.uniformMatrix4fv(f.projectionMatrix,!1,wa);o.activeTexture(o.TEXTURE0);o.uniform1i(f.map,0);c=0;for(e=a.__webglSprites.length;c<
+e;c++)if(k=a.__webglSprites[c],k.visible&&k.opacity!==0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);a.__webglSprites.sort(y);c=0;for(e=a.__webglSprites.length;c<e;c++)k=a.__webglSprites[c],k.visible&&k.opacity!==0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(o.uniform1i(f.useScreenCoordinates,1),o.uniform3f(f.screenPosition,(k.position.x-u)/u,(t-k.position.y)/
+t,Math.max(0,Math.min(1,k.position.z)))):(o.uniform1i(f.useScreenCoordinates,0),o.uniform1i(f.affectedByDistance,k.affectedByDistance?1:0),o.uniformMatrix4fv(f.modelViewMatrix,!1,k._modelViewMatrixArray)),l=k.map.image.width/(k.scaleByViewport?qa:1),n[0]=l*h*k.scale.x,n[1]=l*k.scale.y,o.uniform2f(f.uvScale,k.uvScale.x,k.uvScale.y),o.uniform2f(f.uvOffset,k.uvOffset.x,k.uvOffset.y),o.uniform2f(f.alignment,k.alignment.x,k.alignment.y),o.uniform1f(f.opacity,k.opacity),o.uniform3f(f.color,k.color.r,k.color.g,
+k.color.b),o.uniform1f(f.rotation,k.rotation),o.uniform2fv(f.scale,n),k.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!k.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),I(k.blending),P(k.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(aa)}function A(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
+function E(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function z(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function M(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function I(a){if(a!==ma){switch(a){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)}ma=a}}function C(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Z(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Z(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,
+o.TEXTURE_MIN_FILTER,Z(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,W(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,W(b.minFilter)))}function P(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
+o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.image.width,a.image.height,0,Z(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);C(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function K(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
+o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):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,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function O(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();
+if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);C(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null);var e=a,k=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
+k,e.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),C(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),
+K(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,k=e=0):(b=null,c=ta,a=qa,e=ga,k=pa);b!==oa&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,k,c,a),oa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
+o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function H(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function W(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
+default:return o.LINEAR}}function Z(a){switch(a){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 U=this,o,ca=[],X=null,oa=null,L=-1,Q=null,ia=0,da=null,$=null,ma=null,fa=null,aa=null,ka=null,ea=null,ja=null,ga=0,pa=0,ta=0,qa=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,wa=new Float32Array(16),Da=new Float32Array(16),Ba=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ca=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+G=a.stencil!==void 0?a.stencil:!0,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ha=a.antialias!==void 0?a.antialias:!1,V=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),va=a.clearAlpha!==void 0?a.clearAlpha:0,ra=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var xa,sa=[],a=THREE.ShaderLib.depthRGBA,na=THREE.UniformsUtils.clone(a.uniforms),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:na}),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:na,morphTargets:!0});Fa._shadowPass=!0;ya._shadowPass=!0;try{if(!(o=Ca.getContext("experimental-webgl",{antialias:ha,stencil:G,preserveDrawingBuffer:T})))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(Ga){console.error(Ga)}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(V.r,V.g,V.b,va);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);G=0;Y.vertices[G++]=-1;Y.vertices[G++]=-1;Y.vertices[G++]=0;Y.vertices[G++]=1;Y.vertices[G++]=1;
+Y.vertices[G++]=-1;Y.vertices[G++]=1;Y.vertices[G++]=1;Y.vertices[G++]=1;Y.vertices[G++]=1;Y.vertices[G++]=1;Y.vertices[G++]=0;Y.vertices[G++]=-1;Y.vertices[G++]=1;Y.vertices[G++]=0;G=Y.vertices[G++]=0;Y.faces[G++]=0;Y.faces[G++]=1;Y.faces[G++]=2;Y.faces[G++]=0;Y.faces[G++]=2;Y.faces[G++]=3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,H("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program,
+"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=o.getUniformLocation(Y.program,"alignment");Y.uniforms.color=o.getUniformLocation(Y.program,"color");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program,
+"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){Ca.width=a;Ca.height=b;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(a,b,c,e){ga=a;pa=b;ta=c;qa=e;o.viewport(ga,pa,ta,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){V.setHex(a);va=b;o.clearColor(V.r,V.g,V.b,va)};this.setClearColor=function(a,b){V.copy(a);va=b;o.clearColor(V.r,V.g,V.b,va)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return va};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};
+this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);
+o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var k,f,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
+a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var u,t,p;u=p=n=0;for(t=b.length;u<t;u++)h=b[u],h instanceof
+THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&n++;n+p<=ra?u=p:(u=Math.ceil(ra*p/(n+p)),n=ra-u);h={directional:u,point:n};n=p=0;for(u=b.length;n<u;n++)t=b[n],t instanceof THREE.SpotLight&&t.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var w;a:{u=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},G,e=[];l?e.push(l):(e.push(u),e.push(t));for(G in c)e.push(G),e.push(c[G]);l=e.join();G=0;
+for(e=ca.length;G<e;G++)if(ca[G].code===l){w=ca[G].program;break a}G=o.createProgram();e=[Aa?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
+"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(G,H("fragment",h+u));o.attachShader(G,
+H("vertex",e+t));o.linkProgram(G);o.getProgramParameter(G,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(G,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");G.uniforms={};G.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in n)e.push(x);x=e;e=0;for(n=x.length;e<n;e++)u=x[e],G.uniforms[u]=o.getUniformLocation(G,
+u);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(w in b)e.push(w);w=e;x=0;for(b=w.length;x<b;x++)c=w[x],G.attributes[c]=o.getAttribLocation(G,c);G.id=ca.length;ca.push({program:G,code:l});U.info.memory.programs=ca.length;w=G}a.program=w;w=a.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);
+w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(f in a.attributes)w[f]!==void 0&&w[f]>=0&&o.enableVertexAttribArray(w[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)x="morphTarget"+f,w[x]>=0&&(o.enableVertexAttribArray(w[x]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(k in a.uniforms)a.uniformsList.push([a.uniforms[k],k])};this.clearTarget=function(a,b,c,e){O(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){w(a,b)};this.render=function(a,b,c,G){var ha,z,T,E,D,V,ga,M=a.lights,ra=a.fog;L=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&w(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Da);b.projectionMatrix.flattenToArray(wa);ua.multiply(b.projectionMatrix,b.matrixWorldInverse);p(ua);O(c);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);T=a.__webglObjects.length;for(G=0;G<T;G++)if(D=a.__webglObjects[G],V=D.object,V.visible)if(!(V instanceof THREE.Mesh)||!V.frustumCulled||v(V)){if(V.matrixWorld.flattenToArray(V._objectMatrixArray),
+A(V,b,!0),u(D),D.render=!0,this.sortObjects)V.renderDepth?D.z=V.renderDepth:(Ba.copy(V.position),ua.multiplyVector3(Ba),D.z=Ba.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(y);E=a.__webglObjectsImmediate.length;for(G=0;G<E;G++)D=a.__webglObjectsImmediate[G],V=D.object,V.visible&&(V.matrixAutoUpdate&&V.matrixWorld.flattenToArray(V._objectMatrixArray),A(V,b,!0),x(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);I(a.overrideMaterial.blending);for(G=0;G<T;G++)if(D=
+a.__webglObjects[G],D.render)V=D.object,ga=D.buffer,f(V),h(b,M,ra,a.overrideMaterial,ga,V);for(G=0;G<E;G++)D=a.__webglObjectsImmediate[G],V=D.object,V.visible&&(Q=-1,f(V),ha=e(b,M,ra,a.overrideMaterial,V),V.immediateRenderCallback?V.immediateRenderCallback(ha,o,la):V.render(function(b){k(b,ha,a.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(G=T-1;G>=0;G--)if(D=a.__webglObjects[G],D.render&&(V=D.object,ga=D.buffer,z=D.opaque))f(V),l(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,
+z.polygonOffsetUnits),h(b,M,ra,z,ga,V);for(G=0;G<E;G++)if(D=a.__webglObjectsImmediate[G],V=D.object,V.visible&&(Q=-1,z=D.opaque))f(V),l(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),ha=e(b,M,ra,z,V),V.immediateRenderCallback?V.immediateRenderCallback(ha,o,la):V.render(function(a){k(a,ha,z.shading)});for(G=0;G<T;G++)if(D=a.__webglObjects[G],D.render&&(V=D.object,ga=D.buffer,z=D.transparent))f(V),I(z.blending),l(z.depthTest),n(z.depthWrite),t(z.polygonOffset,
+z.polygonOffsetFactor,z.polygonOffsetUnits),h(b,M,ra,z,ga,V);for(G=0;G<E;G++)if(D=a.__webglObjectsImmediate[G],V=D.object,V.visible&&(Q=-1,z=D.transparent))f(V),I(z.blending),l(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),ha=e(b,M,ra,z,V),V.immediateRenderCallback?V.immediateRenderCallback(ha,o,la):V.render(function(a){k(a,ha,z.shading)})}a.__webglSprites.length&&B(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&N(c)};this.initWebGLObjects=
+function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],k=a,f=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===
+void 0){var l=h,n=void 0,u=void 0,t=void 0,p=void 0,v=t=void 0,G=void 0,w={},x=l.morphTargets.length;l.geometryGroups={};n=0;for(u=l.faces.length;n<u;n++)t=l.faces[n],p=t.materialIndex,v=p!==void 0?p:-1,w[v]===void 0&&(w[v]={hash:v,counter:0}),G=w[v].hash+"_"+w[v].counter,l.geometryGroups[G]===void 0&&(l.geometryGroups[G]={faces:[],materialIndex:p,vertices:0,numMorphTargets:x}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[G].vertices+t>65535&&(w[v].counter+=1,G=w[v].hash+"_"+w[v].counter,l.geometryGroups[G]===
+void 0&&(l.geometryGroups[G]={faces:[],materialIndex:p,vertices:0,numMorphTargets:x})),l.geometryGroups[G].faces.push(n),l.geometryGroups[G].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ia++,l.geometryGroupsList.push(l.geometryGroups[n])}for(f in h.geometryGroups)if(l=h.geometryGroups[f],!l.__webglVertexBuffer){n=l;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){p=u=void 0;n.__webglMorphTargetsBuffers=[];u=0;for(p=n.numMorphTargets;u<p;u++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;
+for(var p=e,y=t=w=void 0,v=y=x=y=void 0,G=v=n=0,ha=t=void 0,B=void 0,t=u=x=w=void 0,x=p.geometry,ha=x.faces,B=l.faces,w=0,t=B.length;w<t;w++)y=B[w],y=ha[y],y instanceof THREE.Face3?(n+=3,v+=1,G+=3):y instanceof THREE.Face4&&(n+=4,v+=2,G+=4);w=c(p,l);t=w.map||w.lightMap||w instanceof THREE.ShaderMaterial?!0:!1;B=w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial?!1:w&&w.shading!==void 0&&w.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;ha=w.vertexColors?
+w.vertexColors:!1;l.__vertexArray=new Float32Array(n*3);if(B)l.__normalArray=new Float32Array(n*3);if(x.hasTangents)l.__tangentArray=new Float32Array(n*4);if(ha)l.__colorArray=new Float32Array(n*3);if(t){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*
+4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(G*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];x=0;for(y=l.numMorphTargets;x<y;x++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=B===THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=ha;l.__normalType=B;l.__webglFaceCount=v*3;l.__webglLineCount=G*2;if(w.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
+[];p=void 0;for(p in w.attributes){t=w.attributes[p];x={};for(u in t)x[u]=t[u];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=o.createBuffer(),x.buffer.belongsToAttribute=p,t.needsUpdate=!0,x.__original=t;l.__webglCustomAttributesList.push(x)}}l.__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)l=h,l.__webglVertexBuffer=o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=o.createBuffer(),
+l.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=o.createBuffer();l.__webglColorBuffer=o.createBuffer();U.info.geometries++;l=h;u=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=new Float32Array(n*
+3);l.__sortArray=[];l.__webglParticleCount=n;u=u.material;if(u.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in u.attributes){originalAttribute=u.attributes[p];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
+attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)l=h.geometryGroups[f],M(k.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
+e instanceof THREE.ParticleSystem?(h=e.geometry,M(k.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?k.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&k.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];k=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)D(k.__webglObjects,
+e);else if(e instanceof THREE.Sprite){k=k.__webglSprites;f=e;for(h=k.length-1;h>=0;h--)k[h]===f&&k.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&D(k.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(k=a.__webglObjects.length;e<k;e++)if(h=a.__webglObjects[e].object,f=h.geometry,l=v=p=void 0,h instanceof THREE.Mesh){n=0;for(u=f.geometryGroupsList.length;n<u;n++)if(p=f.geometryGroupsList[n],l=c(h,p),v=l.attributes&&E(l),f.__dirtyVertices||
+f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||v)if(v=o.DYNAMIC_DRAW,G=!f.dynamic,p.__inittedArrays){var A=x=w=void 0,T=void 0,V=A=void 0,ga=void 0,ra=void 0,Q=void 0,N=y=B=ha=t=void 0,K=void 0,I=void 0,L=void 0,pa=void 0,C=T=Q=T=ra=ga=void 0,H=void 0,J=H=C=ga=void 0,F=void 0,J=H=C=A=A=V=H=C=T=J=H=C=F=J=H=C=F=J=H=C=void 0,va=0,O=0,ta=0,xa=0,X=0,Y=0,P=0,qa=0,aa=0,S=0,na=0,W=J=0,W=void 0,fa=p.__vertexArray,ja=p.__uvArray,ka=p.__uv2Array,
+da=p.__normalArray,la=p.__tangentArray,ea=p.__colorArray,ca=p.__skinVertexAArray,Z=p.__skinVertexBArray,$=p.__skinIndexArray,sa=p.__skinWeightArray,oa=p.__morphTargetsArrays,ma=p.__webglCustomAttributesList,F=void 0,ua=p.__faceArray,ya=p.__lineArray,Fa=p.__needsSmoothNormals,ha=p.__vertexColorType,t=p.__uvType,B=p.__normalType,wa=h.geometry,Da=wa.__dirtyVertices,Aa=wa.__dirtyElements,Ga=wa.__dirtyUvs,Ba=wa.__dirtyNormals,Ea=wa.__dirtyTangents,Ia=wa.__dirtyColors,Ca=wa.__dirtyMorphTargets,Na=wa.vertices,
+Za=p.faces,bb=wa.faces,$a=wa.faceVertexUvs[0],ab=wa.faceVertexUvs[1],Oa=wa.skinVerticesA,Pa=wa.skinVerticesB,Qa=wa.skinIndices,Ka=wa.skinWeights,Ja=wa.morphTargets;if(ma){C=0;for(H=ma.length;C<H;C++)ma[C].offset=0,ma[C].offsetSrc=0}w=0;for(x=Za.length;w<x;w++)if(A=Za[w],T=bb[A],$a&&(y=$a[A]),ab&&(N=ab[A]),A=T.vertexNormals,V=T.normal,ga=T.vertexColors,ra=T.color,Q=T.vertexTangents,T instanceof THREE.Face3){if(Da)K=Na[T.a].position,I=Na[T.b].position,L=Na[T.c].position,fa[O]=K.x,fa[O+1]=K.y,fa[O+2]=
+K.z,fa[O+3]=I.x,fa[O+4]=I.y,fa[O+5]=I.z,fa[O+6]=L.x,fa[O+7]=L.y,fa[O+8]=L.z,O+=9;if(ma){C=0;for(H=ma.length;C<H;C++)if(F=ma[C],F.__original.needsUpdate)J=F.offset,W=F.offsetSrc,F.size===1?(F.boundTo===void 0||F.boundTo==="vertices"?(F.array[J]=F.value[T.a],F.array[J+1]=F.value[T.b],F.array[J+2]=F.value[T.c]):F.boundTo==="faces"?(W=F.value[W],F.array[J]=W,F.array[J+1]=W,F.array[J+2]=W,F.offsetSrc++):F.boundTo==="faceVertices"&&(F.array[J]=F.value[W],F.array[J+1]=F.value[W+1],F.array[J+2]=F.value[W+
+2],F.offsetSrc+=3),F.offset+=3):(F.boundTo===void 0||F.boundTo==="vertices"?(K=F.value[T.a],I=F.value[T.b],L=F.value[T.c]):F.boundTo==="faces"?(L=I=K=W=F.value[W],F.offsetSrc++):F.boundTo==="faceVertices"&&(K=F.value[W],I=F.value[W+1],L=F.value[W+2],F.offsetSrc+=3),F.size===2?(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=I.x,F.array[J+3]=I.y,F.array[J+4]=L.x,F.array[J+5]=L.y,F.offset+=6):F.size===3?(F.type==="c"?(F.array[J]=K.r,F.array[J+1]=K.g,F.array[J+2]=K.b,F.array[J+3]=I.r,F.array[J+4]=I.g,F.array[J+
+5]=I.b,F.array[J+6]=L.r,F.array[J+7]=L.g,F.array[J+8]=L.b):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=I.x,F.array[J+4]=I.y,F.array[J+5]=I.z,F.array[J+6]=L.x,F.array[J+7]=L.y,F.array[J+8]=L.z),F.offset+=9):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=K.w,F.array[J+4]=I.x,F.array[J+5]=I.y,F.array[J+6]=I.z,F.array[J+7]=I.w,F.array[J+8]=L.x,F.array[J+9]=L.y,F.array[J+10]=L.z,F.array[J+11]=L.w,F.offset+=12))}if(Ca){C=0;for(H=Ja.length;C<H;C++)K=Ja[C].vertices[T.a].position,
+I=Ja[C].vertices[T.b].position,L=Ja[C].vertices[T.c].position,J=oa[C],J[na]=K.x,J[na+1]=K.y,J[na+2]=K.z,J[na+3]=I.x,J[na+4]=I.y,J[na+5]=I.z,J[na+6]=L.x,J[na+7]=L.y,J[na+8]=L.z;na+=9}if(Ka.length)C=Ka[T.a],H=Ka[T.b],J=Ka[T.c],sa[S]=C.x,sa[S+1]=C.y,sa[S+2]=C.z,sa[S+3]=C.w,sa[S+4]=H.x,sa[S+5]=H.y,sa[S+6]=H.z,sa[S+7]=H.w,sa[S+8]=J.x,sa[S+9]=J.y,sa[S+10]=J.z,sa[S+11]=J.w,C=Qa[T.a],H=Qa[T.b],J=Qa[T.c],$[S]=C.x,$[S+1]=C.y,$[S+2]=C.z,$[S+3]=C.w,$[S+4]=H.x,$[S+5]=H.y,$[S+6]=H.z,$[S+7]=H.w,$[S+8]=J.x,$[S+9]=
+J.y,$[S+10]=J.z,$[S+11]=J.w,C=Oa[T.a],H=Oa[T.b],J=Oa[T.c],ca[S]=C.x,ca[S+1]=C.y,ca[S+2]=C.z,ca[S+3]=1,ca[S+4]=H.x,ca[S+5]=H.y,ca[S+6]=H.z,ca[S+7]=1,ca[S+8]=J.x,ca[S+9]=J.y,ca[S+10]=J.z,ca[S+11]=1,C=Pa[T.a],H=Pa[T.b],J=Pa[T.c],Z[S]=C.x,Z[S+1]=C.y,Z[S+2]=C.z,Z[S+3]=1,Z[S+4]=H.x,Z[S+5]=H.y,Z[S+6]=H.z,Z[S+7]=1,Z[S+8]=J.x,Z[S+9]=J.y,Z[S+10]=J.z,Z[S+11]=1,S+=12;if(Ia&&ha)ga.length===3&&ha===THREE.VertexColors?(T=ga[0],C=ga[1],H=ga[2]):H=C=T=ra,ea[aa]=T.r,ea[aa+1]=T.g,ea[aa+2]=T.b,ea[aa+3]=C.r,ea[aa+4]=
+C.g,ea[aa+5]=C.b,ea[aa+6]=H.r,ea[aa+7]=H.g,ea[aa+8]=H.b,aa+=9;if(Ea&&wa.hasTangents)ga=Q[0],ra=Q[1],T=Q[2],la[P]=ga.x,la[P+1]=ga.y,la[P+2]=ga.z,la[P+3]=ga.w,la[P+4]=ra.x,la[P+5]=ra.y,la[P+6]=ra.z,la[P+7]=ra.w,la[P+8]=T.x,la[P+9]=T.y,la[P+10]=T.z,la[P+11]=T.w,P+=12;if(Ba&&B)if(A.length===3&&Fa)for(C=0;C<3;C++)V=A[C],da[Y]=V.x,da[Y+1]=V.y,da[Y+2]=V.z,Y+=3;else for(C=0;C<3;C++)da[Y]=V.x,da[Y+1]=V.y,da[Y+2]=V.z,Y+=3;if(Ga&&y!==void 0&&t)for(C=0;C<3;C++)A=y[C],ja[ta]=A.u,ja[ta+1]=A.v,ta+=2;if(Ga&&N!==
+void 0&&t)for(C=0;C<3;C++)A=N[C],ka[xa]=A.u,ka[xa+1]=A.v,xa+=2;Aa&&(ua[X]=va,ua[X+1]=va+1,ua[X+2]=va+2,X+=3,ya[qa]=va,ya[qa+1]=va+1,ya[qa+2]=va,ya[qa+3]=va+2,ya[qa+4]=va+1,ya[qa+5]=va+2,qa+=6,va+=3)}else if(T instanceof THREE.Face4){if(Da)K=Na[T.a].position,I=Na[T.b].position,L=Na[T.c].position,pa=Na[T.d].position,fa[O]=K.x,fa[O+1]=K.y,fa[O+2]=K.z,fa[O+3]=I.x,fa[O+4]=I.y,fa[O+5]=I.z,fa[O+6]=L.x,fa[O+7]=L.y,fa[O+8]=L.z,fa[O+9]=pa.x,fa[O+10]=pa.y,fa[O+11]=pa.z,O+=12;if(ma){C=0;for(H=ma.length;C<H;C++)if(F=
+ma[C],F.__original.needsUpdate)J=F.offset,W=F.offsetSrc,F.size===1?(F.boundTo===void 0||F.boundTo==="vertices"?(F.array[J]=F.value[T.a],F.array[J+1]=F.value[T.b],F.array[J+2]=F.value[T.c],F.array[J+3]=F.value[T.d]):F.boundTo==="faces"?(W=F.value[W],F.array[J]=W,F.array[J+1]=W,F.array[J+2]=W,F.array[J+3]=W,F.offsetSrc++):F.boundTo==="faceVertices"&&(F.array[J]=F.value[W],F.array[J+1]=F.value[W+1],F.array[J+2]=F.value[W+2],F.array[J+3]=F.value[W+3],F.offsetSrc+=4),F.offset+=4):(F.boundTo===void 0||
+F.boundTo==="vertices"?(K=F.value[T.a],I=F.value[T.b],L=F.value[T.c],pa=F.value[T.d]):F.boundTo==="faces"?(pa=L=I=K=W=F.value[W],F.offsetSrc++):F.boundTo==="faceVertices"&&(K=F.value[W],I=F.value[W+1],L=F.value[W+2],pa=F.value[W+3],F.offsetSrc+=4),F.size===2?(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=I.x,F.array[J+3]=I.y,F.array[J+4]=L.x,F.array[J+5]=L.y,F.array[J+6]=pa.x,F.array[J+7]=pa.y,F.offset+=8):F.size===3?(F.type==="c"?(F.array[J]=K.r,F.array[J+1]=K.g,F.array[J+2]=K.b,F.array[J+3]=I.r,
+F.array[J+4]=I.g,F.array[J+5]=I.b,F.array[J+6]=L.r,F.array[J+7]=L.g,F.array[J+8]=L.b,F.array[J+9]=pa.r,F.array[J+10]=pa.g,F.array[J+11]=pa.b):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=I.x,F.array[J+4]=I.y,F.array[J+5]=I.z,F.array[J+6]=L.x,F.array[J+7]=L.y,F.array[J+8]=L.z,F.array[J+9]=pa.x,F.array[J+10]=pa.y,F.array[J+11]=pa.z),F.offset+=12):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=K.w,F.array[J+4]=I.x,F.array[J+5]=I.y,F.array[J+6]=I.z,F.array[J+7]=I.w,F.array[J+
+8]=L.x,F.array[J+9]=L.y,F.array[J+10]=L.z,F.array[J+11]=L.w,F.array[J+12]=pa.x,F.array[J+13]=pa.y,F.array[J+14]=pa.z,F.array[J+15]=pa.w,F.offset+=16))}if(Ca){C=0;for(H=Ja.length;C<H;C++)K=Ja[C].vertices[T.a].position,I=Ja[C].vertices[T.b].position,L=Ja[C].vertices[T.c].position,pa=Ja[C].vertices[T.d].position,J=oa[C],J[na]=K.x,J[na+1]=K.y,J[na+2]=K.z,J[na+3]=I.x,J[na+4]=I.y,J[na+5]=I.z,J[na+6]=L.x,J[na+7]=L.y,J[na+8]=L.z,J[na+9]=pa.x,J[na+10]=pa.y,J[na+11]=pa.z;na+=12}if(Ka.length)C=Ka[T.a],H=Ka[T.b],
+J=Ka[T.c],F=Ka[T.d],sa[S]=C.x,sa[S+1]=C.y,sa[S+2]=C.z,sa[S+3]=C.w,sa[S+4]=H.x,sa[S+5]=H.y,sa[S+6]=H.z,sa[S+7]=H.w,sa[S+8]=J.x,sa[S+9]=J.y,sa[S+10]=J.z,sa[S+11]=J.w,sa[S+12]=F.x,sa[S+13]=F.y,sa[S+14]=F.z,sa[S+15]=F.w,C=Qa[T.a],H=Qa[T.b],J=Qa[T.c],F=Qa[T.d],$[S]=C.x,$[S+1]=C.y,$[S+2]=C.z,$[S+3]=C.w,$[S+4]=H.x,$[S+5]=H.y,$[S+6]=H.z,$[S+7]=H.w,$[S+8]=J.x,$[S+9]=J.y,$[S+10]=J.z,$[S+11]=J.w,$[S+12]=F.x,$[S+13]=F.y,$[S+14]=F.z,$[S+15]=F.w,C=Oa[T.a],H=Oa[T.b],J=Oa[T.c],F=Oa[T.d],ca[S]=C.x,ca[S+1]=C.y,ca[S+
+2]=C.z,ca[S+3]=1,ca[S+4]=H.x,ca[S+5]=H.y,ca[S+6]=H.z,ca[S+7]=1,ca[S+8]=J.x,ca[S+9]=J.y,ca[S+10]=J.z,ca[S+11]=1,ca[S+12]=F.x,ca[S+13]=F.y,ca[S+14]=F.z,ca[S+15]=1,C=Pa[T.a],H=Pa[T.b],J=Pa[T.c],T=Pa[T.d],Z[S]=C.x,Z[S+1]=C.y,Z[S+2]=C.z,Z[S+3]=1,Z[S+4]=H.x,Z[S+5]=H.y,Z[S+6]=H.z,Z[S+7]=1,Z[S+8]=J.x,Z[S+9]=J.y,Z[S+10]=J.z,Z[S+11]=1,Z[S+12]=T.x,Z[S+13]=T.y,Z[S+14]=T.z,Z[S+15]=1,S+=16;if(Ia&&ha)ga.length===4&&ha===THREE.VertexColors?(T=ga[0],C=ga[1],H=ga[2],ga=ga[3]):ga=H=C=T=ra,ea[aa]=T.r,ea[aa+1]=T.g,ea[aa+
+2]=T.b,ea[aa+3]=C.r,ea[aa+4]=C.g,ea[aa+5]=C.b,ea[aa+6]=H.r,ea[aa+7]=H.g,ea[aa+8]=H.b,ea[aa+9]=ga.r,ea[aa+10]=ga.g,ea[aa+11]=ga.b,aa+=12;if(Ea&&wa.hasTangents)ga=Q[0],ra=Q[1],T=Q[2],Q=Q[3],la[P]=ga.x,la[P+1]=ga.y,la[P+2]=ga.z,la[P+3]=ga.w,la[P+4]=ra.x,la[P+5]=ra.y,la[P+6]=ra.z,la[P+7]=ra.w,la[P+8]=T.x,la[P+9]=T.y,la[P+10]=T.z,la[P+11]=T.w,la[P+12]=Q.x,la[P+13]=Q.y,la[P+14]=Q.z,la[P+15]=Q.w,P+=16;if(Ba&&B)if(A.length===4&&Fa)for(C=0;C<4;C++)V=A[C],da[Y]=V.x,da[Y+1]=V.y,da[Y+2]=V.z,Y+=3;else for(C=0;C<
+4;C++)da[Y]=V.x,da[Y+1]=V.y,da[Y+2]=V.z,Y+=3;if(Ga&&y!==void 0&&t)for(C=0;C<4;C++)A=y[C],ja[ta]=A.u,ja[ta+1]=A.v,ta+=2;if(Ga&&N!==void 0&&t)for(C=0;C<4;C++)A=N[C],ka[xa]=A.u,ka[xa+1]=A.v,xa+=2;Aa&&(ua[X]=va,ua[X+1]=va+1,ua[X+2]=va+3,ua[X+3]=va+1,ua[X+4]=va+2,ua[X+5]=va+3,X+=6,ya[qa]=va,ya[qa+1]=va+1,ya[qa+2]=va,ya[qa+3]=va+3,ya[qa+4]=va+1,ya[qa+5]=va+2,ya[qa+6]=va+2,ya[qa+7]=va+3,qa+=8,va+=4)}Da&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,v));if(ma){C=0;for(H=
+ma.length;C<H;C++)F=ma[C],F.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,F.buffer),o.bufferData(o.ARRAY_BUFFER,F.array,v))}if(Ca){C=0;for(H=Ja.length;C<H;C++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[C]),o.bufferData(o.ARRAY_BUFFER,oa[C],v)}Ia&&aa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ea,v));Ba&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,da,v));Ea&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),
+o.bufferData(o.ARRAY_BUFFER,la,v));Ga&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ja,v));Ga&&xa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ka,v));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ua,v),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,v));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,
+ca,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,$,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,sa,v));G&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,
+delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;l.attributes&&z(l)}else if(h instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;l=o.DYNAMIC_DRAW;n=w=G=G=void 0;x=h.vertices;u=h.colors;t=x.length;p=u.length;ha=h.__vertexArray;v=h.__colorArray;B=h.__dirtyColors;if(h.__dirtyVertices){for(G=0;G<t;G++)w=x[G].position,
+n=G*3,ha[n]=w.x,ha[n+1]=w.y,ha[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ha,l)}if(B){for(G=0;G<p;G++)color=u[G],n=G*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,l)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(h instanceof THREE.Line){if(f.__dirtyVertices||f.__dirtyColors){h=f;l=o.DYNAMIC_DRAW;n=w=G=G=void 0;x=h.vertices;u=h.colors;t=x.length;p=u.length;ha=h.__vertexArray;
+v=h.__colorArray;B=h.__dirtyColors;if(h.__dirtyVertices){for(G=0;G<t;G++)w=x[G].position,n=G*3,ha[n]=w.x,ha[n+1]=w.y,ha[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ha,l)}if(B){for(G=0;G<p;G++)color=u[G],n=G*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,l)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)l=c(h,p),v=l.attributes&&E(l),(f.__dirtyVertices||
+f.__dirtyColors||h.sortParticles||v)&&b(f,o.DYNAMIC_DRAW,h),f.__dirtyVertices=!1,f.__dirtyColors=!1,l.attributes&&z(l)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Aa}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
@@ -350,19 +349,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,c,b,e){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,h);h.h=THREE.Math.clamp(h.h+c,0,1);h.s=THREE.Math.clamp(h.s+b,0,1);h.v=THREE.Math.clamp(h.v+e,0,1);a.setHSV(h.h,h.s,h.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,h=a.b,k=Math.max(Math.max(b,e),h),f=Math.min(Math.min(b,e),h);if(f===k)f=b=0;else{var l=k-f,f=l/k,b=b===k?(e-h)/l:e===k?2+(h-b)/l:4+(b-e)/l;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=k;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,h=a.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,l=k.vertices,n=a.faces,u=k.faces,t=a.faceVertexUvs[0],p=k.faceVertexUvs[0],w={},v=0;v<a.materials.length;v++)w[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,z=l.length;v<z;v++){var x=new THREE.Vertex(l[v].position.clone());b&&b.multiplyVector3(x.position);f.push(x)}v=
-0;for(z=u.length;v<z;v++){var f=u[v],y,G,A=f.vertexNormals,B=f.vertexColors;f instanceof THREE.Face3?y=new THREE.Face3(f.a+h,f.b+h,f.c+h):f instanceof THREE.Face4&&(y=new THREE.Face4(f.a+h,f.b+h,f.c+h,f.d+h));y.normal.copy(f.normal);e&&e.multiplyVector3(y.normal);l=0;for(x=A.length;l<x;l++)G=A[l].clone(),e&&e.multiplyVector3(G),y.vertexNormals.push(G);y.color.copy(f.color);l=0;for(x=B.length;l<x;l++)G=B[l],y.vertexColors.push(G.clone());if(f.materialIndex!==void 0){l=k.materials[f.materialIndex];
-x=w[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);y.materialIndex=x}y.centroid.copy(f.centroid);b&&b.multiplyVector3(y.centroid);n.push(y)}v=0;for(z=p.length;v<z;v++){b=p[v];e=[];l=0;for(x=b.length;l<x;l++)e.push(new THREE.UV(b[l].u,b[l].v));t.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,h=a.faces,k=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
-for(b=h.length;a<b;a++){var l=h[a],n,u,t=l.vertexNormals,p=l.vertexColors;l instanceof THREE.Face3?n=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(n=new THREE.Face4(l.a,l.b,l.c,l.d));n.normal.copy(l.normal);e=0;for(f=t.length;e<f;e++)u=t[e],n.vertexNormals.push(u.clone());n.color.copy(l.color);e=0;for(f=p.length;e<f;e++)u=p[e],n.vertexColors.push(u.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);c.faces.push(n)}a=0;for(b=k.length;a<b;a++){h=k[a];n=[];e=0;for(f=h.length;e<
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,h=a.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,l=k.vertices,n=a.faces,t=k.faces,p=a.faceVertexUvs[0],v=k.faceVertexUvs[0],x={},u=0;u<a.materials.length;u++)x[a.materials[u].id]=u;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var u=0,y=l.length;u<y;u++){var w=new THREE.Vertex(l[u].position.clone());b&&b.multiplyVector3(w.position);f.push(w)}u=
+0;for(y=t.length;u<y;u++){var f=t[u],B,A,E=f.vertexNormals,z=f.vertexColors;f instanceof THREE.Face3?B=new THREE.Face3(f.a+h,f.b+h,f.c+h):f instanceof THREE.Face4&&(B=new THREE.Face4(f.a+h,f.b+h,f.c+h,f.d+h));B.normal.copy(f.normal);e&&e.multiplyVector3(B.normal);l=0;for(w=E.length;l<w;l++)A=E[l].clone(),e&&e.multiplyVector3(A),B.vertexNormals.push(A);B.color.copy(f.color);l=0;for(w=z.length;l<w;l++)A=z[l],B.vertexColors.push(A.clone());if(f.materialIndex!==void 0){l=k.materials[f.materialIndex];
+w=x[l.id];if(w===void 0)w=a.materials.length,a.materials.push(l);B.materialIndex=w}B.centroid.copy(f.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}u=0;for(y=v.length;u<y;u++){b=v[u];e=[];l=0;for(w=b.length;l<w;l++)e.push(new THREE.UV(b[l].u,b[l].v));p.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,h=a.faces,k=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
+for(b=h.length;a<b;a++){var l=h[a],n,t,p=l.vertexNormals,v=l.vertexColors;l instanceof THREE.Face3?n=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(n=new THREE.Face4(l.a,l.b,l.c,l.d));n.normal.copy(l.normal);e=0;for(f=p.length;e<f;e++)t=p[e],n.vertexNormals.push(t.clone());n.color.copy(l.color);e=0;for(f=v.length;e<f;e++)t=v[e],n.vertexColors.push(t.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);c.faces.push(n)}a=0;for(b=k.length;a<b;a++){h=k[a];n=[];e=0;for(f=h.length;e<
 f;e++)n.push(new THREE.UV(h[e].u,h[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,h,k,f=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();e+h>1&&(e=1-e,h=1-h);k=1-e-h;f.copy(a);f.multiplyScalar(e);l.copy(c);l.multiplyScalar(h);f.addSelf(l);l.copy(b);l.multiplyScalar(k);f.addSelf(l);return f},randomPointInFace:function(a,c,b){var e,h,k;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,h=c.vertices[a.b].position,
 k=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,h,k);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;h=c.vertices[a.b].position;k=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,h,c),f=THREE.GeometryUtils.triangleArea(h,k,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,h,c),f=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(b+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var k=c+Math.floor((e-c)/2);return u[k]>a?b(c,k-1):u[k]<a?b(k+1,e):k}return b(0,u.length-1)}var e,h,k=a.faces,f=a.vertices,l=k.length,n=0,u=[],t,p,w,v;for(h=0;h<l;h++){e=k[h];if(e instanceof THREE.Face3)t=f[e.a].position,p=f[e.b].position,w=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(t,p,w);else if(e instanceof
-THREE.Face4)t=f[e.a].position,p=f[e.b].position,w=f[e.c].position,v=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(t,p,v),e._area2=THREE.GeometryUtils.triangleArea(p,w,v),e._area=e._area1+e._area2;n+=e._area;u[h]=n}e=[];f={};for(h=0;h<c;h++)l=THREE.GeometryUtils.random()*n,l=b(l),e[h]=THREE.GeometryUtils.randomPointInFace(k[l],a,!0),f[l]?f[l]+=1:f[l]=1;return e},triangleArea:function(a,c,b){var e,h=THREE.GeometryUtils.__v1;h.sub(a,c);e=h.length();h.sub(a,b);a=h.length();h.sub(c,b);b=h.length();
+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var k=c+Math.floor((e-c)/2);return t[k]>a?b(c,k-1):t[k]<a?b(k+1,e):k}return b(0,t.length-1)}var e,h,k=a.faces,f=a.vertices,l=k.length,n=0,t=[],p,v,x,u;for(h=0;h<l;h++){e=k[h];if(e instanceof THREE.Face3)p=f[e.a].position,v=f[e.b].position,x=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(p,v,x);else if(e instanceof
+THREE.Face4)p=f[e.a].position,v=f[e.b].position,x=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(p,v,u),e._area2=THREE.GeometryUtils.triangleArea(v,x,u),e._area=e._area1+e._area2;n+=e._area;t[h]=n}e=[];f={};for(h=0;h<c;h++)l=THREE.GeometryUtils.random()*n,l=b(l),e[h]=THREE.GeometryUtils.randomPointInFace(k[l],a,!0),f[l]?f[l]+=1:f[l]=1;return e},triangleArea:function(a,c,b){var e,h=THREE.GeometryUtils.__v1;h.sub(a,c);e=h.length();h.sub(a,b);a=h.length();h.sub(c,b);b=h.length();
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,h=new THREE.Texture(e,c);e.onload=function(){h.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return h},loadTextureCube:function(a,c,b){var e,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(e=a.length;c<e;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount===6)k.needsUpdate=!0;b&&b(this)},h[c].crossOrigin="",h[c].src=a[c];return k},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,h=a.height,k=document.createElement("canvas");k.width=e;k.height=h;var f=k.getContext("2d");f.drawImage(a,0,0);for(var l=f.getImageData(0,0,e,h).data,n=f.createImageData(e,h),u=n.data,t=0;t<e;t++)for(var p=1;p<h;p++){var w=p-1<0?h-1:p-1,v=(p+1)%h,z=t-1<0?e-1:t-1,x=(t+1)%e,y=[],G=[0,0,l[(p*e+t)*4]/255*c];y.push([-1,0,l[(p*e+z)*4]/255*c]);y.push([-1,-1,l[(w*e+z)*4]/255*c]);y.push([0,-1,l[(w*e+t)*4]/255*c]);y.push([1,-1,l[(w*e+x)*4]/255*c]);
-y.push([1,0,l[(p*e+x)*4]/255*c]);y.push([1,1,l[(v*e+x)*4]/255*c]);y.push([0,1,l[(v*e+t)*4]/255*c]);y.push([-1,1,l[(v*e+z)*4]/255*c]);w=[];z=y.length;for(v=0;v<z;v++){var x=y[v],A=y[(v+1)%z],x=[x[0]-G[0],x[1]-G[1],x[2]-G[2]],A=[A[0]-G[0],A[1]-G[1],A[2]-G[2]];w.push(b([x[1]*A[2]-x[2]*A[1],x[2]*A[0]-x[0]*A[2],x[0]*A[1]-x[1]*A[0]]))}y=[0,0,0];for(v=0;v<w.length;v++)y[0]+=w[v][0],y[1]+=w[v][1],y[2]+=w[v][2];y[0]/=w.length;y[1]/=w.length;y[2]/=w.length;G=(p*e+t)*4;u[G]=(y[0]+1)/2*255|0;u[G+1]=(y[1]+0.5)*
-255|0;u[G+2]=y[2]*255|0;u[G+3]=255}f.putImageData(n,0,0);return k}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,h=a.children.length;for(e=0;e<h;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,h=new THREE.Object3D;for(b=0;b<e;b++){var k=new THREE.Mesh(a,c[b]);h.add(k)}return h}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,h=a.height,k=document.createElement("canvas");k.width=e;k.height=h;var f=k.getContext("2d");f.drawImage(a,0,0);for(var l=f.getImageData(0,0,e,h).data,n=f.createImageData(e,h),t=n.data,p=0;p<e;p++)for(var v=1;v<h;v++){var x=v-1<0?h-1:v-1,u=(v+1)%h,y=p-1<0?e-1:p-1,w=(p+1)%e,B=[],A=[0,0,l[(v*e+p)*4]/255*c];B.push([-1,0,l[(v*e+y)*4]/255*c]);B.push([-1,-1,l[(x*e+y)*4]/255*c]);B.push([0,-1,l[(x*e+p)*4]/255*c]);B.push([1,-1,l[(x*e+w)*4]/255*c]);
+B.push([1,0,l[(v*e+w)*4]/255*c]);B.push([1,1,l[(u*e+w)*4]/255*c]);B.push([0,1,l[(u*e+p)*4]/255*c]);B.push([-1,1,l[(u*e+y)*4]/255*c]);x=[];y=B.length;for(u=0;u<y;u++){var w=B[u],E=B[(u+1)%y],w=[w[0]-A[0],w[1]-A[1],w[2]-A[2]],E=[E[0]-A[0],E[1]-A[1],E[2]-A[2]];x.push(b([w[1]*E[2]-w[2]*E[1],w[2]*E[0]-w[0]*E[2],w[0]*E[1]-w[1]*E[0]]))}B=[0,0,0];for(u=0;u<x.length;u++)B[0]+=x[u][0],B[1]+=x[u][1],B[2]+=x[u][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;A=(v*e+p)*4;t[A]=(B[0]+1)/2*255|0;t[A+1]=(B[1]+0.5)*
+255|0;t[A+2]=B[2]*255|0;t[A+3]=255}f.putImageData(n,0,0);return k}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,h=a.children.length;for(e=0;e<h;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,h=new THREE.Object3D;for(b=0;b<e;b++){var k=new THREE.Mesh(a,c[b]);h.add(k)}return h}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -401,37 +400,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var h=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,h,k){var f=Array.prototype.slice.call(arguments),l=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(l[l.length-2],l[l.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(h,k)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,e,h,k){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,h,k));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,h,k,f,l,n,u,t,p,w,v,z,x;e=0;for(h=this.actions.length;e<h;e++)switch(k=this.actions[e],f=k.action,k=k.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=k[2];n=k[3];p=k[0];w=k[1];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,k=THREE.Shape.Utils.b2(x,v,p,l),x=THREE.Shape.Utils.b2(x,z,w,
-n),b.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=k[4];n=k[5];p=k[0];w=k[1];u=k[2];t=k[3];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,k=THREE.Shape.Utils.b3(x,v,p,u,l),x=THREE.Shape.Utils.b3(x,z,w,t,n),b.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];x=a*k[0].length;f=f.concat(k[0]);k=new THREE.SplineCurve(f);
-for(f=1;f<=x;f++)b.push(k.getPointAt(f/x));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;l=k[0];n=k[1];u=k[2];p=k[3];x=k[4];w=!!k[5];t=f[f.length-2];v=f[f.length-1];f.length==0&&(t=v=0);z=x-p;var y=a*2;for(f=1;f<=y;f++)x=f/y,w||(x=1-x),x=p+x*z,k=t+l+u*Math.cos(x),x=v+n+u*Math.sin(x),b.push(new THREE.Vector2(k,x))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,e,h,k){var f=this.getPoints(),l,n,u,t,p;l=0;for(n=f.length;l<n;l++)u=f[l],t=u.x,p=u.y,u.x=a*t+c*p+b,u.y=e*p+h*t+k;return f};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,h,k,f,l,n,t,p,v,x,u,y,w;e=0;for(h=this.actions.length;e<h;e++)switch(k=this.actions[e],f=k.action,k=k.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=k[2];n=k[3];v=k[0];x=k[1];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,k=THREE.Shape.Utils.b2(w,u,v,l),w=THREE.Shape.Utils.b2(w,y,x,
+n),b.push(new THREE.Vector2(k,w));break;case THREE.PathActions.BEZIER_CURVE_TO:l=k[4];n=k[5];v=k[0];x=k[1];t=k[2];p=k[3];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,k=THREE.Shape.Utils.b3(w,u,v,t,l),w=THREE.Shape.Utils.b3(w,y,x,p,n),b.push(new THREE.Vector2(k,w));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];w=a*k[0].length;f=f.concat(k[0]);k=new THREE.SplineCurve(f);
+for(f=1;f<=w;f++)b.push(k.getPointAt(f/w));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;l=k[0];n=k[1];t=k[2];v=k[3];w=k[4];x=!!k[5];p=f[f.length-2];u=f[f.length-1];f.length==0&&(p=u=0);y=w-v;var B=a*2;for(f=1;f<=B;f++)w=f/B,x||(w=1-w),w=v+w*y,k=p+l+t*Math.cos(w),w=u+n+t*Math.sin(w),b.push(new THREE.Vector2(k,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,e,h,k){var f=this.getPoints(),l,n,t,p,v;l=0;for(n=f.length;l<n;l++)t=f[l],p=t.x,v=t.y,t.x=a*p+c*v+b,t.y=e*v+h*p+k;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,h,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],h=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";e=
 this.getPoints();a=0;for(b=e.length;a<b;a++)h=e[a],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,e,h=[],k=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&k.actions.length!=0&&(h.push(k),k=new THREE.Path),k[b].apply(k,e);k.actions.length!=0&&h.push(k);if(h.length==0)return[];var f,k=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){a=0;for(c=h.length;a<c;a++)e=h[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&k.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
 e.curves):f.holes.push(e);k.push(f)}else{f=new THREE.Shape;a=0;for(c=h.length;a<c;a++)e=h[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,k.push(f),f=new THREE.Shape):f.holes.push(e)}return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),h,k,f,l,n,u,t,p,w,v,z=[];for(n=0;n<c.length;n++){u=c[n];Array.prototype.push.apply(e,u);k=Number.POSITIVE_INFINITY;for(h=0;h<u.length;h++){w=u[h];v=[];for(p=0;p<b.length;p++)t=b[p],t=w.distanceToSquared(t),v.push(t),t<k&&(k=t,f=h,l=p)}h=l-1>=0?l-1:b.length-1;k=f-1>=0?f-1:u.length-1;var x=[u[f],b[l],b[h]];p=THREE.FontUtils.Triangulate.area(x);var y=[u[f],u[k],b[l]];w=THREE.FontUtils.Triangulate.area(y);v=l;t=f;l+=1;f+=-1;l<
-0&&(l+=b.length);l%=b.length;f<0&&(f+=u.length);f%=u.length;h=l-1>=0?l-1:b.length-1;k=f-1>=0?f-1:u.length-1;x=[u[f],b[l],b[h]];x=THREE.FontUtils.Triangulate.area(x);y=[u[f],u[k],b[l]];y=THREE.FontUtils.Triangulate.area(y);p+w>x+y&&(l=v,f=t,l<0&&(l+=b.length),l%=b.length,f<0&&(f+=u.length),f%=u.length,h=l-1>=0?l-1:b.length-1,k=f-1>=0?f-1:u.length-1);p=b.slice(0,l);w=b.slice(l);v=u.slice(f);t=u.slice(0,f);k=[u[f],u[k],b[l]];z.push([u[f],b[l],b[h]]);z.push(k);b=p.concat(v).concat(t).concat(w)}return{shape:b,
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,h=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),k,f,l,n,u={};k=0;for(f=e.length;k<f;k++)n=e[k].x+":"+e[k].y,u[n]!==void 0&&console.log("Duplicate point",n),u[n]=k;k=0;for(f=b.length;k<f;k++){l=b[k];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=u[n],n!==void 0&&(l[e]=n)}k=0;for(f=h.length;k<f;k++){l=h[k];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=u[n],n!==void 0&&(l[e]=n)}return b.concat(h)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),h,k,f,l,n,t,p,v,x,u,y=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];u=[];for(v=0;v<b.length;v++)p=b[v],p=x.distanceToSquared(p),u.push(p),p<k&&(k=p,f=h,l=v)}h=l-1>=0?l-1:b.length-1;k=f-1>=0?f-1:t.length-1;var w=[t[f],b[l],b[h]];v=THREE.FontUtils.Triangulate.area(w);var B=[t[f],t[k],b[l]];x=THREE.FontUtils.Triangulate.area(B);u=l;p=f;l+=1;f+=-1;l<
+0&&(l+=b.length);l%=b.length;f<0&&(f+=t.length);f%=t.length;h=l-1>=0?l-1:b.length-1;k=f-1>=0?f-1:t.length-1;w=[t[f],b[l],b[h]];w=THREE.FontUtils.Triangulate.area(w);B=[t[f],t[k],b[l]];B=THREE.FontUtils.Triangulate.area(B);v+x>w+B&&(l=u,f=p,l<0&&(l+=b.length),l%=b.length,f<0&&(f+=t.length),f%=t.length,h=l-1>=0?l-1:b.length-1,k=f-1>=0?f-1:t.length-1);v=b.slice(0,l);x=b.slice(l);u=t.slice(f);p=t.slice(0,f);k=[t[f],t[k],b[l]];y.push([t[f],b[l],b[h]]);y.push(k);b=v.concat(u).concat(p).concat(x)}return{shape:b,
+isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,h=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),k,f,l,n,t={};k=0;for(f=e.length;k<f;k++)n=e[k].x+":"+e[k].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=k;k=0;for(f=b.length;k<f;k++){l=b[k];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=t[n],n!==void 0&&(l[e]=n)}k=0;for(f=h.length;k<f;k++){l=h[k];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=t[n],n!==void 0&&(l[e]=n)}return b.concat(h)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,h){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
 this.b3p3(a,h)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",h=c.weight!==void 0?c.weight:"normal",k=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=h;THREE.FontUtils.style=k};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var u=a.hierarchy[b].keys[e].morphTargets[n];l[u]=-1}a.hierarchy[b].usedMorphTargets=l;for(e=0;e<a.hierarchy[b].keys.length;e++){var t=
-{};for(u in l){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===u){t[u]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(t[u]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=t}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var t=a.hierarchy[b].keys[e].morphTargets[n];l[t]=-1}a.hierarchy[b].usedMorphTargets=l;for(e=0;e<a.hierarchy[b].keys.length;e++){var p=
+{};for(t in l){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===t){p[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(p[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=p}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,h;for(b=0;b<e;b++){h=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
 THREE.Bone?h.skinMatrix:h.matrix;var k=h.animationCache.prevKey;h=h.animationCache.nextKey;k.pos=this.data.hierarchy[b].keys[0];k.rot=this.data.hierarchy[b].keys[0];k.scl=this.data.hierarchy[b].keys[0];h.pos=this.getNextKeyWith("pos",b,1);h.rot=this.getNextKeyWith("rot",b,1);h.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,h,k,f,l,n,u,t=this.data.JIT.hierarchy,p,w;this.currentTime+=a*this.timeScale;w=this.currentTime;p=this.currentTime%=this.data.length;u=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(a=this.hierarchy[v],n=a.animationCache,this.JITCompile&&t[v][u]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=t[v][u],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=t[v][u],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var x=0;x<3;x++){b=c[x];f=n.prevKey[b];l=n.nextKey[b];if(l.time<=w){if(p<w)if(this.loop){f=this.data.hierarchy[v].keys[0];for(l=this.getNextKeyWith(b,v,1);l.time<p;)f=l,l=this.getNextKeyWith(b,v,l.index+1)}else{this.stop();return}else{do f=l,l=this.getNextKeyWith(b,v,l.index+1);while(l.time<
-p)}n.prevKey[b]=f;n.nextKey[b]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-f.time)/(l.time-f.time);h=f[b];k=l[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+v),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=h[0]+(k[0]-h[0])*e,b.y=h[1]+(k[1]-h[1])*e,b.z=h[2]+(k[2]-h[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",v,f.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,l.index+1).pos,e=e*0.33+0.33,h=this.interpolateCatmullRom(this.points,e),b.x=h[0],b.y=h[1],b.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(h,k,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=h[0]+(k[0]-h[0])*e,b.y=h[1]+(k[1]-h[1])*e,b.z=h[2]+(k[2]-h[2])*e}}if(this.JITCompile&&t[0][u]===void 0){this.hierarchy[0].update(null,!0);for(v=0;v<this.hierarchy.length;v++)t[v][u]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],h,k,f,l,n,u;h=(a.length-1)*c;k=Math.floor(h);h-=k;b[0]=k===0?k:k-1;b[1]=k;b[2]=k>a.length-2?k:k+1;b[3]=k>a.length-3?k:k+2;k=a[b[0]];l=a[b[1]];n=a[b[2]];u=a[b[3]];b=h*h;f=h*b;e[0]=this.interpolate(k[0],l[0],n[0],u[0],h,b,f);e[1]=this.interpolate(k[1],l[1],n[1],u[1],h,b,f);e[2]=this.interpolate(k[2],l[2],n[2],u[2],h,b,f);return e};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,h,k,f,l,n,t,p=this.data.JIT.hierarchy,v,x;this.currentTime+=a*this.timeScale;x=this.currentTime;v=this.currentTime%=this.data.length;t=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(a=this.hierarchy[u],n=a.animationCache,this.JITCompile&&p[u][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=p[u][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=p[u][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];f=n.prevKey[b];l=n.nextKey[b];if(l.time<=x){if(v<x)if(this.loop){f=this.data.hierarchy[u].keys[0];for(l=this.getNextKeyWith(b,u,1);l.time<v;)f=l,l=this.getNextKeyWith(b,u,l.index+1)}else{this.stop();return}else{do f=l,l=this.getNextKeyWith(b,u,l.index+1);while(l.time<
+v)}n.prevKey[b]=f;n.nextKey[b]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(v-f.time)/(l.time-f.time);h=f[b];k=l[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=h[0]+(k[0]-h[0])*e,b.y=h[1]+(k[1]-h[1])*e,b.z=h[2]+(k[2]-h[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",u,f.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,l.index+1).pos,e=e*0.33+0.33,h=this.interpolateCatmullRom(this.points,e),b.x=h[0],b.y=h[1],b.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(h,k,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=h[0]+(k[0]-h[0])*e,b.y=h[1]+(k[1]-h[1])*e,b.z=h[2]+(k[2]-h[2])*e}}if(this.JITCompile&&p[0][t]===void 0){this.hierarchy[0].update(null,!0);for(u=0;u<this.hierarchy.length;u++)p[u][t]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],h,k,f,l,n,t;h=(a.length-1)*c;k=Math.floor(h);h-=k;b[0]=k===0?k:k-1;b[1]=k;b[2]=k>a.length-2?k:k+1;b[3]=k>a.length-3?k:k+2;k=a[b[0]];l=a[b[1]];n=a[b[2]];t=a[b[3]];b=h*h;f=h*b;e[0]=this.interpolate(k[0],l[0],n[0],t[0],h,b,f);e[1]=this.interpolate(k[1],l[1],n[1],t[1],h,b,f);e[2]=this.interpolate(k[2],l[2],n[2],t[2],h,b,f);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,h,k,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*k+a*h+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -439,9 +438,12 @@ this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.p
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
 this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,h,k,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,k,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,h);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
-THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
-THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,h,k,f){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,k,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,h);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
+THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
+THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
+THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
+THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
@@ -450,7 +452,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*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;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function h(a,b,c,e){var k={name:c,fps:0.6,length:e,hierarchy:[]},f,h=b.getControlPointsArray(),l=b.getLength(),y=h.length,G=0;f=y-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:e,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<y-1;f++)G=e*l.chunks[f]/l.total,b.keys[f]={time:G,pos:h[f]};k.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function h(a,b,c,e){var k={name:c,fps:0.6,length:e,hierarchy:[]},f,h=b.getControlPointsArray(),l=b.getLength(),B=h.length,A=0;f=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:e,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<B-1;f++)A=e*l.chunks[f]/l.total,b.keys[f]={time:A,pos:h[f]};k.hierarchy[0]=
 b;THREE.AnimationHandler.add(k);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(a,b){var c,e,k=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),k.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return k}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,l=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*l;this.theta=this.lon*l;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
@@ -468,199 +470,200 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,f=!1,l=1,n=0,u=0,t=0,p=0,w=0,v=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*p);this.rotateVertically(c*w)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*u);this.object.translateY(c*t);f&&(this.roll+=this.rollSpeed*a*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);e.set(0,1,0);b.cross(e,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,f=!1,l=1,n=0,t=0,p=0,v=0,x=0,u=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*v);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*p);f&&(this.roll+=this.rollSpeed*a*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);e.set(0,1,0);b.cross(e,
 h).normalize();e.cross(h,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=h.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=h.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-v)/window.innerWidth;w=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:u=-1;break;case 40:case 83:n=-1;break;case 39:case 68:u=1;break;case 81:f=!0;l=1;break;case 69:f=!0;l=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:u=0;break;case 40:case 83:n=0;break;case 39:case 68:u=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:t=0;break;case 70:t=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){v=(a.clientX-u)/window.innerWidth;x=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:f=!0;l=1;break;case 69:f=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:p=0;break;case 70:p=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var h=!1,k=e.NONE,f=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,u=new THREE.Vector2,t=new THREE.Vector2,p=new THREE.Vector2,w=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var h=!1,k=e.NONE,f=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,p=new THREE.Vector2,v=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),k=e.length();k>1?e.normalize():e.z=Math.sqrt(1-k*k);f.copy(b.object.position).subSelf(b.target);k=b.object.up.clone().setLength(e.y);k.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));k.addSelf(f.setLength(e.z));return k};this.rotateCamera=function(){var a=Math.acos(l.dot(n)/l.length()/n.length());if(a){var c=(new THREE.Vector3).cross(l,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
-e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?l=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(l))}};this.zoomCamera=function(){var a=1+(t.y-u.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?u=t:u.y+=(t.y-u.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=w.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=w:p.addSelf(a.sub(w,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(h&&(l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),u=t=b.getMouseOnScreen(a.clientX,a.clientY),p=w=b.getMouseOnScreen(a.clientX,a.clientY),h=!1),k!==e.NONE&&(k===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):k===e.ZOOM&&!b.noZoom?t=b.getMouseOnScreen(a.clientX,
-a.clientY):k===e.PAN&&!b.noPan&&(w=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),k===e.NONE))k=a.button,k===e.ROTATE?l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):k===e.ZOOM&&!b.noZoom?u=t=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=w=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?l=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(l))}};this.zoomCamera=function(){var a=1+(p.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?t=p:t.y+=(p.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(v);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?v=x:v.addSelf(a.sub(x,v).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(h&&(l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=p=b.getMouseOnScreen(a.clientX,a.clientY),v=x=b.getMouseOnScreen(a.clientX,a.clientY),h=!1),k!==e.NONE&&(k===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):k===e.ZOOM&&!b.noZoom?p=b.getMouseOnScreen(a.clientX,
+a.clientY):k===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),k===e.NONE))k=a.button,k===e.ROTATE?l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):k===e.ZOOM&&!b.noZoom?t=p=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(v=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 k=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&k===e.NONE){if(a.keyCode===b.keys[e.ROTATE])k=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)k=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)k=e.PAN;k!==e.NONE&&(h=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&k!==e.NONE)k=e.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,e,h,k,f,l){function n(a,b,c,f,l,n,p,t){var v,w,x=e||1,y=h||1,o=l/2,z=n/2,A=u.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=k||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=k||1;var G=x+1,B=y+1;l/=x;var C=n/y;for(w=0;w<B;w++)for(n=0;n<G;n++){var da=new THREE.Vector3;da[a]=(n*l-o)*c;da[b]=(w*C-z)*f;da[v]=p;u.vertices.push(new THREE.Vertex(da))}for(w=0;w<y;w++)for(n=0;n<x;n++)u.faces.push(new THREE.Face4(n+
-G*w+A,n+G*(w+1)+A,n+1+G*(w+1)+A,n+1+G*w+A,null,null,t)),u.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var u=this,t=a/2,p=c/2,w=b/2,v,z,x,y,G,A;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(f)}v=0;y=1;z=2;G=3;x=4;A=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var B in l)this.sides[B]!=
-void 0&&(this.sides[B]=l[B]);this.sides.px&&n("z","y",-1,-1,b,c,t,v);this.sides.nx&&n("z","y",1,-1,b,c,-t,y);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,G);this.sides.pz&&n("x","y",1,-1,a,c,w,x);this.sides.nz&&n("x","y",-1,-1,a,c,-w,A);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,h,k){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,h=h||1,l,n,u=[],t=[];for(n=0;n<=h;n++){var p=[],w=[],v=n/h,z=v*(c-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(x*Math.PI*2),-v*b+f,z*Math.cos(x*Math.PI*2))));p.push(this.vertices.length-1);w.push(new THREE.UV(x,v))}u.push(p);t.push(w)}for(n=0;n<h;n++)for(l=0;l<e;l++){var b=u[n][l],p=u[n+1][l],w=u[n+1][l+1],v=u[n][l+1],z=
-this.vertices[b].position.clone().setY(0).normalize(),x=this.vertices[p].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),G=this.vertices[v].position.clone().setY(0).normalize(),A=t[n][l].clone(),B=t[n+1][l].clone(),D=t[n+1][l+1].clone(),O=t[n][l+1].clone();this.faces.push(new THREE.Face4(b,p,w,v,[z,x,y,G]));this.faceVertexUvs[0].push([A,B,D,O])}if(!k&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(l=0;l<e;l++)b=u[0][l],p=u[0][l+
-1],w=this.vertices.length-1,z=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=t[0][l].clone(),B=t[0][l+1].clone(),D=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(b,p,w,[z,x,y])),this.faceVertexUvs[0].push([A,B,D])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(l=0;l<e;l++)b=u[n][l+1],p=u[n][l],w=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=t[n][l+1].clone(),B=t[n][l].clone(),
-D=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(b,p,w,[z,x,y])),this.faceVertexUvs[0].push([A,B,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,e,h,k,f,l){function n(a,b,c,f,l,n,p,u){var v,w,x=e||1,y=h||1,o=l/2,B=n/2,A=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=k||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=k||1;var z=x+1,E=y+1;l/=x;var Q=n/y;for(w=0;w<E;w++)for(n=0;n<z;n++){var ia=new THREE.Vector3;ia[a]=(n*l-o)*c;ia[b]=(w*Q-B)*f;ia[v]=p;t.vertices.push(new THREE.Vertex(ia))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
+z*w+A,n+z*(w+1)+A,n+1+z*(w+1)+A,n+1+z*w+A,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,p=a/2,v=c/2,x=b/2,u,y,w,B,A,E;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(u=0;u<6;u++)this.materials.push(f)}u=0;B=1;y=2;A=3;w=4;E=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var z in l)this.sides[z]!=
+void 0&&(this.sides[z]=l[z]);this.sides.px&&n("z","y",-1,-1,b,c,p,u);this.sides.nx&&n("z","y",1,-1,b,c,-p,B);this.sides.py&&n("x","z",1,1,a,b,v,y);this.sides.ny&&n("x","z",1,-1,a,b,-v,A);this.sides.pz&&n("x","y",1,-1,a,c,x,w);this.sides.nz&&n("x","y",-1,-1,a,c,-x,E);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,h,k){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,h=h||1,l,n,t=[],p=[];for(n=0;n<=h;n++){var v=[],x=[],u=n/h,y=u*(c-a)+a;for(l=0;l<=e;l++){var w=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(w*Math.PI*2),-u*b+f,y*Math.cos(w*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(w,u))}t.push(v);p.push(x)}for(n=0;n<h;n++)for(l=0;l<e;l++){var b=t[n][l],v=t[n+1][l],x=t[n+1][l+1],u=t[n][l+1],y=
+this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[u].position.clone().setY(0).normalize(),E=p[n][l].clone(),z=p[n+1][l].clone(),D=p[n+1][l+1].clone(),M=p[n][l+1].clone();this.faces.push(new THREE.Face4(b,v,x,u,[y,w,B,A]));this.faceVertexUvs[0].push([E,z,D,M])}if(!k&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(l=0;l<e;l++)b=t[0][l],v=t[0][l+
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),E=p[0][l].clone(),z=p[0][l+1].clone(),D=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(b,v,x,[y,w,B])),this.faceVertexUvs[0].push([E,z,D])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(l=0;l<e;l++)b=t[n][l+1],v=t[n][l],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),E=p[n][l+1].clone(),z=p[n][l].clone(),
+D=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(b,v,x,[y,w,B])),this.faceVertexUvs[0].push([E,z,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,h;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)h=a[b],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(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,h=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);k.set(a.x-c.x,a.y-c.y);e=e.normalize();k=k.normalize();f.set(-e.y,e.x);h.set(k.y,-k.x);l.copy(a).addSelf(f);n.copy(a).addSelf(h);if(l.equals(n))return h.clone();
-l.copy(b).addSelf(f);n.copy(c).addSelf(h);f=e.dot(h);h=n.subSelf(l).dot(h);f===0&&(console.log("Either infinite or no solutions!"),h===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=f;if(h<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(h).addSelf(l).subSelf(a).clone()}function h(a){for(K=a.length;--K>=0;){V=K;X=K-1;X<0&&(X=a.length-
-1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=$*b,k=$*(b+1),f=la+V+e,h=la+V+k,o=f,e=la+X+e,k=la+X+k,p=h;o+=M;e+=M;k+=M;p+=M;Q.faces.push(new THREE.Face4(o,e,k,p,null,null,D));D&&(o=b/c,e=(b+1)/c,k=l+n*2,f=(Q.vertices[f].position.z+n)/k,h=(Q.vertices[h].position.z+n)/k,Q.faceVertexUvs[0].push([new THREE.UV(f,o),new THREE.UV(h,o),new THREE.UV(h,e),new THREE.UV(f,e)]))}}}function k(a,b,c){Q.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=M;b+=M;c+=M;Q.faces.push(new THREE.Face3(a,
-b,c,null,null,B));if(B){var e=O.maxY,k=O.maxX,f=Q.vertices[b].position.x,b=Q.vertices[b].position.y,h=Q.vertices[c].position.x,c=Q.vertices[c].position.y;Q.faceVertexUvs[0].push([new THREE.UV(Q.vertices[a].position.x/k,Q.vertices[a].position.y/e),new THREE.UV(f/k,b/e),new THREE.UV(h/k,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,x=c.extrudePath,y,G=!1,A=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,O=this.shapebb;if(x)y=x.getPoints(w),v=y.length,G=!0,p=!1;p||(u=n=t=0);var I,H,P,Q=this,M=this.vertices.length;z&&a.addWrapPath(z);w=A?a.extractAllSpacedPoints(w):a.extractAllPoints(w);z=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();H=0;for(P=w.length;H<P;H++)I=w[H],THREE.Shape.Utils.isClockWise(I)&&
-(w[H]=I.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;H=0;for(P=w.length;H<P;H++)I=w[H],z=z.concat(I);var K,N,ea,Y,S,o,$=z.length,T=x.length,oa=[];K=0;N=A.length;V=N-1;for(X=K+1;K<N;K++,V++,X++)V===N&&(V=0),X===N&&(X=0),oa[K]=e(A[K],A[V],A[X]);var W=[],C,da=oa.concat();H=0;for(P=w.length;H<P;H++){I=w[H];C=[];K=0;N=I.length;V=N-1;for(X=K+1;K<N;K++,V++,X++)V===N&&(V=0),X===N&&(X=0),C[K]=e(I[K],I[V],I[X]);W.push(C);da=da.concat(C)}for(ea=0;ea<t;ea++){Y=ea/t;S=n*(1-Y);Y=u*Math.sin(Y*Math.PI/
-2);K=0;for(N=A.length;K<N;K++)o=b(A[K],oa[K],Y),k(o.x,o.y,-S);H=0;for(P=w.length;H<P;H++){I=w[H];C=W[H];K=0;for(N=I.length;K<N;K++)o=b(I[K],C[K],Y),k(o.x,o.y,-S)}}Y=u;for(K=0;K<$;K++)o=p?b(z[K],da[K],Y):z[K],G?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(ea=1;ea<=v;ea++)for(K=0;K<$;K++)o=p?b(z[K],da[K],Y):z[K],G?k(o.x,o.y+y[ea-1].y,y[ea-1].x):k(o.x,o.y,l/v*ea);for(ea=t-1;ea>=0;ea--){Y=ea/t;S=n*(1-Y);Y=u*Math.sin(Y*Math.PI/2);K=0;for(N=A.length;K<N;K++)o=b(A[K],oa[K],Y),k(o.x,o.y,l+S);H=0;for(P=w.length;H<
-P;H++){I=w[H];C=W[H];K=0;for(N=I.length;K<N;K++)o=b(I[K],C[K],Y),G?k(o.x,o.y+y[v-1].y,y[v-1].x+S):k(o.x,o.y,l+S)}}if(p){p=$*0;for(K=0;K<T;K++)u=x[K],f(u[2]+p,u[1]+p,u[0]+p);p=$*(v+t*2);for(K=0;K<T;K++)u=x[K],f(u[0]+p,u[1]+p,u[2]+p)}else{for(K=0;K<T;K++)u=x[K],f(u[2],u[1],u[0]);for(K=0;K<T;K++)u=x[K],f(u[0]+$*v,u[1]+$*v,u[2]+$*v)}var V,X,la=0;h(A);la+=A.length;H=0;for(P=w.length;H<P;H++)I=w[H],h(I),la+=I.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+l.copy(b).addSelf(f);n.copy(c).addSelf(h);f=e.dot(h);h=n.subSelf(l).dot(h);f===0&&(console.log("Either infinite or no solutions!"),h===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=f;if(h<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(h).addSelf(l).subSelf(a).clone()}function h(a){for(N=a.length;--N>=0;){da=N;$=N-1;$<0&&($=a.length-
+1);for(var b=0,c=u+p*2,b=0;b<c;b++){var e=ca*b,k=ca*(b+1),f=ma+da+e,h=ma+da+k,o=f,e=ma+$+e,k=ma+$+k,t=h;o+=O;e+=O;k+=O;t+=O;K.faces.push(new THREE.Face4(o,e,k,t,null,null,D));D&&(o=b/c,e=(b+1)/c,k=l+n*2,f=(K.vertices[f].position.z+n)/k,h=(K.vertices[h].position.z+n)/k,K.faceVertexUvs[0].push([new THREE.UV(f,o),new THREE.UV(h,o),new THREE.UV(h,e),new THREE.UV(f,e)]))}}}function k(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=O;b+=O;c+=O;K.faces.push(new THREE.Face3(a,
+b,c,null,null,z));if(z){var e=M.maxY,k=M.maxX,f=K.vertices[b].position.x,b=K.vertices[b].position.y,h=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/k,K.vertices[a].position.y/e),new THREE.UV(f/k,b/e),new THREE.UV(h/k,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,v=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,w=c.extrudePath,B,A=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,z=c.material,D=c.extrudeMaterial,M=this.shapebb;if(w)B=w.getPoints(x),u=B.length,A=!0,v=!1;v||(t=n=p=0);var I,C,P,K=this,O=this.vertices.length;y&&a.addWrapPath(y);x=E?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(w=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();C=0;for(P=x.length;C<P;C++)I=x[C],THREE.Shape.Utils.isClockWise(I)&&
+(x[C]=I.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(y,x);E=y;C=0;for(P=x.length;C<P;C++)I=x[C],y=y.concat(I);var N,H,W,Z,U,o,ca=y.length,X=w.length,oa=[];N=0;H=E.length;da=H-1;for($=N+1;N<H;N++,da++,$++)da===H&&(da=0),$===H&&($=0),oa[N]=e(E[N],E[da],E[$]);var L=[],Q,ia=oa.concat();C=0;for(P=x.length;C<P;C++){I=x[C];Q=[];N=0;H=I.length;da=H-1;for($=N+1;N<H;N++,da++,$++)da===H&&(da=0),$===H&&($=0),Q[N]=e(I[N],I[da],I[$]);L.push(Q);ia=ia.concat(Q)}for(W=0;W<p;W++){Z=W/p;U=n*(1-Z);Z=t*Math.sin(Z*
+Math.PI/2);N=0;for(H=E.length;N<H;N++)o=b(E[N],oa[N],Z),k(o.x,o.y,-U);C=0;for(P=x.length;C<P;C++){I=x[C];Q=L[C];N=0;for(H=I.length;N<H;N++)o=b(I[N],Q[N],Z),k(o.x,o.y,-U)}}Z=t;for(N=0;N<ca;N++)o=v?b(y[N],ia[N],Z):y[N],A?k(o.x,o.y+B[0].y,B[0].x):k(o.x,o.y,0);for(W=1;W<=u;W++)for(N=0;N<ca;N++)o=v?b(y[N],ia[N],Z):y[N],A?k(o.x,o.y+B[W-1].y,B[W-1].x):k(o.x,o.y,l/u*W);for(W=p-1;W>=0;W--){Z=W/p;U=n*(1-Z);Z=t*Math.sin(Z*Math.PI/2);N=0;for(H=E.length;N<H;N++)o=b(E[N],oa[N],Z),k(o.x,o.y,l+U);C=0;for(P=x.length;C<
+P;C++){I=x[C];Q=L[C];N=0;for(H=I.length;N<H;N++)o=b(I[N],Q[N],Z),A?k(o.x,o.y+B[u-1].y,B[u-1].x+U):k(o.x,o.y,l+U)}}if(v){v=ca*0;for(N=0;N<X;N++)t=w[N],f(t[2]+v,t[1]+v,t[0]+v);v=ca*(u+p*2);for(N=0;N<X;N++)t=w[N],f(t[0]+v,t[1]+v,t[2]+v)}else{for(N=0;N<X;N++)t=w[N],f(t[2],t[1],t[0]);for(N=0;N<X;N++)t=w[N],f(t[0]+ca*u,t[1]+ca*u,t[2]+ca*u)}var da,$,ma=0;h(E);ma+=E.length;C=0;for(P=x.length;C<P;C++)I=x[C],h(I),ma+=I.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=h.vertices[a].position,k=h.vertices[b].position;return c((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,k);b(0,5,1,k);b(0,1,7,k);b(0,7,10,k);b(0,10,11,k);b(1,5,9,k);b(5,11,4,k);b(11,10,2,k);b(10,7,6,k);b(7,1,8,k);b(3,9,4,k);b(3,4,2,k);b(3,2,6,k);b(3,6,8,k);b(3,8,9,k);b(4,9,5,k);b(2,4,11,k);b(6,2,10,k);b(8,6,7,k);b(9,8,1,k);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,l;for(l in k.faces){var n=e(k.faces[l].a,k.faces[l].b),u=e(k.faces[l].b,k.faces[l].c),t=e(k.faces[l].c,k.faces[l].a);b(k.faces[l].a,n,t,a);b(k.faces[l].b,u,
-n,a);b(k.faces[l].c,t,u,a);b(n,u,t,a)}k.faces=a.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,k);b(0,5,1,k);b(0,1,7,k);b(0,7,10,k);b(0,10,11,k);b(1,5,9,k);b(5,11,4,k);b(11,10,2,k);b(10,7,6,k);b(7,1,8,k);b(3,9,4,k);b(3,4,2,k);b(3,2,6,k);b(3,6,8,k);b(3,8,9,k);b(4,9,5,k);b(2,4,11,k);b(6,2,10,k);b(8,6,7,k);b(9,8,1,k);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,l;for(l in k.faces){var n=e(k.faces[l].a,k.faces[l].b),t=e(k.faces[l].b,k.faces[l].c),p=e(k.faces[l].c,k.faces[l].a);b(k.faces[l].a,n,p,a);b(k.faces[l].b,t,
+n,a);b(k.faces[l].c,p,t,a);b(n,t,p,a)}k.faces=a.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],h=[],k=[],f=(new THREE.Matrix4).setRotationZ(c),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),b[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.001;n+=c){for(l=0;l<b.length;l++)n<this.angle?(b[l]=f.multiplyVector3(b[l].clone()),this.vertices.push(new THREE.Vertex(b[l])),h[l]=this.vertices.length-1):h=k;n==0&&(k=e);
 for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(h[l],h[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,l/a.length),new THREE.UV(1-n/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,l/a.length)]);e=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,l){l<1?(l=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),l.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
 f.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),f.faceVertexUvs[0].push([k(a.uv,a.position,l),k(b.uv,b.position,l),k(c.uv,c.position,l)])):(l-=1,e(a,h(a,b),h(a,c),l),e(h(a,b),b,h(b,c),l),e(h(a,c),h(b,c),c,l),e(h(a,b),h(b,c),h(a,c),l))}function h(a,c){l[a.index]||(l[a.index]=[]);l[c.index]||(l[c.index]=[]);var e=l[a.index][c.index];e===void 0&&(l[a.index][c.index]=l[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function k(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var l=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var h,k=a/2,f=c/2,b=b||1,e=e||1,l=b+1,n=e+1;a/=b;var u=c/e;for(h=0;h<n;h++)for(c=0;c<l;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-k,-(h*u-f),0)));for(h=0;h<e;h++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+l*h,c+l*(h+1),c+1+l*(h+1),c+1+l*h)),this.faceVertexUvs[0].push([new THREE.UV(c/b,h/e),new THREE.UV(c/b,(h+1)/e),new THREE.UV((c+1)/b,(h+1)/e),new THREE.UV((c+1)/b,h/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var h,k=a/2,f=c/2,b=b||1,e=e||1,l=b+1,n=e+1;a/=b;var t=c/e;for(h=0;h<n;h++)for(c=0;c<l;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-k,-(h*t-f),0)));for(h=0;h<e;h++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+l*h,c+l*(h+1),c+1+l*(h+1),c+1+l*h)),this.faceVertexUvs[0].push([new THREE.UV(c/b,h/e),new THREE.UV(c/b,(h+1)/e),new THREE.UV((c+1)/b,(h+1)/e),new THREE.UV((c+1)/b,h/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,h=Math.PI,k=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var l=a*Math.cos(e*h),n=a*Math.sin(e*h),u=[],t=0;for(e=0;e<k;e++){var p=2*e/k,w=n*Math.sin(p*h),p=n*Math.cos(p*h);(b==0||b==f)&&e>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,l,w)))-1);u.push(t)}c.push(u)}for(var v,z,x,h=c.length,b=0;b<h;b++)if(k=c[b].length,b>0)for(e=0;e<k;e++){u=e==k-1;f=c[b][u?0:e+1];l=c[b][u?k-1:e];n=c[b-1][u?
-k-1:e];u=c[b-1][u?0:e+1];w=b/(h-1);v=(b-1)/(h-1);z=(e+1)/k;var p=e/k,t=new THREE.UV(1-z,w),w=new THREE.UV(1-p,w),p=new THREE.UV(1-p,v),y=new THREE.UV(1-z,v);b<c.length-1&&(v=this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),x=this.vertices[n].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,l,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,w,p]));b>1&&(v=
-this.vertices[f].position.clone(),z=this.vertices[n].position.clone(),x=this.vertices[u].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,n,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,p,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,h=Math.PI,k=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var l=a*Math.cos(e*h),n=a*Math.sin(e*h),t=[],p=0;for(e=0;e<k;e++){var v=2*e/k,x=n*Math.sin(v*h),v=n*Math.cos(v*h);(b==0||b==f)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,l,x)))-1);t.push(p)}c.push(t)}for(var u,y,w,h=c.length,b=0;b<h;b++)if(k=c[b].length,b>0)for(e=0;e<k;e++){t=e==k-1;f=c[b][t?0:e+1];l=c[b][t?k-1:e];n=c[b-1][t?
+k-1:e];t=c[b-1][t?0:e+1];x=b/(h-1);u=(b-1)/(h-1);y=(e+1)/k;var v=e/k,p=new THREE.UV(1-y,x),x=new THREE.UV(1-v,x),v=new THREE.UV(1-v,u),B=new THREE.UV(1-y,u);b<c.length-1&&(u=this.vertices[f].position.clone(),y=this.vertices[l].position.clone(),w=this.vertices[n].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,l,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,x,v]));b>1&&(u=
+this.vertices[f].position.clone(),y=this.vertices[n].position.clone(),w=this.vertices[t].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,n,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,v,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,h=String(a).split(""),k=h.length,f=[],a=0;a<k;a++){var l=new THREE.Path,l=this.extractGlyphPoints(h[a],c,b,e,l);e+=l.offset;f.push(l.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,h){var k=[],f,l,n,u,t,p,w,v,z,x,y=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));n=c.length;for(a=0;a<n;)switch(l=c[a++],l){case "m":l=c[a++]*b+e;u=c[a++]*b;k.push(new THREE.Vector2(l,
-u));h.moveTo(l,u);break;case "l":l=c[a++]*b+e;u=c[a++]*b;k.push(new THREE.Vector2(l,u));h.lineTo(l,u);break;case "q":l=c[a++]*b+e;u=c[a++]*b;w=c[a++]*b+e;v=c[a++]*b;h.quadraticCurveTo(w,v,l,u);if(f=k[k.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var G=f/divisions,A=THREE.Shape.Utils.b2(G,t,w,l),G=THREE.Shape.Utils.b2(G,p,v,u);k.push(new THREE.Vector2(A,G))}}break;case "b":if(l=c[a++]*b+e,u=c[a++]*b,w=c[a++]*b+e,v=c[a++]*-b,z=c[a++]*b+e,x=c[a++]*-b,h.bezierCurveTo(l,u,
-w,v,z,x),f=k[k.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)G=f/divisions,A=THREE.Shape.Utils.b3(G,t,w,z,l),G=THREE.Shape.Utils.b3(G,p,v,x,u),k.push(new THREE.Vector2(A,G))}}}return{offset:y.ha*b,points:k,path:h}}}};
-(function(a){var c=function(a){for(var c=a.length,h=0,k=c-1,f=0;f<c;k=f++)h+=a[k].x*a[f].y-a[f].x*a[k].y;return h*0.5};a.Triangulate=function(a,e){var h=a.length;if(h<3)return null;var k=[],f=[],l=[],n,u,t;if(c(a)>0)for(u=0;u<h;u++)f[u]=u;else for(u=0;u<h;u++)f[u]=h-1-u;var p=2*h;for(u=h-1;h>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return k}n=u;h<=n&&(n=0);u=n+1;h<=u&&(u=0);t=u+1;h<=t&&(t=0);var w;a:{w=a;var v=n,z=u,x=t,y=h,G=f,A=void 0,B=void 0,D=void 0,
-O=void 0,I=void 0,H=void 0,P=void 0,Q=void 0,M=void 0,B=w[G[v]].x,D=w[G[v]].y,O=w[G[z]].x,I=w[G[z]].y,H=w[G[x]].x,P=w[G[x]].y;if(1.0E-10>(O-B)*(P-D)-(I-D)*(H-B))w=!1;else{for(A=0;A<y;A++)if(!(A==v||A==z||A==x)){var Q=w[G[A]].x,M=w[G[A]].y,K=void 0,N=void 0,ea=void 0,Y=void 0,S=void 0,o=void 0,$=void 0,T=void 0,oa=void 0,W=void 0,C=void 0,da=void 0,K=ea=S=void 0,K=H-O,N=P-I,ea=B-H,Y=D-P,S=O-B,o=I-D,$=Q-B,T=M-D,oa=Q-O,W=M-I,C=Q-H,da=M-P,K=K*W-N*oa,S=S*T-o*$,ea=ea*da-Y*C;if(K>=0&&ea>=0&&S>=0){w=!1;break a}}w=
-!0}}if(w){k.push([a[f[n]],a[f[u]],a[f[t]]]);l.push([f[n],f[u],f[t]]);n=u;for(t=u+1;t<h;n++,t++)f[n]=f[t];h--;p=2*h}}if(e)return l;return k};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),b=this.size/c.resolution,e=0,h=String(a).split(""),k=h.length,f=[],a=0;a<k;a++){var l=new THREE.Path,l=this.extractGlyphPoints(h[a],c,b,e,l);e+=l.offset;f.push(l.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,h){var k=[],f,l,n,t,p,v,x,u,y,w,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));n=c.length;for(a=0;a<n;)switch(l=c[a++],l){case "m":l=c[a++]*b+e;t=c[a++]*b;k.push(new THREE.Vector2(l,
+t));h.moveTo(l,t);break;case "l":l=c[a++]*b+e;t=c[a++]*b;k.push(new THREE.Vector2(l,t));h.lineTo(l,t);break;case "q":l=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;u=c[a++]*b;h.quadraticCurveTo(x,u,l,t);if(f=k[k.length-1]){p=f.x;v=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var A=f/divisions,E=THREE.Shape.Utils.b2(A,p,x,l),A=THREE.Shape.Utils.b2(A,v,u,t);k.push(new THREE.Vector2(E,A))}}break;case "b":if(l=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,u=c[a++]*-b,y=c[a++]*b+e,w=c[a++]*-b,h.bezierCurveTo(l,t,
+x,u,y,w),f=k[k.length-1]){p=f.x;v=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)A=f/divisions,E=THREE.Shape.Utils.b3(A,p,x,y,l),A=THREE.Shape.Utils.b3(A,v,u,w,t),k.push(new THREE.Vector2(E,A))}}}return{offset:B.ha*b,points:k,path:h}}}};
+(function(a){var c=function(a){for(var c=a.length,h=0,k=c-1,f=0;f<c;k=f++)h+=a[k].x*a[f].y-a[f].x*a[k].y;return h*0.5};a.Triangulate=function(a,e){var h=a.length;if(h<3)return null;var k=[],f=[],l=[],n,t,p;if(c(a)>0)for(t=0;t<h;t++)f[t]=t;else for(t=0;t<h;t++)f[t]=h-1-t;var v=2*h;for(t=h-1;h>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return k}n=t;h<=n&&(n=0);t=n+1;h<=t&&(t=0);p=t+1;h<=p&&(p=0);var x;a:{x=a;var u=n,y=t,w=p,B=h,A=f,E=void 0,z=void 0,D=void 0,
+M=void 0,I=void 0,C=void 0,P=void 0,K=void 0,O=void 0,z=x[A[u]].x,D=x[A[u]].y,M=x[A[y]].x,I=x[A[y]].y,C=x[A[w]].x,P=x[A[w]].y;if(1.0E-10>(M-z)*(P-D)-(I-D)*(C-z))x=!1;else{for(E=0;E<B;E++)if(!(E==u||E==y||E==w)){var K=x[A[E]].x,O=x[A[E]].y,N=void 0,H=void 0,W=void 0,Z=void 0,U=void 0,o=void 0,ca=void 0,X=void 0,oa=void 0,L=void 0,Q=void 0,ia=void 0,N=W=U=void 0,N=C-M,H=P-I,W=z-C,Z=D-P,U=M-z,o=I-D,ca=K-z,X=O-D,oa=K-M,L=O-I,Q=K-C,ia=O-P,N=N*L-H*oa,U=U*X-o*ca,W=W*ia-Z*Q;if(N>=0&&W>=0&&U>=0){x=!1;break a}}x=
+!0}}if(x){k.push([a[f[n]],a[f[t]],a[f[p]]]);l.push([f[n],f[t],f[p]]);n=t;for(p=t+1;p<h;n++,p++)f[n]=f[p];h--;v=2*h}}if(e)return l;return k};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,e,h){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var k=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(f))*Math.cos(k);l.y=(this.radius+this.tube*Math.cos(f))*Math.sin(k);l.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(l.clone().subSelf(h).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var h=(this.segmentsT+1)*b+e-1,k=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,l=(this.segmentsT+1)*b+e,n=new THREE.Face4(h,k,f,l,[c[h],c[k],c[f],c[l]]);n.normal.addSelf(c[h]);n.normal.addSelf(c[k]);n.normal.addSelf(c[f]);n.normal.addSelf(c[l]);n.normal.normalize();this.faces.push(n);
 this.faceVertexUvs[0].push([a[h].clone(),a[k].clone(),a[f].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,e,h,k,f){function l(a,b,c,e,k,f){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(k*(2+c)*0.5*Math.cos(a),k*(2+c)*Math.sin(a)*0.5,f*k*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=h||2;this.q=k||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;k=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,h=l(n,f,this.q,this.p,this.radius,this.heightScale),n=l(n+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=n.x-h.x;b.y=n.y-h.y;b.z=n.z-h.z;e.x=n.x+h.x;e.y=n.y+h.y;e.z=n.z+h.z;k.cross(b,e);e.cross(k,b);k.normalize();e.normalize();n=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);h.x+=n*e.x+f*k.x;h.y+=n*e.y+f*k.y;h.z+=n*e.z+f*k.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
-h.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][k],k=this.grid[a][k],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,b,e,k));this.faceVertexUvs[0].push([f,n,u,t])}this.computeCentroids();
+h.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][k],k=this.grid[a][k],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,b,e,k));this.faceVertexUvs[0].push([f,n,t,p])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,l,n){var t=new THREE.Face4(a,b,c,e,null,l.color,l.material);if(f.useOldVertexColors){t.vertexColors=[];for(var o,v,u,x=0;x<4;x++){u=n[x];o=new THREE.Color;o.setRGB(0,0,0);for(var w=0;w<u.length;w++)v=l.vertexColors[u[w]-1],o.r+=v.r,o.g+=v.g,o.b+=v.b;o.r/=u.length;o.g/=u.length;o.b/=u.length;t.vertexColors[x]=o}}h.push(t);(!f.supportUVs||p.length!=0)&&k.push([p[a],p[b],p[c],p[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],h=[],k=[],f=this,l=a.vertices,e=a.faces,n=l.concat(),u=[],t={},p=[],w,v,z,x,y,G=a.faceVertexUvs[0];w=0;for(v=G.length;w<v;w++){z=0;for(x=G[w].length;z<x;z++)y=e[w]["abcd".charAt(z)],p[y]||(p[y]=G[w][z])}var A;w=0;for(v=e.length;w<v;w++)if(y=e[w],u.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),f.supportUVs&&p.length!=0){A=new THREE.UV;if(y instanceof THREE.Face3)A.u=p[y.a].u+p[y.b].u+p[y.c].u,A.v=p[y.a].v+p[y.b].v+p[y.c].v,A.u/=3,A.v/=3;else if(y instanceof THREE.Face4)A.u=p[y.a].u+
-p[y.b].u+p[y.c].u+p[y.d].u,A.v=p[y.a].v+p[y.b].v+p[y.c].v+p[y.d].v,A.u/=4,A.v/=4;p.push(A)}x=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,k,f,h,l={};e=0;for(k=a.faces.length;e<k;e++)f=a.faces[e],f instanceof THREE.Face3?(h=b(f.a,f.b),c(l,h,e),h=b(f.b,f.c),c(l,h,e),h=b(f.c,f.a),c(l,h,e)):f instanceof THREE.Face4&&(h=b(f.a,f.b),c(l,h,e),h=b(f.b,f.c),c(l,h,e),h=b(f.c,f.d),c(l,h,e),h=b(f.d,f.a),c(l,h,e));return l}(a);var B,D,O=0,G=l.length,I;for(w in x)if(y=x[w],A=y[0],B=
-y[1],I=w.split("_"),v=I[0],I=I[1],D=new THREE.Vector3,y.length!=2?(D.addSelf(l[v].position),D.addSelf(l[I].position),D.multiplyScalar(0.5)):(D.addSelf(u[A]),D.addSelf(u[B]),D.addSelf(l[v].position),D.addSelf(l[I].position),D.multiplyScalar(0.25)),t[w]=G+e.length+O,n.push(new THREE.Vertex(D)),O++,f.supportUVs&&p.length!=0)A=new THREE.UV,A.u=p[v].u+p[I].u,A.v=p[v].v+p[I].v,A.u/=2,A.v/=2,p.push(A);w=0;for(v=u.length;w<v;w++)y=e[w],A=G+w,y instanceof THREE.Face3?(B=b(y.a,y.b),I=b(y.b,y.c),O=b(y.c,y.a),
-c(A,t[B],y.b,t[I],y,["123","12","2","23"]),c(A,t[I],y.c,t[O],y,["123","23","3","31"]),c(A,t[O],y.a,t[B],y,["123","31","1","12"])):y instanceof THREE.Face4?(B=b(y.a,y.b),I=b(y.b,y.c),O=b(y.c,y.d),D=b(y.d,y.a),c(A,t[B],y.b,t[I],y,["1234","12","2","23"]),c(A,t[I],y.c,t[O],y,["1234","23","3","34"]),c(A,t[O],y.d,t[D],y,["1234","34","4","41"]),c(A,t[D],y.a,t[B],y,["1234","41","1","12"])):console.log("face should be a face!",y);var e=n,H={},P={},n=function(a,b){H[a]===void 0&&(H[a]=[]);H[a].push(b)},t=function(a,
-b){P[a]===void 0&&(P[a]={});P[a][b]=null};for(w in x)y=x[w],I=w.split("_"),v=I[0],I=I[1],n(v,[v,I]),n(I,[v,I]),A=y[0],B=y[1],t(v,A),B?t(v,B):t(v,A),t(I,A),B?t(I,B):t(I,A);n=new THREE.Vector3;t=new THREE.Vector3;w=0;for(v=l.length;w<v;w++)if(H[w]!==void 0){n.set(0,0,0);t.set(0,0,0);x=new THREE.Vector3(0,0,0);G=0;for(z in P[w])n.addSelf(u[z]),G++;n.divideScalar(G);G=H[w].length;for(z=0;z<G;z++)y=H[w][z],y=l[y[0]].position.clone().addSelf(l[y[1]].position).divideScalar(2),t.addSelf(y);t.divideScalar(G);
-x.addSelf(l[w].position);x.multiplyScalar(G-3);x.addSelf(n);x.addSelf(t.multiplyScalar(2));x.divideScalar(G);e[w].position=x}a.vertices=e;a.faces=h;a.faceVertexUvs[0]=k;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,l,n){var p=new THREE.Face4(a,b,c,e,null,l.color,l.material);if(f.useOldVertexColors){p.vertexColors=[];for(var t,u,v,w=0;w<4;w++){v=n[w];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<v.length;y++)u=l.vertexColors[v[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=v.length;t.g/=v.length;t.b/=v.length;p.vertexColors[w]=t}}h.push(p);(!f.supportUVs||x.length!=0)&&k.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],h=[],k=[],f=this,l=a.vertices,e=a.faces,n=l.concat(),t=[],p={},v={},x=[],u,y,w,B,A,E=a.faceVertexUvs[0];u=0;for(y=E.length;u<y;u++){w=0;for(B=E[u].length;w<B;w++)A=e[u]["abcd".charAt(w)],x[A]||(x[A]=E[u][w])}var z;u=0;for(y=e.length;u<y;u++)if(A=e[u],t.push(A.centroid),n.push(new THREE.Vertex(A.centroid)),f.supportUVs&&x.length!=0){z=new THREE.UV;if(A instanceof THREE.Face3)z.u=x[A.a].u+x[A.b].u+x[A.c].u,z.v=x[A.a].v+x[A.b].v+x[A.c].v,z.u/=3,z.v/=3;else if(A instanceof THREE.Face4)z.u=
+x[A.a].u+x[A.b].u+x[A.c].u+x[A.d].u,z.v=x[A.a].v+x[A.b].v+x[A.c].v+x[A.d].v,z.u/=4,z.v/=4;x.push(z)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,k,f,h,l={};e=0;for(k=a.faces.length;e<k;e++)f=a.faces[e],f instanceof THREE.Face3?(h=b(f.a,f.b),c(l,h,e),h=b(f.b,f.c),c(l,h,e),h=b(f.c,f.a),c(l,h,e)):f instanceof THREE.Face4&&(h=b(f.a,f.b),c(l,h,e),h=b(f.b,f.c),c(l,h,e),h=b(f.c,f.d),c(l,h,e),h=b(f.d,f.a),c(l,h,e));return l}(a);var D=0,E=l.length,M,I,C={},P={},K=function(a,
+b){C[a]===void 0&&(C[a]=[]);C[a].push(b)},O=function(a,b){P[a]===void 0&&(P[a]={});P[a][b]=null};for(u in y){z=y[u];M=u.split("_");I=M[0];M=M[1];K(I,[I,M]);K(M,[I,M]);w=0;for(B=z.length;w<B;w++)A=z[w],O(I,A,u),O(M,A,u);z.length<2&&(v[u]=!0)}for(u in y)if(z=y[u],A=z[0],z=z[1],M=u.split("_"),I=M[0],M=M[1],B=new THREE.Vector3,v[u]?(B.addSelf(l[I].position),B.addSelf(l[M].position),B.multiplyScalar(0.5)):(B.addSelf(t[A]),B.addSelf(t[z]),B.addSelf(l[I].position),B.addSelf(l[M].position),B.multiplyScalar(0.25)),
+p[u]=E+e.length+D,n.push(new THREE.Vertex(B)),D++,f.supportUVs&&x.length!=0)z=new THREE.UV,z.u=x[I].u+x[M].u,z.v=x[I].v+x[M].v,z.u/=2,z.v/=2,x.push(z);var N,H;M=["123","12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],O=["1234","12","2","23"],W=["1234","23","3","34"],Z=["1234","34","4","41"],U=["1234","41","1","12"];u=0;for(y=t.length;u<y;u++)A=e[u],z=E+u,A instanceof THREE.Face3?(D=b(A.a,A.b),I=b(A.b,A.c),N=b(A.c,A.a),c(z,p[D],A.b,p[I],A,M),c(z,p[I],A.c,p[N],A,B),c(z,p[N],A.a,p[D],
+A,K)):A instanceof THREE.Face4?(D=b(A.a,A.b),I=b(A.b,A.c),N=b(A.c,A.d),H=b(A.d,A.a),c(z,p[D],A.b,p[I],A,O),c(z,p[I],A.c,p[N],A,W),c(z,p[N],A.d,p[H],A,Z),c(z,p[H],A.a,p[D],A,U)):console.log("face should be a face!",A);e=n;n=new THREE.Vector3;p=new THREE.Vector3;u=0;for(y=l.length;u<y;u++)if(C[u]!==void 0){n.set(0,0,0);p.set(0,0,0);A=new THREE.Vector3(0,0,0);z=0;for(w in P[u])n.addSelf(t[w]),z++;D=0;E=C[u].length;for(w=0;w<E;w++)v[b(C[u][w][0],C[u][w][1])]&&D++;if(D!=2){n.divideScalar(z);for(w=0;w<
+E;w++)z=C[u][w],z=l[z[0]].position.clone().addSelf(l[z[1]].position).divideScalar(2),p.addSelf(z);p.divideScalar(E);A.addSelf(l[u].position);A.multiplyScalar(E-3);A.addSelf(n);A.addSelf(p.multiplyScalar(2));A.divideScalar(E);e[u].position=A}}a.vertices=e;a.faces=h;a.faceVertexUvs[0]=k;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function h(a,b,k,f,h,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=k;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}h&&a[b].offset.set(h[0],h[1]);if(l){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[l[0]]!==void 0)a[b].wrapS=f[l[0]];if(f[l[1]]!==void 0)a[b].wrapT=f[l[1]]}e(a[b],c+"/"+k)}function k(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,l,n;l="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?l="MeshPhongMaterial":a.shading=="Basic"&&(l="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=k(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=k(a.colorSpecular);if(a.colorAmbient)f.ambient=k(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&h(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&h(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&h(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&h(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var u=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(u.uniforms),p=f.color;l=f.specular;n=f.ambient;var w=f.shininess;t.tNormal.texture=f.normalMap;if(a.mapNormalFactor)t.uNormalScale.value=a.mapNormalFactor;if(f.map)t.tDiffuse.texture=f.map,t.enableDiffuse.value=!0;if(f.specularMap)t.tSpecular.texture=f.specularMap,t.enableSpecular.value=!0;if(f.lightMap)t.tAO.texture=
-f.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(p);t.uSpecularColor.value.setHex(l);t.uAmbientColor.value.setHex(n);t.uShininess.value=w;if(f.opacity)t.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:t,lights:!0,fog:!0})}else f=new THREE[l](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&h(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(t.uniforms),v=f.color;l=f.specular;n=f.ambient;var x=f.shininess;p.tNormal.texture=f.normalMap;if(a.mapNormalFactor)p.uNormalScale.value=a.mapNormalFactor;if(f.map)p.tDiffuse.texture=f.map,p.enableDiffuse.value=!0;if(f.specularMap)p.tSpecular.texture=f.specularMap,p.enableSpecular.value=!0;if(f.lightMap)p.tAO.texture=
+f.lightMap,p.enableAO.value=!0;p.uDiffuseColor.value.setHex(v);p.uSpecularColor.value.setHex(l);p.uAmbientColor.value.setHex(n);p.uShininess.value=x;if(f.opacity)p.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:p,lights:!0,fog:!0})}else f=new THREE[l](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var h=a,a=h.model,c=h.callback,b=h.texture_path,e=h.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),h=Date.now(),a=new Worker(a),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
 c,e,b,k)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(h)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,h,k){var f=new XMLHttpRequest,l=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,h,c):alert("Couldn't load ["+l+"] ["+f.status+"]"):f.readyState==3?k&&(n==0&&(n=f.getResponseHeader("Content-Length")),k({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",l,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var h=function(b){function c(a,b){var e=t(a,b),f=t(a,b+1),k=t(a,b+2),h=t(a,b+3),l=(h<<1&255|k>>7)-127;e|=(k&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function h(a,b){var c=t(a,b),e=t(a,b+1),f=t(a,b+2);return(t(a,b+3)<<24)+(f<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function u(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function p(b){var c,
-e,f;c=h(a,b);e=h(a,b+I);f=h(a,b+H);b=n(a,b+P);G.faces.push(new THREE.Face3(c,e,f,null,null,b))}function w(b){var c,e,f,k,o,p,t;c=h(a,b);e=h(a,b+I);f=h(a,b+H);k=n(a,b+P);o=h(a,b+Q);p=h(a,b+M);t=h(a,b+K);var b=D[p*3],u=D[p*3+1];p=D[p*3+2];var v=D[t*3],x=D[t*3+1];t=D[t*3+2];G.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,x,t)],null,k))}function v(b){var c,e,f,k;c=h(a,b);e=h(a,b+N);f=h(a,b+ea);k=h(a,b+Y);b=n(a,b+S);G.faces.push(new THREE.Face4(c,
-e,f,k,null,null,b))}function z(b){var c,e,f,k,p,t,u,v,x;c=h(a,b);e=h(a,b+N);f=h(a,b+ea);k=h(a,b+Y);p=n(a,b+S);t=h(a,b+o);u=h(a,b+$);v=h(a,b+T);x=h(a,b+oa);var b=D[u*3],w=D[u*3+1];u=D[u*3+2];var F=D[v*3],y=D[v*3+1];v=D[v*3+2];var ka=D[x*3],J=D[x*3+1];x=D[x*3+2];G.faces.push(new THREE.Face4(c,e,f,k,[new THREE.Vector3(D[t*3],D[t*3+1],D[t*3+2]),new THREE.Vector3(b,w,u),new THREE.Vector3(F,y,v),new THREE.Vector3(ka,J,x)],null,p))}function x(b){var c,e,f,k;c=h(a,b);e=h(a,b+W);f=h(a,b+C);b=O[c*2];k=O[c*
-2+1];c=O[e*2];var n=G.faceVertexUvs[0];e=O[e*2+1];var o=O[f*2];f=O[f*2+1];var p=[];p.push(new THREE.UV(b,k));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,f));n.push(p)}function y(b){var c,e,f,k,n,o;c=h(a,b);e=h(a,b+da);f=h(a,b+V);k=h(a,b+X);b=O[c*2];n=O[c*2+1];c=O[e*2];o=O[e*2+1];e=O[f*2];var p=G.faceVertexUvs[0];f=O[f*2+1];var t=O[k*2];k=O[k*2+1];var u=[];u.push(new THREE.UV(b,n));u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,f));u.push(new THREE.UV(t,k));p.push(u)}var G=this,A=0,B,D=[],O=[],
-I,H,P,Q,M,K,N,ea,Y,S,o,$,T,oa,W,C,da,V,X,la,fa,Z,ja,aa,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:h(a,A+16),nnormals:h(a,A+16+4),nuvs:h(a,A+16+8),ntri_flat:h(a,A+16+12),ntri_smooth:h(a,A+16+16),ntri_flat_uv:h(a,
-A+16+20),ntri_smooth_uv:h(a,A+16+24),nquad_flat:h(a,A+16+28),nquad_smooth:h(a,A+16+32),nquad_flat_uv:h(a,A+16+36),nquad_smooth_uv:h(a,A+16+40)};A+=B.header_bytes;I=B.vertex_index_bytes;H=B.vertex_index_bytes*2;P=B.vertex_index_bytes*3;Q=B.vertex_index_bytes*3+B.material_index_bytes;M=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;N=B.vertex_index_bytes;ea=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;S=B.vertex_index_bytes*
-4;o=B.vertex_index_bytes*4+B.material_index_bytes;$=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;T=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;oa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;W=B.uv_index_bytes;C=B.uv_index_bytes*2;da=B.uv_index_bytes;V=B.uv_index_bytes*2;X=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;ia=B.vertex_index_bytes*4+B.material_index_bytes;la=B.ntri_flat*b;fa=B.ntri_smooth*(b+B.normal_index_bytes*
-3);Z=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ja=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);aa=B.nquad_flat*ia;b=B.nquad_smooth*(ia+B.normal_index_bytes*4);ia=B.nquad_flat_uv*(ia+B.uv_index_bytes*4);A+=function(b){for(var e,k,h,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),k=c(a,b+B.vertex_coordinate_bytes),h=c(a,b+B.vertex_coordinate_bytes*2),G.vertices.push(new THREE.Vertex(new THREE.Vector3(e,k,h)));return B.nvertices*l}(A);A+=function(b){for(var c,e,f,k=B.normal_coordinate_bytes*
-3,h=b+B.nnormals*k;b<h;b+=k)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),f=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return B.nnormals*k}(A);A+=function(b){for(var e,k,h=B.uv_coordinate_bytes*2,l=b+B.nuvs*h;b<l;b+=h)e=c(a,b),k=c(a,b+B.uv_coordinate_bytes),O.push(e,k);return B.nuvs*h}(A);la=A+la;fa=la+fa;Z=fa+Z;ja=Z+ja;aa=ja+aa;b=aa+b;ia=b+ia;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,f=a+B.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),x(b+c);
-return f-a})(fa);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,f=a+B.ntri_smooth_uv*e;for(b=a;b<f;b+=e)w(b),x(b+c);return f-a})(Z);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,f=a+B.nquad_flat_uv*e;for(b=a;b<f;b+=e)v(b),y(b+c);return f-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,f=a+B.nquad_smooth_uv*e;for(b=a;b<
-f;b+=e)z(b),y(b+c);return f-a})(ia);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(A);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(la);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ja);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
-4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(aa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(b))};
-THREE.ColladaLoader=function(){function a(a,e,h){fa=a;e=e||aa;h!==void 0&&(a=h.split("/"),a.pop(),Da=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");pa=c("//dae:library_materials/dae:material",P,"material");sa=c("//dae:library_effects/dae:effect",ea,"effect");qa=c("//dae:library_geometries/dae:geometry",y,"geometry");na=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",S,"animation");va=c(".//dae:library_visual_scenes/dae:visual_scene",
-t,"visual_scene");Ba=[];Ea=[];(a=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ja=va[a]):ja=null;Z=new THREE.Object3D;for(a=0;a<ja.nodes.length;a++)Z.add(k(ja.nodes[a]));b();for(var n in ha);n={scene:Z,morphs:Ba,skins:Ea,dae:{images:ga,materials:pa,effects:sa,geometries:qa,controllers:na,animations:ha,visualScenes:va,scene:ja}};e&&e(n);return n}function c(a,b,c){for(var a=fa.evaluate(a,
-fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),k=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+k++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ha)for(var f=ha[e],k=0;k<f.sampler.length;k++){var h=f.sampler[k];h.create();a=Math.min(a,h.startTime);b=Math.max(b,h.endTime);c=Math.max(c,h.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var k=
-a.channels[0].sampler.output[c];k instanceof THREE.Matrix4&&a.world.copy(k)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function h(a,c,f){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 h=b(),c=ja.getChildById(c.skeleton[0],!0)||ja.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
-u;for(l=0;l<a.vertices.length;l++)k.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<h.frames;f++){var v=[],x=[];for(l=0;l<a.vertices.length;l++)x.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=k.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var w=0;w<n.joints.length;w++)if(o.sid==n.joints[w]){u=w;break}if(u>=0){w=n.invBindMatrices[u];o.invBindMatrix=w;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,w);o.weights=[];for(w=0;w<n.weights.length;w++)for(var y=
-0;y<n.weights[w].length;y++){var z=n.weights[w][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=x[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:x})}}}function k(a){var b=
-new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var l=na[a.controllers[f].url];switch(l.type){case "skin":if(qa[l.skin.source]){var n=new x;n.url=l.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(na[l.skin.source]&&(e=l=na[l.skin.source],l.morph&&qa[l.morph.source]))n=new x,n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(qa[l.morph.source])n=new x,
-n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=qa[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[pa[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
-u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)h(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=na[c.url],n.skinInstanceController=c,n.name="skin_"+Ea.length,Ea.push(n);else if(e!==void 0){o=l;p=e instanceof v?na[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
-else{p=p.morph;for(u=0;u<p.targets.length;u++){var w=qa[p.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:w.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ba.length;Ba.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(k(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function w(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function G(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function B(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function O(){this.input={}}function I(){this.semantic="";this.offset=0;this.source="";this.set=0}function H(a){this.id=a;this.type=null}function P(){this.name=this.id="";this.instance_effect=null}function Q(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function M(a,
-b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function N(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function ea(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function $(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function T(a){var b=a.getAttribute("id");if(ia[b]!=void 0)return ia[b];ia[b]=(new H(b)).parse(a);return ia[b]}function oa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function W(a){for(var a=da(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=da(a),b=[],
-c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function da(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function V(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function X(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function la(a,b){var c="";c+=X(a.x,b)+",";c+=X(a.y,b)+",";c+=X(a.z,b);return c}var fa=null,Z=null,ja,aa=
-null,ia={},ga={},ha={},na={},qa={},pa={},sa={},va,Da,Ba,Ea,Ca=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
-c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new H).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
-f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new I).parse(e))}}return b};u.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var k=a.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=
-W(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 H).parse(k);b[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":e=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};u.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
-(new I).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};u.prototype.parseWeights=function(a,b){for(var c,e,f=[],k=0;k<a.childNodes.length;k++){var h=a.childNodes[k];if(h.nodeType==1)switch(h.nodeName){case "input":f.push((new I).parse(h));break;case "v":c=C(h.textContent);break;case "vcount":e=C(h.textContent)}}for(k=h=0;k<e.length;k++){for(var l=e[k],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=
-f[t],v=c[h+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);h+=f.length}for(o=0;o<n.length;o++)n[o].index=k;this.weights.push(n)}};t.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};t.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};t.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),k=f.indexOf(".")>=0,h=f.indexOf("(")>=0,l;if(k)e=f.split("."),f=e.shift(),e.shift();else if(h){l=f.split("(");f=l.shift();
-for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:k,arrSyntax:h,arrIndices:l},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};p.prototype.getTransformBySid=
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
-1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new x).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new w).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ha)for(var f=ha[e],k=0;k<f.channel.length;k++){var h=f.channel[k],l=f.sampler[k];e=h.target.split("/")[0];if(e==this.id)l.create(),h.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(h)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=
-1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=k=void 0,k=0;k<this.channels.length;k++)n=this.channels[k],f[n.sid]=n;h=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(l=this.transforms[k],n=f[l.sid],n!==void 0){for(var o=n.sampler,t,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){t=o.output[n];break}h=t!==void 0?t instanceof THREE.Matrix4?
-h.multiply(h,t):h.multiply(h,l.matrix):h.multiply(h,l.matrix)}else h=h.multiply(h,l.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.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 a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};w.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=W(a.textContent);this.updateMatrix();return this};
-w.prototype.updateMatrix=function(){var a=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":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=fa.evaluate(".//dae:instance_material",c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=fa.evaluate(".//dae:instance_material",
-c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new G(this)).parse(c)}}return this};G.prototype.parse=function(a){function b(a,c){var e=la(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=
-0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":T(e);break;case "vertices":this.vertices=(new O).parse(e);break;case "triangles":this.primitives.push((new B).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ia[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var k=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
-1],e[c+2]));b(k,a);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,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};G.prototype.handlePrimitive=function(a,b,c){var e=0,f,k,h=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],
-n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<h.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(k=0;k<l.length;k++)switch(n=l[k],source=ia[n.source],o=h[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=la(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
-source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var C;u==3?C=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(C=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));C.daeMaterial=a.material;b.faces.push(C);for(k=0;k<v.length;k++)f=y[v[k]],b.faceVertexUvs[k].push([f[0],f[1],f[2]]);e+=l.length*u}};A.prototype=new B;A.prototype.constructor=A;B.prototype.setVertices=
-function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};B.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new I).parse(a.childNodes[b]));break;case "vcount":this.vcount=C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};D.prototype.parse=
-function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new I).parse(a.childNodes[b]),this.input[input.semantic]=
-input);return this};I.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=da(c.textContent),f=[],k=0;k<e.length;k++)f.push(e[k]=="true"||e[k]=="1"?
-!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=W(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=da(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};H.prototype.read=function(){var a=[],b=this.accessor.params[0];
-switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.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]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"instance_effect"){this.instance_effect=(new Y).parse(a.childNodes[b]);break}return this};Q.prototype.isColor=function(){return this.texture==null};Q.prototype.isTexture=function(){return this.texture!=null};Q.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=W(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};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new Q).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=fa.evaluate(".//dae:float",c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),k=[];f;)k.push(f),f=e.iterateNext();
-e=k;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};M.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof Q)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Da+e.init_from),
-a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ca;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};ea.prototype.create=function(){if(this.shader==null)return null};ea.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};ea.prototype.parseNewparam=
-function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new K(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new N(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};ea.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};ea.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new M(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new H).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(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,k;if(c)b=a.split("."),a=b.shift(),k=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=k;return this};$.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new I).parse(c))}}return this};
-$.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.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(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var h=function(b){function c(a,b){var e=p(a,b),f=p(a,b+1),k=p(a,b+2),h=p(a,b+3),l=(h<<1&255|k>>7)-127;e|=(k&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function h(a,b){var c=p(a,b),e=p(a,b+1),f=p(a,b+2);return(p(a,b+3)<<24)+(f<<16)+(e<<8)+c}function n(a,b){var c=p(a,b);return(p(a,b+1)<<8)+c}function t(a,b){var c=p(a,b);return c>127?c-256:c}function p(a,b){return a.charCodeAt(b)&255}function v(b){var c,
+e,f;c=h(a,b);e=h(a,b+I);f=h(a,b+C);b=n(a,b+P);A.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,k,o,p,t;c=h(a,b);e=h(a,b+I);f=h(a,b+C);k=n(a,b+P);o=h(a,b+K);p=h(a,b+O);t=h(a,b+N);var b=D[p*3],u=D[p*3+1];p=D[p*3+2];var v=D[t*3],w=D[t*3+1];t=D[t*3+2];A.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,k))}function u(b){var c,e,f,k;c=h(a,b);e=h(a,b+H);f=h(a,b+W);k=h(a,b+Z);b=n(a,b+U);A.faces.push(new THREE.Face4(c,
+e,f,k,null,null,b))}function y(b){var c,e,f,k,p,t,u,v,w;c=h(a,b);e=h(a,b+H);f=h(a,b+W);k=h(a,b+Z);p=n(a,b+U);t=h(a,b+o);u=h(a,b+ca);v=h(a,b+X);w=h(a,b+oa);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var G=D[v*3],T=D[v*3+1];v=D[v*3+2];var y=D[w*3],z=D[w*3+1];w=D[w*3+2];A.faces.push(new THREE.Face4(c,e,f,k,[new THREE.Vector3(D[t*3],D[t*3+1],D[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(G,T,v),new THREE.Vector3(y,z,w)],null,p))}function w(b){var c,e,f,k;c=h(a,b);e=h(a,b+L);f=h(a,b+Q);b=M[c*2];k=M[c*2+
+1];c=M[e*2];var n=A.faceVertexUvs[0];e=M[e*2+1];var o=M[f*2];f=M[f*2+1];var p=[];p.push(new THREE.UV(b,k));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,f));n.push(p)}function B(b){var c,e,f,k,n,o;c=h(a,b);e=h(a,b+ia);f=h(a,b+da);k=h(a,b+$);b=M[c*2];n=M[c*2+1];c=M[e*2];o=M[e*2+1];e=M[f*2];var p=A.faceVertexUvs[0];f=M[f*2+1];var t=M[k*2];k=M[k*2+1];var u=[];u.push(new THREE.UV(b,n));u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,f));u.push(new THREE.UV(t,k));p.push(u)}var A=this,E=0,z,D=[],M=[],
+I,C,P,K,O,N,H,W,Z,U,o,ca,X,oa,L,Q,ia,da,$,ma,fa,aa,ka,ea,ja;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,b);z={signature:a.substr(E,8),header_bytes:p(a,E+8),vertex_coordinate_bytes:p(a,E+9),normal_coordinate_bytes:p(a,E+10),uv_coordinate_bytes:p(a,E+11),vertex_index_bytes:p(a,E+12),normal_index_bytes:p(a,E+13),uv_index_bytes:p(a,E+14),material_index_bytes:p(a,E+15),nvertices:h(a,E+16),nnormals:h(a,E+16+4),nuvs:h(a,E+16+8),ntri_flat:h(a,E+16+12),ntri_smooth:h(a,E+16+16),ntri_flat_uv:h(a,
+E+16+20),ntri_smooth_uv:h(a,E+16+24),nquad_flat:h(a,E+16+28),nquad_smooth:h(a,E+16+32),nquad_flat_uv:h(a,E+16+36),nquad_smooth_uv:h(a,E+16+40)};E+=z.header_bytes;I=z.vertex_index_bytes;C=z.vertex_index_bytes*2;P=z.vertex_index_bytes*3;K=z.vertex_index_bytes*3+z.material_index_bytes;O=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;N=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;H=z.vertex_index_bytes;W=z.vertex_index_bytes*2;Z=z.vertex_index_bytes*3;U=z.vertex_index_bytes*
+4;o=z.vertex_index_bytes*4+z.material_index_bytes;ca=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;X=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;L=z.uv_index_bytes;Q=z.uv_index_bytes*2;ia=z.uv_index_bytes;da=z.uv_index_bytes*2;$=z.uv_index_bytes*3;b=z.vertex_index_bytes*3+z.material_index_bytes;ja=z.vertex_index_bytes*4+z.material_index_bytes;ma=z.ntri_flat*b;fa=z.ntri_smooth*(b+z.normal_index_bytes*
+3);aa=z.ntri_flat_uv*(b+z.uv_index_bytes*3);ka=z.ntri_smooth_uv*(b+z.normal_index_bytes*3+z.uv_index_bytes*3);ea=z.nquad_flat*ja;b=z.nquad_smooth*(ja+z.normal_index_bytes*4);ja=z.nquad_flat_uv*(ja+z.uv_index_bytes*4);E+=function(b){for(var e,k,h,l=z.vertex_coordinate_bytes*3,n=b+z.nvertices*l;b<n;b+=l)e=c(a,b),k=c(a,b+z.vertex_coordinate_bytes),h=c(a,b+z.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,k,h)));return z.nvertices*l}(E);E+=function(b){for(var c,e,f,k=z.normal_coordinate_bytes*
+3,h=b+z.nnormals*k;b<h;b+=k)c=t(a,b),e=t(a,b+z.normal_coordinate_bytes),f=t(a,b+z.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return z.nnormals*k}(E);E+=function(b){for(var e,k,h=z.uv_coordinate_bytes*2,l=b+z.nuvs*h;b<l;b+=h)e=c(a,b),k=c(a,b+z.uv_coordinate_bytes),M.push(e,k);return z.nuvs*h}(E);ma=E+ma;fa=ma+fa;aa=fa+aa;ka=aa+ka;ea=ka+ea;b=ea+b;ja=b+ja;(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes,e=c+z.uv_index_bytes*3,f=a+z.ntri_flat_uv*e;for(b=a;b<f;b+=e)v(b),w(b+
+c);return f-a})(fa);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,e=c+z.uv_index_bytes*3,f=a+z.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),w(b+c);return f-a})(aa);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes,e=c+z.uv_index_bytes*4,f=a+z.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),B(b+c);return f-a})(b);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,e=c+z.uv_index_bytes*4,f=a+z.nquad_smooth_uv*e;for(b=
+a;b<f;b+=e)y(b),B(b+c);return f-a})(ja);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes,e=a+z.ntri_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(E);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,e=a+z.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(ma);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes,e=a+z.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(ka);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes+
+z.normal_index_bytes*4,e=a+z.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(b))};
+THREE.ColladaLoader=function(){function a(a,e,h){fa=a;e=e||ea;h!==void 0&&(a=h.split("/"),a.pop(),Da=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");la=c("//dae:library_materials/dae:material",P,"material");ua=c("//dae:library_effects/dae:effect",W,"effect");qa=c("//dae:library_geometries/dae:geometry",B,"geometry");ta=c("//dae:library_controllers/dae:controller",l,"controller");pa=c("//dae:library_animations/dae:animation",U,"animation");wa=c(".//dae:library_visual_scenes/dae:visual_scene",
+p,"visual_scene");Ba=[];Ea=[];(a=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ka=wa[a]):ka=null;aa=new THREE.Object3D;for(a=0;a<ka.nodes.length;a++)aa.add(k(ka.nodes[a]));b();for(var n in pa);n={scene:aa,morphs:Ba,skins:Ea,dae:{images:ga,materials:la,effects:ua,geometries:qa,controllers:ta,animations:pa,visualScenes:wa,scene:ka}};e&&e(n);return n}function c(a,b,c){for(var a=fa.evaluate(a,
+fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),k=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+k++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in pa)for(var f=pa[e],k=0;k<f.sampler.length;k++){var h=f.sampler[k];h.create();a=Math.min(a,h.startTime);b=Math.max(b,h.endTime);c=Math.max(c,h.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var k=
+a.channels[0].sampler.output[c];k instanceof THREE.Matrix4&&a.world.copy(k)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function h(a,c,f){var k=ta[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 h=b(),c=ka.getChildById(c.skeleton[0],!0)||ka.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
+u;for(l=0;l<a.vertices.length;l++)k.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<h.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=k.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
+0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function k(a){var b=
+new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var l=ta[a.controllers[f].url];switch(l.type){case "skin":if(qa[l.skin.source]){var n=new w;n.url=l.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(ta[l.skin.source]&&(e=l=ta[l.skin.source],l.morph&&qa[l.morph.source]))n=new w,n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(qa[l.morph.source])n=new w,
+n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=qa[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var v=ua[la[t.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;t=o[t.symbol]=
+v.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)h(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=ta[c.url],n.skinInstanceController=c,n.name="skin_"+Ea.length,Ea.push(n);else if(e!==void 0){o=l;p=e instanceof u?ta[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
+else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=qa[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ba.length;Ba.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(k(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function z(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function M(){this.input={}}function I(){this.semantic="";this.offset=0;this.source="";this.set=0}function C(a){this.id=a;this.type=null}function P(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function O(a,
+b){this.type=a;this.effect=b;this.material=null}function N(a){this.effect=a;this.format=this.init_from=null}function H(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function W(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function U(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
+this.dotSyntax=this.sid=null}function ca(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function X(a){var b=a.getAttribute("id");if(ja[b]!=void 0)return ja[b];ja[b]=(new C(b)).parse(a);return ja[b]}function oa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=ia(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function Q(a){for(var a=ia(a),b=[],
+c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function ia(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function da(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function $(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ma(a,b){var c="";c+=$(a.x,b)+",";c+=$(a.y,b)+",";c+=$(a.z,b);return c}var fa=null,aa=null,ka,
+ea=null,ja={},ga={},pa={},ta={},qa={},la={},ua={},wa,Da,Ba,Ea,Ca=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
+this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new C).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
+a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new I).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var k=a.childNodes[f];
+if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=L(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 C).parse(k);b[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":e=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
+a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new I).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};t.prototype.parseWeights=function(a,b){for(var c,e,f=[],k=0;k<a.childNodes.length;k++){var h=a.childNodes[k];if(h.nodeType==1)switch(h.nodeName){case "input":f.push((new I).parse(h));break;case "v":c=Q(h.textContent);break;case "vcount":e=Q(h.textContent)}}for(k=h=0;k<e.length;k++){for(var l=
+e[k],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=f[t],v=c[h+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);h+=f.length}for(o=0;o<n.length;o++)n[o].index=k;this.weights.push(n)}};p.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
+b);if(e)return e}return null};p.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c))}}return this};v.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),k=f.indexOf(".")>=0,h=f.indexOf("(")>=0,l;if(k)e=f.split("."),
+f=e.shift(),e.shift();else if(h){l=f.split("(");f=l.shift();for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:k,arrSyntax:h,arrIndices:l},c}return null};v.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};v.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
+b);if(e)return e}return null};v.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};v.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new v).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null).iterateNext())&&this.nodes.push((new v).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in pa)for(var f=pa[e],k=0;k<f.channel.length;k++){var h=f.channel[k],l=f.sampler[k];e=h.target.split("/")[0];if(e==this.id)l.create(),h.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(h)}if(a.length)this.startTime=
+c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=k=void 0,k=0;k<this.channels.length;k++)n=this.channels[k],f[n.sid]=n;h=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(l=this.transforms[k],n=f[l.sid],n!==void 0){for(var o=n.sampler,p,n=0;n<o.input.length-1;n++)if(o.input[n+
+1]>b){p=o.output[n];break}h=p!==void 0?p instanceof THREE.Matrix4?h.multiply(h,p):h.multiply(h,l.matrix):h.multiply(h,l.matrix)}else h=h.multiply(h,l.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=
+a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var a=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":a=
+this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));
+break;case "bind_material":if(c=fa.evaluate(".//dae:instance_material",c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=c.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=
+a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=fa.evaluate(".//dae:instance_material",c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new y).parse(b)),b=a.iterateNext();break}}return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(a){function b(a,
+c){var e=ma(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":X(e);break;case "vertices":this.vertices=(new M).parse(e);break;case "triangles":this.primitives.push((new z).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ja[this.vertices.input.POSITION.source].data;
+for(a=c=0;c<e.length;c+=3,a++){var k=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(k,a);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,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(a,b,c){var e=
+0,f,k,h=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<h.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(k=0;k<l.length;k++)switch(n=l[k],source=ja[n.source],o=h[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=ma(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+
+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var A;u==3?A=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(A=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));A.daeMaterial=a.material;b.faces.push(A);for(k=0;k<v.length;k++)f=y[v[k]],b.faceVertexUvs[k].push([f[0],
+f[1],f[2]]);e+=l.length*u}};E.prototype=new z;E.prototype.constructor=E;z.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};z.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=da(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new I).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+Q(c.textContent);break;case "p":this.p=Q(c.textContent)}}return this};D.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=da(a,"count",0);this.stride=da(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
+"input"&&(input=(new I).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};I.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=da(a,"set",-1);this.offset=da(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};C.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
+ia(c.textContent),f=[],k=0;k<e.length;k++)f.push(e[k]=="true"||e[k]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};
+C.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.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]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};P.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new Z).parse(a.childNodes[b]);break}return this};K.prototype.isColor=function(){return this.texture==null};K.prototype.isTexture=function(){return this.texture!=null};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=L(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};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new K).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=fa.evaluate(".//dae:float",c,oa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var f=e.iterateNext(),k=[];f;)k.push(f),f=e.iterateNext();e=k;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};O.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof K)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(Da+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ca;return this.material=new THREE.MeshLambertMaterial(a)};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+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};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};W.prototype.create=function(){if(this.shader==null)return null};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+W.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new N(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new H(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};W.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};W.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new O(c.nodeName,this)).parse(c)}}};Z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new C).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ca(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,k;if(c)b=a.split("."),a=b.shift(),k=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=k;return this};ca.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new I).parse(c))}}return this};
+ca.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.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(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
-200))aa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ca=a},applySkin:h,geometries:qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+200))ea=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ca=a},applySkin:h,geometries:qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var e,h=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){h.createModel(a.data,c,b);h.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,h=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,h,n,u,t,p,w,v,z,x,y,G,A,B,D=a.faces;p=a.vertices;var O=a.normals,I=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];u=0;for(t=p.length;u<t;)w=new THREE.Vertex,w.position.x=p[u++]*b,w.position.y=
-p[u++]*b,w.position.z=p[u++]*b,e.vertices.push(w);u=0;for(t=D.length;u<t;){b=D[u++];p=b&1;n=b&2;c=b&4;h=b&8;v=b&16;w=b&32;x=b&64;b&=128;p?(y=new THREE.Face4,y.a=D[u++],y.b=D[u++],y.c=D[u++],y.d=D[u++],p=4):(y=new THREE.Face3,y.a=D[u++],y.b=D[u++],y.c=D[u++],p=3);if(n)n=D[u++],y.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<H;c++)G=a.uvs[c],z=D[u++],B=G[z*2],z=G[z*2+1],e.faceUvs[c][n]=new THREE.UV(B,z);if(h)for(c=0;c<H;c++){G=a.uvs[c];A=[];for(h=0;h<p;h++)z=D[u++],B=G[z*2],z=G[z*2+1],A[h]=new THREE.UV(B,
-z);e.faceVertexUvs[c][n]=A}if(v)v=D[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],y.normal=h;if(w)for(c=0;c<p;c++)v=D[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],y.vertexNormals.push(h);if(x)w=D[u++],w=new THREE.Color(I[w]),y.color=w;if(b)for(c=0;c<p;c++)w=D[u++],w=new THREE.Color(I[w]),y.vertexColors.push(w);e.faces.push(y)}}})(h);(function(){var b,c,h,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)h=a.skinWeights[b],n=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(h,
-n,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)h=a.skinIndices[b],n=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(h,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,h,n,u,t,p,w,v,z;c=0;for(h=a.morphTargets.length;c<h;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;n=0;for(u=z.length;n<u;n+=3)t=z[n]*b,p=z[n+1]*
-b,w=z[n+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(t,p,w)))}}if(a.morphColors!==void 0){c=0;for(h=a.morphColors.length;c<h;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];u=e.morphColors[c].colors;t=a.morphColors[c].colors;b=0;for(n=t.length;b<n;b+=3)p=new THREE.Color(16755200),p.setRGB(t[b],t[b+1],t[b+2]),u.push(p)}}})(h);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,h=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,h,n,t,p,v,x,u,y,w,B,A,E,z,D=a.faces;v=a.vertices;var M=a.normals,I=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(p=v.length;t<p;)x=new THREE.Vertex,x.position.x=v[t++]*b,x.position.y=
+v[t++]*b,x.position.z=v[t++]*b,e.vertices.push(x);t=0;for(p=D.length;t<p;){b=D[t++];v=b&1;n=b&2;c=b&4;h=b&8;u=b&16;x=b&32;w=b&64;b&=128;v?(B=new THREE.Face4,B.a=D[t++],B.b=D[t++],B.c=D[t++],B.d=D[t++],v=4):(B=new THREE.Face3,B.a=D[t++],B.b=D[t++],B.c=D[t++],v=3);if(n)n=D[t++],B.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<C;c++)A=a.uvs[c],y=D[t++],z=A[y*2],y=A[y*2+1],e.faceUvs[c][n]=new THREE.UV(z,y);if(h)for(c=0;c<C;c++){A=a.uvs[c];E=[];for(h=0;h<v;h++)y=D[t++],z=A[y*2],y=A[y*2+1],E[h]=new THREE.UV(z,
+y);e.faceVertexUvs[c][n]=E}if(u)u=D[t++]*3,h=new THREE.Vector3,h.x=M[u++],h.y=M[u++],h.z=M[u],B.normal=h;if(x)for(c=0;c<v;c++)u=D[t++]*3,h=new THREE.Vector3,h.x=M[u++],h.y=M[u++],h.z=M[u],B.vertexNormals.push(h);if(w)x=D[t++],x=new THREE.Color(I[x]),B.color=x;if(b)for(c=0;c<v;c++)x=D[t++],x=new THREE.Color(I[x]),B.vertexColors.push(x);e.faces.push(B)}}})(h);(function(){var b,c,h,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)h=a.skinWeights[b],n=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(h,
+n,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)h=a.skinIndices[b],n=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(h,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,h,n,t,p,v,x,u,y;c=0;for(h=a.morphTargets.length;c<h;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;n=0;for(t=y.length;n<t;n+=3)p=y[n]*b,v=y[n+1]*
+b,x=y[n+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(p,v,x)))}}if(a.morphColors!==void 0){c=0;for(h=a.morphColors.length;c<h;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;p=a.morphColors[c].colors;b=0;for(n=p.length;b<n;b+=3)v=new THREE.Color(16755200),v.setRGB(p[b],p[b+1],p[b+2]),t.push(v)}}})(h);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:h+"/"+a}function l(){for(v in N.objects)if(!T.objects[v])if(A=N.objects[v],A.geometry!==void 0){if(I=T.geometries[A.geometry]){var a=!1;for(W=0;W<A.materials.length;W++)M=T.materials[A.materials[W]],a=M instanceof THREE.ShaderMaterial;a&&I.computeTangents();B=A.position;r=A.rotation;q=A.quaternion;
-s=A.scale;q=0;M.length==0&&(M=new THREE.MeshFaceMaterial);M.length>1&&(M=new THREE.MeshFaceMaterial);object=new THREE.Mesh(I,M);object.name=v;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;T.scene.add(object);T.objects[v]=object;A.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(a));if(A.castsShadow)a=
-new THREE.ShadowVolume(I),T.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},T.triggers[object.name]=a)}}else B=A.position,r=A.rotation,q=A.quaternion,s=A.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
-A.visible!==void 0?A.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},T.triggers[object.name]=a)}function n(a){return function(c){T.geometries[a]=c;l();Y-=1;b.onLoadComplete();t()}}function u(a){return function(b){T.geometries[a]=b}}function t(){b.callbackProgress({totalModels:o,totalTextures:$,loadedModels:o-Y,loadedTextures:$-S},T);b.onLoadProgress();Y==0&&S==0&&c(T)}var p,w,v,z,x,y,G,A,B,D,O,I,H,P,Q,
-M,K,N,ea,Y,S,o,$,T;N=a.data;Q=new THREE.BinaryLoader;ea=new THREE.JSONLoader;S=Y=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in N.objects)if(A=N.objects[v],A.meshCollider){a=!0;break}if(a)T.scene.collisions=new THREE.CollisionSystem;if(N.transform){a=N.transform.position;D=N.transform.rotation;var oa=N.transform.scale;a&&T.scene.position.set(a[0],a[1],a[2]);D&&T.scene.rotation.set(D[0],D[1],D[2]);oa&&
-T.scene.scale.set(oa[0],oa[1],oa[2]);(a||D||oa)&&T.scene.updateMatrix()}a=function(){S-=1;t();b.onLoadComplete()};for(x in N.cameras)D=N.cameras[x],D.type=="perspective"?H=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(H=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),B=D.position,D=D.target,H.position.set(B[0],B[1],B[2]),H.target=new THREE.Vector3(D[0],D[1],D[2]),T.cameras[x]=H;for(z in N.lights)x=N.lights[z],H=x.color!==void 0?x.color:16777215,
-D=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(B=x.direction,K=new THREE.DirectionalLight(H,D),K.position.set(B[0],B[1],B[2]),K.position.normalize()):x.type=="point"?(B=x.position,d=x.distance,K=new THREE.PointLight(H,D,d),K.position.set(B[0],B[1],B[2])):x.type=="ambient"&&(K=new THREE.AmbientLight(H)),T.scene.add(K),T.lights[z]=K;for(y in N.fogs)z=N.fogs[y],z.type=="linear"?P=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(P=new THREE.FogExp2(0,z.density)),D=z.color,P.color.setRGB(D[0],
-D[1],D[2]),T.fogs[y]=P;if(T.cameras&&N.defaults.camera)T.currentCamera=T.cameras[N.defaults.camera];if(T.fogs&&N.defaults.fog)T.scene.fog=T.fogs[N.defaults.fog];D=N.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(D[0],D[1],D[2]);T.bgColorAlpha=N.defaults.bgalpha;for(p in N.geometries)if(y=N.geometries[p],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,b.onLoadStart();o=Y;for(p in N.geometries)y=N.geometries[p],y.type=="cube"?(I=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,
-y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),T.geometries[p]=I):y.type=="plane"?(I=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),T.geometries[p]=I):y.type=="sphere"?(I=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),T.geometries[p]=I):y.type=="cylinder"?(I=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),T.geometries[p]=I):y.type=="torus"?(I=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),T.geometries[p]=
-I):y.type=="icosahedron"?(I=new THREE.IcosahedronGeometry(y.subdivisions),T.geometries[p]=I):y.type=="bin_mesh"?Q.load(e(y.url,N.urlBaseType),n(p)):y.type=="ascii_mesh"?ea.load(e(y.url,N.urlBaseType),n(p)):y.type=="embedded_mesh"&&(y=N.embeds[y.id])&&ea.createModel(y,u(p),"");for(G in N.textures)if(p=N.textures[G],p.url instanceof Array){S+=p.url.length;for(Q=0;Q<p.url.length;Q++)b.onLoadStart()}else S+=1,b.onLoadStart();$=S;for(G in N.textures){p=N.textures[G];if(p.mapping!=void 0&&THREE[p.mapping]!=
-void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){Q=[];for(var W=0;W<p.url.length;W++)Q[W]=e(p.url[W],N.urlBaseType);Q=THREE.ImageUtils.loadTextureCube(Q,p.mapping,a)}else{Q=THREE.ImageUtils.loadTexture(e(p.url,N.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)Q.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)Q.magFilter=THREE[p.magFilter];if(p.repeat){Q.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)Q.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)Q.wrapT=THREE.RepeatWrapping}p.offset&&
-Q.offset.set(p.offset[0],p.offset[1]);if(p.wrap){ea={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(ea[p.wrap[0]]!==void 0)Q.wrapS=ea[p.wrap[0]];if(ea[p.wrap[1]]!==void 0)Q.wrapT=ea[p.wrap[1]]}}T.textures[G]=Q}for(w in N.materials){G=N.materials[w];for(O in G.parameters)if(O=="envMap"||O=="map"||O=="lightMap")G.parameters[O]=T.textures[G.parameters[O]];else if(O=="shading")G.parameters[O]=G.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")G.parameters[O]=
-THREE[G.parameters[O]]?THREE[G.parameters[O]]:THREE.NormalBlending;else if(O=="combine")G.parameters[O]=G.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(G.parameters[O]=="face")G.parameters[O]=THREE.FaceColors;else if(G.parameters[O])G.parameters[O]=THREE.VertexColors;if(G.parameters.opacity!==void 0&&G.parameters.opacity<1)G.parameters.transparent=!0;if(G.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
-Q=G.parameters.color;ea=G.parameters.specular;y=G.parameters.ambient;P=G.parameters.shininess;a.tNormal.texture=T.textures[G.parameters.normalMap];if(G.parameters.normalMapFactor)a.uNormalScale.value=G.parameters.normalMapFactor;if(G.parameters.map)a.tDiffuse.texture=G.parameters.map,a.enableDiffuse.value=!0;if(G.parameters.lightMap)a.tAO.texture=G.parameters.lightMap,a.enableAO.value=!0;if(G.parameters.specularMap)a.tSpecular.texture=T.textures[G.parameters.specularMap],a.enableSpecular.value=!0;
-a.uDiffuseColor.value.setHex(Q);a.uSpecularColor.value.setHex(ea);a.uAmbientColor.value.setHex(y);a.uShininess.value=P;if(G.parameters.opacity)a.uOpacity.value=G.parameters.opacity;G=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else G=new THREE[G.type](G.parameters);T.materials[w]=G}l();b.callbackSync(T);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:h+"/"+a}function l(){for(u in H.objects)if(!X.objects[u])if(E=H.objects[u],E.geometry!==void 0){if(I=X.geometries[E.geometry]){var a=!1;for(L=0;L<E.materials.length;L++)O=X.materials[E.materials[L]],a=O instanceof THREE.ShaderMaterial;a&&I.computeTangents();z=E.position;r=E.rotation;q=E.quaternion;
+s=E.scale;q=0;O.length==0&&(O=new THREE.MeshFaceMaterial);O.length>1&&(O=new THREE.MeshFaceMaterial);object=new THREE.Mesh(I,O);object.name=u;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;X.scene.add(object);X.objects[u]=object;E.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),X.scene.collisions.colliders.push(a));if(E.castsShadow)a=
+new THREE.ShadowVolume(I),X.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},X.triggers[object.name]=a)}}else z=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+E.visible!==void 0?E.visible:!1,X.scene.add(object),X.objects[u]=object,X.empties[u]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},X.triggers[object.name]=a)}function n(a){return function(c){X.geometries[a]=c;l();Z-=1;b.onLoadComplete();p()}}function t(a){return function(b){X.geometries[a]=b}}function p(){b.callbackProgress({totalModels:o,totalTextures:ca,loadedModels:o-Z,loadedTextures:ca-U},X);b.onLoadProgress();Z==0&&U==0&&c(X)}var v,x,u,y,w,B,A,E,z,D,M,I,C,P,
+K,O,N,H,W,Z,U,o,ca,X;H=a.data;K=new THREE.BinaryLoader;W=new THREE.JSONLoader;U=Z=0;X={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in H.objects)if(E=H.objects[u],E.meshCollider){a=!0;break}if(a)X.scene.collisions=new THREE.CollisionSystem;if(H.transform){a=H.transform.position;D=H.transform.rotation;var oa=H.transform.scale;a&&X.scene.position.set(a[0],a[1],a[2]);D&&X.scene.rotation.set(D[0],D[1],D[2]);oa&&
+X.scene.scale.set(oa[0],oa[1],oa[2]);(a||D||oa)&&X.scene.updateMatrix()}a=function(){U-=1;p();b.onLoadComplete()};for(w in H.cameras)D=H.cameras[w],D.type=="perspective"?C=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(C=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),z=D.position,D=D.target,C.position.set(z[0],z[1],z[2]),C.target=new THREE.Vector3(D[0],D[1],D[2]),X.cameras[w]=C;for(y in H.lights)w=H.lights[y],C=w.color!==void 0?w.color:16777215,
+D=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(z=w.direction,N=new THREE.DirectionalLight(C,D),N.position.set(z[0],z[1],z[2]),N.position.normalize()):w.type=="point"?(z=w.position,d=w.distance,N=new THREE.PointLight(C,D,d),N.position.set(z[0],z[1],z[2])):w.type=="ambient"&&(N=new THREE.AmbientLight(C)),X.scene.add(N),X.lights[y]=N;for(B in H.fogs)y=H.fogs[B],y.type=="linear"?P=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(P=new THREE.FogExp2(0,y.density)),D=y.color,P.color.setRGB(D[0],
+D[1],D[2]),X.fogs[B]=P;if(X.cameras&&H.defaults.camera)X.currentCamera=X.cameras[H.defaults.camera];if(X.fogs&&H.defaults.fog)X.scene.fog=X.fogs[H.defaults.fog];D=H.defaults.bgcolor;X.bgColor=new THREE.Color;X.bgColor.setRGB(D[0],D[1],D[2]);X.bgColorAlpha=H.defaults.bgalpha;for(v in H.geometries)if(B=H.geometries[v],B.type=="bin_mesh"||B.type=="ascii_mesh")Z+=1,b.onLoadStart();o=Z;for(v in H.geometries)B=H.geometries[v],B.type=="cube"?(I=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,
+B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),X.geometries[v]=I):B.type=="plane"?(I=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),X.geometries[v]=I):B.type=="sphere"?(I=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),X.geometries[v]=I):B.type=="cylinder"?(I=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),X.geometries[v]=I):B.type=="torus"?(I=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),X.geometries[v]=
+I):B.type=="icosahedron"?(I=new THREE.IcosahedronGeometry(B.subdivisions),X.geometries[v]=I):B.type=="bin_mesh"?K.load(e(B.url,H.urlBaseType),n(v)):B.type=="ascii_mesh"?W.load(e(B.url,H.urlBaseType),n(v)):B.type=="embedded_mesh"&&(B=H.embeds[B.id])&&W.createModel(B,t(v),"");for(A in H.textures)if(v=H.textures[A],v.url instanceof Array){U+=v.url.length;for(K=0;K<v.url.length;K++)b.onLoadStart()}else U+=1,b.onLoadStart();ca=U;for(A in H.textures){v=H.textures[A];if(v.mapping!=void 0&&THREE[v.mapping]!=
+void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var L=0;L<v.url.length;L++)K[L]=e(v.url[L],H.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,a)}else{K=THREE.ImageUtils.loadTexture(e(v.url,H.urlBaseType),v.mapping,a);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);if(v.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}v.offset&&
+K.offset.set(v.offset[0],v.offset[1]);if(v.wrap){W={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(W[v.wrap[0]]!==void 0)K.wrapS=W[v.wrap[0]];if(W[v.wrap[1]]!==void 0)K.wrapT=W[v.wrap[1]]}}X.textures[A]=K}for(x in H.materials){A=H.materials[x];for(M in A.parameters)if(M=="envMap"||M=="map"||M=="lightMap")A.parameters[M]=X.textures[A.parameters[M]];else if(M=="shading")A.parameters[M]=A.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")A.parameters[M]=
+THREE[A.parameters[M]]?THREE[A.parameters[M]]:THREE.NormalBlending;else if(M=="combine")A.parameters[M]=A.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(A.parameters[M]=="face")A.parameters[M]=THREE.FaceColors;else if(A.parameters[M])A.parameters[M]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=!0;if(A.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(v.uniforms);
+K=A.parameters.color;W=A.parameters.specular;B=A.parameters.ambient;P=A.parameters.shininess;a.tNormal.texture=X.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)a.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)a.tDiffuse.texture=A.parameters.map,a.enableDiffuse.value=!0;if(A.parameters.lightMap)a.tAO.texture=A.parameters.lightMap,a.enableAO.value=!0;if(A.parameters.specularMap)a.tSpecular.texture=X.textures[A.parameters.specularMap],a.enableSpecular.value=!0;
+a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(W);a.uAmbientColor.value.setHex(B);a.uShininess.value=P;if(A.parameters.opacity)a.uOpacity.value=A.parameters.opacity;A=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:a,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);X.materials[x]=A}l();b.callbackSync(X);p()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,l=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
 c,h,k,f,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,h=0;h<8;h++){for(var k=0,f=0;f<c;++f){var l=a.charCodeAt(f+e);k+=l>>1^-(l&1);b[8*f+h]=k}e+=c}c=a.length-e;k=new Uint16Array(c);for(h=f=0;h<c;h++)l=a.charCodeAt(h+e),k[h]=f-l,l==0&&f++;return[b,k]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,h,k){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),u=[],t=[];(function(a,f,n){for(var t,u,y,G=a.length;n<G;n+=f)t=a[n],u=a[n+1],y=a[n+2],t=t/16383*b,u=u/16383*b,y=y/16383*b,t+=e,u+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,y)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,t.push(e,1-f)})(f[0],8,3);(function(a,
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,u.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,k,n,A,B,D,O=a.length;for(b=0;b<O;b+=3){e=a[b];f=a[b+1];h=a[b+2];k=c;B=e;D=f;n=h;A=e;var I=f,H=h,P=k.materials[0],Q=u[I*3],M=u[I*3+1],I=u[I*3+2],K=u[H*3],N=u[H*3+1],H=u[H*3+2];A=new THREE.Vector3(u[A*3],u[A*3+1],u[A*3+2]);I=new THREE.Vector3(Q,M,I);H=new THREE.Vector3(K,N,H);k.faces.push(new THREE.Face3(B,D,n,[A,I,H],null,P));k=t[e*2];e=t[e*2+
-1];n=t[f*2];A=t[f*2+1];B=t[h*2];D=t[h*2+1];h=c.faceVertexUvs[0];f=n;n=A;A=[];A.push(new THREE.UV(k,e));A.push(new THREE.UV(f,n));A.push(new THREE.UV(B,D));h.push(A)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,h,k){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],p=[];(function(a,f,n){for(var p,t,B,A=a.length;n<A;n+=f)p=a[n],t=a[n+1],B=a[n+2],p=p/16383*b,t=t/16383*b,B=B/16383*b,p+=e,t+=h,B+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,B)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,p.push(e,1-f)})(f[0],8,3);(function(a,
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,k,n,E,z,D,M=a.length;for(b=0;b<M;b+=3){e=a[b];f=a[b+1];h=a[b+2];k=c;z=e;D=f;n=h;E=e;var I=f,C=h,P=k.materials[0],K=t[I*3],O=t[I*3+1],I=t[I*3+2],N=t[C*3],H=t[C*3+1],C=t[C*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);I=new THREE.Vector3(K,O,I);C=new THREE.Vector3(N,H,C);k.faces.push(new THREE.Face3(z,D,n,[E,I,C],null,P));k=p[e*2];e=p[e*2+
+1];n=p[f*2];E=p[f*2+1];z=p[h*2];D=p[h*2+1];h=c.faceVertexUvs[0];f=n;n=E;E=[];E.push(new THREE.UV(k,e));E.push(new THREE.UV(f,n));E.push(new THREE.UV(z,D));h.push(E)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,h){return a+(c-a)*h};this.VIntX=function(a,c,h,k,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[k]=l+f*this.delta;c[k+1]=n;c[k+2]=u;h[k]=this.lerp(t[a],t[a+3],f);h[k+1]=this.lerp(t[a+1],t[a+4],f);h[k+2]=this.lerp(t[a+2],t[a+5],f)};this.VIntY=function(a,c,h,k,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[k]=l;c[k+1]=n+f*this.delta;c[k+
-2]=u;c=a+this.yd*3;h[k]=this.lerp(t[a],t[c],f);h[k+1]=this.lerp(t[a+1],t[c+1],f);h[k+2]=this.lerp(t[a+2],t[c+2],f)};this.VIntZ=function(a,c,h,k,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[k]=l;c[k+1]=n;c[k+2]=u+f*this.delta;c=a+this.zd*3;h[k]=this.lerp(t[a],t[c],f);h[k+1]=this.lerp(t[a+1],t[c+1],f);h[k+2]=this.lerp(t[a+2],t[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,h,k,f,l){var n=k+1,u=k+this.yd,t=k+this.zd,p=n+this.yd,w=n+this.zd,v=k+this.yd+this.zd,z=n+this.yd+this.zd,x=0,y=this.field[k],G=this.field[n],A=this.field[u],B=this.field[p],D=this.field[t],O=this.field[w],I=this.field[v],H=this.field[z];y<f&&(x|=1);G<f&&(x|=2);A<f&&(x|=8);B<f&&(x|=4);D<f&&(x|=16);O<f&&(x|=32);I<f&&(x|=128);H<f&&(x|=64);var P=THREE.edgeTable[x];if(P===0)return 0;
-var Q=this.delta,M=a+Q,K=c+Q,Q=h+Q;P&1&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,0,f,a,c,h,y,G));P&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,f,M,c,h,G,B));P&4&&(this.compNorm(u),this.compNorm(p),this.VIntX(u*3,this.vlist,this.nlist,6,f,a,K,h,A,B));P&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,f,a,c,h,y,A));P&16&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,12,f,a,c,Q,D,O));
-P&32&&(this.compNorm(w),this.compNorm(z),this.VIntY(w*3,this.vlist,this.nlist,15,f,M,c,Q,O,H));P&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,f,a,K,Q,I,H));P&128&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,21,f,a,c,Q,D,I));P&256&&(this.compNorm(k),this.compNorm(t),this.VIntZ(k*3,this.vlist,this.nlist,24,f,a,c,h,y,D));P&512&&(this.compNorm(n),this.compNorm(w),this.VIntZ(n*3,this.vlist,this.nlist,27,f,M,c,h,G,O));P&1024&&(this.compNorm(p),
-this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,f,M,K,h,B,H));P&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,f,a,K,h,A,I));x<<=4;for(f=k=0;THREE.triTable[x+f]!=-1;)a=x+f,c=a+1,h=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[h],l),f+=3,k++;return k};this.posnormtriv=function(a,c,h,k,f,l){var n=this.count*3;this.positionArray[n]=a[h];this.positionArray[n+1]=a[h+1];this.positionArray[n+2]=a[h+2];this.positionArray[n+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,h){return a+(c-a)*h};this.VIntX=function(a,c,h,k,f,l,n,t,p,v){f=(f-p)/(v-p);p=this.normal_cache;c[k]=l+f*this.delta;c[k+1]=n;c[k+2]=t;h[k]=this.lerp(p[a],p[a+3],f);h[k+1]=this.lerp(p[a+1],p[a+4],f);h[k+2]=this.lerp(p[a+2],p[a+5],f)};this.VIntY=function(a,c,h,k,f,l,n,t,p,v){f=(f-p)/(v-p);p=this.normal_cache;c[k]=l;c[k+1]=n+f*this.delta;c[k+
+2]=t;c=a+this.yd*3;h[k]=this.lerp(p[a],p[c],f);h[k+1]=this.lerp(p[a+1],p[c+1],f);h[k+2]=this.lerp(p[a+2],p[c+2],f)};this.VIntZ=function(a,c,h,k,f,l,n,t,p,v){f=(f-p)/(v-p);p=this.normal_cache;c[k]=l;c[k+1]=n;c[k+2]=t+f*this.delta;c=a+this.zd*3;h[k]=this.lerp(p[a],p[c],f);h[k+1]=this.lerp(p[a+1],p[c+1],f);h[k+2]=this.lerp(p[a+2],p[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,h,k,f,l){var n=k+1,t=k+this.yd,p=k+this.zd,v=n+this.yd,x=n+this.zd,u=k+this.yd+this.zd,y=n+this.yd+this.zd,w=0,B=this.field[k],A=this.field[n],E=this.field[t],z=this.field[v],D=this.field[p],M=this.field[x],I=this.field[u],C=this.field[y];B<f&&(w|=1);A<f&&(w|=2);E<f&&(w|=8);z<f&&(w|=4);D<f&&(w|=16);M<f&&(w|=32);I<f&&(w|=128);C<f&&(w|=64);var P=THREE.edgeTable[w];if(P===0)return 0;
+var K=this.delta,O=a+K,N=c+K,K=h+K;P&1&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,0,f,a,c,h,B,A));P&2&&(this.compNorm(n),this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,3,f,O,c,h,A,z));P&4&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,6,f,a,N,h,E,z));P&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,f,a,c,h,B,E));P&16&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,12,f,a,c,K,D,M));
+P&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,f,O,c,K,M,C));P&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,N,K,I,C));P&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,f,a,c,K,D,I));P&256&&(this.compNorm(k),this.compNorm(p),this.VIntZ(k*3,this.vlist,this.nlist,24,f,a,c,h,B,D));P&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,f,O,c,h,A,M));P&1024&&(this.compNorm(v),
+this.compNorm(y),this.VIntZ(v*3,this.vlist,this.nlist,30,f,O,N,h,z,C));P&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,f,a,N,h,E,I));w<<=4;for(f=k=0;THREE.triTable[w+f]!=-1;)a=w+f,c=a+1,h=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[h],l),f+=3,k++;return k};this.posnormtriv=function(a,c,h,k,f,l){var n=this.count*3;this.positionArray[n]=a[h];this.positionArray[n+1]=a[h+1];this.positionArray[n+2]=a[h+2];this.positionArray[n+
 3]=a[k];this.positionArray[n+4]=a[k+1];this.positionArray[n+5]=a[k+2];this.positionArray[n+6]=a[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+2];this.normalArray[n]=c[h];this.normalArray[n+1]=c[h+1];this.normalArray[n+2]=c[h+2];this.normalArray[n+3]=c[k];this.normalArray[n+4]=c[k+1];this.normalArray[n+5]=c[k+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,h,k,f){var l=this.size*Math.sqrt(k/f),n=h*this.size,u=c*this.size,t=a*this.size,p=Math.floor(n-l);p<1&&(p=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var w=Math.floor(u-l);w<1&&(w=1);u=Math.floor(u+l);u>this.size-1&&(u=this.size-1);var v=Math.floor(t-l);v<1&&(v=1);l=Math.floor(t+l);
-l>this.size-1&&(l=this.size-1);for(var z,x,y,G,A,B;p<n;p++){t=this.size2*p;x=p/this.size-h;A=x*x;for(x=w;x<u;x++){y=t+this.size*x;z=x/this.size-c;B=z*z;for(z=v;z<l;z++)G=z/this.size-a,G=k/(1.0E-6+G*G+B+A)-f,G>0&&(this.field[y+z]+=G)}}};this.addPlaneX=function(a,c){var h,k,f,l,n,u=this.size,t=this.yd,p=this.zd,w=this.field,v=u*Math.sqrt(a/c);v>u&&(v=u);for(h=0;h<v;h++)if(k=h/u,k*=k,l=a/(1.0E-4+k)-c,l>0)for(k=0;k<u;k++){n=h+k*t;for(f=0;f<u;f++)w[p*f+n]+=l}};this.addPlaneY=function(a,c){var h,k,f,l,
-n,u,t=this.size,p=this.yd,w=this.zd,v=this.field,z=t*Math.sqrt(a/c);z>t&&(z=t);for(k=0;k<z;k++)if(h=k/t,h*=h,l=a/(1.0E-4+h)-c,l>0){n=k*p;for(h=0;h<t;h++){u=n+h;for(f=0;f<t;f++)v[w*f+u]+=l}}};this.addPlaneZ=function(a,c){var h,k,f,l,n,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(h=f/size,h*=h,l=a/(1.0E-4+h)-c,l>0){n=zd*f;for(k=0;k<size;k++){u=n+k*yd;for(h=0;h<size;h++)field[u+h]+=l}}};this.reset=function(){var a;for(a=
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,h,k,f,l,n,u,t,p,w=this.size-2;for(f=1;f<w;f++){p=this.size2*f;u=(f-this.halfsize)/this.halfsize;for(k=1;k<w;k++){t=p+this.size*k;n=(k-this.halfsize)/this.halfsize;for(h=1;h<w;h++)l=(h-this.halfsize)/this.halfsize,c=t+h,this.polygonize(l,n,u,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,h=[];this.render(function(k){var f,l,n,u,t,p,w,v;for(f=0;f<k.count;f++)w=
-f*3,t=w+1,v=w+2,l=k.positionArray[w],n=k.positionArray[t],u=k.positionArray[v],p=new THREE.Vector3(l,n,u),l=k.normalArray[w],n=k.normalArray[t],u=k.normalArray[v],w=new THREE.Vector3(l,n,u),w.normalize(),t=new THREE.Vertex(p),c.vertices.push(t),h.push(w);nfaces=k.count/3;for(f=0;f<nfaces;f++)w=(a+f)*3,t=w+1,v=w+2,p=h[w],l=h[t],n=h[v],w=new THREE.Face3(w,t,v,[p,l,n]),c.faces.push(w);a+=nfaces;k.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,h,k,f){var l=this.size*Math.sqrt(k/f),n=h*this.size,t=c*this.size,p=a*this.size,v=Math.floor(n-l);v<1&&(v=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-l);x<1&&(x=1);t=Math.floor(t+l);t>this.size-1&&(t=this.size-1);var u=Math.floor(p-l);u<1&&(u=1);l=Math.floor(p+l);
+l>this.size-1&&(l=this.size-1);for(var y,w,B,A,E,z;v<n;v++){p=this.size2*v;w=v/this.size-h;E=w*w;for(w=x;w<t;w++){B=p+this.size*w;y=w/this.size-c;z=y*y;for(y=u;y<l;y++)A=y/this.size-a,A=k/(1.0E-6+A*A+z+E)-f,A>0&&(this.field[B+y]+=A)}}};this.addPlaneX=function(a,c){var h,k,f,l,n,t=this.size,p=this.yd,v=this.zd,x=this.field,u=t*Math.sqrt(a/c);u>t&&(u=t);for(h=0;h<u;h++)if(k=h/t,k*=k,l=a/(1.0E-4+k)-c,l>0)for(k=0;k<t;k++){n=h+k*p;for(f=0;f<t;f++)x[v*f+n]+=l}};this.addPlaneY=function(a,c){var h,k,f,l,
+n,t,p=this.size,v=this.yd,x=this.zd,u=this.field,y=p*Math.sqrt(a/c);y>p&&(y=p);for(k=0;k<y;k++)if(h=k/p,h*=h,l=a/(1.0E-4+h)-c,l>0){n=k*v;for(h=0;h<p;h++){t=n+h;for(f=0;f<p;f++)u[x*f+t]+=l}}};this.addPlaneZ=function(a,c){var h,k,f,l,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(h=f/size,h*=h,l=a/(1.0E-4+h)-c,l>0){n=zd*f;for(k=0;k<size;k++){t=n+k*yd;for(h=0;h<size;h++)field[t+h]+=l}}};this.reset=function(){var a;for(a=
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,h,k,f,l,n,t,p,v,x=this.size-2;for(f=1;f<x;f++){v=this.size2*f;t=(f-this.halfsize)/this.halfsize;for(k=1;k<x;k++){p=v+this.size*k;n=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)l=(h-this.halfsize)/this.halfsize,c=p+h,this.polygonize(l,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,h=[];this.render(function(k){var f,l,n,t,p,v,x,u;for(f=0;f<k.count;f++)x=
+f*3,p=x+1,u=x+2,l=k.positionArray[x],n=k.positionArray[p],t=k.positionArray[u],v=new THREE.Vector3(l,n,t),l=k.normalArray[x],n=k.normalArray[p],t=k.normalArray[u],x=new THREE.Vector3(l,n,t),x.normalize(),p=new THREE.Vertex(v),c.vertices.push(p),h.push(x);nfaces=k.count/3;for(f=0;f<nfaces;f++)x=(a+f)*3,p=x+1,u=x+2,v=h[x],l=h[p],n=h[u],x=new THREE.Face3(x,p,u,[v,l,n]),c.faces.push(x);a+=nfaces;k.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
 THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -690,20 +693,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,h,k=0;c=0;for(b=this.colliders.length;c<b;c++)if(h=this.colliders[c],e=this.rayCast(a,h),e<Number.MAX_VALUE)h.distance=e,e>k?this.hits.push(h):this.hits.unshift(h),k=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var f=c.mesh.geometry.faces[k],l=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,u=c.mesh.geometry.vertices[f.c].position,t=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,l,n,u,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,l,n,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,u,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:h}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var f=c.mesh.geometry.faces[k],l=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,t=c.mesh.geometry.vertices[f.c].position,p=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,l,n,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,l,n,p,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,t,p,e,this.collisionNormal,c.mesh),f<e&&(e=f,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:h}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,h,k,f){var l=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;k.set(0,0,0);l.sub(b,c);n.sub(e,b);k.cross(l,n);l=k.dot(a.direction);if(!(l<0))if(f.doubleSided||f.flipSided)k.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;f=k.dot(c)-k.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=l*h))return Number.MAX_VALUE;f/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(f);l.addSelf(a.origin);Math.abs(k.x)>
 Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(a=l.y-c.y,k=b.y-c.y,h=e.y-c.y,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,k=b.x-c.x,h=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(a=l.x-c.x,k=b.x-c.x,h=e.x-c.x,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,k=b.x-c.x,h=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y);c=k*e-b*h;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-l*h)*c;if(!(e>=0))return Number.MAX_VALUE;c*=k*l-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,h=0,k=0,f=0,l=0,n=0,u=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,u=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,u=!1,f=1);b.origin.y<c.min.y?(h=c.min.y-b.origin.y,h/=b.direction.y,u=!1,l=-1):b.origin.y>c.max.y&&(h=c.max.y-b.origin.y,h/=b.direction.y,
-u=!1,l=1);b.origin.z<c.min.z?(k=c.min.z-b.origin.z,k/=b.direction.z,u=!1,n=-1):b.origin.z>c.max.z&&(k=c.max.z-b.origin.z,k/=b.direction.z,u=!1,n=1);if(u)return-1;u=0;h>e&&(u=1,e=h);k>e&&(u=2,e=k);switch(u){case 0:l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,h=0,k=0,f=0,l=0,n=0,t=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,t=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,f=1);b.origin.y<c.min.y?(h=c.min.y-b.origin.y,h/=b.direction.y,t=!1,l=-1):b.origin.y>c.max.y&&(h=c.max.y-b.origin.y,h/=b.direction.y,
+t=!1,l=1);b.origin.z<c.min.z?(k=c.min.z-b.origin.z,k/=b.direction.z,t=!1,n=-1):b.origin.z>c.max.z&&(k=c.max.z-b.origin.z,k/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;h>e&&(t=1,e=h);k>e&&(t=2,e=k);switch(t){case 0:l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,l,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,h=new THREE.PerspectiveCamera,k=new THREE.PerspectiveCamera,f=new THREE.Matrix4,l=new THREE.Matrix4,n,u,t,p;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},w=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
-1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:w},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var x=new THREE.Scene;x.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));x.add(z);this.setSize=function(a,e){b.call(c,a,e);w.width=a;w.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||u!==b.near||t!==b.far||p!==b.fov){n=b.aspect;u=b.near;t=b.far;p=b.fov;var A=b.projectionMatrix.clone(),B=125/30*0.5,D=B*u/125,O=u*Math.tan(p*Math.PI/360),I;f.n14=B;l.n14=-B;B=-O*n+D;I=O*n+D;A.n11=2*u/(I-B);A.n13=(I+B)/(I-B);h.projectionMatrix.copy(A);B=-O*n-D;
-I=O*n-D;A.n11=2*u/(I-B);A.n13=(I+B)/(I-B);k.projectionMatrix.copy(A)}h.matrixWorld.copy(b.matrixWorld).multiplySelf(l);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,w,!0);k.matrixWorld.copy(b.matrixWorld).multiplySelf(f);k.position.copy(b.position);k.near=b.near;k.far=b.far;e.call(c,a,k,v,!0);x.updateMatrixWorld();e.call(c,x,z)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,h=new THREE.PerspectiveCamera,k=new THREE.PerspectiveCamera,f=new THREE.Matrix4,l=new THREE.Matrix4,n,t,p,v;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53,
+1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;u.width=a;u.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||p!==b.far||v!==b.fov){n=b.aspect;t=b.near;p=b.far;v=b.fov;var E=b.projectionMatrix.clone(),z=125/30*0.5,D=z*t/125,M=t*Math.tan(v*Math.PI/360),I;f.n14=z;l.n14=-z;z=-M*n+D;I=M*n+D;E.n11=2*t/(I-z);E.n13=(I+z)/(I-z);h.projectionMatrix.copy(E);z=-M*n-D;
+I=M*n-D;E.n11=2*t/(I-z);E.n13=(I+z)/(I-z);k.projectionMatrix.copy(E)}h.matrixWorld.copy(b.matrixWorld).multiplySelf(l);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,x,!0);k.matrixWorld.copy(b.matrixWorld).multiplySelf(f);k.position.copy(b.position);k.near=b.near;k.far=b.far;e.call(c,a,k,u,!0);w.updateMatrixWorld();e.call(c,w,y)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,h,k,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);h=a/2;k=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);l.projectionMatrix=f.projectionMatrix;l.position.copy(b.position);l.target.copy(b.target);l.translateX(-c.separation);l.lookAt(l.target);this.setViewport(0,0,h,k);e.call(c,a,f);this.setViewport(h,0,h,k);e.call(c,a,l,!1)}};

+ 142 - 138
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-g)/k:e===h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],t={},u=0;u<a.materials.length;u++)t[a.materials[u].id]=u;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var u=0,z=k.length;u<z;u++){var v=new THREE.Vertex(k[u].position.clone());b&&b.multiplyVector3(v.position);f.push(v)}u=
-0;for(z=m.length;u<z;u++){var f=m[u],p,y,x=f.vertexNormals,w=f.vertexColors;f instanceof THREE.Face3?p=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(p=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));p.normal.copy(f.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(f.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
-v=t[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);p.materialIndex=v}p.centroid.copy(f.centroid);b&&b.multiplyVector3(p.centroid);l.push(p)}u=0;for(z=o.length;u<z;u++){b=o[u];e=[];k=0;for(v=b.length;k<v;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},p=0;p<a.materials.length;p++)u[a.materials[p].id]=p;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var p=0,z=k.length;p<z;p++){var w=new THREE.Vertex(k[p].position.clone());b&&b.multiplyVector3(w.position);f.push(w)}p=
+0;for(z=m.length;p<z;p++){var f=m[p],x,v,y=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?x=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(x=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));x.normal.copy(f.normal);e&&e.multiplyVector3(x.normal);k=0;for(w=y.length;k<w;k++)v=y[k].clone(),e&&e.multiplyVector3(v),x.vertexNormals.push(v);x.color.copy(f.color);k=0;for(w=t.length;k<w;k++)v=t[k],x.vertexColors.push(v.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
+w=u[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);x.materialIndex=w}x.centroid.copy(f.centroid);b&&b.multiplyVector3(x.centroid);l.push(x)}p=0;for(z=o.length;p<z;p++){b=o[p];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
 for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<
 f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,
 h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var f=e+Math.floor((c-e)/2);return m[f]>a?b(e,f-1):m[f]<a?b(f+1,c):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,t,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,t);else if(e instanceof
-THREE.Face4)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,t,u),e._area=e._area1+e._area2;l+=e._area;m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var f=e+Math.floor((c-e)/2);return m[f]>a?b(e,f-1):m[f]<a?b(f+1,c):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,u,p;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
+THREE.Face4)n=f[e.a].position,o=f[e.b].position,u=f[e.c].position,p=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,p),e._area2=THREE.GeometryUtils.triangleArea(o,u,p),e._area=e._area1+e._area2;l+=e._area;m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var t=o-1<0?g-1:o-1,u=(o+1)%g,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(t*e+z)*4]/255*c]);p.push([0,-1,k[(t*e+n)*4]/255*c]);p.push([1,-1,k[(t*e+v)*4]/255*c]);
-p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(u*e+v)*4]/255*c]);p.push([0,1,k[(u*e+n)*4]/255*c]);p.push([-1,1,k[(u*e+z)*4]/255*c]);t=[];z=p.length;for(u=0;u<z;u++){var v=p[u],x=p[(u+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];t.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
-255|0;m[y+2]=p[2]*255|0;m[y+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,g=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);g.add(h)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var u=o-1<0?g-1:o-1,p=(o+1)%g,z=n-1<0?e-1:n-1,w=(n+1)%e,x=[],v=[0,0,k[(o*e+n)*4]/255*c];x.push([-1,0,k[(o*e+z)*4]/255*c]);x.push([-1,-1,k[(u*e+z)*4]/255*c]);x.push([0,-1,k[(u*e+n)*4]/255*c]);x.push([1,-1,k[(u*e+w)*4]/255*c]);
+x.push([1,0,k[(o*e+w)*4]/255*c]);x.push([1,1,k[(p*e+w)*4]/255*c]);x.push([0,1,k[(p*e+n)*4]/255*c]);x.push([-1,1,k[(p*e+z)*4]/255*c]);u=[];z=x.length;for(p=0;p<z;p++){var w=x[p],y=x[(p+1)%z],w=[w[0]-v[0],w[1]-v[1],w[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];u.push(b([w[1]*y[2]-w[2]*y[1],w[2]*y[0]-w[0]*y[2],w[0]*y[1]-w[1]*y[0]]))}x=[0,0,0];for(p=0;p<u.length;p++)x[0]+=u[p][0],x[1]+=u[p][1],x[2]+=u[p][2];x[0]/=u.length;x[1]/=u.length;x[2]/=u.length;v=(o*e+n)*4;m[v]=(x[0]+1)/2*255|0;m[v+1]=(x[1]+0.5)*
+255|0;m[v+2]=x[2]*255|0;m[v+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,g=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);g.add(h)}return g}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -52,9 +52,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,t,u,z,v;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];t=h[1];b.length>0?(f=b[b.length-1],u=f.x,z=f.y):(f=this.actions[e-1].args,u=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b2(v,u,o,k),v=THREE.Shape.Utils.b2(v,z,t,
-l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];t=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],u=f.x,z=f.y):(f=this.actions[e-1].args,u=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b3(v,u,o,m,k),v=THREE.Shape.Utils.b3(v,z,t,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
-for(f=1;f<=v;f++)b.push(h.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];t=!!h[5];n=f[f.length-2];u=f[f.length-1];f.length==0&&(n=u=0);z=v-o;var p=a*2;for(f=1;f<=p;f++)v=f/p,t||(v=1-v),v=o+v*z,h=n+k+m*Math.cos(v),v=u+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,u,p,z,w;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];u=h[1];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b2(w,p,o,k),w=THREE.Shape.Utils.b2(w,z,u,
+l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];u=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],p=f.x,z=f.y):(f=this.actions[e-1].args,p=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)w=f/a,h=THREE.Shape.Utils.b3(w,p,o,m,k),w=THREE.Shape.Utils.b3(w,z,u,n,l),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];w=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
+for(f=1;f<=w;f++)b.push(h.getPointAt(f/w));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];w=h[4];u=!!h[5];n=f[f.length-2];p=f[f.length-1];f.length==0&&(n=p=0);z=w-o;var x=a*2;for(f=1;f<=x;f++)w=f/x,u||(w=1-w),w=o+w*z,h=n+k+m*Math.cos(w),w=p+l+m*Math.sin(w),b.push(new THREE.Vector2(h,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
 THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
 this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
@@ -62,8 +62,8 @@ THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;f
 e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,t,u,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){t=m[g];u=[];for(o=0;o<b.length;o++)n=b[o],n=t.distanceToSquared(n),u.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var v=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;n=f;k+=1;f+=-1;k<
-0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;v=[m[f],b[k],b[g]];v=THREE.FontUtils.Triangulate.area(v);p=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+t>v+p&&(k=u,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);t=b.slice(k);u=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];z.push([m[f],b[k],b[g]]);z.push(h);b=o.concat(u).concat(n).concat(t)}return{shape:b,
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,u,p,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){u=m[g];p=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),p.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var w=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(w);var x=[m[f],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(x);p=k;n=f;k+=1;f+=-1;k<
+0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;w=[m[f],b[k],b[g]];w=THREE.FontUtils.Triangulate.area(w);x=[m[f],m[h],b[k]];x=THREE.FontUtils.Triangulate.area(x);o+u>w+x&&(k=p,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);u=b.slice(k);p=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];z.push([m[f],b[k],b[g]]);z.push(h);b=o.concat(p).concat(n).concat(u)}return{shape:b,
 isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
@@ -77,11 +77,11 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,t;this.currentTime+=a*this.timeScale;t=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,z=this.hierarchy.length;u<z;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){b=c[v];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=t){if(o<t)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
-o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(null,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,u;this.currentTime+=a*this.timeScale;u=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,z=this.hierarchy.length;p<z;p++)if(a=this.hierarchy[p],l=a.animationCache,this.JITCompile&&n[p][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=n[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){f=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(b,p,1);k.time<o;)f=k,k=this.getNextKeyWith(b,p,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,p,k.index+1);while(k.time<
+o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(null,!0);for(p=0;p<this.hierarchy.length;p++)n[p][m]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
@@ -90,9 +90,12 @@ this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.p
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var e=this.renderTarget;e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,this.cameraNX,e);e.activeCubeFace=2;a.render(b,this.cameraPY,e);e.activeCubeFace=3;a.render(b,
 this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
-THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
-THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
+THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
+THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
+THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
+THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
@@ -101,7 +104,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*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;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,y=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),x=g.length,v=0;h=x-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<x-1;h++)v=c*k.chunks[h]/k.total,b.keys[h]={time:v,pos:g[h]};f.hierarchy[0]=
 b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
@@ -119,37 +122,37 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*o);this.rotateVertically(c*t)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,u=0,p=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*o);this.rotateVertically(c*u)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,
 g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;u=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,u=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
-e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=t.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=t:o.addSelf(a.sub(t,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=t=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
-a.clientY):h===e.PAN&&!b.noPan&&(t=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=t=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=u.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=u:o.addSelf(a.sub(u,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=u=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
+a.clientY):h===e.PAN&&!b.noPan&&(u=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=u=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,o,n){var u,p,t=e||1,v=g||1,z=k/2,w=l/2,x=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")u="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")u="y",v=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")u="x",t=h||1;var y=t+1,O=v+1;k/=t;var R=l/v;for(p=0;p<O;p++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(p*R-w)*f;U[u]=o;m.vertices.push(new THREE.Vertex(U))}for(p=0;p<v;p++)for(l=0;l<t;l++)m.faces.push(new THREE.Face4(l+
-y*p+x,l+y*(p+1)+x,l+1+y*(p+1)+x,l+1+y*p+x,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/t,p/v),new THREE.UV(l/t,(p+1)/v),new THREE.UV((l+1)/t,(p+1)/v),new THREE.UV((l+1)/t,p/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,t=b/2,u,z,v,p,y,x;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(u=0;u<6;u++)this.materials.push(f)}u=0;p=1;z=2;y=3;v=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=
-void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,u);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,t,v);this.sides.nz&&l("x","y",-1,-1,a,c,-t,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],t=[],u=l/g,z=u*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-u*b+f,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(v,u))}m.push(o);n.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],z=
-this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),y=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,t,u,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
-1],t=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,t,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],t=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
-A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,t,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,n,p){var o,u,v=e||1,t=g||1,w=k/2,x=l/2,z=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")o="y",t=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")o="x",v=h||1;var y=v+1,O=t+1;k/=v;var R=l/t;for(u=0;u<O;u++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-w)*c;U[b]=(u*R-x)*f;U[o]=n;m.vertices.push(new THREE.Vertex(U))}for(u=0;u<t;u++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+
+y*u+z,l+y*(u+1)+z,l+1+y*(u+1)+z,l+1+y*u+z,null,null,p)),m.faceVertexUvs[0].push([new THREE.UV(l/v,u/t),new THREE.UV(l/v,(u+1)/t),new THREE.UV((l+1)/v,(u+1)/t),new THREE.UV((l+1)/v,u/t)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,p,z,w,x,v,y;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(f)}p=0;x=1;z=2;v=3;w=4;y=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var t in k)this.sides[t]!=
+void 0&&(this.sides[t]=k[t]);this.sides.px&&l("z","y",-1,-1,b,c,n,p);this.sides.nx&&l("z","y",1,-1,b,c,-n,x);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,v);this.sides.pz&&l("x","y",1,-1,a,c,u,w);this.sides.nz&&l("x","y",-1,-1,a,c,-u,y);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],u=[],p=l/g,z=p*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(w*Math.PI*2),-p*b+f,z*Math.cos(w*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(w,p))}m.push(o);n.push(u)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],p=m[l][k+1],z=
+this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[o].position.clone().setY(0).normalize(),x=this.vertices[u].position.clone().setY(0).normalize(),v=this.vertices[p].position.clone().setY(0).normalize(),y=n[l][k].clone(),t=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,p,[z,w,x,v]));this.faceVertexUvs[0].push([y,t,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
+1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=n[0][k].clone(),t=n[0][k+1].clone(),A=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=n[l][k+1].clone(),t=n[l][k].clone(),
+A=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,w,x])),this.faceVertexUvs[0].push([y,t,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
-k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
-1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=X+S+e,g=X+S+f,m=h,e=X+T+e,f=X+T+f,o=g;m+=L;e+=L;f+=L;o+=L;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
-b,c,null,null,w));if(w){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,t=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(t),u=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);z=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
-(t[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,t);x=z;E=0;for(I=t.length;E<I;E++)B=t[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=t.length;E<I;E++){B=t[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=
-0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=u;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];
-R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[u-1].y,p[u-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],f(m[2]+o,m[1]+o,m[0]+o);o=P*(u+n*2);for(C=0;C<H;C++)m=v[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],f(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],f(m[0]+P*u,m[1]+P*u,m[2]+P*u)}var S,T,X=0;g(x);X+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){S=B;T=B-1;T<0&&(T=a.length-
+1);for(var b=0,c=p+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=X+S+e,g=X+S+f,m=h,e=X+T+e,f=X+T+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;G.faces.push(new THREE.Face3(a,
+b,c,null,null,t));if(t){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,u=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,z=c.bendPath,w=c.extrudePath,x,v=!1,y=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,A=c.extrudeMaterial,D=this.shapebb;if(w)x=w.getPoints(u),p=x.length,v=!0,o=!1;o||(m=l=n=0);var C,E,I,G=this,K=this.vertices.length;z&&a.addWrapPath(z);u=y?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(w=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)C=u[E],THREE.Shape.Utils.isClockWise(C)&&
+(u[E]=C.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(z,u);y=z;E=0;for(I=u.length;E<I;E++)C=u[E],z=z.concat(C);var B,F,J,M,N,L,P=z.length,H=w.length,Q=[];B=0;F=y.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[B]=e(y[B],y[S],y[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){C=u[E];R=[];B=0;F=C.length;S=F-1;for(T=B+1;B<F;B++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[B]=e(C[B],C[S],C[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=
+0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,-N);E=0;for(I=u.length;E<I;E++){C=u[E];R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),h(L.x,L.y,-N)}}M=m;for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[0].y,x[0].x):h(L.x,L.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)L=o?b(z[B],U[B],M):z[B],v?h(L.x,L.y+x[J-1].y,x[J-1].x):h(L.x,L.y,k/p*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);B=0;for(F=y.length;B<F;B++)L=b(y[B],Q[B],M),h(L.x,L.y,k+N);E=0;for(I=u.length;E<I;E++){C=u[E];
+R=O[E];B=0;for(F=C.length;B<F;B++)L=b(C[B],R[B],M),v?h(L.x,L.y+x[p-1].y,x[p-1].x+N):h(L.x,L.y,k+N)}}if(o){o=P*0;for(B=0;B<H;B++)m=w[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<H;B++)m=w[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<H;B++)m=w[B],f(m[2],m[1],m[0]);for(B=0;B<H;B++)m=w[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var S,T,X=0;g(y);X+=y.length;E=0;for(I=u.length;E<I;E++)C=u[E],g(C),X+=C.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
@@ -162,18 +165,18 @@ f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,t=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,t)))-1);m.push(n)}c.push(m)}for(var u,z,v,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
-h-1:e];m=c[b-1][m?0:e+1];t=b/(g-1);u=(b-1)/(g-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,t),t=new THREE.UV(1-o,t),o=new THREE.UV(1-o,u),p=new THREE.UV(1-z,u);b<c.length-1&&(u=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),u.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,t,o]));b>1&&(u=
-this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),u.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var p,z,w,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
+h-1:e];m=c[b-1][m?0:e+1];u=b/(g-1);p=(b-1)/(g-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,u),u=new THREE.UV(1-o,u),o=new THREE.UV(1-o,p),x=new THREE.UV(1-z,p);b<c.length-1&&(p=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(p=
+this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),w=this.vertices[m].position.clone(),p.normalize(),z.normalize(),w.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([n,o,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,t,u,z,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
-m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;t=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var y=f/divisions,x=THREE.Shape.Utils.b2(y,n,t,k),y=THREE.Shape.Utils.b2(y,o,u,m);h.push(new THREE.Vector2(x,y))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,t=c[a++]*b+e,u=c[a++]*-b,z=c[a++]*b+e,v=c[a++]*-b,g.bezierCurveTo(k,m,
-t,u,z,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)y=f/divisions,x=THREE.Shape.Utils.b3(y,n,t,z,k),y=THREE.Shape.Utils.b3(y,o,u,v,m),h.push(new THREE.Vector2(x,y))}}}return{offset:p.ha*b,points:h,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var u=l,z=m,v=n,p=g,y=f,x=void 0,w=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,L=void 0,w=t[y[u]].x,A=t[y[u]].y,D=t[y[z]].x,B=t[y[z]].y,E=t[y[v]].x,I=t[y[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==z||x==v)){var G=t[y[x]].x,L=t[y[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,K=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,K=B-A,P=G-w,H=L-A,Q=G-D,O=L-B,R=G-E,U=L-I,C=C*O-F*Q,N=N*H-K*P,J=J*U-M*R;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,u,p,z,w,x=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
+m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;p=c[a++]*b;g.quadraticCurveTo(u,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var v=f/divisions,y=THREE.Shape.Utils.b2(v,n,u,k),v=THREE.Shape.Utils.b2(v,o,p,m);h.push(new THREE.Vector2(y,v))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,p=c[a++]*-b,z=c[a++]*b+e,w=c[a++]*-b,g.bezierCurveTo(k,m,
+u,p,z,w),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)v=f/divisions,y=THREE.Shape.Utils.b3(v,n,u,z,k),v=THREE.Shape.Utils.b3(v,o,p,w,m),h.push(new THREE.Vector2(y,v))}}}return{offset:x.ha*b,points:h,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var u;a:{u=a;var p=l,z=m,w=n,x=g,v=f,y=void 0,t=void 0,A=void 0,
+D=void 0,C=void 0,E=void 0,I=void 0,G=void 0,K=void 0,t=u[v[p]].x,A=u[v[p]].y,D=u[v[z]].x,C=u[v[z]].y,E=u[v[w]].x,I=u[v[w]].y;if(1.0E-10>(D-t)*(I-A)-(C-A)*(E-t))u=!1;else{for(y=0;y<x;y++)if(!(y==p||y==z||y==w)){var G=u[v[y]].x,K=u[v[y]].y,B=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,B=J=N=void 0,B=E-D,F=I-C,J=t-E,M=A-I,N=D-t,L=C-A,P=G-t,H=K-A,Q=G-D,O=K-C,R=G-E,U=K-I,B=B*O-F*Q,N=N*H-L*P,J=J*U-M*R;if(B>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[f[l]],
 a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
@@ -182,134 +185,135 @@ THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;
 this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var p,n,u,t=0;t<4;t++){u=l[t];p=new THREE.Color;p.setRGB(0,0,0);for(var v=0;v<u.length;v++)n=k.vertexColors[u[v]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=u.length;p.g/=u.length;p.b/=u.length;m.vertexColors[t]=p}}g.push(m);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,z,v,p,y=a.faceVertexUvs[0];t=0;for(u=y.length;t<u;t++){z=0;for(v=y[t].length;z<v;z++)p=e[t]["abcd".charAt(z)],o[p]||(o[p]=y[t][z])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
-o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var w,A,D=0,y=k.length,B;for(t in v)if(p=v[t],x=p[0],w=
-p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=y+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],x=y+t,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
-c(x,n[w],p.b,n[B],p,["123","12","2","23"]),c(x,n[B],p.c,n[D],p,["123","23","3","31"]),c(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(x,n[w],p.b,n[B],p,["1234","12","2","23"]),c(x,n[B],p.c,n[D],p,["1234","23","3","34"]),c(x,n[D],p.d,n[A],p,["1234","34","4","41"]),c(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
-b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(t in v)p=v[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);y=0;for(z in I[t])l.addSelf(m[z]),y++;l.divideScalar(y);y=E[t].length;for(z=0;z<y;z++)p=E[t][z],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(y);
-v.addSelf(k[t].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[t].position=v}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var p,n,o,v=0;v<4;v++){o=l[v];p=new THREE.Color;p.setRGB(0,0,0);for(var t=0;t<o.length;t++)n=k.vertexColors[o[t]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=o.length;p.g/=o.length;p.b/=o.length;m.vertexColors[v]=p}}g.push(m);(!f.supportUVs||u.length!=0)&&h.push([u[a],u[b],u[c],u[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o={},u=[],p,z,w,x,v,y=a.faceVertexUvs[0];p=0;for(z=y.length;p<z;p++){w=0;for(x=y[p].length;w<x;w++)v=e[p]["abcd".charAt(w)],u[v]||(u[v]=y[p][w])}var t;p=0;for(z=e.length;p<z;p++)if(v=e[p],m.push(v.centroid),l.push(new THREE.Vertex(v.centroid)),f.supportUVs&&u.length!=0){t=new THREE.UV;if(v instanceof THREE.Face3)t.u=u[v.a].u+u[v.b].u+u[v.c].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v,t.u/=3,t.v/=3;else if(v instanceof THREE.Face4)t.u=
+u[v.a].u+u[v.b].u+u[v.c].u+u[v.d].u,t.v=u[v.a].v+u[v.b].v+u[v.c].v+u[v.d].v,t.u/=4,t.v/=4;u.push(t)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var A=0,y=k.length,D,C,E={},I={},G=function(a,
+b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},K=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(p in z){t=z[p];D=p.split("_");C=D[0];D=D[1];G(C,[C,D]);G(D,[C,D]);w=0;for(x=t.length;w<x;w++)v=t[w],K(C,v,p),K(D,v,p);t.length<2&&(o[p]=!0)}for(p in z)if(t=z[p],v=t[0],t=t[1],D=p.split("_"),C=D[0],D=D[1],x=new THREE.Vector3,o[p]?(x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.5)):(x.addSelf(m[v]),x.addSelf(m[t]),x.addSelf(k[C].position),x.addSelf(k[D].position),x.multiplyScalar(0.25)),
+n[p]=y+e.length+A,l.push(new THREE.Vertex(x)),A++,f.supportUVs&&u.length!=0)t=new THREE.UV,t.u=u[C].u+u[D].u,t.v=u[C].v+u[D].v,t.u/=2,t.v/=2,u.push(t);var B,F;D=["123","12","2","23"];x=["123","23","3","31"];var G=["123","31","1","12"],K=["1234","12","2","23"],J=["1234","23","3","34"],M=["1234","34","4","41"],N=["1234","41","1","12"];p=0;for(z=m.length;p<z;p++)v=e[p],t=y+p,v instanceof THREE.Face3?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.a),c(t,n[A],v.b,n[C],v,D),c(t,n[C],v.c,n[B],v,x),c(t,n[B],v.a,n[A],
+v,G)):v instanceof THREE.Face4?(A=b(v.a,v.b),C=b(v.b,v.c),B=b(v.c,v.d),F=b(v.d,v.a),c(t,n[A],v.b,n[C],v,K),c(t,n[C],v.c,n[B],v,J),c(t,n[B],v.d,n[F],v,M),c(t,n[F],v.a,n[A],v,N)):console.log("face should be a face!",v);e=l;l=new THREE.Vector3;n=new THREE.Vector3;p=0;for(z=k.length;p<z;p++)if(E[p]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);t=0;for(w in I[p])l.addSelf(m[w]),t++;A=0;y=E[p].length;for(w=0;w<y;w++)o[b(E[p][w][0],E[p][w][1])]&&A++;if(A!=2){l.divideScalar(t);for(w=0;w<
+y;w++)t=E[p][w],t=k[t[0]].position.clone().addSelf(k[t[1]].position).divideScalar(2),n.addSelf(t);n.divideScalar(y);v.addSelf(k[p].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[p].position=v}}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
 if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var t=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
-f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var u=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
+f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=u;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,e=g.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
 c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),h=n(a,b+2),g=n(a,b+3),k=(g<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(g>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
-e,f;c=g(a,b);e=g(a,b+B);f=g(a,b+E);b=l(a,b+I);y.faces.push(new THREE.Face3(c,e,f,null,null,b))}function t(b){var c,e,f,h,m,n,o;c=g(a,b);e=g(a,b+B);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);n=g(a,b+L);o=g(a,b+C);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var u=A[o*3],t=A[o*3+1];o=A[o*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(u,t,o)],null,h))}function u(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);b=l(a,b+N);y.faces.push(new THREE.Face4(c,
-e,f,h,null,null,b))}function z(b){var c,e,f,h,m,n,o,p,u;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);n=g(a,b+K);o=g(a,b+P);p=g(a,b+H);u=g(a,b+Q);var b=A[o*3],t=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[u*3],v=A[u*3+1];u=A[u*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,t,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,u)],null,m))}function v(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+R);b=D[c*2];h=D[c*
-2+1];c=D[e*2];var l=y.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function p(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+U);f=g(a,b+S);h=g(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=y.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,h));n.push(p)}var y=this,x=0,w,A=[],D=[],
-B,E,I,G,L,C,F,J,M,N,K,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,
-x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;L=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*
-4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;R=w.uv_index_bytes*2;U=w.uv_index_bytes;S=w.uv_index_bytes*2;T=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;W=w.vertex_index_bytes*4+w.material_index_bytes;X=w.ntri_flat*b;V=w.ntri_smooth*(b+w.normal_index_bytes*
-3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*W;b=w.nquad_smooth*(W+w.normal_index_bytes*4);W=w.nquad_flat_uv*(W+w.uv_index_bytes*4);x+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),g=c(a,b+w.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,g)));return w.nvertices*k}(x);x+=function(b){for(var c,e,f,h=w.normal_coordinate_bytes*
-3,g=b+w.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),f=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,g=w.uv_coordinate_bytes*2,k=b+w.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);X=x+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=c+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),v(b+c);return f-a})(V);
-(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(b=a;b<f;b+=e)t(b),v(b+c);return f-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),p(b+c);return f-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=c+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(b=a;b<f;b+=e)z(b),p(b+
-c);return f-a})(W);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)t(b);return e-a})(X);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(Y);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,e,g){V=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",p,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
+e,f;c=g(a,b);e=g(a,b+C);f=g(a,b+E);b=l(a,b+I);v.faces.push(new THREE.Face3(c,e,f,null,null,b))}function u(b){var c,e,f,h,m,n,o;c=g(a,b);e=g(a,b+C);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);n=g(a,b+K);o=g(a,b+B);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var u=A[o*3],t=A[o*3+1];o=A[o*3+2];v.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(u,t,o)],null,h))}function p(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);b=l(a,b+N);v.faces.push(new THREE.Face4(c,
+e,f,h,null,null,b))}function z(b){var c,e,f,h,m,n,o,p,u;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);n=g(a,b+L);o=g(a,b+P);p=g(a,b+H);u=g(a,b+Q);var b=A[o*3],t=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[u*3],w=A[u*3+1];u=A[u*3+2];v.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,t,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,w,u)],null,m))}function w(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+R);b=D[c*2];h=D[c*
+2+1];c=D[e*2];var l=v.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function x(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+U);f=g(a,b+S);h=g(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=v.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,h));n.push(p)}var v=this,y=0,t,A=[],D=[],
+C,E,I,G,K,B,F,J,M,N,L,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,e,b);t={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,
+y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=t.header_bytes;C=t.vertex_index_bytes;E=t.vertex_index_bytes*2;I=t.vertex_index_bytes*3;G=t.vertex_index_bytes*3+t.material_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;B=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;F=t.vertex_index_bytes;J=t.vertex_index_bytes*2;M=t.vertex_index_bytes*3;N=t.vertex_index_bytes*
+4;L=t.vertex_index_bytes*4+t.material_index_bytes;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;H=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;O=t.uv_index_bytes;R=t.uv_index_bytes*2;U=t.uv_index_bytes;S=t.uv_index_bytes*2;T=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;W=t.vertex_index_bytes*4+t.material_index_bytes;X=t.ntri_flat*b;V=t.ntri_smooth*(b+t.normal_index_bytes*
+3);Z=t.ntri_flat_uv*(b+t.uv_index_bytes*3);Y=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);$=t.nquad_flat*W;b=t.nquad_smooth*(W+t.normal_index_bytes*4);W=t.nquad_flat_uv*(W+t.uv_index_bytes*4);y+=function(b){for(var e,h,g,k=t.vertex_coordinate_bytes*3,l=b+t.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+t.vertex_coordinate_bytes),g=c(a,b+t.vertex_coordinate_bytes*2),v.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,g)));return t.nvertices*k}(y);y+=function(b){for(var c,e,f,h=t.normal_coordinate_bytes*
+3,g=b+t.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+t.normal_coordinate_bytes),f=m(a,b+t.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return t.nnormals*h}(y);y+=function(b){for(var e,h,g=t.uv_coordinate_bytes*2,k=b+t.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+t.uv_coordinate_bytes),D.push(e,h);return t.nuvs*g}(y);X=y+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=c+t.uv_index_bytes*3,f=a+t.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),w(b+c);return f-a})(V);
+(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=c+t.uv_index_bytes*3,f=a+t.ntri_smooth_uv*e;for(b=a;b<f;b+=e)u(b),w(b+c);return f-a})(Z);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=c+t.uv_index_bytes*4,f=a+t.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),x(b+c);return f-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=c+t.uv_index_bytes*4,f=a+t.nquad_smooth_uv*e;for(b=a;b<f;b+=e)z(b),x(b+
+c);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=a+t.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(y);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=a+t.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=a+t.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*
+4,e=a+t.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,e,g){V=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",x,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
 n,"visual_scene");da=[];ea=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=V.evaluate(a,V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[c];
 h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function g(a,c,f){var h=aa[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 g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
-for(f=0;f<g.frames;f++){var u=[],t=[];for(k=0;k<a.vertices.length;k++)t.push(new THREE.Vertex(new THREE.Vector3));e(c,u,f);k=u;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var w=0;w<l.weights[v].length;w++){var x=l.weights[v][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
-m.sid+"'.";}for(k=0;k<u.length;k++)if(u[k].type=="JOINT")for(l=0;l<u[k].weights.length;l++)m=u[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=t[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,u[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:t})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
-new v;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var p=ha[ga[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=
-k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;n=e instanceof u?aa[e.url]:e;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(p=0;p<n.targets.length;p++){var t=ba[n.targets[p]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
+for(f=0;f<g.frames;f++){var u=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));e(c,u,f);k=u;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var t=0;t<l.joints.length;t++)if(m.sid==l.joints[t]){p=t;break}if(p>=0){t=l.invBindMatrices[p];m.invBindMatrix=t;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,t);m.weights=[];for(t=0;t<l.weights.length;t++)for(var w=0;w<l.weights[t].length;w++){var x=l.weights[t][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
+m.sid+"'.";}for(k=0;k<u.length;k++)if(u[k].type=="JOINT")for(l=0;l<u[k].weights.length;l++)m=u[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,u[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
+new w;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new w,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var u=ha[ga[o.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;o=m[o.symbol]=u.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=
+k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;n=e instanceof p?aa[e.url]:e;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(u=0;u<n.targets.length;u++){var t=ba[n.targets[u]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
 m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);a.geometries.length>1?b.add(l):b=l}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function L(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
+null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function p(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function x(){this.id="";this.mesh=null}function v(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function y(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function C(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
 if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function T(a,
 b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
 c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=
-0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};
+0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new C).parse(e))}}return b};
 m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=O(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 E).parse(h);b[h.id]=h;break;case "joints":c=
-h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
-a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new B).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":e=R(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],u=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=u;break;case "WEIGHT":n.weight=b[p.source].data[u]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
+h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
+a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new C).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":e=R(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],u=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=u;break;case "WEIGHT":n.weight=b[p.source].data[u]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
 0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,
 b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));break;case "instance_geometry":this.geometries.push((new v).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
+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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
 if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=
 this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};t.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var a=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":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};v.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=X(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var f=
+this.transforms[a].matrix)};u.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var a=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":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new v(this)).parse(c)}}return this};v.prototype.parse=function(a){function b(a,c){var e=X(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new t).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new y).parse(e))}}var f=
 {};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);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,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,u=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":u.push(l.set)}for(;e<g.length;){var t=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=W[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);t.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],
-source.data[n+1],source.data[n+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var y;p==3?y=new THREE.Face3(t[0],t[1],t[2],[v[0],v[1],v[2]],x.length?x:new THREE.Color):p==4&&(y=new THREE.Face4(t[0],t[1],t[2],t[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));y.daeMaterial=a.material;b.faces.push(y);for(h=0;h<u.length;h++)f=
-w[u[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));
+return this};v.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,u=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":u.push(l.set)}for(;e<g.length;){var t=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=W[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);t.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],
+source.data[n+1],source.data[n+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var z;p==3?z=new THREE.Face3(t[0],t[1],t[2],[v[0],v[1],v[2]],x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(t[0],t[1],t[2],t[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(h=0;h<u.length;h++)f=
+w[u[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};y.prototype=new t;y.prototype.constructor=y;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[b]));
 break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
-"input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
+"input"&&(input=(new C).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
 U(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);
 break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.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]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=
 a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(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};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",
-c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};L.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=
+this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",
+c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};B.prototype.parse=function(a){for(var b=
 0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new C(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new L(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new K(this)).parse(c))}}return this};K.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
+J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new B(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new C).parse(c))}}return this};
 P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.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(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
 200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var e,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,t,u,z,v,p,y,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*b,t.position.y=
-o[m++]*b,t.position.z=o[m++]*b,e.vertices.push(t);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;u=b&16;t=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],z=A[m++],w=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(w,z);if(g)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(g=0;g<o;g++)z=A[m++],w=y[z*2],z=y[z*2+1],x[g]=new THREE.UV(w,
-z);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(c=0;c<o;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(b)for(c=0;c<o;c++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,t,u,z;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
-b,t=z[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,u,p,z,w,x,v,y,t,A=a.faces;o=a.vertices;var D=a.normals,C=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)u=new THREE.Vertex,u.position.x=o[m++]*b,u.position.y=
+o[m++]*b,u.position.z=o[m++]*b,e.vertices.push(u);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;p=b&16;u=b&32;w=b&64;b&=128;o?(x=new THREE.Face4,x.a=A[m++],x.b=A[m++],x.c=A[m++],x.d=A[m++],o=4):(x=new THREE.Face3,x.a=A[m++],x.b=A[m++],x.c=A[m++],o=3);if(l)l=A[m++],x.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)v=a.uvs[c],z=A[m++],t=v[z*2],z=v[z*2+1],e.faceUvs[c][l]=new THREE.UV(t,z);if(g)for(c=0;c<E;c++){v=a.uvs[c];y=[];for(g=0;g<o;g++)z=A[m++],t=v[z*2],z=v[z*2+1],y[g]=new THREE.UV(t,
+z);e.faceVertexUvs[c][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.normal=g;if(u)for(c=0;c<o;c++)p=A[m++]*3,g=new THREE.Vector3,g.x=D[p++],g.y=D[p++],g.z=D[p],x.vertexNormals.push(g);if(w)u=A[m++],u=new THREE.Color(C[u]),x.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(C[u]),x.vertexColors.push(u);e.faces.push(x)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,u,p,z;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];p=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
+b,u=z[l+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;for(O=0;O<x.materials.length;O++)L=H.materials[x.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;q=x.quaternion;
-s=x.scale;q=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);object=new THREE.Mesh(B,L);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(x.castsShadow)a=
-new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
-x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,t,u,z,v,p,y,x,w,A,D,B,E,I,G,
-L,C,F,J,M,N,K,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
-Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(v in F.cameras)A=F.cameras[v],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[v]=E;for(z in F.lights)v=F.lights[z],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:
-1,v.type=="directional"?(w=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[z]=C;for(p in F.fogs)z=F.fogs[p],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[p]=I;if(H.cameras&&
-F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,b.onLoadStart();K=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,
-null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=B):p.type=="icosahedron"?
-(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load(e(p.url,F.urlBaseType),l(o)):p.type=="ascii_mesh"?J.load(e(p.url,F.urlBaseType),l(o)):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(y in F.textures)if(o=F.textures[y],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(y in F.textures){o=F.textures[y];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(p in F.objects)if(!H.objects[p])if(y=F.objects[p],y.geometry!==void 0){if(C=H.geometries[y.geometry]){var a=!1;for(O=0;O<y.materials.length;O++)K=H.materials[y.materials[O]],a=K instanceof THREE.ShaderMaterial;a&&C.computeTangents();t=y.position;r=y.rotation;q=y.quaternion;
+s=y.scale;q=0;K.length==0&&(K=new THREE.MeshFaceMaterial);K.length>1&&(K=new THREE.MeshFaceMaterial);object=new THREE.Mesh(C,K);object.name=p;object.position.set(t[0],t[1],t[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;H.scene.add(object);H.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(y.castsShadow)a=
+new THREE.ShadowVolume(C),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}}else t=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+y.visible!==void 0?y.visible:!1,H.scene.add(object),H.objects[p]=object,H.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:L,totalTextures:P,loadedModels:L-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,p,z,w,x,v,y,t,A,D,C,E,I,G,
+K,B,F,J,M,N,L,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in F.objects)if(y=F.objects[p],y.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
+Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(w in F.cameras)A=F.cameras[w],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),t=A.position,A=A.target,E.position.set(t[0],t[1],t[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[w]=E;for(z in F.lights)w=F.lights[z],E=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:
+1,w.type=="directional"?(t=w.direction,B=new THREE.DirectionalLight(E,A),B.position.set(t[0],t[1],t[2]),B.position.normalize()):w.type=="point"?(t=w.position,d=w.distance,B=new THREE.PointLight(E,A,d),B.position.set(t[0],t[1],t[2])):w.type=="ambient"&&(B=new THREE.AmbientLight(E)),H.scene.add(B),H.lights[z]=B;for(x in F.fogs)z=F.fogs[x],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[x]=I;if(H.cameras&&
+F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(x=F.geometries[o],x.type=="bin_mesh"||x.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)x=F.geometries[o],x.type=="cube"?(C=new THREE.CubeGeometry(x.width,x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,
+null,x.flipped,x.sides),H.geometries[o]=C):x.type=="plane"?(C=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="sphere"?(C=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),H.geometries[o]=C):x.type=="cylinder"?(C=new THREE.CylinderGeometry(x.topRad,x.botRad,x.height,x.radSegs,x.heightSegs),H.geometries[o]=C):x.type=="torus"?(C=new THREE.TorusGeometry(x.radius,x.tube,x.segmentsR,x.segmentsT),H.geometries[o]=C):x.type=="icosahedron"?
+(C=new THREE.IcosahedronGeometry(x.subdivisions),H.geometries[o]=C):x.type=="bin_mesh"?G.load(e(x.url,F.urlBaseType),l(o)):x.type=="ascii_mesh"?J.load(e(x.url,F.urlBaseType),l(o)):x.type=="embedded_mesh"&&(x=F.embeds[x.id])&&J.createModel(x,m(o),"");for(v in F.textures)if(o=F.textures[v],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(v in F.textures){o=F.textures[v];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
 if(o.url instanceof Array){G=[];for(var O=0;O<o.url.length;O++)G[O]=e(o.url[O],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],
-o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[y]=G}for(t in F.materials){y=F.materials[t];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=H.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?
-THREE[y.parameters[D]]:THREE.NormalBlending;else if(D=="combine")y.parameters[D]=y.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(y.parameters[D]=="face")y.parameters[D]=THREE.FaceColors;else if(y.parameters[D])y.parameters[D]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=y.parameters.color;
-J=y.parameters.specular;p=y.parameters.ambient;I=y.parameters.shininess;a.tNormal.texture=H.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=H.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
-a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);H.materials[t]=y}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[v]=G}for(u in F.materials){v=F.materials[u];for(D in v.parameters)if(D=="envMap"||D=="map"||D=="lightMap")v.parameters[D]=H.textures[v.parameters[D]];else if(D=="shading")v.parameters[D]=v.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")v.parameters[D]=THREE[v.parameters[D]]?
+THREE[v.parameters[D]]:THREE.NormalBlending;else if(D=="combine")v.parameters[D]=v.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(v.parameters[D]=="face")v.parameters[D]=THREE.FaceColors;else if(v.parameters[D])v.parameters[D]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=!0;if(v.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=v.parameters.color;
+J=v.parameters.specular;x=v.parameters.ambient;I=v.parameters.shininess;a.tNormal.texture=H.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=H.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
+a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(x);a.uShininess.value=I;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);H.materials[u]=v}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
 c,g,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,p,y=a.length;l<y;l+=f)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=g,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
-b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],L=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,L,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,x,v=a.length;l<v;l+=f)m=a[l],n=a[l+1],x=a[l+2],m=m/16383*b,n=n/16383*b,x=x/16383*b,m+=e,n+=g,x+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,x)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
+b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,y,t,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;t=e;A=f;l=g;y=e;var C=f,E=g,I=h.materials[0],G=m[C*3],K=m[C*3+1],C=m[C*3+2],B=m[E*3],F=m[E*3+1],E=m[E*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);C=new THREE.Vector3(G,K,C);E=new THREE.Vector3(B,F,E);h.faces.push(new THREE.Face3(t,A,l,[y,C,E],null,I));h=n[e*2];e=n[e*2+
+1];l=n[f*2];y=n[f*2+1];t=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=y;y=[];y.push(new THREE.UV(h,e));y.push(new THREE.UV(f,l));y.push(new THREE.UV(t,A));g.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
 2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[z];p<f&&(v|=1);y<f&&(v|=2);x<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);D<f&&(v|=32);B<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I===0)return 0;
-var G=this.delta,L=a+G,C=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,L,c,g,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,p,x));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));
-I&32&&(this.compNorm(t),this.compNorm(z),this.VIntY(t*3,this.vlist,this.nlist,15,f,L,c,G,D,E));I&64&&(this.compNorm(u),this.compNorm(z),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,L,c,g,y,D));I&1024&&(this.compNorm(o),
-this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,f,L,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,p=h+this.yd+this.zd,z=l+this.yd+this.zd,w=0,x=this.field[h],v=this.field[l],y=this.field[m],t=this.field[o],A=this.field[n],D=this.field[u],C=this.field[p],E=this.field[z];x<f&&(w|=1);v<f&&(w|=2);y<f&&(w|=8);t<f&&(w|=4);A<f&&(w|=16);D<f&&(w|=32);C<f&&(w|=128);E<f&&(w|=64);var I=THREE.edgeTable[w];if(I===0)return 0;
+var G=this.delta,K=a+G,B=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,x,v));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,c,g,v,t));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,B,g,y,t));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,x,y));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));
+I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,f,K,c,G,D,E));I&64&&(this.compNorm(p),this.compNorm(z),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,G,C,E));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,C));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,x,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,c,g,v,D));I&1024&&(this.compNorm(o),
+this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,f,K,B,g,t,E));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,C));w<<=4;for(f=h=0;THREE.triTable[w+f]!=-1;)a=w+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+
 3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);
-k>this.size-1&&(k=this.size-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-g;x=v*v;for(v=t;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=u;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-f,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,
-l,m,n=this.size,o=this.yd,t=this.zd,u=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)u[t*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,t=this.size-2;for(f=1;f<t;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,t,u;for(f=0;f<h.count;f++)t=
-f*3,n=t+1,u=t+2,k=h.positionArray[t],l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(t);nfaces=h.count/3;for(f=0;f<nfaces;f++)t=(a+f)*3,n=t+1,u=t+2,o=g[t],k=g[n],l=g[u],t=new THREE.Face3(t,n,u,[o,k,l]),c.faces.push(t);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
+k>this.size-1&&(k=this.size-1);for(var z,w,x,v,y,t;o<l;o++){n=this.size2*o;w=o/this.size-g;y=w*w;for(w=u;w<m;w++){x=n+this.size*w;z=w/this.size-c;t=z*z;for(z=p;z<k;z++)v=z/this.size-a,v=h/(1.0E-6+v*v+t+y)-f,v>0&&(this.field[x+z]+=v)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,p=m*Math.sqrt(a/c);p>m&&(p=m);for(g=0;g<p;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)u[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,
+l,m,n=this.size,o=this.yd,u=this.zd,p=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)p[u*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,u=this.size-2;for(f=1;f<u;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,u,p;for(f=0;f<h.count;f++)u=
+f*3,n=u+1,p=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[p],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[p],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(u);nfaces=h.count/3;for(f=0;f<nfaces;f++)u=(a+f)*3,n=u+1,p=u+2,o=g[u],k=g[n],l=g[p],u=new THREE.Face3(u,n,p,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
 THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -350,9 +354,9 @@ e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n,o;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
-1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));v.add(z);this.setSize=function(a,e){b.call(c,a,e);t.width=a;t.height=e;u.width=a;u.height=e};this.render=function(a,b){a.updateMatrixWorld();if(l!==b.aspect||m!==b.near||n!==b.far||o!==b.fov){l=b.aspect;m=b.near;n=b.far;o=b.fov;var x=b.projectionMatrix.clone(),w=125/30*0.5,A=w*m/125,D=m*Math.tan(o*Math.PI/360),B;f.n14=w;k.n14=-w;w=-D*l+A;B=D*l+A;x.n11=2*m/(B-w);x.n13=(B+w)/(B-w);g.projectionMatrix.copy(x);w=-D*l-A;
-B=D*l-A;x.n11=2*m/(B-w);x.n13=(B+w)/(B-w);h.projectionMatrix.copy(x)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(k);g.position.copy(b.position);g.near=b.near;g.far=b.far;e.call(c,a,g,t,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,u,!0);v.updateMatrixWorld();e.call(c,v,z)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n,o;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
+1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(z);this.setSize=function(a,e){b.call(c,a,e);u.width=a;u.height=e;p.width=a;p.height=e};this.render=function(a,b){a.updateMatrixWorld();if(l!==b.aspect||m!==b.near||n!==b.far||o!==b.fov){l=b.aspect;m=b.near;n=b.far;o=b.fov;var y=b.projectionMatrix.clone(),t=125/30*0.5,A=t*m/125,D=m*Math.tan(o*Math.PI/360),C;f.n14=t;k.n14=-t;t=-D*l+A;C=D*l+A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);g.projectionMatrix.copy(y);t=-D*l-A;
+C=D*l-A;y.n11=2*m/(C-t);y.n13=(C+t)/(C-t);h.projectionMatrix.copy(y)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(k);g.position.copy(b.position);g.near=b.near;g.far=b.far;e.call(c,a,g,u,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,p,!0);w.updateMatrixWorld();e.call(c,w,z)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};

+ 4 - 2
src/extras/modifiers/SubdivisionModifier.js

@@ -502,10 +502,12 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 			continue;
 			// Do not move vertex if there's 2 connecting sharp edges.
 		}
-		
+
+		/*
 		if (sharpEdgeCount>2) {
 			// TODO
 		}
+		*/
 		
 		F.divideScalar(f);
 		
@@ -545,4 +547,4 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) {
 	newGeometry.computeFaceNormals();
 	newGeometry.computeVertexNormals();
 	
-};
+};