Browse Source

Merge remote-tracking branch 'remotes/mrdoob/dev' into dev

alteredq 13 years ago
parent
commit
bad3639c26

+ 297 - 295
build/Three.js

@@ -15,11 +15,11 @@ this.y=Math.asin(a.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 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){function b(a,b,c){p.sub(c,a);t=p.dot(b);if(t<=0)return null;n=q.add(a,m.copy(b).multiplyScalar(t));return o=c.distanceTo(n)}function d(a,b,c,d){p.sub(d,b);q.sub(c,b);m.sub(a,b);s=p.dot(p);u=p.dot(q);r=p.dot(m);y=q.dot(q);v=q.dot(m);G=1/(s*y-u*u);B=(y*r-u*v)*G;H=(s*v-u*r)*G;return B>=0&&H>=0&&B+H<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+THREE.Ray=function(a,c){function b(a,b,c){p.sub(c,a);t=p.dot(b);if(t<=0)return null;n=q.add(a,m.copy(b).multiplyScalar(t));return o=c.distanceTo(n)}function d(a,b,c,d){p.sub(d,b);q.sub(c,b);m.sub(a,b);s=p.dot(p);u=p.dot(q);r=p.dot(m);z=q.dot(q);E=q.dot(m);G=1/(s*z-u*u);v=(z*r-u*E)*G;w=(s*E-u*r)*G;return v>=0&&w>=0&&v+w<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
 c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,p=[],q=0,t=m.children.length;q<t;q++)Array.prototype.push.apply(p,this.intersectObject(m.children[q]));if(m instanceof THREE.Particle){q=
 b(this.origin,this.direction,m.matrixWorld.getPosition());if(q===null||q>m.scale.x)return[];n={distance:q,point:m.position,face:null,object:m};p.push(n)}else if(m instanceof THREE.Mesh){q=b(this.origin,this.direction,m.matrixWorld.getPosition());if(q===null||q>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var o,s=m.geometry,u=s.vertices,r;m.matrixRotationWorld.extractRotation(m.matrixWorld);q=0;for(t=s.faces.length;q<t;q++)if(n=s.faces[q],a.copy(this.origin),
 c.copy(this.direction),r=m.matrixWorld,i=r.multiplyVector3(i.copy(n.centroid)).subSelf(a),o=i.dot(c),!(o<=0)&&(g=r.multiplyVector3(g.copy(u[n.a].position)),e=r.multiplyVector3(e.copy(u[n.b].position)),f=r.multiplyVector3(f.copy(u[n.c].position)),h=n instanceof THREE.Face4?r.multiplyVector3(h.copy(u[n.d].position)):null,l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),o=c.dot(l),m.doubleSided||(m.flipSided?o>0:o<0)))if(o=l.dot(i.sub(g,a))/o,k.add(a,c.multiplyScalar(o)),n instanceof THREE.Face3)d(k,
-g,e,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n)}return p};var p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,t,n,o,s,u,r,y,v,G,B,H};
+g,e,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n)}return p};var p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,t,n,o,s,u,r,z,E,G,v,w};
 THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,k,p){h=!1;c=e;b=f;d=k;g=p;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
 function(e,f,k,p,q,m){h?(h=!1,c=e<k?e<q?e:q:k<q?k:q,b=f<p?f<m?f:m:p<m?p:m,d=e>k?e>q?e:q:k>q?k:q,g=f>p?f>m?f:m:p>m?p:m):(c=e<k?e<q?e<c?e:c:q<c?q:c:k<q?k<c?k:c:q<c?q:c,b=f<p?f<m?f<b?f:b:m<b?m:b:p<m?p<b?p:b:m<b?m:b,d=e>k?e>q?e>d?e:d:q>d?q:d:k>q?k>d?k:d:q>d?q:d,g=f>p?f>m?f>g?f:g:m>g?m:g:p>m?p>g?p:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
 e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
@@ -28,16 +28,16 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=
 THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,p||0,q||0,m||0,t||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=q;this.n42=m;this.n43=t;this.n44=n;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 d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,q=a.n33,m=a.n34,t=a.n41,n=a.n42,o=a.n43,
-s=a.n44,u=c.n11,r=c.n12,y=c.n13,v=c.n14,G=c.n21,B=c.n22,H=c.n23,w=c.n24,D=c.n31,A=c.n32,K=c.n33,L=c.n34,S=c.n41,W=c.n42,U=c.n43,X=c.n44;this.n11=b*u+d*G+g*D+e*S;this.n12=b*r+d*B+g*A+e*W;this.n13=b*y+d*H+g*K+e*U;this.n14=b*v+d*w+g*L+e*X;this.n21=f*u+h*G+i*D+l*S;this.n22=f*r+h*B+i*A+l*W;this.n23=f*y+h*H+i*K+l*U;this.n24=f*v+h*w+i*L+l*X;this.n31=k*u+p*G+q*D+m*S;this.n32=k*r+p*B+q*A+m*W;this.n33=k*y+p*H+q*K+m*U;this.n34=k*v+p*w+q*L+m*X;this.n41=t*u+n*G+o*D+s*S;this.n42=t*r+n*B+o*A+s*W;this.n43=t*y+n*
-H+o*K+s*U;this.n44=t*v+n*w+o*L+s*X;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,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*c+this.n22*
-b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*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,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,q=this.n41,m=this.n42,t=this.n43,n=this.n44;return d*f*l*q-b*h*l*q-d*e*k*q+c*h*k*q+b*e*p*q-c*f*p*q-d*f*i*m+b*h*i*m+d*g*k*m-a*h*k*m-b*g*p*m+a*f*p*m+d*e*i*t-c*h*i*t-d*g*l*t+a*h*l*t+c*g*p*t-a*e*p*t-b*e*i*n+c*f*i*n+b*g*l*n-a*f*l*n-c*g*k*n+a*e*k*n},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),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+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,
+s=a.n44,u=c.n11,r=c.n12,z=c.n13,E=c.n14,G=c.n21,v=c.n22,w=c.n23,C=c.n24,F=c.n31,B=c.n32,L=c.n33,J=c.n34,W=c.n41,X=c.n42,T=c.n43,ea=c.n44;this.n11=b*u+d*G+g*F+e*W;this.n12=b*r+d*v+g*B+e*X;this.n13=b*z+d*w+g*L+e*T;this.n14=b*E+d*C+g*J+e*ea;this.n21=f*u+h*G+i*F+l*W;this.n22=f*r+h*v+i*B+l*X;this.n23=f*z+h*w+i*L+l*T;this.n24=f*E+h*C+i*J+l*ea;this.n31=k*u+p*G+q*F+m*W;this.n32=k*r+p*v+q*B+m*X;this.n33=k*z+p*w+q*L+m*T;this.n34=k*E+p*C+q*J+m*ea;this.n41=t*u+n*G+o*F+s*W;this.n42=t*r+n*v+o*B+s*X;this.n43=t*
+z+n*w+o*L+s*T;this.n44=t*E+n*C+o*J+s*ea;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,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
+c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*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,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,q=this.n41,m=this.n42,t=this.n43,n=this.n44;return d*f*l*q-b*h*l*q-d*e*k*q+c*h*k*q+b*e*p*q-c*f*p*q-d*f*i*m+b*h*i*m+d*g*k*m-a*h*k*m-b*g*p*m+a*f*p*m+d*e*i*t-c*h*i*t-d*g*l*t+a*h*l*t+c*g*p*t-a*e*p*t-b*e*i*n+c*f*i*n+b*g*l*n-a*f*l*n-c*g*k*n+a*e*k*
+n},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),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+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,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,p=a.n33,q=a.n34,m=a.n41,t=a.n42,n=a.n43,o=a.n44;this.n11=h*q*t-i*p*t+i*k*n-f*q*n-h*k*o+f*p*o;this.n12=g*p*t-d*q*t-g*k*n+b*q*n+d*k*o-b*p*o;this.n13=d*i*t-g*h*t+g*f*n-b*i*n-d*f*o+b*h*o;this.n14=g*h*k-d*i*k-g*f*p+b*i*p+d*f*q-b*h*q;this.n21=i*p*m-h*q*m-i*l*n+e*q*n+h*l*o-e*p*o;this.n22=d*q*m-g*p*m+
 g*l*n-c*q*n-d*l*o+c*p*o;this.n23=g*h*m-d*i*m-g*e*n+c*i*n+d*e*o-c*h*o;this.n24=d*i*l-g*h*l+g*e*p-c*i*p-d*e*q+c*h*q;this.n31=f*q*m-i*k*m+i*l*t-e*q*t-f*l*o+e*k*o;this.n32=g*k*m-b*q*m-g*l*t+c*q*t+b*l*o-c*k*o;this.n33=d*i*m-g*f*m+g*e*t-c*i*t-b*e*o+c*f*o;this.n34=g*f*l-b*i*l-g*e*k+c*i*k+b*e*q-c*f*q;this.n41=h*k*m-f*p*m-h*l*t+e*p*t+f*l*n-e*k*n;this.n42=b*p*m-d*k*m+d*l*t-c*p*t-b*l*n+c*k*n;this.n43=d*f*m-b*h*m-d*e*t+c*h*t+b*e*n-c*f*n;this.n44=b*h*l-d*f*l+d*e*k-c*h*k-b*e*p+c*f*p;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,l=f*g,k=d*h,p=d*g;this.n11=i+p*b;this.n12=k*b-l;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=l*b-k;this.n32=p+i*b;this.n33=e*f;break;case "ZXY":i=f*h;l=f*g;k=d*h;p=d*g;this.n11=i-p*b;this.n12=-e*g;this.n13=k+l*b;this.n21=l+k*b;this.n22=e*h;this.n23=p-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
@@ -56,18 +56,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
 if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},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[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,l=[],
-k,p,q=[],m,t=[],n,o,s=[],u,r,y=[],v={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,B=new THREE.Vector4,H=new THREE.Matrix4,w=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],A=new THREE.Vector4,K=new THREE.Vector4;this.computeFrustum=function(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[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=D[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);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-H.multiply(b.matrixWorld,b.projectionMatrixInverse);H.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,d){e=0;v.objects.length=0;v.sprites.length=0;v.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 d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=D[h].x*d.n14+D[h].y*d.n24+D[h].z*d.n34+D[h].w,c<=e){c=!1;break a}c=!0}c?(H.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,D=e.far,G,E,I,P,M,j,V,Z,O,aa,Y,ea,Q,ga,na,ja;r=o=m=p=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);H.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(H);v=this.projectGraph(a,!1);a=0;for(G=v.objects.length;a<G;a++)if(O=v.objects[a].object,aa=O.matrixWorld,
-ea=O.material,i=0,O instanceof THREE.Mesh){Y=O.geometry;Q=O.geometry.materials;P=Y.vertices;ga=Y.faces;na=Y.faceVertexUvs;Y=O.matrixRotationWorld.extractRotation(aa);E=0;for(I=P.length;E<I;E++)h=c(),h.positionWorld.copy(P[E].position),aa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<D;P=0;for(E=ga.length;P<E;P++){I=
-ga[P];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],V=l[I.c],M.visible&&j.visible&&V.visible&&(O.doubleSided||O.flipSided!=(V.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(V.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))Z=q[p]=q[p]||new THREE.RenderableFace3,p++,k=Z,k.v1.copy(M),k.v2.copy(j),k.v3.copy(V);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],V=l[I.c],Z=l[I.d],M.visible&&j.visible&&V.visible&&Z.visible&&
-(O.doubleSided||O.flipSided!=((Z.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(Z.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(j.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0)))ja=t[m]=t[m]||new THREE.RenderableFace4,m++,k=ja,k.v1.copy(M),k.v2.copy(j),k.v3.copy(V),k.v4.copy(Z);else continue;k.normalWorld.copy(I.normal);
-Y.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);aa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);H.multiplyVector3(k.centroidScreen);V=I.vertexNormals;M=0;for(j=V.length;M<j;M++)Z=k.vertexNormalsWorld[M],Z.copy(V[M]),Y.multiplyVector3(Z);M=0;for(j=na.length;M<j;M++)if(ja=na[M][P]){V=0;for(Z=ja.length;V<Z;V++)k.uvs[M][V]=ja[V]}k.material=ea;k.faceMaterial=I.materialIndex!==null?Q[I.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(O instanceof
-THREE.Line){w.multiply(H,aa);P=O.geometry.vertices;M=c();M.positionScreen.copy(P[0].position);w.multiplyVector4(M.positionScreen);E=1;for(I=P.length;E<I;E++)if(M=c(),M.positionScreen.copy(P[E].position),w.multiplyVector4(M.positionScreen),j=l[i-2],A.copy(M.positionScreen),K.copy(j.positionScreen),d(A,K))A.multiplyScalar(1/A.w),K.multiplyScalar(1/K.w),O=s[o]=s[o]||new THREE.RenderableLine,o++,n=O,n.v1.positionScreen.copy(A),n.v2.positionScreen.copy(K),n.z=Math.max(A.z,K.z),n.material=ea,v.elements.push(n)}a=
-0;for(G=v.sprites.length;a<G;a++)if(O=v.sprites[a].object,aa=O.matrixWorld,O instanceof THREE.Particle&&(B.set(aa.n14,aa.n24,aa.n34,1),H.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))f=y[r]=y[r]||new THREE.RenderableParticle,r++,u=f,u.x=B.x/B.w,u.y=B.y/B.w,u.z=B.z,u.rotation=O.rotation.z,u.scale.x=O.scale.x*Math.abs(u.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),u.scale.y=O.scale.y*Math.abs(u.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),u.material=O.material,v.elements.push(u);
-g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
+k,p,q=[],m,t=[],n,o,s=[],u,r,z=[],E={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,v=new THREE.Vector4,w=new THREE.Matrix4,C=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],B=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){F[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);F[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);F[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[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=F[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);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.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,d){e=0;E.objects.length=0;E.sprites.length=0;E.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 d=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=F[h].x*d.n14+F[h].y*d.n24+F[h].z*d.n34+F[h].w,c<=e){c=!1;break a}c=!0}c?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.sprites.push(g)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
+E.objects.sort(b);return E};this.projectScene=function(a,e,g){var f=e.near,F=e.far,G,x,I,O,M,j,P,ha,V,Q,K,fa,U,ia,pa,na;r=o=m=p=0;E.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);E=this.projectGraph(a,!1);a=0;for(G=E.objects.length;a<G;a++)if(V=E.objects[a].object,Q=V.matrixWorld,
+fa=V.material,i=0,V instanceof THREE.Mesh){K=V.geometry;U=V.geometry.materials;O=K.vertices;ia=K.faces;pa=K.faceVertexUvs;K=V.matrixRotationWorld.extractRotation(Q);x=0;for(I=O.length;x<I;x++)h=c(),h.positionWorld.copy(O[x].position),Q.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<F;O=0;for(x=ia.length;O<x;O++){I=
+ia[O];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],P=l[I.c],M.visible&&j.visible&&P.visible&&(V.doubleSided||V.flipSided!=(P.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(P.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))ha=q[p]=q[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],P=l[I.c],ha=l[I.d],M.visible&&j.visible&&P.visible&&ha.visible&&
+(V.doubleSided||V.flipSided!=((ha.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(ha.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-P.positionScreen.x)*(ha.positionScreen.y-P.positionScreen.y)-(j.positionScreen.y-P.positionScreen.y)*(ha.positionScreen.x-P.positionScreen.x)<0)))na=t[m]=t[m]||new THREE.RenderableFace4,m++,k=na,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P),k.v4.copy(ha);else continue;k.normalWorld.copy(I.normal);
+K.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);Q.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);w.multiplyVector3(k.centroidScreen);P=I.vertexNormals;M=0;for(j=P.length;M<j;M++)ha=k.vertexNormalsWorld[M],ha.copy(P[M]),K.multiplyVector3(ha);M=0;for(j=pa.length;M<j;M++)if(na=pa[M][O]){P=0;for(ha=na.length;P<ha;P++)k.uvs[M][P]=na[P]}k.material=fa;k.faceMaterial=I.materialIndex!==null?U[I.materialIndex]:null;k.z=k.centroidScreen.z;E.elements.push(k)}}else if(V instanceof
+THREE.Line){C.multiply(w,Q);O=V.geometry.vertices;M=c();M.positionScreen.copy(O[0].position);C.multiplyVector4(M.positionScreen);x=1;for(I=O.length;x<I;x++)if(M=c(),M.positionScreen.copy(O[x].position),C.multiplyVector4(M.positionScreen),j=l[i-2],B.copy(M.positionScreen),L.copy(j.positionScreen),d(B,L))B.multiplyScalar(1/B.w),L.multiplyScalar(1/L.w),V=s[o]=s[o]||new THREE.RenderableLine,o++,n=V,n.v1.positionScreen.copy(B),n.v2.positionScreen.copy(L),n.z=Math.max(B.z,L.z),n.material=fa,E.elements.push(n)}a=
+0;for(G=E.sprites.length;a<G;a++)if(V=E.sprites[a].object,Q=V.matrixWorld,V instanceof THREE.Particle&&(v.set(Q.n14,Q.n24,Q.n34,1),w.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=z[r]=z[r]||new THREE.RenderableParticle,r++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=V.rotation.z,u.scale.x=V.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=V.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=V.material,E.elements.push(u);
+g&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;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=
@@ -83,9 +83,9 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[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{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
-b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;y=q.u-k.u;v=p.v-k.v;G=q.v-k.v;B=1/(r*G-y*v);A.set((G*m-v*t)*B,(G*n-v*o)*B,(G*s-v*u)*B);K.set((r*t-y*m)*B,(r*o-y*n)*B,(r*u-y*s)*B);w[b].addSelf(A);w[c].addSelf(A);w[d].addSelf(A);D[b].addSelf(K);
-D[c].addSelf(K);D[d].addSelf(K)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,y,v,G,B,H,w=[],D=[],A=new THREE.Vector3,K=new THREE.Vector3,L=new THREE.Vector3,S=new THREE.Vector3,W=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)w[c]=new THREE.Vector3,D[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var U=["a","b",
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)W.copy(e.vertexNormals[d]),g=e[U[d]],H=w[g],L.copy(H),L.subSelf(W.multiplyScalar(W.dot(H))).normalize(),S.cross(e.vertexNormals[d],H),g=S.dot(D[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,g)}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(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;z=q.u-k.u;E=p.v-k.v;G=q.v-k.v;v=1/(r*G-z*E);B.set((G*m-E*t)*v,(G*n-E*o)*v,(G*s-E*u)*v);L.set((r*t-z*m)*v,(r*o-z*n)*v,(r*u-z*s)*v);C[b].addSelf(B);C[c].addSelf(B);C[d].addSelf(B);F[b].addSelf(L);
+F[c].addSelf(L);F[d].addSelf(L)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C=[],F=[],B=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)C[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var T=["a","b",
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)X.copy(e.vertexNormals[d]),g=e[T[d]],w=C[g],J.copy(w),J.subSelf(X.multiplyScalar(X.dot(w))).normalize(),W.cross(e.vertexNormals[d],w),g=W.dot(F[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}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=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],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;
@@ -149,45 +149,46 @@ THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lig
 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,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,k,p,q,m,t,n;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(q=a[i],q instanceof THREE.RenderableParticle){t=q.x*g+g;n=q.y*e+e;k=0;for(p=q.material.length;k<p;k++)if(m=q.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=t+"px",m.style.top=n+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(y!=a)n.strokeStyle=y=a}function g(a){if(v!=a)n.fillStyle=v=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,y=null,v=null,G=null,B=null,H=null,w,D,A,K,L=new THREE.RenderableVertex,S=new THREE.RenderableVertex,W,U,X,$,E,I,P,M,j,V,Z,O,aa=new THREE.Color,Y=new THREE.Color,ea=new THREE.Color,Q=new THREE.Color,ga=new THREE.Color,na=[],ja,ma,la,ka,ya,xa,sa,pa,qa,R,z=new THREE.Rectangle,ba=new THREE.Rectangle,F=new THREE.Rectangle,ca=!1,J=new THREE.Color,da=new THREE.Color,T=new THREE.Color,ha=new THREE.Vector3,ta,wa,N,ra,ua,fa,a=16;ta=document.createElement("canvas");
-ta.width=ta.height=2;wa=ta.getContext("2d");wa.fillStyle="rgba(0,0,0,1)";wa.fillRect(0,0,2,2);N=wa.getImageData(0,0,2,2);ra=N.data;ua=document.createElement("canvas");ua.width=ua.height=a;fa=ua.getContext("2d");fa.translate(-a/2,-a/2);fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;z.set(-m,-t,m,t);ba.set(-m,-t,m,t);u=1;r=0;H=
-B=G=v=y=null};this.setClearColor=function(a,b){o.copy(a);s=b;ba.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;ba.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);ba.isEmpty()||(ba.minSelf(z),ba.inflate(2),s<1&&n.clearRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(ba.getX()),
-Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()))),ba.empty())};this.render=function(a,k){function q(a){var b,c,d,e;J.setRGB(0,0,0);da.setRGB(0,0,0);T.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(J.r+=e.r,J.g+=e.g,J.b+=e.b):d instanceof THREE.DirectionalLight?(da.r+=e.r,da.g+=e.g,da.b+=e.b):d instanceof THREE.PointLight&&(T.r+=e.r,T.g+=e.g,T.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
-f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(ha.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,fa;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,fa=
-k.height>>1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*fa,F.set(a.x-j,a.y-h,a.x+j,a.y+h),z.intersects(F)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-fa),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,F.set(a.x-j,a.y-h,a.x+j,a.y+h),z.intersects(F)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,
-e,g,f){c(f.opacity);b(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(G!=a)n.lineWidth=G=a;a=f.linecap;if(B!=a)n.lineCap=B=a;a=f.linejoin;if(H!=a)n.lineJoin=H=a;d(f.color.getContextStyle());n.stroke();F.inflate(f.linewidth*2)}}function Ga(a,d,g,f,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);W=a.positionScreen.x;U=a.positionScreen.y;
-X=d.positionScreen.x;$=d.positionScreen.y;E=g.positionScreen.x;I=g.positionScreen.y;r(W,U,X,$,E,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Ha(W,U,X,$,E,I,ka[f].u,ka[f].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ha.copy(m.vertexNormalsWorld[f]),ya=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,xa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+
-0.5,ha.copy(m.vertexNormalsWorld[j]),sa=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,pa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(m.vertexNormalsWorld[h]),qa=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,R=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,Ha(W,U,X,$,E,I,ya,xa,sa,pa,qa,R,l.envMap)}else l.wireframe?za(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&
-(ka=m.uvs[0],Ha(W,U,X,$,E,I,ka[f].u,ka[f].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(Y.r=ea.r=Q.r=J.r,Y.g=ea.g=Q.g=J.g,Y.b=ea.b=Q.b=J.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Y),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],Q),Y.r=Math.max(0,Math.min(l.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(l.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(l.color.b*
-Y.b,1)),ea.r=Math.max(0,Math.min(l.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(l.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(l.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),ga.r=(ea.r+Q.r)*0.5,ga.g=(ea.g+Q.g)*0.5,ga.b=(ea.b+Q.b)*0.5,la=Da(Y,ea,Q,ga),v(W,U,X,$,E,I,0,0,1,0,0,1,la)):(aa.r=J.r,aa.g=J.g,aa.b=J.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,Math.min(l.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(l.color.g*
-aa.g,1)),aa.b=Math.max(0,Math.min(l.color.b*aa.b,1)),l.wireframe?za(aa,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(aa)):l.wireframe?za(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(l.color);else if(l instanceof THREE.MeshDepthMaterial)ja=k.near,ma=k.far,Y.r=Y.g=Y.b=1-Ba(a.positionScreen.z,ja,ma),ea.r=ea.g=ea.b=1-Ba(d.positionScreen.z,ja,ma),Q.r=Q.g=Q.b=1-Ba(g.positionScreen.z,ja,ma),ga.r=(ea.r+Q.r)*0.5,ga.g=(ea.g+Q.g)*0.5,ga.b=(ea.b+Q.b)*0.5,la=Da(Y,ea,
-Q,ga),v(W,U,X,$,E,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)aa.r=Ca(m.normalWorld.x),aa.g=Ca(m.normalWorld.y),aa.b=Ca(m.normalWorld.z),l.wireframe?za(aa,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(aa)}function u(a,d,g,f,h,l,m,n,fa){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)Ga(a,d,f,0,1,3,m,n,fa),Ga(h,g,l,1,2,3,m,n,fa);else if(W=a.positionScreen.x,U=a.positionScreen.y,X=d.positionScreen.x,$=d.positionScreen.y,
-E=g.positionScreen.x,I=g.positionScreen.y,P=f.positionScreen.x,M=f.positionScreen.y,j=h.positionScreen.x,V=h.positionScreen.y,Z=l.positionScreen.x,O=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ea(W,U,X,$,E,I,P,M),n.wireframe?za(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(Y.r=ea.r=Q.r=ga.r=J.r,Y.g=ea.g=Q.g=ga.g=J.g,Y.b=ea.b=
-Q.b=ga.b=J.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Y),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],Q),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ga),Y.r=Math.max(0,Math.min(n.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(n.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(n.color.b*Y.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(n.color.r*
-Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*Q.b,1)),ga.r=Math.max(0,Math.min(n.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(n.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(n.color.b*ga.b,1)),la=Da(Y,ea,Q,ga),r(W,U,X,$,P,M),v(W,U,X,$,P,M,0,0,1,0,0,1,la),r(j,V,E,I,Z,O),v(j,V,E,I,Z,O,1,0,1,1,0,1,la)):(aa.r=J.r,aa.g=J.g,aa.b=J.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,Math.min(n.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(n.color.g*aa.g,1)),aa.b=Math.max(0,
-Math.min(n.color.b*aa.b,1)),Ea(W,U,X,$,E,I,P,M),n.wireframe?za(aa,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(aa)):(Ea(W,U,X,$,E,I,P,M),n.wireframe?za(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(n.color));else if(n instanceof THREE.MeshNormalMaterial)aa.r=Ca(m.normalWorld.x),aa.g=Ca(m.normalWorld.y),aa.b=Ca(m.normalWorld.z),Ea(W,U,X,$,E,I,P,M),n.wireframe?za(aa,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(aa);else if(n instanceof THREE.MeshDepthMaterial)ja=
-k.near,ma=k.far,Y.r=Y.g=Y.b=1-Ba(a.positionScreen.z,ja,ma),ea.r=ea.g=ea.b=1-Ba(d.positionScreen.z,ja,ma),Q.r=Q.g=Q.b=1-Ba(f.positionScreen.z,ja,ma),ga.r=ga.g=ga.b=1-Ba(g.positionScreen.z,ja,ma),la=Da(Y,ea,Q,ga),r(W,U,X,$,P,M),v(W,U,X,$,P,M,0,0,1,0,0,1,la),r(j,V,E,I,Z,O),v(j,V,E,I,Z,O,1,0,1,1,0,1,la)}function r(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function Ea(a,b,c,d,e,g,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,
-j);n.lineTo(a,b);n.closePath()}function za(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(B!=c)n.lineCap=B=c;if(H!=e)n.lineJoin=H=e;d(a.getContextStyle());n.stroke();F.inflate(b*2)}function y(a){g(a.getContextStyle());n.fill()}function Ha(a,b,c,d,e,f,j,h,i,m,l,k,fa){if(fa.image.width!=0){if(fa.needsUpdate==!0||na[fa.id]==void 0){var p=fa.wrapS==THREE.RepeatWrapping,q=fa.wrapT==THREE.RepeatWrapping;na[fa.id]=n.createPattern(fa.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");fa.needsUpdate=
-!1}g(na[fa.id]);var p=fa.offset.x/fa.repeat.x,q=fa.offset.y/fa.repeat.y,R=(fa.image.width-1)*fa.repeat.x,fa=(fa.image.height-1)*fa.repeat.y,j=(j+p)*R,h=(h+q)*fa,i=(i+p)*R,m=(m+q)*fa,l=(l+p)*R,k=(k+q)*fa;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=1/(i*k-l*m);fa=(k*c-m*e)*p;m=(k*d-m*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-fa*j-c*h;b=b-m*j-d*h;n.save();n.transform(fa,m,c,d,a,b);n.fill();n.restore()}}function v(a,b,c,d,e,f,g,j,h,i,m,l,k){var fa,p;fa=k.width-1;p=k.height-1;g*=fa;j*=p;h*=fa;i*=p;m*=fa;l*=p;
-c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;l-=j;p=1/(h*l-m*i);fa=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(h*e-m*c)*p;d=(h*f-m*d)*p;a=a-fa*g-c*j;b=b-i*g-d*j;n.save();n.transform(fa,i,c,d,a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Da(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ra[0]=e<0?0:e>255?255:e;ra[1]=g<0?0:g>255?255:g;ra[2]=a<0?0:a>255?255:a;ra[4]=f<0?0:f>255?255:f;ra[5]=
-j<0?0:j>255?255:j;ra[6]=b<0?0:b>255?255:b;ra[8]=h<0?0:h>255?255:h;ra[9]=i<0?0:i>255?255:i;ra[10]=c<0?0:c>255?255:c;ra[12]=m<0?0:m>255?255:m;ra[13]=l<0?0:l>255?255:l;ra[14]=d<0?0:d>255?255:d;wa.putImageData(N,0,0);fa.drawImage(ta,0,0);return ua}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ia,oa,va;this.autoClear?this.clear():
-n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);Fa=0;for(Ia=h.length;Fa<Ia;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){F.empty();if(oa instanceof THREE.RenderableParticle)w=oa,w.x*=m,w.y*=t,o(w,oa,va,a);else if(oa instanceof THREE.RenderableLine)w=oa.v1,D=oa.v2,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=
-m,D.positionScreen.y*=t,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(D.positionScreen.x,D.positionScreen.y),z.intersects(F)&&s(w,D,oa,va,a);else if(oa instanceof THREE.RenderableFace3)w=oa.v1,D=oa.v2,A=oa.v3,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,A.positionScreen.x*=m,A.positionScreen.y*=t,va.overdraw&&(Aa(w.positionScreen,D.positionScreen),Aa(D.positionScreen,A.positionScreen),Aa(A.positionScreen,w.positionScreen)),F.add3Points(w.positionScreen.x,
-w.positionScreen.y,D.positionScreen.x,D.positionScreen.y,A.positionScreen.x,A.positionScreen.y),z.intersects(F)&&Ga(w,D,A,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)w=oa.v1,D=oa.v2,A=oa.v3,K=oa.v4,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,A.positionScreen.x*=m,A.positionScreen.y*=t,K.positionScreen.x*=m,K.positionScreen.y*=t,L.positionScreen.copy(D.positionScreen),S.positionScreen.copy(K.positionScreen),va.overdraw&&(Aa(w.positionScreen,
-D.positionScreen),Aa(D.positionScreen,K.positionScreen),Aa(K.positionScreen,w.positionScreen),Aa(A.positionScreen,L.positionScreen),Aa(A.positionScreen,S.positionScreen)),F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(D.positionScreen.x,D.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(K.positionScreen.x,K.positionScreen.y),z.intersects(F)&&u(w,D,A,K,L,S,oa,va,a);ba.addRectangle(F)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(w.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){D[a]==null&&(D[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),W==0&&D[a].setAttribute("shape-rendering","crispEdges"));return D[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,y=new THREE.Color,v=new THREE.Color,G=new THREE.Color,B=new THREE.Color,H,w=new THREE.Vector3,D=[],A=[],K,L,S,W=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":W=1;break;case "low":W=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var D,E,I,P;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
-f=g.lights;S=L=0;if(r=f.length>0){v.setRGB(0,0,0);G.setRGB(0,0,0);B.setRGB(0,0,0);D=0;for(E=f.length;D<E;D++)P=f[D],I=P.color,P instanceof THREE.AmbientLight?(v.r+=I.r,v.g+=I.g,v.b+=I.b):P instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):P instanceof THREE.PointLight&&(B.r+=I.r,B.g+=I.g,B.b+=I.b)}D=0;for(E=e.length;D<E;D++)if(I=e[D],P=I.material,P=P instanceof THREE.MeshFaceMaterial?I.faceMaterial:P,!(P==null||P.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
-p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=S++;A[j]==null&&(A[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),W==0&&A[j].setAttribute("shape-rendering","crispEdges"));K=A[j];K.setAttribute("x1",I.positionScreen.x);K.setAttribute("y1",I.positionScreen.y);
-K.setAttribute("x2",M.positionScreen.x);K.setAttribute("y2",M.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),i.appendChild(K))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
-p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,w=n;d.info.render.vertices+=3;d.info.render.faces++;K=c(L++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+w.positionScreen.x+","+w.positionScreen.y+"z");P instanceof THREE.MeshBasicMaterial?y.copy(P.color):P instanceof THREE.MeshLambertMaterial?
-r?(y.r=v.r,y.g=v.g,y.b=v.b,a(f,I.centroidWorld,I.normalWorld,y),y.r=Math.max(0,Math.min(P.color.r*y.r,1)),y.g=Math.max(0,Math.min(P.color.g*y.g,1)),y.b=Math.max(0,Math.min(P.color.b*y.b,1))):y.copy(P.color):P instanceof THREE.MeshDepthMaterial?(H=1-P.__2near/(P.__farPlusNear-I.z*P.__farMinusNear),y.setRGB(H,H,H)):P instanceof THREE.MeshNormalMaterial&&y.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));P.wireframe?K.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
-P.wireframeLinewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.wireframeLinecap+"; stroke-linejoin: "+P.wireframeLinejoin):K.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+P.opacity);i.appendChild(K)}}else if(I instanceof THREE.RenderableFace4&&(m=I.v1,t=I.v2,n=I.v3,o=I.v4,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=p,n.positionScreen.y*=-q,o.positionScreen.x*=p,o.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,
-m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),s.intersects(u))){var M=m,j=t,w=n,Z=o;d.info.render.vertices+=4;d.info.render.faces++;K=c(L++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+w.positionScreen.x+","+w.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");P instanceof THREE.MeshBasicMaterial?
-y.copy(P.color):P instanceof THREE.MeshLambertMaterial?r?(y.r=v.r,y.g=v.g,y.b=v.b,a(f,I.centroidWorld,I.normalWorld,y),y.r=Math.max(0,Math.min(P.color.r*y.r,1)),y.g=Math.max(0,Math.min(P.color.g*y.g,1)),y.b=Math.max(0,Math.min(P.color.b*y.b,1))):y.copy(P.color):P instanceof THREE.MeshDepthMaterial?(H=1-P.__2near/(P.__farPlusNear-I.z*P.__farMinusNear),y.setRGB(H,H,H)):P instanceof THREE.MeshNormalMaterial&&y.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));P.wireframe?K.setAttribute("style",
-"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+P.wireframeLinewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.wireframeLinecap+"; stroke-linejoin: "+P.wireframeLinejoin):K.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+P.opacity);i.appendChild(K)}}};
+THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function g(a){if(E!=a)n.fillStyle=E=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,z=null,E=null,G=null,v=null,w=null,C,F,B,L,J=new THREE.RenderableVertex,W=new THREE.RenderableVertex,X,T,ea,ba,x,I,O,M,j,P,ha,V,Q=new THREE.Color,K=new THREE.Color,fa=new THREE.Color,U=new THREE.Color,ia=new THREE.Color,pa=[],na=[],ka,oa,la,ma,ya,ra,sa,xa,R,A,Z=new THREE.Rectangle,H=new THREE.Rectangle,$=new THREE.Rectangle,ca=!1,aa=new THREE.Color,S=new THREE.Color,ga=new THREE.Color,Y=new THREE.Vector3,va,N,ua,ta,da,Fa,a=16;va=document.createElement("canvas");
+va.width=va.height=2;N=va.getContext("2d");N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);ua=N.getImageData(0,0,2,2);ta=ua.data;da=document.createElement("canvas");da.width=da.height=a;Fa=da.getContext("2d");Fa.translate(-a/2,-a/2);Fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;Z.set(-m,-t,m,t);H.set(-m,-t,m,t);u=1;r=0;w=v=G=
+E=z=null};this.setClearColor=function(a,b){o.copy(a);s=b;H.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;H.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);H.isEmpty()||(H.minSelf(Z),H.inflate(2),s<1&&n.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(H.getX()),
+Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function q(a){var b,c,d,e;aa.setRGB(0,0,0);S.setRGB(0,0,0);ga.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(S.r+=e.r,S.g+=e.g,S.b+=e.b):d instanceof THREE.PointLight&&(ga.r+=e.r,ga.g+=e.g,ga.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(Y.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,da;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,da=k.height>>
+1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*da,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-da),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,e,
+f,g){c(g.opacity);b(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(G!=a)n.lineWidth=G=a;a=g.linecap;if(v!=a)n.lineCap=v=a;a=g.linejoin;if(w!=a)n.lineJoin=w=a;d(g.color.getContextStyle());n.stroke();$.inflate(g.linewidth*2)}}function u(a,d,g,f,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);X=a.positionScreen.x;T=a.positionScreen.y;
+ea=d.positionScreen.x;ba=d.positionScreen.y;x=g.positionScreen.x;I=g.positionScreen.y;Ea(X,T,ea,ba,x,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Y.copy(m.vertexNormalsWorld[f]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,ra=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
+Y.copy(m.vertexNormalsWorld[j]),sa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,xa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(m.vertexNormalsWorld[h]),R=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,A=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,E(X,T,ea,ba,x,I,ya,ra,sa,xa,R,A,l.envMap)}else l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],
+E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(K.r=fa.r=U.r=aa.r,K.g=fa.g=U.g=aa.g,K.b=fa.b=U.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),K.r=Math.max(0,Math.min(l.color.r*K.r,1)),K.g=Math.max(0,Math.min(l.color.g*K.g,1)),K.b=Math.max(0,Math.min(l.color.b*
+K.b,1)),fa.r=Math.max(0,Math.min(l.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(l.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(l.color.b*fa.b,1)),U.r=Math.max(0,Math.min(l.color.r*U.r,1)),U.g=Math.max(0,Math.min(l.color.g*U.g,1)),U.b=Math.max(0,Math.min(l.color.b*U.b,1)),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*
+Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)):l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshDepthMaterial)ka=k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(g.positionScreen.z,ka,oa),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),
+Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)}function r(a,d,g,f,h,l,m,n,da){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)u(a,d,f,0,1,3,m,n,da),u(h,g,l,1,2,3,m,n,da);else if(X=a.positionScreen.x,T=a.positionScreen.y,ea=d.positionScreen.x,ba=d.positionScreen.y,x=g.positionScreen.x,
+I=g.positionScreen.y,O=f.positionScreen.x,M=f.positionScreen.y,j=h.positionScreen.x,P=h.positionScreen.y,ha=l.positionScreen.x,V=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(K.r=fa.r=U.r=ia.r=aa.r,K.g=fa.g=U.g=ia.g=aa.g,K.b=fa.b=U.b=ia.b=aa.b,p(i,
+m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),K.r=Math.max(0,Math.min(n.color.r*K.r,1)),K.g=Math.max(0,Math.min(n.color.g*K.g,1)),K.b=Math.max(0,Math.min(n.color.b*K.b,1)),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*fa.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
+Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ia.r=Math.max(0,Math.min(n.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(n.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(n.color.b*ia.b,1)),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*
+Q.b,1)),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q)):(Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color));else if(n instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q);else if(n instanceof THREE.MeshDepthMaterial)ka=
+k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(f.positionScreen.z,ka,oa),ia.r=ia.g=ia.b=1-Ba(g.positionScreen.z,ka,oa),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)}function Ea(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function Ha(a,b,c,d,e,g,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
+g);n.lineTo(f,j);n.lineTo(a,b);n.closePath()}function z(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(v!=c)n.lineCap=v=c;if(w!=e)n.lineJoin=w=e;d(a.getContextStyle());n.stroke();$.inflate(b*2)}function za(a){g(a.getContextStyle());n.fill()}function E(a,b,c,d,e,f,j,h,i,m,l,k,da){if(da.image.width!=0){if(da.needsUpdate==!0||pa[da.id]==void 0){var p=da.wrapS==THREE.RepeatWrapping,q=da.wrapT==THREE.RepeatWrapping;pa[da.id]=n.createPattern(da.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");da.needsUpdate=
+!1}g(pa[da.id]);var p=da.offset.x/da.repeat.x,q=da.offset.y/da.repeat.y,R=da.image.width*da.repeat.x,t=da.image.height*da.repeat.y,j=(j+p)*R,h=(h+q)*t,i=(i+p)*R,m=(m+q)*t,l=(l+p)*R,k=(k+q)*t;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=i*k-l*m;if(p==0){if(na[da.id]==void 0)b=document.createElement("canvas"),b.width=da.image.width,b.height=da.image.height,a=b.getContext("2d"),a.drawImage(da.image,0,0),na[da.id]=a.getImageData(0,0,da.image.width,da.image.height).data,delete b;b=na[da.id];j=(Math.floor(j)+
+Math.floor(h)*da.image.width)*4;Q.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);za(Q)}else p=1/p,da=(k*c-m*e)*p,m=(k*d-m*f)*p,c=(i*e-l*c)*p,d=(i*f-l*d)*p,a=a-da*j-c*h,j=b-m*j-d*h,n.save(),n.transform(da,m,c,d,a,j),n.fill(),n.restore()}}function Ca(a,b,c,d,e,g,f,j,h,i,m,l,k){var da,p;da=k.width-1;p=k.height-1;f*=da;j*=p;h*=da;i*=p;m*=da;l*=p;c-=a;d-=b;e-=a;g-=b;h-=f;i-=j;m-=f;l-=j;p=1/(h*l-m*i);da=(l*c-i*e)*p;i=(l*d-i*g)*p;c=(h*e-m*c)*p;d=(h*g-m*d)*p;a=a-da*f-c*j;b=b-i*f-d*j;n.save();n.transform(da,i,c,d,
+a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=f<0?0:f>255?255:f;ta[2]=a<0?0:a>255?255:a;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255?255:m;ta[13]=l<0?0:l>255?255:
+l;ta[14]=d<0?0:d>255?255:d;N.putImageData(ua,0,0);Fa.drawImage(va,0,0);return da}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ia,Ja,qa,wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);
+Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(qa=h[Ia],wa=qa.material,wa=wa instanceof THREE.MeshFaceMaterial?qa.faceMaterial:wa,!(wa==null||wa.opacity==0)){$.empty();if(qa instanceof THREE.RenderableParticle)C=qa,C.x*=m,C.y*=t,o(C,qa,wa,a);else if(qa instanceof THREE.RenderableLine)C=qa.v1,F=qa.v2,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),Z.intersects($)&&s(C,F,qa,
+wa,a);else if(qa instanceof THREE.RenderableFace3)C=qa.v1,F=qa.v2,B=qa.v3,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,B.positionScreen),Aa(B.positionScreen,C.positionScreen)),$.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,B.positionScreen.x,B.positionScreen.y),Z.intersects($)&&u(C,F,B,0,1,2,qa,wa,a);
+else if(qa instanceof THREE.RenderableFace4)C=qa.v1,F=qa.v2,B=qa.v3,L=qa.v4,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,L.positionScreen.x*=m,L.positionScreen.y*=t,J.positionScreen.copy(F.positionScreen),W.positionScreen.copy(L.positionScreen),wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,L.positionScreen),Aa(L.positionScreen,C.positionScreen),Aa(B.positionScreen,J.positionScreen),Aa(B.positionScreen,
+W.positionScreen)),$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),$.addPoint(B.positionScreen.x,B.positionScreen.y),$.addPoint(L.positionScreen.x,L.positionScreen.y),Z.intersects($)&&r(C,F,B,L,J,W,qa,wa,a);H.addRectangle($)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(C.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),X==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,z=new THREE.Color,E=new THREE.Color,G=new THREE.Color,v=new THREE.Color,w,C=new THREE.Vector3,F=[],B=[],L,J,W,X=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":X=1;break;case "low":X=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var F,x,I,O;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
+f=g.lights;W=J=0;if(r=f.length>0){E.setRGB(0,0,0);G.setRGB(0,0,0);v.setRGB(0,0,0);F=0;for(x=f.length;F<x;F++)O=f[F],I=O.color,O instanceof THREE.AmbientLight?(E.r+=I.r,E.g+=I.g,E.b+=I.b):O instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):O instanceof THREE.PointLight&&(v.r+=I.r,v.g+=I.g,v.b+=I.b)}F=0;for(x=e.length;F<x;F++)if(I=e[F],O=I.material,O=O instanceof THREE.MeshFaceMaterial?I.faceMaterial:O,!(O==null||O.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
+p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=W++;B[j]==null&&(B[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&B[j].setAttribute("shape-rendering","crispEdges"));L=B[j];L.setAttribute("x1",I.positionScreen.x);L.setAttribute("y1",I.positionScreen.y);
+L.setAttribute("x2",M.positionScreen.x);L.setAttribute("y2",M.positionScreen.y);O instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+O.color.getContextStyle()+"; stroke-width: "+O.linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.linecap+"; stroke-linejoin: "+O.linejoin),i.appendChild(L))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
+p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,C=n;d.info.render.vertices+=3;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?z.copy(O.color):O instanceof THREE.MeshLambertMaterial?
+r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):L.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+O.opacity);i.appendChild(L)}}else if(I instanceof THREE.RenderableFace4&&(m=I.v1,t=I.v2,n=I.v3,o=I.v4,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=p,n.positionScreen.y*=-q,o.positionScreen.x*=p,o.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,
+m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),s.intersects(u))){var M=m,j=t,C=n,ha=o;d.info.render.vertices+=4;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+" L "+ha.positionScreen.x+","+ha.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?
+z.copy(O.color):O instanceof THREE.MeshLambertMaterial?r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style",
+"fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):L.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+O.opacity);i.appendChild(L)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -221,123 +222,123 @@ 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){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-function b(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 d(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){ba.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,J.copy(e),ba.multiplyVector3(J),n[d]=[J.z,d];n.sort(function(a,
-b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[n[d][1]],k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
-h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],f=d*3,k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
-h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,
-f+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+g+h)/3,e=(e+i+m)/3,f=
-(f+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=o(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==Y&&(Y=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&
-g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,l=0;h=f.morphTargetInfluences;var n,k=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=
-m;i[l]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
+function b(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 d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){Z.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ca.copy(e),Z.multiplyVector3(ca),n[d]=[ca.z,d];n.sort(function(a,
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[n[d][1]],k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=n[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=n[d][1],f=h.value[f],
+h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],g=d*3,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
+h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
+g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
+(g+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=o(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==K&&(K=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
+e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
+f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,l=0;h=g.morphTargetInfluences;var n,k=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
+m;i[l]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==xa&&(j.lineWidth(d),xa=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
-e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==xa&&(j.lineWidth(d),xa=d),j.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[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=z[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),d=0;d<6;d++)if(a=z[d].x*b.n14+z[d].y*b.n24+z[d].z*b.n34+z[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;T||(T=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){aa=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ha[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ha[p];T.position.copy(k.position);T.lookAt(k.target.position);T.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(T));this.autoUpdateScene&&a.updateMatrixWorld();T.matrixWorldInverse.getInverse(T.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(T.projectionMatrix);i.multiplySelf(T.matrixWorldInverse);T.matrixWorldInverse.flattenToArray(ca);T.projectionMatrix.flattenToArray(F);
-ba.multiply(T.projectionMatrix,T.matrixWorldInverse);f(ba);A(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(E.r,E.g,E.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,T,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
-k.geometry.morphTargets.length?wa:ta,e(T,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),Y=-1,s(k,T,!1),u(k),m=o(T,q,null,ta,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,z):k.render(function(a){g(a,m,ta.shading)}));p++}}function k(a,b,c,d,f,g,h,j){var i,l,m,k;b?(l=a.length-1,k=b=-1):(l=0,b=a.length,k=1);for(var n=l;n!==b;n+=k)if(i=
-a[n],i.render){l=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);y(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(l);e(d,f,g,i,m,l)}}function p(a,b,c,d,e,f,h){for(var i,l,m,k,n=0,p=a.length;n<p;n++)if(i=a[n],l=i.object,l.visible){Y=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&G(m.blending);r(m.depthTest);y(m.depthWrite);v(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}u(l);k=o(c,d,e,m,l);l.immediateRenderCallback?l.immediateRenderCallback(k,
-j,z):l.render(function(a){g(a,k,m.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
-for(var f=0,g=M.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==Z&&(j.useProgram(f),Z=f,h=!0);if(d.id!==aa)aa=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,F);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
-m,k=0,n=0,p=0,q,R,t,o=da,ba=o.directional.colors,s=o.directional.positions,z=o.point.colors,u=o.point.positions,A=o.point.distances,r=0,D=0,c=l=t=0,h=b.length;c<h;c++)if(l=b[c],m=l.color,q=l.position,R=l.intensity,t=l.distance,l instanceof THREE.AmbientLight)M.gammaInput?(k+=m.r*m.r,n+=m.g*m.g,p+=m.b*m.b):(k+=m.r,n+=m.g,p+=m.b);else if(l instanceof THREE.DirectionalLight)t=r*3,M.gammaInput?(ba[t]=m.r*m.r*R*R,ba[t+1]=m.g*m.g*R*R,ba[t+2]=m.b*m.b*R*R):(ba[t]=m.r*R,ba[t+1]=m.g*R,ba[t+2]=m.b*R),s[t]=q.x,
-s[t+1]=q.y,s[t+2]=q.z,r+=1;else if(l instanceof THREE.SpotLight)t=r*3,M.gammaInput?(ba[t]=m.r*m.r*R*R,ba[t+1]=m.g*m.g*R*R,ba[t+2]=m.b*m.b*R*R):(ba[t]=m.r*R,ba[t+1]=m.g*R,ba[t+2]=m.b*R),m=1/q.length(),s[t]=q.x*m,s[t+1]=q.y*m,s[t+2]=q.z*m,r+=1;else if(l instanceof THREE.PointLight)l=D*3,M.gammaInput?(z[l]=m.r*m.r*R*R,z[l+1]=m.g*m.g*R*R,z[l+2]=m.b*m.b*R*R):(z[l]=m.r*R,z[l+1]=m.g*R,z[l+2]=m.b*R),u[l]=q.x,u[l+1]=q.y,u[l+2]=q.z,A[D]=t,D+=1;c=r*3;for(h=ba.length;c<h;c++)ba[c]=0;c=D*3;for(h=z.length;c<h;c++)z[c]=
-0;o.point.length=D;o.directional.length=r;o.ambient[0]=k;o.ambient[1]=n;o.ambient[2]=p;b=da;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,
-M.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;
-if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=S.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof
-THREE.MeshLambertMaterial)M.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ha.length;b++)i.shadowMatrix.value[b]=ha[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=
-d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(k=b[i][0],p=k.type,h=k.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!k._array)k._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)o=
-p*3,k._array[o]=h[p].x,k._array[o+1]=h[p].y,k._array[o+2]=h[p].z;j.uniform3fv(n,k._array)}else if(p==="m4"){if(!k._array)k._array=new Float32Array(16);h.flattenToArray(k._array);j.uniformMatrix4fv(n,!1,k._array)}else if(p==="m4v"){if(!k._array)k._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(k._array,p*16);j.uniformMatrix4fv(n,!1,k._array)}else if(p==="t"){if(j.uniform1i(n,h),n=k.texture)if(n.image instanceof Array&&n.image.length===6){if(k=n,k.image.length===
-6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,k.image[h]);H(j.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,j.activeTexture(j.TEXTURE0+
-h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.__webglTexture)):w(n,h)}else if(p==="tv"){if(!k._array){k._array=[];p=0;for(q=k.texture.length;p<q;p++)k._array[p]=h+p}j.uniform1iv(n,k._array);p=0;for(q=k.texture.length;p<q;p++)(n=k.texture[p])&&w(n,k._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
-d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,ca);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,ca),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,
-!1,e._objectMatrixArray);return f}function s(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(Q!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Q=a.doubleSided;if(ga!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a.flipSided}function r(a){ja!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),
-ja=a)}function y(a){ma!==a&&(j.depthMask(a),ma=a)}function v(a,b,c){la!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),la=a);if(a&&(ka!==b||ya!==c))j.polygonOffset(b,c),ka=b,ya=c}function G(a){if(a!==na){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,
-j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}na=a}}function B(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function H(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-
-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,L(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)))}function w(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=j.createTexture(),M.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.image.width,a.image.height,0,L(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);H(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}
-function D(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(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=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);H(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(a.format),
-a.width,a.height,0,L(a.format),L(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),H(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.width,a.height,0,L(a.format),L(a.type),null),
-c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),D(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=qa,a=R,d=sa,
-e=pa);b!==O&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),O=b)}function K(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function L(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;
-case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;
-case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},S=a.canvas!==void 0?a.canvas:document.createElement("canvas"),W=a.precision!==void 0?a.precision:"highp",U=a.antialias!==void 0?a.antialias:!1,X=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,E=a.clearColor!==void 0?new THREE.Color(a.clearColor):
-new THREE.Color(0),I=a.clearAlpha!==void 0?a.clearAlpha:0,P=a.maxLights!==void 0?a.maxLights:4;this.domElement=S;this.context=null;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;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=this,j,V=[],Z=null,O=null,aa=-1,Y=null,ea=0,Q=null,ga=null,na=null,ja=null,ma=null,la=null,ka=null,ya=null,xa=null,sa=0,pa=0,qa=0,R=0,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ba=new THREE.Matrix4,F=new Float32Array(16),
-ca=new Float32Array(16),J=new THREE.Vector4,da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},T,ha=[],ta,wa,N={},ra=!1;j=function(){var a;try{if(!(a=S.getContext("experimental-webgl",{antialias:U,stencil:X,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
-j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(E.r,E.g,E.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=
-1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);
-N.program=j.createProgram();j.attachShader(N.program,B("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,B("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,
-"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=
-j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ta=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});wa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-ta._shadowPass=!0;wa._shadowPass=!0})();this.context=j;var ua=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ua};this.setSize=function(a,b){S.width=a;S.height=b;this.setViewport(0,0,S.width,S.height)};this.setViewport=function(a,b,c,d){sa=a;pa=b;qa=c;R=d;j.viewport(sa,pa,qa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
-this.setClearColorHex=function(a,b){E.setHex(a);I=b;j.clearColor(E.r,E.g,E.b,I)};this.setClearColor=function(a,b){E.copy(a);I=b;j.clearColor(E.r,E.g,E.b,I)};this.getClearColor=function(){return E};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){A(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
-!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
-j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
-j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,t=a.fog;aa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.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(ca);b.projectionMatrix.flattenToArray(F);ba.multiply(b.projectionMatrix,b.matrixWorldInverse);f(ba);A(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var o=g,z=o.object,u=o.buffer,D=void 0,D=D=void 0,D=z.material;if(D instanceof THREE.MeshFaceMaterial){if(D=u.materialIndex,D>=0)D=z.geometry.materials[D],D.transparent?(o.transparent=D,o.opaque=null):(o.opaque=D,o.transparent=null)}else if(D)D.transparent?
-(o.transparent=D,o.opaque=null):(o.opaque=D,o.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(J.copy(m.position),ba.multiplyVector3(J),g.z=J.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),
-r(a.overrideMaterial.depthTest),y(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,t,!1),p(a.__webglObjectsImmediate,"opaque",b,q,t,!1),k(a.__webglObjects,!1,"transparent",b,q,t,!0),p(a.__webglObjectsImmediate,"transparent",b,q,t,!0));
-if(a.__webglSprites.length){m=N.attributes;q=N.uniforms;t=R/qa;d=[];e=qa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);Z=N.program;Y=ja=na=-1;ra||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ra=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,
-!1,F);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(o=a.__webglSprites.length;m<o;m++)if(z=a.__webglSprites[m],z.visible&&z.opacity!==0)z.useScreenCoordinates?z.z=-z.position.z:(z._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray),z.z=-z._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(o=a.__webglSprites.length;m<o;m++)z=a.__webglSprites[m],z.visible&&z.opacity!==0&&z.map&&z.map.image&&z.map.image.width&&(z.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,
-1),j.uniform3f(q.screenPosition,(z.position.x-e)/e,(n-z.position.y)/n,Math.max(0,Math.min(1,z.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,z.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,z._modelViewMatrixArray)),b=z.map.image.width/(z.scaleByViewport?R:1),d[0]=b*t*z.scale.x,d[1]=b*z.scale.y,j.uniform2f(q.uvScale,z.uvScale.x,z.uvScale.y),j.uniform2f(q.uvOffset,z.uvOffset.x,z.uvOffset.y),j.uniform2f(q.alignment,z.alignment.x,z.alignment.y),
-j.uniform1f(q.opacity,z.opacity),j.uniform3f(q.color,z.color.r,z.color.g,z.color.b),j.uniform1f(q.rotation,z.rotation),j.uniform2fv(q.scale,d),z.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!z.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(z.blending),w(z.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ma)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
-c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,g=void 0,h=void 0,i=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 i=h,k=void 0,l=void 0,p=void 0,R=void 0,o=void 0,z=void 0,ba=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)p=i.faces[k],R=p.materialIndex,z=R!==void 0?R:-1,s[z]===void 0&&(s[z]={hash:z,counter:0}),ba=s[z].hash+"_"+s[z].counter,i.geometryGroups[ba]===
-void 0&&(i.geometryGroups[ba]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[ba].vertices+o>65535&&(s[z].counter+=1,ba=s[z].hash+"_"+s[z].counter,i.geometryGroups[ba]===void 0&&(i.geometryGroups[ba]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof THREE.Face3?i.geometryGroups[ba].faces3.push(k):i.geometryGroups[ba].faces4.push(k),i.geometryGroups[ba].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
-ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(g in h.geometryGroups)if(i=h.geometryGroups[g],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
-j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){p=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(p=k.numMorphTargets;l<p;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;l=i.faces3;z=i.faces4;k=l.length*3+z.length*4;p=l.length*1+z.length*2;z=l.length*3+z.length*4;l=b(R,i);ba=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
-l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(ba){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
-2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(z*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=ba;
-i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=p*3;i.__webglLineCount=z*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in l.attributes){var R=l.attributes[p],o={},A;for(A in R)o[A]=R[A];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,z=1,o.type==="v2"?z=2:o.type==="v3"?z=3:o.type==="v4"?z=4:o.type==="c"&&(z=3),o.size=z,o.array=new Float32Array(k*z),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ya&&(j.lineWidth(d),ya=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
+e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ya&&(j.lineWidth(d),ya=d),j.drawArrays(g,0,e.__webglLineCount),M.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){A[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);A[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);A[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);A[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);A[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);A[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=A[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),d=0;d<6;d++)if(a=A[d].x*b.n14+A[d].y*b.n24+A[d].z*b.n34+A[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;S||(S=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){Q=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ga[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ga[p];S.position.copy(k.position);S.lookAt(k.target.position);S.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(S));this.autoUpdateScene&&a.updateMatrixWorld();S.matrixWorldInverse.getInverse(S.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(S.projectionMatrix);i.multiplySelf(S.matrixWorldInverse);S.matrixWorldInverse.flattenToArray($);S.projectionMatrix.flattenToArray(H);
+Z.multiply(S.projectionMatrix,S.matrixWorldInverse);f(Z);B(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(x.r,x.g,x.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,S,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
+k.geometry.morphTargets.length?va:Y,e(S,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),K=-1,s(k,S,!1),u(k),m=o(S,q,null,Y,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,A):k.render(function(a){g(a,m,Y.shading)}));p++}}function k(a,b,c,d,g,f,h,j){var i,l,k,m;b?(l=a.length-1,m=b=-1):(l=0,b=a.length,m=1);for(var n=l;n!==b;n+=m)if(i=a[n],
+i.render){l=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);z(i.depthWrite);E(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(l);e(d,g,f,i,k,l)}}function p(a,b,c,d,e,f,h){for(var i,l,k,m,n=0,p=a.length;n<p;n++)if(i=a[n],l=i.object,l.visible){K=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&G(k.blending);r(k.depthTest);z(k.depthWrite);E(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}u(l);m=o(c,d,e,k,l);l.immediateRenderCallback?l.immediateRenderCallback(m,
+j,A):l.render(function(a){g(a,m,k.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
+for(var g=0,f=M.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ha&&(j.useProgram(g),ha=g,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,H);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
+k,m=0,n=0,p=0,q,R,t,o=aa,Z=o.directional.colors,s=o.directional.positions,A=o.point.colors,u=o.point.positions,B=o.point.distances,r=0,F=0,c=l=t=0,h=b.length;c<h;c++)if(l=b[c],k=l.color,q=l.position,R=l.intensity,t=l.distance,l instanceof THREE.AmbientLight)M.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,p+=k.b*k.b):(m+=k.r,n+=k.g,p+=k.b);else if(l instanceof THREE.DirectionalLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),s[t]=q.x,s[t+
+1]=q.y,s[t+2]=q.z,r+=1;else if(l instanceof THREE.SpotLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),k=1/q.length(),s[t]=q.x*k,s[t+1]=q.y*k,s[t+2]=q.z*k,r+=1;else if(l instanceof THREE.PointLight)l=F*3,M.gammaInput?(A[l]=k.r*k.r*R*R,A[l+1]=k.g*k.g*R*R,A[l+2]=k.b*k.b*R*R):(A[l]=k.r*R,A[l+1]=k.g*R,A[l+2]=k.b*R),u[l]=q.x,u[l+1]=q.y,u[l+2]=q.z,B[F]=t,F+=1;c=r*3;for(h=Z.length;c<h;c++)Z[c]=0;c=F*3;for(h=A.length;c<h;c++)A[c]=0;o.point.length=
+F;o.directional.length=r;o.ambient[0]=m;o.ambient[1]=n;o.ambient[2]=p;b=aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,M.gammaInput?
+i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
+THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=W.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)M.gammaInput?
+i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ga.length;b++)i.shadowMatrix.value[b]=ga[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=d.uniformsList;i=0;for(c=
+b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(m=b[i][0],p=m.type,h=m.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)o=p*3,m._array[o]=h[p].x,m._array[o+
+1]=h[p].y,m._array[o+2]=h[p].z;j.uniform3fv(n,m._array)}else if(p==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(m._array,p*16);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="t"){if(j.uniform1i(n,h),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=
+j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[h]);w(j.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.__webglTexture)):C(n,h)}else if(p===
+"tv"){if(!m._array){m._array=[];p=0;for(q=m.texture.length;p<q;p++)m._array[p]=h+p}j.uniform1iv(n,m._array);p=0;for(q=m.texture.length;p<q;p++)(n=m.texture[p])&&C(n,m._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&
+j.uniformMatrix4fv(f.viewMatrix,!1,$);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,$),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function s(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ia!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ia=a.flipSided}function r(a){na!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),na=a)}function z(a){ka!==a&&(j.depthMask(a),ka=a)}function E(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
+j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ma!==c))j.polygonOffset(b,c),la=b,ma=c}function G(a){if(a!==pa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,
+j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}pa=a}}function v(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function w(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,J(b.wrapT)),
+j.texParameteri(a,j.TEXTURE_MAG_FILTER,J(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,J(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)))}function C(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),M.info.memory.textures++;j.activeTexture(j.TEXTURE0+
+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.image.width,a.image.height,0,J(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);w(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function F(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function B(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=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
+a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);F(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
+c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),F(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=R,d=ra,e=sa);b!==V&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),V=b)}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
+default:return j.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
+var a=a||{},W=a.canvas!==void 0?a.canvas:document.createElement("canvas"),X=a.precision!==void 0?a.precision:"highp",T=a.antialias!==void 0?a.antialias:!1,ea=a.stencil!==void 0?a.stencil:!0,ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,x=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),I=a.clearAlpha!==void 0?a.clearAlpha:0,O=a.maxLights!==void 0?a.maxLights:4;this.domElement=W;this.context=null;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;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=
+this,j,P=[],ha=null,V=null,Q=-1,K=null,fa=0,U=null,ia=null,pa=null,na=null,ka=null,oa=null,la=null,ma=null,ya=null,ra=0,sa=0,xa=0,R=0,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,H=new Float32Array(16),$=new Float32Array(16),ca=new THREE.Vector4,aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},S,ga=[],Y,va,N={},ua=!1;j=function(){var a;try{if(!(a=
+W.getContext("experimental-webgl",{antialias:T,stencil:ea,preserveDrawingBuffer:ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);
+j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(x.r,x.g,x.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=
+1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);N.program=j.createProgram();j.attachShader(N.program,v("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,v("vertex",THREE.ShaderLib.sprite.vertexShader));
+j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,
+"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,
+"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Y=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});Y._shadowPass=!0;va._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
+function(){return ta};this.setSize=function(a,b){W.width=a;W.height=b;this.setViewport(0,0,W.width,W.height)};this.setViewport=function(a,b,c,d){ra=a;sa=b;xa=c;R=d;j.viewport(ra,sa,xa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){x.setHex(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.setClearColor=function(a,b){x.copy(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.getClearColor=
+function(){return x};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){B(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
+a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
+0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
+M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,t=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&
+l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.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($);b.projectionMatrix.flattenToArray(H);Z.multiply(b.projectionMatrix,b.matrixWorldInverse);f(Z);B(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var o=g,A=o.object,u=o.buffer,F=void 0,F=F=void 0,F=A.material;if(F instanceof THREE.MeshFaceMaterial){if(F=u.materialIndex,F>=0)F=A.geometry.materials[F],F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=F,o.transparent=null)}else if(F)F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=
+F,o.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ca.copy(m.position),Z.multiplyVector3(ca),g.z=ca.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),r(a.overrideMaterial.depthTest),
+z(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,t,!1),p(a.__webglObjectsImmediate,"opaque",b,q,t,!1),k(a.__webglObjects,!1,"transparent",b,q,t,!0),p(a.__webglObjectsImmediate,"transparent",b,q,t,!0));if(a.__webglSprites.length){m=
+N.attributes;q=N.uniforms;t=R/xa;d=[];e=xa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);ha=N.program;K=na=pa=-1;ua||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ua=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,
+!1,H);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(o=a.__webglSprites.length;m<o;m++)if(A=a.__webglSprites[m],A.visible&&A.opacity!==0)A.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray),A.z=-A._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(o=a.__webglSprites.length;m<o;m++)A=a.__webglSprites[m],A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width&&(A.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,
+1),j.uniform3f(q.screenPosition,(A.position.x-e)/e,(n-A.position.y)/n,Math.max(0,Math.min(1,A.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,A.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,A._modelViewMatrixArray)),b=A.map.image.width/(A.scaleByViewport?R:1),d[0]=b*t*A.scale.x,d[1]=b*A.scale.y,j.uniform2f(q.uvScale,A.uvScale.x,A.uvScale.y),j.uniform2f(q.uvOffset,A.uvOffset.x,A.uvOffset.y),j.uniform2f(q.alignment,A.alignment.x,A.alignment.y),
+j.uniform1f(q.opacity,A.opacity),j.uniform3f(q.color,A.color.r,A.color.g,A.color.b),j.uniform1f(q.rotation,A.rotation),j.uniform2fv(q.scale,d),A.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!A.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(A.blending),C(A.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=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 i=h,k=void 0,l=void 0,p=void 0,R=void 0,o=void 0,A=void 0,Z=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)p=i.faces[k],R=p.materialIndex,A=R!==void 0?R:-1,s[A]===void 0&&(s[A]={hash:A,counter:0}),Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===
+void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[Z].vertices+o>65535&&(s[A].counter+=1,Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof THREE.Face3?i.geometryGroups[Z].faces3.push(k):i.geometryGroups[Z].faces4.push(k),i.geometryGroups[Z].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
+fa++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
+j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){p=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(p=k.numMorphTargets;l<p;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;l=i.faces3;A=i.faces4;k=l.length*3+A.length*4;p=l.length*1+A.length*2;A=l.length*3+A.length*4;l=b(R,i);Z=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(Z){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
+2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(A*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=Z;
+i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=p*3;i.__webglLineCount=A*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in l.attributes){var R=l.attributes[p],o={},B;for(B in R)o[B]=R[B];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,A=1,o.type==="v2"?A=2:o.type==="v3"?A=3:o.type==="v4"?A=4:o.type==="c"&&(A=3),o.size=A,o.array=new Float32Array(k*A),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=
 p,R.needsUpdate=!0,o.__original=R;i.__webglCustomAttributesList.push(o)}}i.__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)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
 3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
-i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups)i=h.geometryGroups[g],q(f.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
-(h=e.geometry,q(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(f.__webglObjects,e);else if(e instanceof
-THREE.Sprite){f=f.__webglSprites;g=e;for(h=f.length-1;h>=0;h--)f[h]===g&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(A=a.__webglObjects[e].object,g=A.geometry,h=p=l=void 0,A instanceof THREE.Mesh){i=0;for(k=g.geometryGroupsList.length;i<k;i++)if(l=g.geometryGroupsList[i],h=b(A,l),p=h.attributes&&m(h),g.__dirtyVertices||g.__dirtyMorphTargets||
-g.__dirtyElements||g.__dirtyUvs||g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!g.dynamic,l.__inittedArrays){var D=z=o=void 0,r=void 0,K=void 0,L=void 0,F=void 0,y=void 0,I=void 0,P=void 0,G=void 0,E=D=L=void 0,J=void 0,w=void 0,v=void 0,B=r=void 0,H=void 0,ca=r=I=G=void 0,N=void 0,U=v=w=J=F=void 0,T=r=v=w=J=U=v=w=J=U=v=w=J=void 0,S=void 0,W=L=void 0,aa=void 0,da=void 0,ha=void 0,X=void 0,O=E=da=S=0,Y=0,$=T=D=0,Q=F=B=0,C=0,V=void 0,Q=l.__vertexArray,aa=l.__uvArray,
-C=l.__uv2Array,W=l.__normalArray,K=l.__tangentArray,H=l.__colorArray,ca=l.__skinVertexAArray,N=l.__skinVertexBArray,y=l.__skinIndexArray,Z=l.__skinWeightArray,U=l.__morphTargetsArrays,ba=l.__webglCustomAttributesList,x=void 0,x=l.__faceArray,V=l.__lineArray,ga=l.__needsSmoothNormals,G=l.__vertexColorType,P=l.__uvType,L=l.__normalType,I=A.geometry,wa=I.__dirtyElements,ta=I.__dirtyUvs,ja=I.__dirtyNormals,na=I.__dirtyTangents,ma=I.__dirtyColors,ha=I.__dirtyMorphTargets,X=I.vertices,s=l.faces3,u=l.faces4,
-ia=I.faces,ua=I.faceVertexUvs[0],ra=I.faceVertexUvs[1],ka=I.skinVerticesA,la=I.skinVerticesB,sa=I.skinIndices,pa=I.skinWeights,qa=I.morphTargets;if(I.__dirtyVertices){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=X[r.a].position,w=X[r.b].position,v=X[r.c].position,Q[da]=J.x,Q[da+1]=J.y,Q[da+2]=J.z,Q[da+3]=w.x,Q[da+4]=w.y,Q[da+5]=w.z,Q[da+6]=v.x,Q[da+7]=v.y,Q[da+8]=v.z,da+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=X[r.a].position,w=X[r.b].position,v=X[r.c].position,r=X[r.d].position,Q[da]=J.x,Q[da+1]=J.y,
-Q[da+2]=J.z,Q[da+3]=w.x,Q[da+4]=w.y,Q[da+5]=w.z,Q[da+6]=v.x,Q[da+7]=v.y,Q[da+8]=v.z,Q[da+9]=r.x,Q[da+10]=r.y,Q[da+11]=r.z,da+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,p)}if(ha){da=0;for(ha=qa.length;da<ha;da++){o=Q=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=qa[da].vertices[r.a].position,w=qa[da].vertices[r.b].position,v=qa[da].vertices[r.c].position,X=U[da],X[Q]=J.x,X[Q+1]=J.y,X[Q+2]=J.z,X[Q+3]=w.x,X[Q+4]=w.y,X[Q+5]=w.z,X[Q+6]=v.x,X[Q+7]=v.y,X[Q+8]=v.z,Q+=9;o=
-0;for(z=u.length;o<z;o++)r=ia[u[o]],J=qa[da].vertices[r.a].position,w=qa[da].vertices[r.b].position,v=qa[da].vertices[r.c].position,r=qa[da].vertices[r.d].position,X=U[da],X[Q]=J.x,X[Q+1]=J.y,X[Q+2]=J.z,X[Q+3]=w.x,X[Q+4]=w.y,X[Q+5]=w.z,X[Q+6]=v.x,X[Q+7]=v.y,X[Q+8]=v.z,X[Q+9]=r.x,X[Q+10]=r.y,X[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[da]);j.bufferData(j.ARRAY_BUFFER,U[da],p)}}if(pa.length){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=pa[r.a],w=pa[r.b],v=pa[r.c],Z[F]=J.x,
-Z[F+1]=J.y,Z[F+2]=J.z,Z[F+3]=J.w,Z[F+4]=w.x,Z[F+5]=w.y,Z[F+6]=w.z,Z[F+7]=w.w,Z[F+8]=v.x,Z[F+9]=v.y,Z[F+10]=v.z,Z[F+11]=v.w,J=sa[r.a],w=sa[r.b],v=sa[r.c],y[F]=J.x,y[F+1]=J.y,y[F+2]=J.z,y[F+3]=J.w,y[F+4]=w.x,y[F+5]=w.y,y[F+6]=w.z,y[F+7]=w.w,y[F+8]=v.x,y[F+9]=v.y,y[F+10]=v.z,y[F+11]=v.w,J=ka[r.a],w=ka[r.b],v=ka[r.c],ca[F]=J.x,ca[F+1]=J.y,ca[F+2]=J.z,ca[F+3]=1,ca[F+4]=w.x,ca[F+5]=w.y,ca[F+6]=w.z,ca[F+7]=1,ca[F+8]=v.x,ca[F+9]=v.y,ca[F+10]=v.z,ca[F+11]=1,J=la[r.a],w=la[r.b],v=la[r.c],N[F]=J.x,N[F+1]=J.y,
-N[F+2]=J.z,N[F+3]=1,N[F+4]=w.x,N[F+5]=w.y,N[F+6]=w.z,N[F+7]=1,N[F+8]=v.x,N[F+9]=v.y,N[F+10]=v.z,N[F+11]=1,F+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=pa[r.a],w=pa[r.b],v=pa[r.c],U=pa[r.d],Z[F]=J.x,Z[F+1]=J.y,Z[F+2]=J.z,Z[F+3]=J.w,Z[F+4]=w.x,Z[F+5]=w.y,Z[F+6]=w.z,Z[F+7]=w.w,Z[F+8]=v.x,Z[F+9]=v.y,Z[F+10]=v.z,Z[F+11]=v.w,Z[F+12]=U.x,Z[F+13]=U.y,Z[F+14]=U.z,Z[F+15]=U.w,J=sa[r.a],w=sa[r.b],v=sa[r.c],U=sa[r.d],y[F]=J.x,y[F+1]=J.y,y[F+2]=J.z,y[F+3]=J.w,y[F+4]=w.x,y[F+5]=w.y,y[F+6]=w.z,y[F+7]=w.w,y[F+8]=
-v.x,y[F+9]=v.y,y[F+10]=v.z,y[F+11]=v.w,y[F+12]=U.x,y[F+13]=U.y,y[F+14]=U.z,y[F+15]=U.w,J=ka[r.a],w=ka[r.b],v=ka[r.c],U=ka[r.d],ca[F]=J.x,ca[F+1]=J.y,ca[F+2]=J.z,ca[F+3]=1,ca[F+4]=w.x,ca[F+5]=w.y,ca[F+6]=w.z,ca[F+7]=1,ca[F+8]=v.x,ca[F+9]=v.y,ca[F+10]=v.z,ca[F+11]=1,ca[F+12]=U.x,ca[F+13]=U.y,ca[F+14]=U.z,ca[F+15]=1,J=la[r.a],w=la[r.b],v=la[r.c],r=la[r.d],N[F]=J.x,N[F+1]=J.y,N[F+2]=J.z,N[F+3]=1,N[F+4]=w.x,N[F+5]=w.y,N[F+6]=w.z,N[F+7]=1,N[F+8]=v.x,N[F+9]=v.y,N[F+10]=v.z,N[F+11]=1,N[F+12]=r.x,N[F+13]=
-r.y,N[F+14]=r.z,N[F+15]=1,F+=16;F>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,y,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Z,p))}if(ma&&G){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],F=r.vertexColors,y=r.color,F.length===3&&G===THREE.VertexColors?
-(r=F[0],ca=F[1],N=F[2]):N=ca=r=y,H[B]=r.r,H[B+1]=r.g,H[B+2]=r.b,H[B+3]=ca.r,H[B+4]=ca.g,H[B+5]=ca.b,H[B+6]=N.r,H[B+7]=N.g,H[B+8]=N.b,B+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],F=r.vertexColors,y=r.color,F.length===4&&G===THREE.VertexColors?(r=F[0],ca=F[1],N=F[2],F=F[3]):F=N=ca=r=y,H[B]=r.r,H[B+1]=r.g,H[B+2]=r.b,H[B+3]=ca.r,H[B+4]=ca.g,H[B+5]=ca.b,H[B+6]=N.r,H[B+7]=N.g,H[B+8]=N.b,H[B+9]=F.r,H[B+10]=F.g,H[B+11]=F.b,B+=12;B>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
-H,p))}if(na&&I.hasTangents){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],I=r.vertexTangents,B=I[0],H=I[1],G=I[2],K[T]=B.x,K[T+1]=B.y,K[T+2]=B.z,K[T+3]=B.w,K[T+4]=H.x,K[T+5]=H.y,K[T+6]=H.z,K[T+7]=H.w,K[T+8]=G.x,K[T+9]=G.y,K[T+10]=G.z,K[T+11]=G.w,T+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],I=r.vertexTangents,B=I[0],H=I[1],G=I[2],I=I[3],K[T]=B.x,K[T+1]=B.y,K[T+2]=B.z,K[T+3]=B.w,K[T+4]=H.x,K[T+5]=H.y,K[T+6]=H.z,K[T+7]=H.w,K[T+8]=G.x,K[T+9]=G.y,K[T+10]=G.z,K[T+11]=G.w,K[T+12]=I.x,K[T+13]=I.y,K[T+14]=I.z,K[T+
-15]=I.w,T+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,K,p)}if(ja&&L){o=0;for(z=s.length;o<z;o++)if(r=ia[s[o]],K=r.vertexNormals,L=r.normal,K.length===3&&ga)for(T=0;T<3;T++)L=K[T],W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;else for(T=0;T<3;T++)W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;o=0;for(z=u.length;o<z;o++)if(r=ia[u[o]],K=r.vertexNormals,L=r.normal,K.length===4&&ga)for(T=0;T<4;T++)L=K[T],W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;else for(T=0;T<4;T++)W[D]=L.x,W[D+1]=L.y,W[D+
-2]=L.z,D+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,W,p)}if(ta&&ua&&P){o=0;for(z=s.length;o<z;o++)if(D=s[o],D=ua[D],D!==void 0)for(T=0;T<3;T++)W=D[T],aa[E]=W.u,aa[E+1]=W.v,E+=2;o=0;for(z=u.length;o<z;o++)if(D=u[o],D=ua[D],D!==void 0)for(T=0;T<4;T++)W=D[T],aa[E]=W.u,aa[E+1]=W.v,E+=2;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,aa,p))}if(ta&&ra&&P){o=0;for(z=s.length;o<z;o++)if(D=s[o],E=ra[D],E!==void 0)for(T=0;T<3;T++)aa=E[T],
-C[O]=aa.u,C[O+1]=aa.v,O+=2;o=0;for(z=u.length;o<z;o++)if(D=u[o],E=ra[D],E!==void 0)for(T=0;T<4;T++)aa=E[T],C[O]=aa.u,C[O+1]=aa.v,O+=2;O>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,C,p))}if(wa){o=0;for(z=s.length;o<z;o++)x[Y]=S,x[Y+1]=S+1,x[Y+2]=S+2,Y+=3,V[$]=S,V[$+1]=S+1,V[$+2]=S,V[$+3]=S+2,V[$+4]=S+1,V[$+5]=S+2,$+=6,S+=3;o=0;for(z=u.length;o<z;o++)x[Y]=S,x[Y+1]=S+1,x[Y+2]=S+3,x[Y+3]=S+1,x[Y+4]=S+2,x[Y+5]=S+3,Y+=6,V[$]=S,V[$+1]=S+1,V[$+2]=S,V[$+3]=S+3,V[$+4]=S+
-1,V[$+5]=S+2,V[$+6]=S+2,V[$+7]=S+3,$+=8,S+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,x,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,V,p)}if(ba){T=0;for(S=ba.length;T<S;T++)if(x=ba[T],x.__original.needsUpdate){C=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],x.array[C]=x.value[r.a],x.array[C+1]=x.value[r.b],x.array[C+2]=x.value[r.c],C+=3;o=0;
-for(z=u.length;o<z;o++)r=ia[u[o]],x.array[C]=x.value[r.a],x.array[C+1]=x.value[r.b],x.array[C+2]=x.value[r.c],x.array[C+3]=x.value[r.d],C+=4}else{if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)V=x.value[s[o]],x.array[C]=V,x.array[C+1]=V,x.array[C+2]=V,C+=3;o=0;for(z=u.length;o<z;o++)V=x.value[u[o]],x.array[C]=V,x.array[C+1]=V,x.array[C+2]=V,x.array[C+3]=V,C+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],
-v=x.value[r.c],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,C+=6;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,x.array[C+6]=r.x,x.array[C+7]=r.y,C+=8}else{if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,
-x.array[C+4]=v.x,x.array[C+5]=v.y,C+=6;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,x.array[C+6]=r.x,x.array[C+7]=r.y,C+=8}}else if(x.size===3)if(O=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],
-x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],C+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],x.array[C+9]=r[O[0]],x.array[C+10]=r[O[1]],x.array[C+11]=r[O[2]],C+=12}else{if(x.boundTo==="faces"){o=0;for(z=
-s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],C+=9;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],x.array[C+9]=r[O[0]],x.array[C+10]=
-r[O[1]],x.array[C+11]=r[O[2]],C+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,C+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=
-J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,x.array[C+12]=r.x,x.array[C+13]=r.y,x.array[C+14]=r.z,x.array[C+15]=r.w,C+=16}else if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+
-9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,C+=12;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,x.array[C+12]=r.x,x.array[C+13]=r.y,x.array[C+14]=r.z,x.array[C+15]=r.w,C+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,p)}}R&&(delete l.__inittedArrays,delete l.__colorArray,
-delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}g.__dirtyVertices=!1;g.__dirtyMorphTargets=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyColors=!1;g.__dirtyTangents=!1;h.attributes&&t(h)}else if(A instanceof THREE.Ribbon){if(g.__dirtyVertices||g.__dirtyColors){h=g;
-A=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;z=h.vertices;k=h.colors;ba=z.length;l=k.length;s=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<ba;R++)o=z[R].position,i=R*3,s[i]=o.x,s[i+1]=o.y,s[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,A)}if(u){for(R=0;R<l;R++)o=k[R],i=R*3,p[i]=o.r,p[i+1]=o.g,p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,A)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(A instanceof
-THREE.Line){h=b(A,l);p=h.attributes&&m(h);if(g.__dirtyVertices||g.__dirtyColors||p){A=g;i=j.DYNAMIC_DRAW;ba=k=S=z=ia=void 0;z=A.vertices;l=A.colors;ba=z.length;p=l.length;s=A.__vertexArray;R=A.__colorArray;u=A.__dirtyColors;o=A.__webglCustomAttributesList;E=$=Y=O=S=ia=void 0;if(A.__dirtyVertices){for(ia=0;ia<ba;ia++)S=z[ia].position,k=ia*3,s[k]=S.x,s[k+1]=S.y,s[k+2]=S.z;j.bindBuffer(j.ARRAY_BUFFER,A.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(z=0;z<p;z++)ba=l[z],k=z*3,R[k]=ba.r,
-R[k+1]=ba.g,R[k+2]=ba.b;j.bindBuffer(j.ARRAY_BUFFER,A.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ia=0;for(S=o.length;ia<S;ia++)if(E=o[ia],E.needsUpdate&&(E.boundTo===void 0||E.boundTo==="vertices")){k=0;Y=E.value.length;if(E.size===1)for(O=0;O<Y;O++)E.array[O]=E.value[O];else if(E.size===2)for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,k+=2;else if(E.size===3)if(E.type==="c")for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.r,E.array[k+1]=$.g,E.array[k+2]=$.b,k+=3;else for(O=
-0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,E.array[k+2]=$.z,k+=3;else if(E.size===4)for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,E.array[k+2]=$.z,E.array[k+3]=$.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,E.buffer);j.bufferData(j.ARRAY_BUFFER,E.array,i)}}}g.__dirtyVertices=!1;g.__dirtyColors=!1;h.attributes&&t(h)}else if(A instanceof THREE.ParticleSystem)h=b(A,l),p=h.attributes&&m(h),(g.__dirtyVertices||g.__dirtyColors||A.sortParticles||p)&&d(g,j.DYNAMIC_DRAW,A),g.__dirtyVertices=
-!1,g.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);
-a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var l,k,m;l=m=i=0;for(k=b.length;l<k;l++)f=b[l],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=P?l=m:(l=Math.ceil(P*m/(i+m)),i=P-l);f={directional:l,point:i};i=m=0;for(l=b.length;i<l;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{l=a.fragmentShader;k=a.vertexShader;var i=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:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,
-perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(l),d.push(k));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=V.length;p<d;p++)if(V[p].code===h){o=V[p].program;break a}p=j.createProgram();d=[ua?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.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.perPixel?"#define PHONG_PER_PIXEL":"",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");
-f=["#ifdef GL_ES","precision "+W+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.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");j.attachShader(p,B("fragment",f+l));j.attachShader(p,
-B("vertex",d+k));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)l=q[d],p.uniforms[l]=j.getUniformLocation(p,
-l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=V.length;V.push({program:p,code:h});M.info.memory.programs=V.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
+i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],q(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
+(h=e.geometry,q(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(g.__webglObjects,e);else if(e instanceof
+THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(B=a.__webglObjects[e].object,f=B.geometry,h=p=l=void 0,B instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(B,l),p=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!f.dynamic,l.__inittedArrays){var F=A=o=void 0,r=void 0,L=void 0,z=void 0,H=void 0,J=void 0,I=void 0,O=void 0,G=void 0,C=F=z=void 0,x=void 0,w=void 0,v=void 0,E=r=void 0,$=void 0,ca=r=I=G=void 0,N=void 0,T=v=w=x=H=void 0,S=r=v=w=x=T=v=w=x=T=v=w=x=void 0,aa=void 0,W=z=void 0,X=void 0,Q=void 0,ea=void 0,V=void 0,K=C=Q=aa=0,ba=0,U=S=F=0,P=H=E=0,D=0,ga=void 0,P=l.__vertexArray,X=l.__uvArray,
+D=l.__uv2Array,W=l.__normalArray,L=l.__tangentArray,$=l.__colorArray,ca=l.__skinVertexAArray,N=l.__skinVertexBArray,J=l.__skinIndexArray,Y=l.__skinWeightArray,T=l.__morphTargetsArrays,Z=l.__webglCustomAttributesList,y=void 0,y=l.__faceArray,ga=l.__lineArray,ha=l.__needsSmoothNormals,G=l.__vertexColorType,O=l.__uvType,z=l.__normalType,I=B.geometry,ia=I.__dirtyElements,va=I.__dirtyUvs,pa=I.__dirtyNormals,ta=I.__dirtyTangents,na=I.__dirtyColors,ea=I.__dirtyMorphTargets,V=I.vertices,s=l.faces3,u=l.faces4,
+ja=I.faces,ka=I.faceVertexUvs[0],ma=I.faceVertexUvs[1],la=I.skinVerticesA,oa=I.skinVerticesB,ua=I.skinIndices,ra=I.skinWeights,sa=I.morphTargets;if(I.__dirtyVertices){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,Q+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,r=V[r.d].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,
+P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,P[Q+9]=r.x,P[Q+10]=r.y,P[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,P,p)}if(ea){Q=0;for(ea=sa.length;Q<ea;Q++){o=P=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,P+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],
+x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,r=sa[Q].vertices[r.d].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,V[P+9]=r.x,V[P+10]=r.y,V[P+11]=r.z,P+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[Q]);j.bufferData(j.ARRAY_BUFFER,T[Q],p)}}if(ra.length){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,
+Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,x=la[r.a],w=la[r.b],v=la[r.c],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,
+N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,H+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],T=ra[r.d],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,Y[H+12]=T.x,Y[H+13]=T.y,Y[H+14]=T.z,Y[H+15]=T.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],T=ua[r.d],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,J[H+
+12]=T.x,J[H+13]=T.y,J[H+14]=T.z,J[H+15]=T.w,x=la[r.a],w=la[r.b],v=la[r.c],T=la[r.d],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,ca[H+12]=T.x,ca[H+13]=T.y,ca[H+14]=T.z,ca[H+15]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],r=oa[r.d],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,N[H+12]=r.x,N[H+13]=r.y,N[H+14]=r.z,N[H+15]=1,H+=16;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,J,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Y,p))}if(na&&G){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],H=r.vertexColors,J=r.color,H.length===3&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2]):N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=
+r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,E+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],H=r.vertexColors,J=r.color,H.length===4&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2],H=H[3]):H=N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,$[E+9]=H.r,$[E+10]=H.g,$[E+11]=H.b,E+=12;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,p))}if(ta&&I.hasTangents){o=0;for(A=s.length;o<A;o++)r=
+ja[s[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,S+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],I=I[3],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,L[S+12]=I.x,L[S+13]=I.y,L[S+14]=I.z,L[S+15]=I.w,S+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);
+j.bufferData(j.ARRAY_BUFFER,L,p)}if(pa&&z){o=0;for(A=s.length;o<A;o++)if(r=ja[s[o]],L=r.vertexNormals,z=r.normal,L.length===3&&ha)for(S=0;S<3;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<3;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;o=0;for(A=u.length;o<A;o++)if(r=ja[u[o]],L=r.vertexNormals,z=r.normal,L.length===4&&ha)for(S=0;S<4;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<4;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,
+W,p)}if(va&&ka&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],F=ka[F],F!==void 0)for(S=0;S<3;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],F=ka[F],F!==void 0)for(S=0;S<4;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;C>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,X,p))}if(va&&ma&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],C=ma[F],C!==void 0)for(S=0;S<3;S++)X=C[S],D[K]=X.u,D[K+1]=X.v,K+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],C=ma[F],C!==void 0)for(S=0;S<4;S++)X=
+C[S],D[K]=X.u,D[K+1]=X.v,K+=2;K>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,D,p))}if(ia){o=0;for(A=s.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+2,ba+=3,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+2,ga[U+4]=aa+1,ga[U+5]=aa+2,U+=6,aa+=3;o=0;for(A=u.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+3,y[ba+3]=aa+1,y[ba+4]=aa+2,y[ba+5]=aa+3,ba+=6,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+3,ga[U+4]=aa+1,ga[U+5]=aa+2,ga[U+6]=aa+2,ga[U+7]=aa+3,U+=8,aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
+l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,y,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,p)}if(Z){S=0;for(aa=Z.length;S<aa;S++)if(y=Z[S],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],D+=3;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],
+y.array[D+2]=y.value[r.c],y.array[D+3]=y.value[r.d],D+=4}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)ga=y.value[s[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,D+=3;o=0;for(A=u.length;o<A;o++)ga=y.value[u[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,y.array[D+3]=ga,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+
+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=v=w=x=
+ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}}else if(y.size===3)if(K=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+
+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x[K[0]],y.array[D+
+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}}else if(y.size===4)if(y.boundTo===
+void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=
+w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}else if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=
+u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,y.array,p)}}R&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,
+delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(B instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;B=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;A=h.vertices;k=h.colors;Z=A.length;
+l=k.length;s=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<Z;R++)o=A[R].position,i=R*3,s[i]=o.x,s[i+1]=o.y,s[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,B)}if(u){for(R=0;R<l;R++)o=k[R],i=R*3,p[i]=o.r,p[i+1]=o.g,p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,B)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(B instanceof THREE.Line){h=b(B,l);p=h.attributes&&m(h);if(f.__dirtyVertices||
+f.__dirtyColors||p){B=f;i=j.DYNAMIC_DRAW;Z=k=aa=A=ja=void 0;A=B.vertices;l=B.colors;Z=A.length;p=l.length;s=B.__vertexArray;R=B.__colorArray;u=B.__dirtyColors;o=B.__webglCustomAttributesList;C=U=ba=K=aa=ja=void 0;if(B.__dirtyVertices){for(ja=0;ja<Z;ja++)aa=A[ja].position,k=ja*3,s[k]=aa.x,s[k+1]=aa.y,s[k+2]=aa.z;j.bindBuffer(j.ARRAY_BUFFER,B.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(A=0;A<p;A++)Z=l[A],k=A*3,R[k]=Z.r,R[k+1]=Z.g,R[k+2]=Z.b;j.bindBuffer(j.ARRAY_BUFFER,B.__webglColorBuffer);
+j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ja=0;for(aa=o.length;ja<aa;ja++)if(C=o[ja],C.needsUpdate&&(C.boundTo===void 0||C.boundTo==="vertices")){k=0;ba=C.value.length;if(C.size===1)for(K=0;K<ba;K++)C.array[K]=C.value[K];else if(C.size===2)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,k+=2;else if(C.size===3)if(C.type==="c")for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.r,C.array[k+1]=U.g,C.array[k+2]=U.b,k+=3;else for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=
+U.z,k+=3;else if(C.size===4)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=U.z,C.array[k+3]=U.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,C.buffer);j.bufferData(j.ARRAY_BUFFER,C.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&t(h)}else if(B instanceof THREE.ParticleSystem)h=b(B,l),p=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||B.sortParticles||p)&&d(f,j.DYNAMIC_DRAW,B),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,
+b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,
+l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=O?k=m:(k=Math.ceil(O*m/(i+m)),i=O-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=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:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),
+d.push(c[p]);h=d.join();p=0;for(d=P.length;p<d;p++)if(P[p].code===h){o=P[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.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.perPixel?"#define PHONG_PER_PIXEL":"",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");
+f=["#ifdef GL_ES","precision "+X+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.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");j.attachShader(p,v("fragment",f+k));j.attachShader(p,
+v("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)k=q[d],p.uniforms[k]=j.getUniformLocation(p,
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=P.length;P.push({program:p,code:h});M.info.memory.programs=P.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
 o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)q="morphTarget"+g,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 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:
@@ -485,22 +486,23 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=q:p.addSelf(a.
 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&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=b.getMouseOnScreen(a.clientX,a.clientY),p=q=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
 a.clientY):e===d.PAN&&!b.noPan&&(q=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=q=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o,p=d||1,q=g||1,s=h/2,r=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var u=p+1,I=q+1;h/=p;var P=i/q;for(o=0;o<I;o++)for(i=0;i<u;i++){var M=new THREE.Vector3;M[a]=(i*h-s)*c;M[b]=(o*P-r)*f;M[n]=k;l.vertices.push(new THREE.Vertex(M))}for(o=0;o<q;o++)for(i=0;i<p;i++)l.faces.push(new THREE.Face4(i+
-u*o+t,i+u*(o+1)+t,i+1+u*(o+1)+t,i+1+u*o+t,null,null,m)),l.faceVertexUvs[0].push([new THREE.UV(i/p,o/q),new THREE.UV(i/p,(o+1)/q),new THREE.UV((i+1)/p,(o+1)/q),new THREE.UV((i+1)/p,o/q)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=
-void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=g||1,q=h/2,s=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var r=o+1,u=p+1,I=h/o,O=i/p,M=new THREE.Vector3;M[n]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<r;i++){var j=new THREE.Vector3;j[a]=(i*I-q)*c;j[b]=(h*O-s)*f;j[n]=k;l.vertices.push(new THREE.Vertex(j))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+r*h+t,i+r*(h+1)+t,i+1+r*(h+1)+t,i+1+r*h+t),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=
+3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],k=[];for(i=0;i<=g;i++){var p=[],q=[],m=i/g,t=m*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(n*Math.PI*2),-m*b+f,t*Math.cos(n*Math.PI*2))));p.push(this.vertices.length-1);q.push(new THREE.UV(n,m))}l.push(p);k.push(q)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],p=l[i+1][h],q=l[i+1][h+1],m=l[i][h+1],t=
-this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),r=k[i+1][h].clone(),y=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,q,m,[t,n,o,s]));this.faceVertexUvs[0].push([u,r,y,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],p=l[0][h+
-1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),u=k[0][h].clone(),r=k[0][h+1].clone(),y=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,y])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],p=l[i][h],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),r=k[i][h].clone(),
-y=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),r=k[i+1][h].clone(),z=k[i+1][h+1].clone(),E=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,q,m,[t,n,o,s]));this.faceVertexUvs[0].push([u,r,z,E])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],p=l[0][h+
+1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),u=k[0][h].clone(),r=k[0][h+1].clone(),z=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,z])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],p=l[i][h],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),r=k[i][h].clone(),
+z=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,z])}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,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;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 d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(A=a.length;--A>=0;){j=A;V=A-1;V<0&&(V=a.length-1);for(var b=
-0,c=m+k*2,b=0;b<c;b++){var d=X*b,e=X*(b+1),f=Z+j+d,g=Z+j+e,l=f,d=Z+V+d,e=Z+V+e,n=g;l+=D;d+=D;e+=D;n+=D;w.faces.push(new THREE.Face4(l,d,e,n,null,null,y));y&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(w.vertices[f].position.z+i)/e,g=(w.vertices[g].position.z+i)/e,w.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;w.faces.push(new THREE.Face3(a,b,c,null,
-null,r));if(r){var d=v.maxY,e=v.maxX,f=w.vertices[b].position.x,b=w.vertices[b].position.y,g=w.vertices[c].position.x,c=w.vertices[c].position.y;w.faceVertexUvs[0].push([new THREE.UV(w.vertices[a].position.x/e,w.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,q=c.curveSegments!==
-void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,y=c.extrudeMaterial,v=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,B,H,w=this,D=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();B=0;for(H=q.length;B<H;B++)G=q[B],THREE.Shape.Utils.isClockWise(G)&&
-(q[B]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;B=0;for(H=q.length;B<H;B++)G=q[B],t=t.concat(G);var A,K,L,S,W,U,X=t.length,$=n.length,E=[];A=0;K=u.length;j=K-1;for(V=A+1;A<K;A++,j++,V++)j===K&&(j=0),V===K&&(V=0),E[A]=d(u[A],u[j],u[V]);var I=[],P,M=E.concat();B=0;for(H=q.length;B<H;B++){G=q[B];P=[];A=0;K=G.length;j=K-1;for(V=A+1;A<K;A++,j++,V++)j===K&&(j=0),V===K&&(V=0),P[A]=d(G[A],G[j],G[V]);I.push(P);M=M.concat(P)}for(L=0;L<k;L++){S=L/k;W=i*(1-S);S=l*Math.sin(S*Math.PI/2);A=
-0;for(K=u.length;A<K;A++)U=b(u[A],E[A],S),e(U.x,U.y,-W);B=0;for(H=q.length;B<H;B++){G=q[B];P=I[B];A=0;for(K=G.length;A<K;A++)U=b(G[A],P[A],S),e(U.x,U.y,-W)}}S=l;for(A=0;A<X;A++)U=p?b(t[A],M[A],S):t[A],s?e(U.x,U.y+o[0].y,o[0].x):e(U.x,U.y,0);for(L=1;L<=m;L++)for(A=0;A<X;A++)U=p?b(t[A],M[A],S):t[A],s?e(U.x,U.y+o[L-1].y,o[L-1].x):e(U.x,U.y,h/m*L);for(L=k-1;L>=0;L--){S=L/k;W=i*(1-S);S=l*Math.sin(S*Math.PI/2);A=0;for(K=u.length;A<K;A++)U=b(u[A],E[A],S),e(U.x,U.y,h+W);B=0;for(H=q.length;B<H;B++){G=q[B];
-P=I[B];A=0;for(K=G.length;A<K;A++)U=b(G[A],P[A],S),s?e(U.x,U.y+o[m-1].y,o[m-1].x+W):e(U.x,U.y,h+W)}}if(p){p=X*0;for(A=0;A<$;A++)l=n[A],f(l[2]+p,l[1]+p,l[0]+p);p=X*(m+k*2);for(A=0;A<$;A++)l=n[A],f(l[0]+p,l[1]+p,l[2]+p)}else{for(A=0;A<$;A++)l=n[A],f(l[2],l[1],l[0]);for(A=0;A<$;A++)l=n[A],f(l[0]+X*m,l[1]+X*m,l[2]+X*m)}var j,V,Z=0;g(u);Z+=u.length;B=0;for(H=q.length;B<H;B++)G=q[B],g(G),Z+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){j=B;P=B-1;P<0&&(P=a.length-1);for(var b=
+0,c=m+k*2,b=0;b<c;b++){var d=ea*b,e=ea*(b+1),f=ha+j+d,g=ha+j+e,l=f,d=ha+P+d,e=ha+P+e,n=g;l+=F;d+=F;e+=F;n+=F;C.faces.push(new THREE.Face4(l,d,e,n,null,null,z));z&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,
+null,null,r));if(r){var d=E.maxY,e=E.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
+q=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,z=c.extrudeMaterial,E=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,v,w,C=this,F=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();v=0;for(w=q.length;v<w;v++)G=q[v],THREE.Shape.Utils.isClockWise(G)&&
+(q[v]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;v=0;for(w=q.length;v<w;v++)G=q[v],t=t.concat(G);var B,L,J,W,X,T,ea=t.length,ba=n.length,x=[];B=0;L=u.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),x[B]=d(u[B],u[j],u[P]);var I=[],O,M=x.concat();v=0;for(w=q.length;v<w;v++){G=q[v];O=[];B=0;L=G.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),O[B]=d(G[B],G[j],G[P]);I.push(O);M=M.concat(O)}for(J=0;J<k;J++){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);
+B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,-X);v=0;for(w=q.length;v<w;v++){G=q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),e(T.x,T.y,-X)}}W=l;for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[0].y,o[0].x):e(T.x,T.y,0);for(J=1;J<=m;J++)for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[J-1].y,o[J-1].x):e(T.x,T.y,h/m*J);for(J=k-1;J>=0;J--){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,h+X);v=0;for(w=q.length;v<w;v++){G=
+q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),s?e(T.x,T.y+o[m-1].y,o[m-1].x+X):e(T.x,T.y,h+X)}}if(p){p=ea*0;for(B=0;B<ba;B++)l=n[B],f(l[2]+p,l[1]+p,l[0]+p);p=ea*(m+k*2);for(B=0;B<ba;B++)l=n[B],f(l[0]+p,l[1]+p,l[2]+p)}else{for(B=0;B<ba;B++)l=n[B],f(l[2],l[1],l[0]);for(B=0;B<ba;B++)l=n[B],f(l[0]+ea*m,l[1]+ea*m,l[2]+ea*m)}var j,P,ha=0;g(u);ha+=u.length;v=0;for(w=q.length;v<w;v++)G=q[v],g(G),ha+=G.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 d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,
@@ -511,8 +513,8 @@ THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize()
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(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 h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var l=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*l-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
-THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,e=c/2,b=b||1,d=d||1,f=b+1,h=d+1,i=a/b,l=c/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<f;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*l-e),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+f*a,c+f*(a+1),c+1+f*(a+1),c+1+f*a),g.normal.copy(k),g.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
+b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};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,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),l=[],k=0;for(d=0;d<e;d++){var p=2*d/e,q=i*Math.sin(p*g),p=i*Math.cos(p*g);(b==0||b==f)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,h,q)))-1);l.push(k)}c.push(l)}for(var m,t,n,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
 e-1:d];l=c[b-1][l?0:d+1];q=b/(g-1);m=(b-1)/(g-1);t=(d+1)/e;var p=d/e,k=new THREE.UV(1-t,q),q=new THREE.UV(1-p,q),p=new THREE.UV(1-p,m),o=new THREE.UV(1-t,m);b<c.length-1&&(m=this.vertices[f].position.clone(),t=this.vertices[h].position.clone(),n=this.vertices[i].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,q,p]));b>1&&(m=
 this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),n=this.vertices[l].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,p,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
@@ -523,9 +525,9 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,l,k,p,q,m,t,n,o,s=c.glyphs[a]||c.glyphs["?"];if(s){if(s.o){c=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=c.length;for(a=0;a<l;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,
 k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;m=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(m,t,i,k);if(f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,r=THREE.Shape.Utils.b2(u,p,m,i),u=THREE.Shape.Utils.b2(u,q,t,k);e.push(new THREE.Vector2(r,u))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,m=c[a++]*b+d,t=c[a++]*-b,n=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,k,m,t,n,o),f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,r=THREE.Shape.Utils.b3(u,p,m,
 n,i),u=THREE.Shape.Utils.b3(u,q,t,o,k),e.push(new THREE.Vector2(r,u))}}}return{offset:s.ha*b,points:e,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,y=void 0,
-v=void 0,G=void 0,B=void 0,H=void 0,w=void 0,D=void 0,r=q[s[m]].x,y=q[s[m]].y,v=q[s[t]].x,G=q[s[t]].y,B=q[s[n]].x,H=q[s[n]].y;if(1.0E-10>(v-r)*(H-y)-(G-y)*(B-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var w=q[s[u]].x,D=q[s[u]].y,A=void 0,K=void 0,L=void 0,S=void 0,W=void 0,U=void 0,X=void 0,$=void 0,E=void 0,I=void 0,P=void 0,M=void 0,A=L=W=void 0,A=B-v,K=H-G,L=r-B,S=y-H,W=v-r,U=G-y,X=w-r,$=D-y,E=w-v,I=D-G,P=w-B,M=D-H,A=A*I-K*E,W=W*$-U*X,L=L*M-S*P;if(A>=0&&L>=0&&W>=0){q=!1;break a}}q=!0}}if(q){e.push([a[f[i]],
-a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,z=void 0,
+E=void 0,G=void 0,v=void 0,w=void 0,C=void 0,F=void 0,r=q[s[m]].x,z=q[s[m]].y,E=q[s[t]].x,G=q[s[t]].y,v=q[s[n]].x,w=q[s[n]].y;if(1.0E-10>(E-r)*(w-z)-(G-z)*(v-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var C=q[s[u]].x,F=q[s[u]].y,B=void 0,L=void 0,J=void 0,W=void 0,X=void 0,T=void 0,ea=void 0,ba=void 0,x=void 0,I=void 0,O=void 0,M=void 0,B=J=X=void 0,B=v-E,L=w-G,J=r-v,W=z-w,X=E-r,T=G-z,ea=C-r,ba=F-z,x=C-E,I=F-G,O=C-v,M=F-w,B=B*I-L*x,X=X*ba-T*ea,J=J*M-W*O;if(B>=0&&J>=0&&X>=0){q=!1;break a}}q=
+!0}}if(q){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};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,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -533,13 +535,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.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 d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,k])}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,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){l.vertexColors=[];for(var j,k,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)k=h.vertexColors[m[o]-1],j.r+=k.r,j.g+=k.g,j.b+=k.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;l.vertexColors[n]=j}}g.push(l);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)l=h.vertexColors[m[o]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
 b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},q=[],m,t,n,o,s,u=a.faceVertexUvs[0];m=0;for(t=u.length;m<t;m++){n=0;for(o=u[m].length;n<o;n++)s=d[m]["abcd".charAt(n)],q[s]||(q[s]=u[m][n])}var r;m=0;for(t=d.length;m<t;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&q.length!=0){r=new THREE.UV;if(s instanceof THREE.Face3)r.u=q[s.a].u+q[s.b].u+q[s.c].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v,r.u/=3,r.v/=3;else if(s instanceof THREE.Face4)r.u=
-q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var y=0,u=h.length,v,G,B={},H={},w=function(a,
-b){B[a]===void 0&&(B[a]=[]);B[a].push(b)},D=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in t){r=t[m];v=m.split("_");G=v[0];v=v[1];w(G,[G,v]);w(v,[G,v]);n=0;for(o=r.length;n<o;n++)s=r[n],D(G,s,m),D(v,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],v=m.split("_"),G=v[0],v=v[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
-k[m]=u+d.length+y,i.push(new THREE.Vertex(o)),y++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[v].u,r.v=q[G].v+q[v].v,r.u/=2,r.v/=2,q.push(r);var A,K;v=["123","12","2","23"];o=["123","23","3","31"];var w=["123","31","1","12"],D=["1234","12","2","23"],L=["1234","23","3","34"],S=["1234","34","4","41"],W=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(y=b(s.a,s.b),G=b(s.b,s.c),A=b(s.c,s.a),c(r,k[y],s.b,k[G],s,v),c(r,k[G],s.c,k[A],s,o),c(r,k[A],s.a,k[y],
-s,w)):s instanceof THREE.Face4?(y=b(s.a,s.b),G=b(s.b,s.c),A=b(s.c,s.d),K=b(s.d,s.a),c(r,k[y],s.b,k[G],s,D),c(r,k[G],s.c,k[A],s,L),c(r,k[A],s.d,k[K],s,S),c(r,k[K],s.a,k[y],s,W)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(B[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in H[m])i.addSelf(l[n]),r++;y=0;u=B[m].length;for(n=0;n<u;n++)p[b(B[m][n][0],B[m][n][1])]&&y++;if(y!=2){i.divideScalar(r);for(n=0;n<
-u;n++)r=B[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var z=0,u=h.length,E,G,v={},w={},C=function(a,
+b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},F=function(a,b){w[a]===void 0&&(w[a]={});w[a][b]=null};for(m in t){r=t[m];E=m.split("_");G=E[0];E=E[1];C(G,[G,E]);C(E,[G,E]);n=0;for(o=r.length;n<o;n++)s=r[n],F(G,s,m),F(E,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],E=m.split("_"),G=E[0],E=E[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.25)),
+k[m]=u+d.length+z,i.push(new THREE.Vertex(o)),z++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[E].u,r.v=q[G].v+q[E].v,r.u/=2,r.v/=2,q.push(r);var B,L;E=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],W=["1234","34","4","41"],X=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.a),c(r,k[z],s.b,k[G],s,E),c(r,k[G],s.c,k[B],s,o),c(r,k[B],s.a,k[z],
+s,C)):s instanceof THREE.Face4?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.d),L=b(s.d,s.a),c(r,k[z],s.b,k[G],s,F),c(r,k[G],s.c,k[B],s,J),c(r,k[B],s.d,k[L],s,W),c(r,k[L],s.a,k[z],s,X)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(v[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in w[m])i.addSelf(l[n]),r++;z=0;u=v[m].length;for(n=0;n<u;n++)p[b(v[m][n][0],v[m][n][1])]&&z++;if(z!=2){i.divideScalar(r);for(n=0;n<
+u;n++)r=v[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;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 d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;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)==
@@ -554,111 +556,111 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHtt
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",f,!0);
 e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,l,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];l=r[f*2+1];f=r[g*2];k=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(f,k));g.push(o)}}
-function k(b,c){var d,e,f,g,h,i,l,k,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];l=r[f*2];m=r[f*2+1];k=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(l,m));j.push(new THREE.UV(k,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=l[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,l,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];l=d[e*3];k=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[k*3],j=u[k*3+1];k=u[k*3+2];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(u[l*3],u[l*3+1],u[l*3+2]),new THREE.Vector3(p,j,k),new THREE.Vector3(q,s,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,l,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];l=j[e];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];var r=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[k*
-3],u[k*3+1],u[k*3+2]),new THREE.Vector3(q,s,m),new THREE.Vector3(r,t,o),new THREE.Vector3(v,w,p)],null,l))}}var n=this,o=0,s,u=[],r=[],y,v,G,B,H,w;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
-o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;w=s.vertex_index_bytes*
-4+s.material_index_bytes;y=s.ntri_flat*b;v=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);B=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);H=s.nquad_flat*w;b=s.nquad_smooth*(w+s.normal_index_bytes*4);w=s.nquad_flat_uv*(w+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
-o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);y=o+y+c(s.ntri_flat*2);v=y+v+c(s.ntri_smooth*2);G=v+G+c(s.ntri_flat_uv*2);B=G+B+c(s.ntri_smooth_uv*2);H=B+H+c(s.nquad_flat*2);
-b=H+b+c(s.nquad_smooth*2);w=b+w+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(v);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(w);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(B);(function(a){var b=
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);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,d,g){O=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");la=c("//dae:library_materials/dae:material",H,"material");ka=c("//dae:library_effects/dae:effect",L,"effect");ma=c("//dae:library_geometries/dae:geometry",o,"geometry");ja=c("//dae:library_controllers/dae:controller",h,"controller");na=c("//dae:library_animations/dae:animation",W,"animation");ya=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");sa=[];pa=[];(a=O.evaluate(".//dae:scene/dae:instance_visual_scene",O,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ya[a]):Y=null;aa=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)aa.add(e(Y.nodes[a]));b();for(var i in na);i={scene:aa,morphs:sa,skins:pa,dae:{images:ga,materials:la,effects:ka,geometries:ma,controllers:ja,animations:na,visualScenes:ya,scene:Y}};d&&d(i);return i}function c(a,b,c){for(var a=O.evaluate(a,O,E,
-XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in na)for(var e=na[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];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 d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
-a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=ja[c.url];if(!f||!f.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),h,i,j,l,k=new THREE.Vector3,
-m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(l=0;l<h.length;l++)if(j=h[l],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
-0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],l=j.index,j=j.weight,m=a.vertices[l],l=o[l],k.x=m.position.x,k.y=m.position.y,k.z=m.position.z,n[h].skinningMatrix.multiplyVector3(k),l.position.x+=k.x*j,l.position.y+=k.y*j,l.position.z+=k.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ja[a.controllers[f].url];switch(i.type){case "skin":if(ma[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ja[i.skin.source]&&(d=i=ja[i.skin.source],i.morph&&ma[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ma[i.morph.source])j=new n,
-j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ma[i.url],l={},k=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ka[la[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=l[o.symbol]=
-p.material;k++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(k>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)k=i.faces[h],k.materials=[l[k.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ja[c.url],j.skinInstanceController=c,j.name="skin_"+pa.length,pa.push(j);else if(d!==void 0){h=i;l=d instanceof m?ja[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");
-else{l=l.morph;for(k=0;k<l.targets.length;k++)if(p=ma[l.targets[k]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+sa.length;sa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function G(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function H(){this.name=this.id="";this.instance_effect=null}function w(){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 D(a,
-b){this.type=a;this.effect=b;this.material=null}function A(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function S(){this.url=""}function W(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function X(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function $(a){var b=a.getAttribute("id");if(Q[b]!=void 0)return Q[b];Q[b]=(new B(b)).parse(a);return Q[b]}function E(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=M(a),b=[],c=0;c<
-a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function V(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 Z(a,b){var c="";c+=V(a.x,b)+",";c+=V(a.y,b)+",";c+=V(a.z,b);return c}var O=null,aa=null,Y,ea=null,Q=
-{},ga={},na={},ja={},ma={},la={},ka={},ya,xa,sa,pa,qa=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};h.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 l).parse(c);this.type=
-c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new B).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
-e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
-I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new B).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
-(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=P(g.textContent);break;case "vcount":d=P(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var l={},k=0;k<e.length;k++){var m=
-e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}i.push(l);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
-for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},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 d=this.nodes[c].getChildById(a,b);if(d)return d}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 d=this.nodes[c].getChildBySid(a,b);if(d)return d}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 m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=O.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",O,E,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 q).parse(b));
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in na)for(var e=na[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+
-1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,l,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){l=j.output[i];break}g=l!==void 0?l instanceof THREE.Matrix4?g.multiply(g,l):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.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};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)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.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};
-m.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=O.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};
-t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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=O.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),
-b=a.iterateNext();break}}return this};o.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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=Z(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":$(d);break;case "vertices":this.vertices=
-(new v).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),
-this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,l,k,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],
-k=Q[i.source],j=g[d+e*h.length+i.offset],l=k.accessor.params.length,l*=j,i.semantic){case "VERTEX":i=Z(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(k.data[l],k.data[l+1],k.data[l+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(k.data[l],k.data[l+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[l],k.data[l+1],k.data[l+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):
-n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.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};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");
-this.count=j(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 G).parse(a.childNodes[b]));break;case "vcount":this.vcount=P(c.textContent);break;case "p":this.p=P(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=
-c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&
-this.set<0)this.set=0;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 "bool_array":for(var d=M(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new y).parse(c.childNodes[d]);break}}}return this};B.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),d=new THREE.Matrix4;d.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(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};H.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 S).parse(a.childNodes[b]);break}return this};w.prototype.isColor=function(){return this.texture==null};w.prototype.isTexture=function(){return this.texture!=
-null};w.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=I(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};D.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 w).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=O.evaluate(".//dae:float",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.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 d=this[c];
-if(d instanceof w)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(xa+d.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=d.color.getHex():b||(a[c]=d.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=qa;return this.material=new THREE.MeshLambertMaterial(a)};A.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};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 "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};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
-null;for(var 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};L.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new A(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
-default:console.log(d.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};L.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 D(c.nodeName,this)).parse(c)}}};S.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};W.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 B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new X(this)).parse(c));break;case "channel":this.channel.push((new U(this)).parse(c))}}return this};
-U.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,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};X.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 G).parse(c))}}return this};X.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 d=new XMLHttpRequest;
-d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){qa=a},applySkin:g,geometries:ma}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];k=r[f*2+1];f=r[g*2];l=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,l));g.push(o)}}
+function k(b,c){var d,e,f,g,h,i,k,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];k=r[f*2];m=r[f*2+1];l=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(k,m));j.push(new THREE.UV(l,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,k,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[l*3],j=u[l*3+1];l=u[l*3+2];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(p,j,l),new THREE.Vector3(q,s,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,k,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];k=j[e];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];var r=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[l*
+3],u[l*3+1],u[l*3+2]),new THREE.Vector3(q,s,m),new THREE.Vector3(r,t,o),new THREE.Vector3(v,w,p)],null,k))}}var n=this,o=0,s,u=[],r=[],z,E,G,v,w,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
+o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;C=s.vertex_index_bytes*
+4+s.material_index_bytes;z=s.ntri_flat*b;E=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);v=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);w=s.nquad_flat*C;b=s.nquad_smooth*(C+s.normal_index_bytes*4);C=s.nquad_flat_uv*(C+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
+o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);z=o+z+c(s.ntri_flat*2);E=z+E+c(s.ntri_smooth*2);G=E+G+c(s.ntri_flat_uv*2);v=G+v+c(s.ntri_smooth_uv*2);w=v+w+c(s.nquad_flat*2);
+b=w+b+c(s.nquad_smooth*2);C=b+C+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(E);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
+c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(C);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(z);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(function(a){var b=
+s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(w);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,d,g){V=a;d=d||fa;g!==void 0&&(a=g.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");ia=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",w,"material");la=c("//dae:library_effects/dae:effect",J,"effect");ka=c("//dae:library_geometries/dae:geometry",o,"geometry");na=c("//dae:library_controllers/dae:controller",h,"controller");pa=c("//dae:library_animations/dae:animation",X,"animation");ma=c(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");ra=[];sa=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),K=ma[a]):K=null;Q=new THREE.Object3D;for(a=0;a<K.nodes.length;a++)Q.add(e(K.nodes[a]));b();for(var i in pa);i={scene:Q,morphs:ra,skins:sa,dae:{images:ia,materials:oa,effects:la,geometries:ka,controllers:na,animations:pa,visualScenes:ma,scene:K}};d&&d(i);return i}function c(a,b,c){for(var a=V.evaluate(a,V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];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 d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
+f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=na[c.url];if(!f||!f.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=K.getChildById(c.skeleton[0],!0)||K.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=na[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
+new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+sa.length,sa.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=ka[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ra.length;ra.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function E(){this.input={}}function G(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function L(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 W(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function ea(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ba(a){var b=a.getAttribute("id");
+if(U[b]!=void 0)return U[b];U[b]=(new v(b)).parse(a);return U[b]}function x(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(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 ha(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var V=null,Q=null,K,fa=null,U={},ia={},pa={},na={},ka={},oa={},la={},ma,ya,ra,sa,xa=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};h.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 l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new v).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};
+l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new v).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":d=O(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},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 d=this.nodes[c].getChildById(a,
+b);if(d)return d}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 d=this.nodes[c].getChildBySid(a,b);if(d)return d}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 m).parse(b));break;case "instance_geometry":this.geometries.push((new n).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,x,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 q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.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};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)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.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};m.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,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};o.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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=ha(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ba(d);break;case "vertices":this.vertices=(new E).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e=
+{};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ha(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.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};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(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 G).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.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 d=M(c.textContent),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};
+v.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),d=new THREE.Matrix4;d.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(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};w.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 W).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.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=I(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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=V.evaluate(".//dae:float",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.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 d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ia[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(ya+d.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=d.color.getHex():b||(a[c]=d.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=xa;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};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 "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 d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new B(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.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 F(c.nodeName,this)).parse(c)}}};W.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.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 v).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ea(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.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,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};ea.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 G).parse(c))}}return this};
+ea.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 d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
+200))fa=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){xa=a},applySkin:g,geometries:ka}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
 e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,p,q,m,t,n,o,s,u,r,y=a.faces;p=a.vertices;var v=a.normals,G=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
-k;)q=new THREE.Vertex,q.position.x=p[l++]*b,q.position.y=p[l++]*b,q.position.z=p[l++]*b,d.vertices.push(q);l=0;for(k=y.length;l<k;){b=y[l++];p=b&1;i=b&2;c=b&4;g=b&8;m=b&16;q=b&32;n=b&64;b&=128;p?(o=new THREE.Face4,o.a=y[l++],o.b=y[l++],o.c=y[l++],o.d=y[l++],p=4):(o=new THREE.Face3,o.a=y[l++],o.b=y[l++],o.c=y[l++],p=3);if(i)i=y[l++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)s=a.uvs[c],t=y[l++],r=s[t*2],t=s[t*2+1],d.faceUvs[c][i]=new THREE.UV(r,t);if(g)for(c=0;c<B;c++){s=a.uvs[c];u=[];
-for(g=0;g<p;g++)t=y[l++],r=s[t*2],t=s[t*2+1],u[g]=new THREE.UV(r,t);d.faceVertexUvs[c][i]=u}if(m)m=y[l++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],o.normal=g;if(q)for(c=0;c<p;c++)m=y[l++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],o.vertexNormals.push(g);if(n)q=y[l++],q=new THREE.Color(G[q]),o.color=q;if(b)for(c=0;c<p;c++)q=y[l++],q=new THREE.Color(G[q]),o.vertexColors.push(q);d.faces.push(o)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,p,q,m,t,n,o,s,u,r,z=a.faces;p=a.vertices;var E=a.normals,G=a.colors,v=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&v++;for(c=0;c<v;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
+k;)q=new THREE.Vertex,q.position.x=p[l++]*b,q.position.y=p[l++]*b,q.position.z=p[l++]*b,d.vertices.push(q);l=0;for(k=z.length;l<k;){b=z[l++];p=b&1;i=b&2;c=b&4;g=b&8;m=b&16;q=b&32;n=b&64;b&=128;p?(o=new THREE.Face4,o.a=z[l++],o.b=z[l++],o.c=z[l++],o.d=z[l++],p=4):(o=new THREE.Face3,o.a=z[l++],o.b=z[l++],o.c=z[l++],p=3);if(i)i=z[l++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<v;c++)s=a.uvs[c],t=z[l++],r=s[t*2],t=s[t*2+1],d.faceUvs[c][i]=new THREE.UV(r,t);if(g)for(c=0;c<v;c++){s=a.uvs[c];u=[];
+for(g=0;g<p;g++)t=z[l++],r=s[t*2],t=s[t*2+1],u[g]=new THREE.UV(r,t);d.faceVertexUvs[c][i]=u}if(m)m=z[l++]*3,g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],o.normal=g;if(q)for(c=0;c<p;c++)m=z[l++]*3,g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],o.vertexNormals.push(g);if(n)q=z[l++],q=new THREE.Color(G[q]),o.color=q;if(b)for(c=0;c<p;c++)q=z[l++],q=new THREE.Color(G[q]),o.vertexColors.push(q);d.faces.push(o)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
 2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,k,p,q,m,t;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
 t=a.morphTargets[c].vertices;i=0;for(l=t.length;i<l;i+=3)k=t[i]*b,p=t[i+1]*b,q=t[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,p,q)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),l.push(p)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(e){console.error(e),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in L.objects)if(!E.objects[q])if(s=L.objects[q],s.geometry!==void 0){if(w=E.geometries[s.geometry]){a=!1;for(P=0;P<s.materials.length;P++)K=E.materials[s.materials[P]],a=K instanceof THREE.ShaderMaterial;a&&w.computeTangents();y=s.position;v=s.rotation;G=s.quaternion;B=s.scale;G=0;K.length==0&&(K=new THREE.MeshFaceMaterial);K.length>1&&(K=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(w,K);a.name=q;a.position.set(y[0],y[1],y[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(B[0],B[1],B[2]);a.visible=s.visible;E.scene.add(a);E.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);E.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(w),E.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
-{type:s.trigger,object:s},E.triggers[a.name]=b)}}else y=s.position,v=s.rotation,G=s.quaternion,B=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(y[0],y[1],y[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(B[0],B[1],B[2]),a.visible=s.visible!==void 0?s.visible:!1,E.scene.add(a),E.objects[q]=a,E.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},E.triggers[a.name]=b)}function e(a){return function(b){E.geometries[a]=
-b;g();W-=1;i.onLoadComplete();h()}}function f(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:X,totalTextures:$,loadedModels:X-W,loadedTextures:$-U},E);i.onLoadProgress();W==0&&U==0&&c(E)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,y,v,G,B,H,w,D,A,K,L,S,W,U,X,$,E;L=a;b=new THREE.BinaryLoader;S=new THREE.JSONLoader;U=W=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(q in L.objects)if(s=L.objects[q],s.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;u=L.transform.rotation;var I=L.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);u&&E.scene.rotation.set(u[0],u[1],u[2]);I&&E.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&E.scene.updateMatrix()}a=function(){U-=1;h();i.onLoadComplete()};for(t in L.cameras)u=L.cameras[t],u.type=="perspective"?D=new THREE.PerspectiveCamera(u.fov,
-u.aspect,u.near,u.far):u.type=="ortho"&&(D=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),y=u.position,u=u.target,D.position.set(y[0],y[1],y[2]),D.target=new THREE.Vector3(u[0],u[1],u[2]),E.cameras[t]=D;for(m in L.lights)u=L.lights[m],t=u.color!==void 0?u.color:16777215,D=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(y=u.direction,r=new THREE.DirectionalLight(t,D),r.position.set(y[0],y[1],y[2]),r.position.normalize()):u.type=="point"?(y=u.position,r=u.distance,
-r=new THREE.PointLight(t,D,r),r.position.set(y[0],y[1],y[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),E.scene.add(r),E.lights[m]=r;for(n in L.fogs)m=L.fogs[n],m.type=="linear"?A=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(A=new THREE.FogExp2(0,m.density)),u=m.color,A.color.setRGB(u[0],u[1],u[2]),E.fogs[n]=A;if(E.cameras&&L.defaults.camera)E.currentCamera=E.cameras[L.defaults.camera];if(E.fogs&&L.defaults.fog)E.scene.fog=E.fogs[L.defaults.fog];u=L.defaults.bgcolor;E.bgColor=new THREE.Color;
-E.bgColor.setRGB(u[0],u[1],u[2]);E.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(n=L.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")W+=1,i.onLoadStart();X=W;for(k in L.geometries)n=L.geometries[k],n.type=="cube"?(w=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),E.geometries[k]=w):n.type=="plane"?(w=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=w):n.type=="sphere"?
-(w=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=w):n.type=="cylinder"?(w=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),E.geometries[k]=w):n.type=="torus"?(w=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),E.geometries[k]=w):n.type=="icosahedron"?(w=new THREE.IcosahedronGeometry(n.subdivisions),E.geometries[k]=w):n.type=="bin_mesh"?b.load(d(n.url,L.urlBaseType),e(k)):n.type=="ascii_mesh"?S.load(d(n.url,L.urlBaseType),
-e(k)):n.type=="embedded_mesh"&&(n=L.embeds[n.id])&&S.createModel(n,f(k),"");for(o in L.textures)if(k=L.textures[o],k.url instanceof Array){U+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else U+=1,i.onLoadStart();$=U;for(o in L.textures){k=L.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var P=0;P<k.url.length;P++)n[P]=d(k.url[P],L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
-L.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){A={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(A[k.wrap[0]]!==void 0)n.wrapS=A[k.wrap[0]];if(A[k.wrap[1]]!==void 0)n.wrapT=
-A[k.wrap[1]]}}E.textures[o]=n}for(p in L.materials){o=L.materials[p];for(H in o.parameters)if(H=="envMap"||H=="map"||H=="lightMap")o.parameters[H]=E.textures[o.parameters[H]];else if(H=="shading")o.parameters[H]=o.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")o.parameters[H]=THREE[o.parameters[H]]?THREE[o.parameters[H]]:THREE.NormalBlending;else if(H=="combine")o.parameters[H]=o.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==
-"vertexColors")if(o.parameters[H]=="face")o.parameters[H]=THREE.FaceColors;else if(o.parameters[H])o.parameters[H]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;A=o.parameters.specular;b=o.parameters.ambient;S=o.parameters.shininess;a.tNormal.texture=E.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
-o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=E.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(A);a.uAmbientColor.value.setHex(b);a.uShininess.value=S;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);E.materials[p]=o}g();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in J.objects)if(!x.objects[q])if(s=J.objects[q],s.geometry!==void 0){if(C=x.geometries[s.geometry]){a=!1;for(O=0;O<s.materials.length;O++)L=x.materials[s.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&C.computeTangents();z=s.position;E=s.rotation;G=s.quaternion;v=s.scale;G=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(C,L);a.name=q;a.position.set(z[0],z[1],z[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]);a.scale.set(v[0],v[1],v[2]);a.visible=s.visible;x.scene.add(a);x.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);x.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(C),x.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
+{type:s.trigger,object:s},x.triggers[a.name]=b)}}else z=s.position,E=s.rotation,G=s.quaternion,v=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(z[0],z[1],z[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]),a.scale.set(v[0],v[1],v[2]),a.visible=s.visible!==void 0?s.visible:!1,x.scene.add(a),x.objects[q]=a,x.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},x.triggers[a.name]=b)}function e(a){return function(b){x.geometries[a]=
+b;g();X-=1;i.onLoadComplete();h()}}function f(a){return function(b){x.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ea,totalTextures:ba,loadedModels:ea-X,loadedTextures:ba-T},x);i.onLoadProgress();X==0&&T==0&&c(x)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C,F,B,L,J,W,X,T,ea,ba,x;J=a;b=new THREE.BinaryLoader;W=new THREE.JSONLoader;T=X=0;x={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(q in J.objects)if(s=J.objects[q],s.meshCollider){a=!0;break}if(a)x.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;u=J.transform.rotation;var I=J.transform.scale;a&&x.scene.position.set(a[0],a[1],a[2]);u&&x.scene.rotation.set(u[0],u[1],u[2]);I&&x.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&x.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(t in J.cameras)u=J.cameras[t],u.type=="perspective"?F=new THREE.PerspectiveCamera(u.fov,
+u.aspect,u.near,u.far):u.type=="ortho"&&(F=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),z=u.position,u=u.target,F.position.set(z[0],z[1],z[2]),F.target=new THREE.Vector3(u[0],u[1],u[2]),x.cameras[t]=F;for(m in J.lights)u=J.lights[m],t=u.color!==void 0?u.color:16777215,F=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(z=u.direction,r=new THREE.DirectionalLight(t,F),r.position.set(z[0],z[1],z[2]),r.position.normalize()):u.type=="point"?(z=u.position,r=u.distance,
+r=new THREE.PointLight(t,F,r),r.position.set(z[0],z[1],z[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),x.scene.add(r),x.lights[m]=r;for(n in J.fogs)m=J.fogs[n],m.type=="linear"?B=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(B=new THREE.FogExp2(0,m.density)),u=m.color,B.color.setRGB(u[0],u[1],u[2]),x.fogs[n]=B;if(x.cameras&&J.defaults.camera)x.currentCamera=x.cameras[J.defaults.camera];if(x.fogs&&J.defaults.fog)x.scene.fog=x.fogs[J.defaults.fog];u=J.defaults.bgcolor;x.bgColor=new THREE.Color;
+x.bgColor.setRGB(u[0],u[1],u[2]);x.bgColorAlpha=J.defaults.bgalpha;for(k in J.geometries)if(n=J.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")X+=1,i.onLoadStart();ea=X;for(k in J.geometries)n=J.geometries[k],n.type=="cube"?(C=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),x.geometries[k]=C):n.type=="plane"?(C=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="sphere"?
+(C=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="cylinder"?(C=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),x.geometries[k]=C):n.type=="torus"?(C=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),x.geometries[k]=C):n.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(n.subdivisions),x.geometries[k]=C):n.type=="bin_mesh"?b.load(d(n.url,J.urlBaseType),e(k)):n.type=="ascii_mesh"?W.load(d(n.url,J.urlBaseType),
+e(k)):n.type=="embedded_mesh"&&(n=J.embeds[n.id])&&W.createModel(n,f(k),"");for(o in J.textures)if(k=J.textures[o],k.url instanceof Array){T+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();ba=T;for(o in J.textures){k=J.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var O=0;O<k.url.length;O++)n[O]=d(k.url[O],J.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
+J.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){B={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(B[k.wrap[0]]!==void 0)n.wrapS=B[k.wrap[0]];if(B[k.wrap[1]]!==void 0)n.wrapT=
+B[k.wrap[1]]}}x.textures[o]=n}for(p in J.materials){o=J.materials[p];for(w in o.parameters)if(w=="envMap"||w=="map"||w=="lightMap")o.parameters[w]=x.textures[o.parameters[w]];else if(w=="shading")o.parameters[w]=o.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")o.parameters[w]=THREE[o.parameters[w]]?THREE[o.parameters[w]]:THREE.NormalBlending;else if(w=="combine")o.parameters[w]=o.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==
+"vertexColors")if(o.parameters[w]=="face")o.parameters[w]=THREE.FaceColors;else if(o.parameters[w])o.parameters[w]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;B=o.parameters.specular;b=o.parameters.ambient;W=o.parameters.shininess;a.tNormal.texture=x.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
+o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=x.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(B);a.uAmbientColor.value.setHex(b);a.uShininess.value=W;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);x.materials[p]=o}g();i.callbackSync(x);h()};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 d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.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),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var l,k,o,s=a.length;i<s;i+=f)l=a[i],k=a[i+1],o=a[i+2],l=l/16383*b,k=k/16383*b,o=o/16383*b,l+=d,k+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(l,k,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,y,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;y=e;i=f;u=d;var G=e,B=f,H=g.materials[0],w=l[G*3],D=l[G*3+1],G=l[G*3+2],A=l[B*3],K=l[B*3+1],B=l[B*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(w,D,G);B=new THREE.Vector3(A,K,B);g.faces.push(new THREE.Face3(r,y,i,[u,G,B],null,H));g=k[d*2];d=k[d*2+
-1];i=k[e*2];u=k[e*2+1];r=k[f*2];y=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,y));f.push(u)}})(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,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var k,l,o,s=a.length;i<s;i+=f)k=a[i],l=a[i+1],o=a[i+2],k=k/16383*b,l=l/16383*b,o=o/16383*b,k+=d,l+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,z,E=a.length;for(b=0;b<E;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;z=e;i=f;u=d;var G=e,v=f,w=g.materials[0],C=l[G*3],F=l[G*3+1],G=l[G*3+2],B=l[v*3],L=l[v*3+1],v=l[v*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(C,F,G);v=new THREE.Vector3(B,L,v);g.faces.push(new THREE.Face3(r,z,i,[u,G,v],null,w));g=k[d*2];d=k[d*2+
+1];i=k[e*2];u=k[e*2+1];r=k[f*2];z=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,z));f.push(u)}})(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,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=l;g[e]=this.lerp(k[a],k[a+3],f);g[e+1]=this.lerp(k[a+1],k[a+4],f);g[e+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
 2]=l;c=a+this.yd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=l+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[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,e,f,h){var i=e+1,l=e+this.yd,k=e+this.zd,p=i+this.yd,q=i+this.zd,m=e+this.yd+this.zd,t=i+this.yd+this.zd,n=0,o=this.field[e],s=this.field[i],u=this.field[l],r=this.field[p],y=this.field[k],v=this.field[q],G=this.field[m],B=this.field[t];o<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);r<f&&(n|=4);y<f&&(n|=16);v<f&&(n|=32);G<f&&(n|=128);B<f&&(n|=64);var H=THREE.edgeTable[n];if(H===0)return 0;
-var w=this.delta,D=a+w,A=c+w,w=g+w;H&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,s));H&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,c,g,s,r));H&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,A,g,u,r));H&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,u));H&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,w,y,v));
-H&32&&(this.compNorm(q),this.compNorm(t),this.VIntY(q*3,this.vlist,this.nlist,15,f,D,c,w,v,B));H&64&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,A,w,G,B));H&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,w,y,G));H&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,y));H&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,c,g,s,v));H&1024&&(this.compNorm(p),
-this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,f,D,A,g,r,B));H&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,A,g,u,G));n<<=4;for(f=e=0;THREE.triTable[n+f]!=-1;)a=n+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],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+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,e,f,h){var i=e+1,l=e+this.yd,k=e+this.zd,p=i+this.yd,q=i+this.zd,m=e+this.yd+this.zd,t=i+this.yd+this.zd,n=0,o=this.field[e],s=this.field[i],u=this.field[l],r=this.field[p],z=this.field[k],E=this.field[q],G=this.field[m],v=this.field[t];o<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);r<f&&(n|=4);z<f&&(n|=16);E<f&&(n|=32);G<f&&(n|=128);v<f&&(n|=64);var w=THREE.edgeTable[n];if(w===0)return 0;
+var C=this.delta,F=a+C,B=c+C,C=g+C;w&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,s));w&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,c,g,s,r));w&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,B,g,u,r));w&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,u));w&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,C,z,E));
+w&32&&(this.compNorm(q),this.compNorm(t),this.VIntY(q*3,this.vlist,this.nlist,15,f,F,c,C,E,v));w&64&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,B,C,G,v));w&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,C,z,G));w&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,z));w&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,c,g,s,E));w&1024&&(this.compNorm(p),
+this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,f,F,B,g,r,v));w&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,B,g,u,G));n<<=4;for(f=e=0;THREE.triTable[n+f]!=-1;)a=n+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],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(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,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,l=c*this.size,k=a*this.size,p=Math.floor(i-h);p<1&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var q=Math.floor(l-h);q<1&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);
 h>this.size-1&&(h=this.size-1);for(var t,n,o,s,u,r;p<i;p++){k=this.size2*p;n=p/this.size-g;u=n*n;for(n=q;n<l;n++){o=k+this.size*n;t=n/this.size-c;r=t*t;for(t=m;t<h;t++)s=t/this.size-a,s=e/(1.0E-6+s*s+r+u)-f,s>0&&(this.field[o+t]+=s)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,l=this.size,k=this.yd,p=this.zd,q=this.field,m=l*Math.sqrt(a/c);m>l&&(m=l);for(g=0;g<m;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<l;e++){i=g+e*k;for(f=0;f<l;f++)q[p*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
@@ -706,7 +708,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 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,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,p;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
 1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:m}},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}"}),
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||p!==b.fov){i=b.aspect;l=b.near;k=b.far;p=b.fov;var u=b.projectionMatrix.clone(),r=125/30*0.5,y=r*l/125,v=l*Math.tan(p*Math.PI/360),G;f.n14=r;h.n14=-r;r=-v*i+y;G=v*i+y;u.n11=2*l/(G-r);u.n13=(G+r)/(G-r);g.projectionMatrix.copy(u);r=-v*i-y;G=v*i-y;u.n11=
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||p!==b.fov){i=b.aspect;l=b.near;k=b.far;p=b.fov;var u=b.projectionMatrix.clone(),r=125/30*0.5,z=r*l/125,E=l*Math.tan(p*Math.PI/360),G;f.n14=r;h.n14=-r;r=-E*i+z;G=E*i+z;u.n11=2*l/(G-r);u.n13=(G+r)/(G-r);g.projectionMatrix.copy(u);r=-E*i-z;G=E*i-z;u.n11=
 2*l/(G-r);u.n13=(G+r)/(G-r);e.projectionMatrix.copy(u)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,q,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);n.updateMatrixWorld();d.call(c,n,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};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);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};

+ 62 - 61
build/custom/ThreeCanvas.js

@@ -14,64 +14,64 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);q=i.dot(b);if(q<=0)return null;k=n.add(a,o.copy(b).multiplyScalar(q));return t=c.distanceTo(k)}function d(a,b,c,d){i.sub(d,b);n.sub(c,b);o.sub(a,b);K=i.dot(i);C=i.dot(n);Q=i.dot(o);O=n.dot(n);w=n.dot(o);F=1/(K*O-C*C);z=(O*Q-C*w)*F;D=(K*w-C*Q)*F;return z>=0&&D>=0&&z+D<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
-c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var i,o=[],n=0,W=k.children.length;n<W;n++)Array.prototype.push.apply(o,this.intersectObject(k.children[n]));if(k instanceof THREE.Particle){n=
-c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.scale.x)return[];i={distance:n,point:k.position,face:null,object:k};o.push(i)}else if(k instanceof THREE.Mesh){n=c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return o;var q,G=k.geometry,H=G.vertices,I;k.matrixRotationWorld.extractRotation(k.matrixWorld);n=0;for(W=G.faces.length;n<W;n++)if(i=G.faces[n],a.copy(this.origin),
-b.copy(this.direction),I=k.matrixWorld,l=I.multiplyVector3(l.copy(i.centroid)).subSelf(a),q=l.dot(b),!(q<=0)&&(f=I.multiplyVector3(f.copy(H[i.a].position)),e=I.multiplyVector3(e.copy(H[i.b].position)),g=I.multiplyVector3(g.copy(H[i.c].position)),h=i instanceof THREE.Face4?I.multiplyVector3(h.copy(H[i.d].position)):null,m=k.matrixRotationWorld.multiplyVector3(m.copy(i.normal)),q=b.dot(m),k.doubleSided||(k.flipSided?q>0:q<0)))if(q=m.dot(l.sub(f,a))/q,j.add(a,b.multiplyScalar(q)),i instanceof THREE.Face3)d(j,
-f,e,g)&&(i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i));else if(i instanceof THREE.Face4&&(d(j,f,e,h)||d(j,e,g,h)))i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i)}return o};var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,q,k,t,K,C,Q,O,w,F,z,D};
+THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;k=n.add(a,o.copy(b).multiplyScalar(p));return s=c.distanceTo(k)}function d(a,b,c,d){i.sub(d,b);n.sub(c,b);o.sub(a,b);K=i.dot(i);C=i.dot(n);Q=i.dot(o);O=n.dot(n);w=n.dot(o);F=1/(K*O-C*C);z=(O*Q-C*w)*F;D=(K*w-C*Q)*F;return z>=0&&D>=0&&z+D<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var i,o=[],n=0,W=k.children.length;n<W;n++)Array.prototype.push.apply(o,this.intersectObject(k.children[n]));if(k instanceof THREE.Particle){n=
+c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.scale.x)return[];i={distance:n,point:k.position,face:null,object:k};o.push(i)}else if(k instanceof THREE.Mesh){n=c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return o;var p,G=k.geometry,H=G.vertices,I;k.matrixRotationWorld.extractRotation(k.matrixWorld);n=0;for(W=G.faces.length;n<W;n++)if(i=G.faces[n],a.copy(this.origin),
+b.copy(this.direction),I=k.matrixWorld,m=I.multiplyVector3(m.copy(i.centroid)).subSelf(a),p=m.dot(b),!(p<=0)&&(f=I.multiplyVector3(f.copy(H[i.a].position)),e=I.multiplyVector3(e.copy(H[i.b].position)),g=I.multiplyVector3(g.copy(H[i.c].position)),h=i instanceof THREE.Face4?I.multiplyVector3(h.copy(H[i.d].position)):null,l=k.matrixRotationWorld.multiplyVector3(l.copy(i.normal)),p=b.dot(l),k.doubleSided||(k.flipSided?p>0:p<0)))if(p=l.dot(m.sub(f,a))/p,j.add(a,b.multiplyScalar(p)),i instanceof THREE.Face3)d(j,
+f,e,g)&&(i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i));else if(i instanceof THREE.Face4&&(d(j,f,e,h)||d(j,e,g,h)))i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i)}return o};var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,p,k,s,K,C,Q,O,w,F,z,D};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,i){h=!1;b=e;c=g;d=j;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 function(e,g,j,i,n,o){h?(h=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<i?g<o?g:o:i<o?i:o,d=e>j?e>n?e:n:j>n?j:n,f=g>i?g>o?g:o:i>o?i:o):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<i?g<o?g<c?g:c:o<c?o:c:i<o?i<c?i:c:o<c?o:c,d=e>j?e>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,f=g>i?g>o?g>f?g:f:o>f?o:f:i>o?i>f?i:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},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,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,m,j,i,n,o,q,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,m||0,j!==void 0?j:1,i||0,n||0,o||0,q||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,m,j,i,n,o,q,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=m;this.n33=j;this.n34=i;this.n41=n;this.n42=o;this.n43=q;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,m=a.n24,j=a.n31,i=a.n32,n=a.n33,o=a.n34,q=a.n41,k=a.n42,t=a.n43,
-K=a.n44,C=b.n11,Q=b.n12,O=b.n13,w=b.n14,F=b.n21,z=b.n22,D=b.n23,u=b.n24,r=b.n31,E=b.n32,N=b.n33,W=b.n34,ea=b.n41,G=b.n42,H=b.n43,I=b.n44;this.n11=c*C+d*F+f*r+e*ea;this.n12=c*Q+d*z+f*E+e*G;this.n13=c*O+d*D+f*N+e*H;this.n14=c*w+d*u+f*W+e*I;this.n21=g*C+h*F+l*r+m*ea;this.n22=g*Q+h*z+l*E+m*G;this.n23=g*O+h*D+l*N+m*H;this.n24=g*w+h*u+l*W+m*I;this.n31=j*C+i*F+n*r+o*ea;this.n32=j*Q+i*z+n*E+o*G;this.n33=j*O+i*D+n*N+o*H;this.n34=j*w+i*u+n*W+o*I;this.n41=q*C+k*F+t*r+K*ea;this.n42=q*Q+k*z+t*E+K*G;this.n43=q*
-O+k*D+t*N+K*H;this.n44=q*w+k*u+t*W+K*I;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,p,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,m||0,l||0,j!==void 0?j:1,i||0,n||0,o||0,p||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=m;this.n32=l;this.n33=j;this.n34=i;this.n41=n;this.n42=o;this.n43=p;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,l=a.n24,j=a.n31,i=a.n32,n=a.n33,o=a.n34,p=a.n41,k=a.n42,s=a.n43,
+K=a.n44,C=b.n11,Q=b.n12,O=b.n13,w=b.n14,F=b.n21,z=b.n22,D=b.n23,u=b.n24,r=b.n31,E=b.n32,N=b.n33,W=b.n34,da=b.n41,G=b.n42,H=b.n43,I=b.n44;this.n11=c*C+d*F+f*r+e*da;this.n12=c*Q+d*z+f*E+e*G;this.n13=c*O+d*D+f*N+e*H;this.n14=c*w+d*u+f*W+e*I;this.n21=g*C+h*F+m*r+l*da;this.n22=g*Q+h*z+m*E+l*G;this.n23=g*O+h*D+m*N+l*H;this.n24=g*w+h*u+m*W+l*I;this.n31=j*C+i*F+n*r+o*da;this.n32=j*Q+i*z+n*E+o*G;this.n33=j*O+i*D+n*N+o*H;this.n34=j*w+i*u+n*W+o*I;this.n41=p*C+k*F+s*r+K*da;this.n42=p*Q+k*z+s*E+K*G;this.n43=p*
+O+k*D+s*N+K*H;this.n44=p*w+k*u+s*W+K*I;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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 b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,m=this.n32,j=this.n33,i=this.n34,n=this.n41,o=this.n42,q=this.n43,k=this.n44;return d*g*m*n-c*h*m*n-d*e*j*n+b*h*j*n+c*e*i*n-b*g*i*n-d*g*l*o+c*h*l*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*l*q-b*h*l*q-d*f*m*q+a*h*m*q+b*f*i*q-a*e*i*q-c*e*l*k+b*g*l*k+c*f*m*k-a*g*m*k-b*f*j*k+a*e*j*k},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,m=this.n31,l=this.n32,j=this.n33,i=this.n34,n=this.n41,o=this.n42,p=this.n43,k=this.n44;return d*g*l*n-c*h*l*n-d*e*j*n+b*h*j*n+c*e*i*n-b*g*i*n-d*g*m*o+c*h*m*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*m*p-b*h*m*p-d*f*l*p+a*h*l*p+b*f*i*p-a*e*i*p-c*e*m*k+b*g*m*k+c*f*l*k-a*g*l*k-b*f*j*k+a*e*j*k},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
 a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,m=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,m*g+c,m*h-d*e,0,l*h-d*g,m*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){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 b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,l=a.n24,m=a.n31,j=a.n32,i=a.n33,n=a.n34,o=a.n41,q=a.n42,k=a.n43,t=a.n44;this.n11=h*n*q-l*i*q+l*j*k-g*n*k-h*j*t+g*i*t;this.n12=f*i*q-d*n*q-f*j*k+c*n*k+d*j*t-c*i*t;this.n13=d*l*q-f*h*q+f*g*k-c*l*k-d*g*t+c*h*t;this.n14=f*h*j-d*l*j-f*g*i+c*l*i+d*g*n-c*h*n;this.n21=l*i*o-h*n*o-l*m*k+e*n*k+h*m*t-e*i*t;this.n22=d*n*o-f*i*o+
-f*m*k-b*n*k-d*m*t+b*i*t;this.n23=f*h*o-d*l*o-f*e*k+b*l*k+d*e*t-b*h*t;this.n24=d*l*m-f*h*m+f*e*i-b*l*i-d*e*n+b*h*n;this.n31=g*n*o-l*j*o+l*m*q-e*n*q-g*m*t+e*j*t;this.n32=f*j*o-c*n*o-f*m*q+b*n*q+c*m*t-b*j*t;this.n33=d*l*o-f*g*o+f*e*q-b*l*q-c*e*t+b*g*t;this.n34=f*g*m-c*l*m-f*e*j+b*l*j+c*e*n-b*g*n;this.n41=h*j*o-g*i*o-h*m*q+e*i*q+g*m*k-e*j*k;this.n42=c*i*o-d*j*o+d*m*q-b*i*q-c*m*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*q+b*h*q+c*e*k-b*g*k;this.n44=c*h*m-d*g*m+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=g*h,m=g*f,j=d*h,i=d*f;this.n11=l+i*c;this.n12=j*c-m;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=m*c-j;this.n32=i+l*c;this.n33=e*g;break;case "ZXY":l=g*h;m=g*f;j=d*h;i=d*f;this.n11=l-i*c;this.n12=-e*f;this.n13=j+m*c;this.n21=m+j*c;this.n22=e*h;this.n23=i-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
-e*h;m=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-m;this.n13=l*d+i;this.n21=g*f;this.n22=i*d+l;this.n23=m*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-l*f;this.n13=j*f+m;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*f+j;this.n33=l-i*f;break;case "XZY":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+i;this.n22=e*h;this.n23=m*f-j;this.n31=j*f-m;this.n32=c*h;this.n33=i*f+l;break;default:l=e*h,m=e*
-f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=m+j*d,this.n22=l-i*d,this.n23=-c*g,this.n31=i-l*d,this.n32=j+m*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,l=b*g;b*=h;var m=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(m+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+m);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,m=f*e,l=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,l*g+c,l*h-d*e,0,m*h-d*g,l*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){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 b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,m=a.n24,l=a.n31,j=a.n32,i=a.n33,n=a.n34,o=a.n41,p=a.n42,k=a.n43,s=a.n44;this.n11=h*n*p-m*i*p+m*j*k-g*n*k-h*j*s+g*i*s;this.n12=f*i*p-d*n*p-f*j*k+c*n*k+d*j*s-c*i*s;this.n13=d*m*p-f*h*p+f*g*k-c*m*k-d*g*s+c*h*s;this.n14=f*h*j-d*m*j-f*g*i+c*m*i+d*g*n-c*h*n;this.n21=m*i*o-h*n*o-m*l*k+e*n*k+h*l*s-e*i*s;this.n22=d*n*o-f*i*o+
+f*l*k-b*n*k-d*l*s+b*i*s;this.n23=f*h*o-d*m*o-f*e*k+b*m*k+d*e*s-b*h*s;this.n24=d*m*l-f*h*l+f*e*i-b*m*i-d*e*n+b*h*n;this.n31=g*n*o-m*j*o+m*l*p-e*n*p-g*l*s+e*j*s;this.n32=f*j*o-c*n*o-f*l*p+b*n*p+c*l*s-b*j*s;this.n33=d*m*o-f*g*o+f*e*p-b*m*p-c*e*s+b*g*s;this.n34=f*g*l-c*m*l-f*e*j+b*m*j+c*e*n-b*g*n;this.n41=h*j*o-g*i*o-h*l*p+e*i*p+g*l*k-e*j*k;this.n42=c*i*o-d*j*o+d*l*p-b*i*p-c*l*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*p+b*h*p+c*e*k-b*g*k;this.n44=c*h*l-d*g*l+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=g*h,l=g*f,j=d*h,i=d*f;this.n11=m+i*c;this.n12=j*c-l;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=l*c-j;this.n32=i+m*c;this.n33=e*g;break;case "ZXY":m=g*h;l=g*f;j=d*h;i=d*f;this.n11=m-i*c;this.n12=-e*f;this.n13=j+l*c;this.n21=l+j*c;this.n22=e*h;this.n23=i-m*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":m=
+e*h;l=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-l;this.n13=m*d+i;this.n21=g*f;this.n22=i*d+m;this.n23=l*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-m*f;this.n13=j*f+l;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+j;this.n33=m-i*f;break;case "XZY":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=m*f+i;this.n22=e*h;this.n23=l*f-j;this.n31=j*f-l;this.n32=c*h;this.n33=i*f+m;break;default:m=e*h,l=e*
+f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=l+j*d,this.n22=m-i*d,this.n23=-c*g,this.n31=i-m*d,this.n32=j+l*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,m=b*g;b*=h;var l=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(l+d);this.n12=m-f;this.n13=b+g;this.n21=m+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*m;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*m;c[7]=a*j;c[8]=a*i;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*m;c[6]=a*l;c[7]=a*j;c[8]=a*i;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,l,m;g=new THREE.Matrix4;h=b-a;l=c-d;m=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((e+f)/m);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,m,l;g=new THREE.Matrix4;h=b-a;m=c-d;l=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/m;g.n23=0;g.n24=-((c+d)/m);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((e+f)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=m[l]=m[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],h,l,m=[],
-j,i,n=[],o,q=[],k,t,K=[],C,Q,O=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,D=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,N=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[m]=l[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],h,m,l=[],
+j,i,n=[],o,p=[],k,s,K=[],C,Q,O=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,D=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,N=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
 a.n23,a.n44+a.n24);r[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);r[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);r[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=r[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);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.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(b,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=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 d=b.matrixWorld,
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=r[h].x*d.n14+r[h].y*d.n24+r[h].z*d.n34+r[h].w,c<=e){c=!1;break a}c=!0}c?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,S,v,R,P,V,J,s,A,x,y,M,ka,aa;Q=t=o=i=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(D);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(J=w.objects[a].object,s=J.matrixWorld,
-x=J.material,l=0,J instanceof THREE.Mesh){A=J.geometry;y=J.geometry.materials;S=A.vertices;M=A.faces;ka=A.faceVertexUvs;A=J.matrixRotationWorld.extractRotation(s);L=0;for(B=S.length;L<B;L++)h=b(),h.positionWorld.copy(S[L].position),s.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<r;S=0;for(L=M.length;S<L;S++){B=
-M[S];if(B instanceof THREE.Face3)if(v=m[B.a],R=m[B.b],P=m[B.c],v.visible&&R.visible&&P.visible&&(J.doubleSided||J.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))V=n[i]=n[i]||new THREE.RenderableFace3,i++,j=V,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=m[B.a],R=m[B.b],P=m[B.c],V=m[B.d],v.visible&&R.visible&&P.visible&&V.visible&&
-(J.doubleSided||J.flipSided!=((V.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(V.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(V.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(V.positionScreen.x-P.positionScreen.x)<0)))aa=q[o]=q[o]||new THREE.RenderableFace4,o++,j=aa,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P),j.v4.copy(V);else continue;j.normalWorld.copy(B.normal);
-A.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);s.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);D.multiplyVector3(j.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)V=j.vertexNormalsWorld[v],V.copy(P[v]),A.multiplyVector3(V);v=0;for(R=ka.length;v<R;v++)if(aa=ka[v][S]){P=0;for(V=aa.length;P<V;P++)j.uvs[v][P]=aa[P]}j.material=x;j.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;j.z=j.centroidScreen.z;w.elements.push(j)}}else if(J instanceof
-THREE.Line){u.multiply(D,s);S=J.geometry.vertices;v=b();v.positionScreen.copy(S[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=S.length;L<B;L++)if(v=b(),v.positionScreen.copy(S[L].position),u.multiplyVector4(v.positionScreen),R=m[l-2],E.copy(v.positionScreen),N.copy(R.positionScreen),d(E,N))E.multiplyScalar(1/E.w),N.multiplyScalar(1/N.w),J=K[t]=K[t]||new THREE.RenderableLine,t++,k=J,k.v1.positionScreen.copy(E),k.v2.positionScreen.copy(N),k.z=Math.max(E.z,N.z),k.material=x,w.elements.push(k)}a=
-0;for(F=w.sprites.length;a<F;a++)if(J=w.sprites[a].object,s=J.matrixWorld,J instanceof THREE.Particle&&(z.set(s.n14,s.n24,s.n34,1),D.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=O[Q]=O[Q]||new THREE.RenderableParticle,Q++,C=g,C.x=z.x/z.w,C.y=z.y/z.w,C.z=z.z,C.rotation=J.rotation.z,C.scale.x=J.scale.x*Math.abs(C.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),C.scale.y=J.scale.y*Math.abs(C.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),C.material=J.material,w.elements.push(C);
+w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,S,v,R,P,V,J,t,A,x,y,M,la,fa;Q=s=o=i=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(D);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(J=w.objects[a].object,t=J.matrixWorld,
+x=J.material,m=0,J instanceof THREE.Mesh){A=J.geometry;y=J.geometry.materials;S=A.vertices;M=A.faces;la=A.faceVertexUvs;A=J.matrixRotationWorld.extractRotation(t);L=0;for(B=S.length;L<B;L++)h=b(),h.positionWorld.copy(S[L].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<r;S=0;for(L=M.length;S<L;S++){B=
+M[S];if(B instanceof THREE.Face3)if(v=l[B.a],R=l[B.b],P=l[B.c],v.visible&&R.visible&&P.visible&&(J.doubleSided||J.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))V=n[i]=n[i]||new THREE.RenderableFace3,i++,j=V,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=l[B.a],R=l[B.b],P=l[B.c],V=l[B.d],v.visible&&R.visible&&P.visible&&V.visible&&
+(J.doubleSided||J.flipSided!=((V.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(V.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(V.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(V.positionScreen.x-P.positionScreen.x)<0)))fa=p[o]=p[o]||new THREE.RenderableFace4,o++,j=fa,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P),j.v4.copy(V);else continue;j.normalWorld.copy(B.normal);
+A.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);t.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);D.multiplyVector3(j.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)V=j.vertexNormalsWorld[v],V.copy(P[v]),A.multiplyVector3(V);v=0;for(R=la.length;v<R;v++)if(fa=la[v][S]){P=0;for(V=fa.length;P<V;P++)j.uvs[v][P]=fa[P]}j.material=x;j.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;j.z=j.centroidScreen.z;w.elements.push(j)}}else if(J instanceof
+THREE.Line){u.multiply(D,t);S=J.geometry.vertices;v=b();v.positionScreen.copy(S[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=S.length;L<B;L++)if(v=b(),v.positionScreen.copy(S[L].position),u.multiplyVector4(v.positionScreen),R=l[m-2],E.copy(v.positionScreen),N.copy(R.positionScreen),d(E,N))E.multiplyScalar(1/E.w),N.multiplyScalar(1/N.w),J=K[s]=K[s]||new THREE.RenderableLine,s++,k=J,k.v1.positionScreen.copy(E),k.v2.positionScreen.copy(N),k.z=Math.max(E.z,N.z),k.material=x,w.elements.push(k)}a=
+0;for(F=w.sprites.length;a<F;a++)if(J=w.sprites[a].object,t=J.matrixWorld,J instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),D.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=O[Q]=O[Q]||new THREE.RenderableParticle,Q++,C=g,C.x=z.x/z.w,C.y=z.y/z.w,C.z=z.z,C.rotation=J.rotation.z,C.scale.x=J.scale.x*Math.abs(C.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),C.scale.y=J.scale.y*Math.abs(C.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),C.material=J.material,w.elements.push(C);
 f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=m*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-m*-h;b.z=i*l+c*-h+m*-g-j*-e;return b}};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,l=m*c+g*f-h*d,j=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=l*m+c*-e+j*-h-i*-g;b.y=j*m+c*-g+i*-e-l*-h;b.z=i*m+c*-h+l*-g-j*-e;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -79,12 +79,12 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
-c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,D){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=l.x-h.x;q=m.x-h.x;k=l.y-h.y;t=m.y-h.y;K=l.z-h.z;C=m.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*q)*z,(F*k-w*t)*z,(F*K-w*C)*z);N.set((Q*q-O*o)*z,(Q*t-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N);
-r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,l,m,j,i,n,o,q,k,t,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3,W=new THREE.Vector3,ea=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a",
-"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]],D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),ea.cross(e.vertexNormals[d],D),f=ea.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;p=l.x-h.x;k=m.y-h.y;s=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*p)*z,(F*k-w*s)*z,(F*K-w*C)*z);N.set((Q*p-O*o)*z,(Q*s-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N);
+r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,p,k,s,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3,W=new THREE.Vector3,da=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a",
+"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]],D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),da.cross(e.vertexNormals[d],D),f=da.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
@@ -128,33 +128,34 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 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 b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(Q!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}Q=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,n,o,q,k=j.getContext("2d"),t=new THREE.Color(0),K=0,C=1,Q=0,O=null,w=null,F=null,z=null,D=null,u,r,E,N,W=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,G,H,I,Y,L,B,S,v,R,P,V,J,s=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,ka=[],aa,ga,fa,ba,Aa,Ba,Ca,Da,Ea,Fa,la=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,xa=!1,$=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,T=new THREE.Vector3,pa,qa,ya,ca,ra,ua,a=16;pa=document.createElement("canvas");
-pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ca=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;n=b;o=Math.floor(i/2);q=Math.floor(n/2);j.width=i;j.height=n;la.set(-o,-q,o,q);Z.set(-o,-q,o,q);C=1;Q=0;
-D=z=F=w=O=null};this.setClearColor=function(a,b){t.copy(a);K=b;Z.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){t.setHex(a);K=b;Z.set(-o,-q,o,q)};this.clear=function(){k.setTransform(1,0,0,-1,o,q);Z.isEmpty()||(Z.minSelf(la),Z.inflate(2),K<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),K>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+K+")"),k.fillRect(Math.floor(Z.getX()),
-Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,j){function i(a){var b,c,d,e;$.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function t(a,e,g){b(g.opacity);c(g.blending);var h,j,i,l,p,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=g.map.image,p=l.width>>1,n=l.height>>
-1,g=e.scale.x*o,i=e.scale.y*q,h=g*p,j=i*n,X.set(a.x-h,a.y-j,a.x+h,a.y+j),la.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-p,-n),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*q,X.set(a.x-h,a.y-j,a.x+h,a.y+j),la.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function w(a,e,
-f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(D!=a)k.lineJoin=D=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function C(a,d,f,g,h,k,i,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);G=a.positionScreen.x;H=a.positionScreen.y;
-I=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;K(G,H,I,Y,L,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],za(G,H,I,Y,L,B,ba[g].u,ba[g].v,ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Aa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ba=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
-Ca=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Da=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Ea=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Fa=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,za(G,H,I,Y,L,B,Aa,Ba,Ca,Da,Ea,Fa,p.envMap)}else p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],za(G,H,I,Y,L,B,ba[g].u,ba[g].v,
-ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map)),c(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],x),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],y),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*
-x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(G,H,I,Y,L,B,0,0,1,0,0,1,fa)):(s.r=$.r,s.g=$.g,s.b=$.b,n(l,i.centroidWorld,i.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,
-1)),p.wireframe?ha(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)):p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshDepthMaterial)aa=j.near,ga=j.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(f.positionScreen.z,aa,ga),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,fa=va(A,x,y,M),na(G,H,I,Y,L,B,0,0,1,0,0,1,fa);else if(p instanceof THREE.MeshNormalMaterial)s.r=
-oa(i.normalWorld.x),s.g=oa(i.normalWorld.y),s.b=oa(i.normalWorld.z),p.wireframe?ha(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)}function Q(a,d,f,g,h,k,i,p,o){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)C(a,d,g,0,1,3,i,p,o),C(h,f,k,1,2,3,i,p,o);else if(G=a.positionScreen.x,H=a.positionScreen.y,I=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,v=g.positionScreen.y,R=h.positionScreen.x,
-P=h.positionScreen.y,V=k.positionScreen.x,J=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)O(G,H,I,Y,L,B,S,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)xa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],x),
-n(l,i.v4.positionWorld,i.vertexNormalsWorld[3],y),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],M),A.r=Math.max(0,Math.min(p.color.r*A.r,1)),A.g=Math.max(0,Math.min(p.color.g*A.g,1)),A.b=Math.max(0,Math.min(p.color.b*A.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),M.r=Math.max(0,Math.min(p.color.r*
-M.r,1)),M.g=Math.max(0,Math.min(p.color.g*M.g,1)),M.b=Math.max(0,Math.min(p.color.b*M.b,1)),fa=va(A,x,y,M),K(G,H,I,Y,S,v),na(G,H,I,Y,S,v,0,0,1,0,0,1,fa),K(R,P,L,B,V,J),na(R,P,L,B,V,J,1,0,1,1,0,1,fa)):(s.r=$.r,s.g=$.g,s.b=$.b,n(l,i.centroidWorld,i.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1)),O(G,H,I,Y,L,B,S,v),p.wireframe?ha(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)):(O(G,H,I,
-Y,L,B,S,v),p.wireframe?ha(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color));else if(p instanceof THREE.MeshNormalMaterial)s.r=oa(i.normalWorld.x),s.g=oa(i.normalWorld.y),s.b=oa(i.normalWorld.z),O(G,H,I,Y,L,B,S,v),p.wireframe?ha(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s);else if(p instanceof THREE.MeshDepthMaterial)aa=j.near,ga=j.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,aa,ga),x.r=x.g=x.b=1-ma(d.positionScreen.z,aa,ga),y.r=y.g=y.b=1-ma(g.positionScreen.z,
-aa,ga),M.r=M.g=M.b=1-ma(f.positionScreen.z,aa,ga),fa=va(A,x,y,M),K(G,H,I,Y,S,v),na(G,H,I,Y,S,v,0,0,1,0,0,1,fa),K(R,P,L,B,V,J),na(R,P,L,B,V,J,1,0,1,1,0,1,fa)}function K(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function O(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(D!=e)k.lineJoin=D=e;d(a.getContextStyle());
-k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,o,n,m){if(m.image.width!=0){if(m.needsUpdate==!0||ka[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;ka[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(ka[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=
-(j+q)*s,l=(l+r)*m,o=(o+q)*s,n=(n+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;o-=h;n-=i;q=1/(j*n-o*l);m=(n*c-l*e)*q;l=(n*d-l*g)*q;c=(j*e-o*c)*q;d=(j*g-o*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function na(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,q;n=o.width-1;q=o.height-1;g*=n;h*=q;i*=n;j*=q;l*=n;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);n=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();
-k.drawImage(o,0,0);k.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ca[0]=e<0?0:e>255?255:e;ca[1]=f<0?0:f>255?255:f;ca[2]=a<0?0:a>255?255:a;ca[4]=g<0?0:g>255?255:g;ca[5]=h<0?0:h>255?255:h;ca[6]=b<0?0:b>255?255:b;ca[8]=i<0?0:i>255?255:i;ca[9]=j<0?0:j>255?255:j;ca[10]=c<0?0:c>255?255:c;ca[12]=k<0?0:k>255?255:k;ca[13]=l<0?0:l>255?255:l;ca[14]=d<0?
-0:d>255?255:d;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function oa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ga,U,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=m.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&i(l);wa=0;for(Ga=h.length;wa<
-Ga;wa++)if(U=h[wa],da=U.material,da=da instanceof THREE.MeshFaceMaterial?U.faceMaterial:da,!(da==null||da.opacity==0)){X.empty();if(U instanceof THREE.RenderableParticle)u=U,u.x*=o,u.y*=q,t(u,U,da,a);else if(U instanceof THREE.RenderableLine)u=U.v1,r=U.v2,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),la.intersects(X)&&w(u,r,U,da,a);else if(U instanceof THREE.RenderableFace3)u=
-U.v1,r=U.v2,E=U.v3,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,E.positionScreen),ja(E.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,E.positionScreen.x,E.positionScreen.y),la.intersects(X)&&C(u,r,E,0,1,2,U,da,a);else if(U instanceof THREE.RenderableFace4)u=U.v1,r=U.v2,
-E=U.v3,N=U.v4,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,N.positionScreen.x*=o,N.positionScreen.y*=q,W.positionScreen.copy(r.positionScreen),ea.positionScreen.copy(N.positionScreen),da.overdraw&&(ja(u.positionScreen,r.positionScreen),ja(r.positionScreen,N.positionScreen),ja(N.positionScreen,u.positionScreen),ja(E.positionScreen,W.positionScreen),ja(E.positionScreen,ea.positionScreen)),X.addPoint(u.positionScreen.x,
-u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),la.intersects(X)&&Q(u,r,E,N,W,ea,U,da,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+THREE.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(Q!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}Q=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,h,m,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,n,o,p,k=j.getContext("2d"),s=new THREE.Color(0),K=0,C=1,Q=0,O=null,w=null,F=null,z=null,D=null,u,r,E,N,W=new THREE.RenderableVertex,da=new THREE.RenderableVertex,G,H,I,Y,L,B,S,v,R,P,V,J,t=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,ya=!1,$=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,T=new THREE.Vector3,qa,ra,za,ba,sa,va,a=16;qa=document.createElement("canvas");
+qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);za=ra.getImageData(0,0,2,2);ba=za.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;n=b;o=Math.floor(i/2);p=Math.floor(n/2);j.width=i;j.height=n;ma.set(-o,-p,o,p);Z.set(-o,-p,o,p);C=1;Q=0;
+D=z=F=w=O=null};this.setClearColor=function(a,b){s.copy(a);K=b;Z.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){s.setHex(a);K=b;Z.set(-o,-p,o,p)};this.clear=function(){k.setTransform(1,0,0,-1,o,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),K<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),K>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+K+")"),k.fillRect(Math.floor(Z.getX()),
+Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,j){function i(a){var b,c,d,e;$.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):d instanceof THREE.PointLight&&(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b)}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
+g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,j,i,m,q,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,q=m.width>>1,n=m.height>>
+1,g=e.scale.x*o,i=e.scale.y*p,h=g*q,j=i*n,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-q,-n),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*p,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function w(a,e,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(D!=a)k.lineJoin=D=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function C(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);G=a.positionScreen.x;H=a.positionScreen.y;
+I=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;K(G,H,I,Y,L,B);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Ba=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ca=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
+Da=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ea=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Fa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ga=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,Aa(G,H,I,Y,L,B,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,
+aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],y),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),x.r=Math.max(0,Math.min(q.color.r*
+x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,
+1)),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(f.positionScreen.z,ga,ha),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)t.r=
+pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)}function Q(a,d,f,g,h,k,i,q,o){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)C(a,d,g,0,1,3,i,q,o),C(h,f,k,1,2,3,i,q,o);else if(G=a.positionScreen.x,H=a.positionScreen.y,I=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,v=g.positionScreen.y,R=h.positionScreen.x,
+P=h.positionScreen.y,V=k.positionScreen.x,J=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)O(G,H,I,Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),
+n(m,i.v4.positionWorld,i.vertexNormalsWorld[3],y),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],M),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=Math.max(0,Math.min(q.color.r*
+M.r,1)),M.g=Math.max(0,Math.min(q.color.g*M.g,1)),M.b=Math.max(0,Math.min(q.color.b*M.b,1)),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,1)),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):(O(G,H,I,
+Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)t.r=pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(g.positionScreen.z,
+ga,ha),M.r=M.g=M.b=1-na(f.positionScreen.z,ga,ha),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)}function K(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function O(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ja(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(D!=e)k.lineJoin=D=e;d(a.getContextStyle());
+k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function Aa(a,b,c,d,e,g,h,i,j,m,o,n,l){if(l.image.width!=0){if(l.needsUpdate==!0||la[l.id]==void 0){var p=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;la[l.id]=k.createPattern(l.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}f(la[l.id]);var p=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,u=l.image.height*l.repeat.y,h=(h+p)*s,i=(i+r)*u,j=(j+p)*s,
+m=(m+r)*u,o=(o+p)*s,n=(n+r)*u;c-=a;d-=b;e-=a;g-=b;j-=h;m-=i;o-=h;n-=i;p=j*n-o*m;if(p==0){if(fa[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),fa[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=fa[l.id];h=(Math.floor(h)+Math.floor(i)*l.image.width)*4;t.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(t)}else p=1/p,l=(n*c-m*e)*p,m=(n*d-m*g)*p,c=(j*e-o*c)*p,d=(j*g-o*d)*p,a=a-l*h-c*i,h=b-m*h-
+d*i,k.save(),k.transform(l,m,c,d,a,h),k.fill(),k.restore()}}function oa(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,p;n=o.width-1;p=o.height-1;g*=n;h*=p;i*=n;j*=p;l*=n;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);n=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();k.drawImage(o,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*
+255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ba[0]=e<0?0:e>255?255:e;ba[1]=f<0?0:f>255?255:f;ba[2]=a<0?0:a>255?255:a;ba[4]=g<0?0:g>255?255:g;ba[5]=h<0?0:h>255?255:h;ba[6]=b<0?0:b>255?255:b;ba[8]=i<0?0:i>255?255:i;ba[9]=j<0?0:j>255?255:j;ba[10]=c<0?0:c>255?255:c;ba[12]=k<0?0:k>255?255:k;ba[13]=l<0?0:l>255?255:l;ba[14]=d<0?0:d>255?255:d;ra.putImageData(za,0,0);va.drawImage(qa,0,0);return sa}function na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function pa(a){a=(a+1)*0.5;return a<0?0:a>
+1?1:a}function ka(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ha,U,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,p);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,j,this.sortElements);h=g.elements;m=g.lights;(ya=m.length>0)&&i(m);xa=0;for(Ha=h.length;xa<Ha;xa++)if(U=h[xa],ca=U.material,ca=ca instanceof THREE.MeshFaceMaterial?U.faceMaterial:ca,!(ca==null||ca.opacity==0)){X.empty();if(U instanceof THREE.RenderableParticle)u=
+U,u.x*=o,u.y*=p,s(u,U,ca,a);else if(U instanceof THREE.RenderableLine)u=U.v1,r=U.v2,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),ma.intersects(X)&&w(u,r,U,ca,a);else if(U instanceof THREE.RenderableFace3)u=U.v1,r=U.v2,E=U.v3,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,ca.overdraw&&
+(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,E.positionScreen),ka(E.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,E.positionScreen.x,E.positionScreen.y),ma.intersects(X)&&C(u,r,E,0,1,2,U,ca,a);else if(U instanceof THREE.RenderableFace4)u=U.v1,r=U.v2,E=U.v3,N=U.v4,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,N.positionScreen.x*=
+o,N.positionScreen.y*=p,W.positionScreen.copy(r.positionScreen),da.positionScreen.copy(N.positionScreen),ca.overdraw&&(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,N.positionScreen),ka(N.positionScreen,u.positionScreen),ka(E.positionScreen,W.positionScreen),ka(E.positionScreen,da.positionScreen)),X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),
+ma.intersects(X)&&Q(u,r,E,N,W,da,U,ca,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
 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};

+ 149 - 148
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){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+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;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=e;c.v=f;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],q=f.faceVertexUvs[0],n={},l=0;l<a.materials.length;l++)n[a.materials[l].id]=l;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var l=0,s=h.length;l<s;l++){var m=new THREE.Vertex(h[l].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}l=
-0;for(s=j.length;l<s;l++){var e=j[l],p,o,r=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=r.length;h<m;h++)o=r[h].clone(),d&&d.multiplyVector3(o),p.vertexNormals.push(o);p.color.copy(e.color);h=0;for(m=t.length;h<m;h++)o=t[h],p.vertexColors.push(o.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
-m=n[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);p.materialIndex=m}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}l=0;for(s=q.length;l<s;l++){b=q[l];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,j,k=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)j=q[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],q=f.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var l=0,s=h.length;l<s;l++){var m=new THREE.Vertex(h[l].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}l=
+0;for(s=k.length;l<s;l++){var e=k[l],p,n,r=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=r.length;h<m;h++)n=r[h].clone(),d&&d.multiplyVector3(n),p.vertexNormals.push(n);p.color.copy(e.color);h=0;for(m=t.length;h<m;h++)n=t[h],p.vertexColors.push(n.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
+m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);p.materialIndex=m}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}l=0;for(s=q.length;l<s;l++){b=q[l];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
 e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,j=[],k,q,n,l;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,n);else if(d instanceof
-THREE.Face4)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,l=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,l),d._area2=THREE.GeometryUtils.triangleArea(q,n,l),d._area=d._area1+d._area2;i+=d._area;j[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,q,o,l;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,o);else if(d instanceof
+THREE.Face4)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,l=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,l),d._area2=THREE.GeometryUtils.triangleArea(q,o,l),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(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 d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},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 d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),j=i.data,k=0;k<d;k++)for(var q=1;q<g;q++){var n=q-1<0?g-1:q-1,l=(q+1)%g,s=k-1<0?d-1:k-1,m=(k+1)%d,p=[],o=[0,0,h[(q*d+k)*4]/255*c];p.push([-1,0,h[(q*d+s)*4]/255*c]);p.push([-1,-1,h[(n*d+s)*4]/255*c]);p.push([0,-1,h[(n*d+k)*4]/255*c]);p.push([1,-1,h[(n*d+m)*4]/255*c]);
-p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(l*d+m)*4]/255*c]);p.push([0,1,h[(l*d+k)*4]/255*c]);p.push([-1,1,h[(l*d+s)*4]/255*c]);n=[];s=p.length;for(l=0;l<s;l++){var m=p[l],r=p[(l+1)%s],m=[m[0]-o[0],m[1]-o[1],m[2]-o[2]],r=[r[0]-o[0],r[1]-o[1],r[2]-o[2]];n.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(l=0;l<n.length;l++)p[0]+=n[l][0],p[1]+=n[l][1],p[2]+=n[l][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;o=(q*d+k)*4;j[o]=(p[0]+1)/2*255|0;j[o+1]=(p[1]+0.5)*
-255|0;j[o+2]=p[2]*255|0;j[o+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var q=1;q<g;q++){var o=q-1<0?g-1:q-1,l=(q+1)%g,s=j-1<0?d-1:j-1,m=(j+1)%d,p=[],n=[0,0,h[(q*d+j)*4]/255*c];p.push([-1,0,h[(q*d+s)*4]/255*c]);p.push([-1,-1,h[(o*d+s)*4]/255*c]);p.push([0,-1,h[(o*d+j)*4]/255*c]);p.push([1,-1,h[(o*d+m)*4]/255*c]);
+p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(l*d+m)*4]/255*c]);p.push([0,1,h[(l*d+j)*4]/255*c]);p.push([-1,1,h[(l*d+s)*4]/255*c]);o=[];s=p.length;for(l=0;l<s;l++){var m=p[l],r=p[(l+1)%s],m=[m[0]-n[0],m[1]-n[1],m[2]-n[2]],r=[r[0]-n[0],r[1]-n[1],r[2]-n[2]];o.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(l=0;l<o.length;l++)p[0]+=o[l][0],p[1]+=o[l][1],p[2]+=o[l][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;n=(q*d+j)*4;k[n]=(p[0]+1)/2*255|0;k[n+1]=(p[1]+0.5)*
+255|0;k[n+2]=p[2]*255|0;k[n+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}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,37 +52,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 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,d,g,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};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=[],d,g,f,e,h,i,j,k,q,n,l,s,m;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];q=f[0];n=f[1];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,l,q,h),m=THREE.Shape.Utils.b2(m,s,n,
-i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];n=f[1];j=f[2];k=f[3];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,l,q,j,h),m=THREE.Shape.Utils.b3(m,s,n,k,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
-for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];j=f[2];q=f[3];m=f[4];n=!!f[5];k=e[e.length-2];l=e[e.length-1];e.length==0&&(k=l=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,n||(m=1-m),m=q+m*s,f=k+h+j*Math.cos(m),m=l+i+j*Math.sin(m),b.push(new THREE.Vector2(f,m))}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,d,g,f){var e=this.getPoints(),h,i,j,k,q;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,q=j.y,j.x=a*k+c*q+b,j.y=d*q+g*k+f;return e};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,k,j,q,o,l,s,m;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];q=f[0];o=f[1];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,l,q,h),m=THREE.Shape.Utils.b2(m,s,o,
+i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,l,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];l=e[e.length-1];e.length==0&&(j=l=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=l+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}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,d,g,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,q=k.y,k.x=a*j+c*q+b,k.y=d*q+g*j+f;return e};
 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,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(g.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&g.push(f);if(g.length==0)return[];var e,f=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
 d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};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,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};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(),d=b.concat(),g,f,e,h,i,j,k,q,n,l,s=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(g=0;g<j.length;g++){n=j[g];l=[];for(q=0;q<b.length;q++)k=b[q],k=n.distanceToSquared(k),l.push(k),k<f&&(f=k,e=g,h=q)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;var m=[j[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[j[e],j[f],b[h]];n=THREE.FontUtils.Triangulate.area(p);l=h;k=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;m=[j[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[j[e],j[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+n>m+p&&(h=l,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:j.length-1);q=b.slice(0,h);n=b.slice(h);l=j.slice(e);k=j.slice(0,e);f=[j[e],j[f],b[h]];s.push([j[e],b[h],b[g]]);s.push(f);b=q.concat(l).concat(k).concat(n)}return{shape:b,
-isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,j={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,k,j,q,o,l,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];l=[];for(q=0;q<b.length;q++)j=b[q],j=o.distanceToSquared(j),l.push(j),j<f&&(f=j,e=g,h=q)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);l=h;j=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;m=[k[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=l,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);q=b.slice(0,h);o=b.slice(h);l=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=q.concat(l).concat(j).concat(o)}return{shape:b,
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}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,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},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,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 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,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].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 d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var j=a.hierarchy[b].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
-{};for(j in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var j=
+{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));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 d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){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=d!==void 0?d:!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,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.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,d,g,f,e,h,i,j,k=this.data.JIT.hierarchy,q,n;this.currentTime+=a*this.timeScale;n=this.currentTime;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,s=this.hierarchy.length;l<s;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&k[l][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[l][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[l][j],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 m=0;m<3;m++){b=c[m];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=n){if(q<n)if(this.loop){e=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(b,l,1);h.time<q;)e=h,h=this.getNextKeyWith(b,l,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,l,h.index+1);while(h.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,f,e,h,i,k,j=this.data.JIT.hierarchy,q,o;this.currentTime+=a*this.timeScale;o=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,s=this.hierarchy.length;l<s;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[l][k],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 m=0;m<3;m++){b=c[m];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(q<o)if(this.loop){e=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(b,l,1);h.time<q;)e=h,h=this.getNextKeyWith(b,l,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,l,h.index+1);while(h.time<
 q)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",l,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)k[l][j]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,j;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],j[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],j[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],j[2],g,b,e);return d};
+"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)j[l][k]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=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+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){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=
@@ -104,7 +104,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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 d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,o=0;f=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[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)o=c*h.chunks[f]/h.total,b.keys[f]={time:o,pos:g[f]};e.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 d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,n=0;f=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[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)n=c*h.chunks[f]/h.total,b.keys[f]={time:n,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}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.0050;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 e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;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)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
@@ -122,76 +122,77 @@ 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,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,q=0,n=0,l=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*q);this.rotateVertically(c*n)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*k);e&&(this.roll+=this.rollSpeed*a*h);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);d.set(0,1,0);b.cross(d,
+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,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,o=0,l=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*q);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*j);e&&(this.roll+=this.rollSpeed*a*h);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);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-l)/window.innerWidth;n=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-l)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={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,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,n=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 d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,o=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 d=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),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.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?q=n:q.addSelf(a.sub(n,q).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),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,e);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&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),q=n=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
-a.clientY):f===d.PAN&&!b.noPan&&(n=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=n=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.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?q=o:q.addSelf(a.sub(o,q).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),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,e);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&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=b.getMouseOnScreen(a.clientX,a.clientY),q=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
+a.clientY):f===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,k,l){var m,n,o=d||1,q=g||1,p=h/2,s=i/2,r=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",q=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=f||1;var t=o+1,K=q+1;h/=o;var H=i/q;for(n=0;n<K;n++)for(i=0;i<t;i++){var N=new THREE.Vector3;N[a]=(i*h-p)*c;N[b]=(n*H-s)*e;N[m]=k;j.vertices.push(new THREE.Vertex(N))}for(n=0;n<q;n++)for(i=0;i<o;i++)j.faces.push(new THREE.Face4(i+
-t*n+r,i+t*(n+1)+r,i+1+t*(n+1)+r,i+1+t*n+r,null,null,l)),j.faceVertexUvs[0].push([new THREE.UV(i/o,n/q),new THREE.UV(i/o,(n+1)/q),new THREE.UV((i+1)/o,(n+1)/q),new THREE.UV((i+1)/o,n/q)])}THREE.Geometry.call(this);var j=this,k=a/2,q=c/2,n=b/2,l,s,m,p,o,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(e)}l=0;p=1;s=2;o=3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=
-void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,k,l);this.sides.nx&&i("z","y",1,-1,b,c,-k,p);this.sides.py&&i("x","z",1,1,a,b,q,s);this.sides.ny&&i("x","z",1,-1,a,b,-q,o);this.sides.pz&&i("x","y",1,-1,a,c,n,m);this.sides.nz&&i("x","y",-1,-1,a,c,-n,r);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,j=[],k=[];for(i=0;i<=g;i++){var q=[],n=[],l=i/g,s=l*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(m*Math.PI*2),-l*b+e,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);n.push(new THREE.UV(m,l))}j.push(q);k.push(n)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=j[i][h],q=j[i+1][h],n=j[i+1][h+1],l=j[i][h+1],s=
-this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),r=k[i][h].clone(),t=k[i+1][h].clone(),w=k[i+1][h+1].clone(),z=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,q,n,l,[s,m,p,o]));this.faceVertexUvs[0].push([r,t,w,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],q=j[0][h+
-1],n=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=k[0][h].clone(),t=k[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,q,n,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],q=j[i][h],n=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=k[i][h+1].clone(),t=k[i][h].clone(),
-w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,q,n,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,l){var m,o=d||1,n=g||1,q=h/2,p=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",n=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=f||1;var r=o+1,t=n+1,L=h/o,H=i/n,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var J=new THREE.Vector3;J[a]=(i*L-q)*c;J[b]=(h*H-p)*e;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<n;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+r*h+s,i+r*(h+1)+s,i+1+r*(h+1)+s,i+1+r*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/n),new THREE.UV(i/o,(h+1)/n),new THREE.UV((i+1)/o,(h+1)/n),new THREE.UV((i+1)/o,h/n)])}THREE.Geometry.call(this);var k=this,j=a/2,q=c/2,o=b/2,l,s,m,p,n,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(e)}l=0;p=1;s=2;n=
+3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,j,l);this.sides.nx&&i("z","y",1,-1,b,c,-j,p);this.sides.py&&i("x","z",1,1,a,b,q,s);this.sides.ny&&i("x","z",1,-1,a,b,-q,n);this.sides.pz&&i("x","y",1,-1,a,c,o,m);this.sides.nz&&i("x","y",-1,-1,a,c,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var q=[],o=[],l=i/g,s=l*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(m*Math.PI*2),-l*b+e,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(q);j.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],q=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],s=
+this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),n=this.vertices[l].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,q,o,l,[s,m,p,n]));this.faceVertexUvs[0].push([r,t,w,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],q=k[0][h+
+1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],q=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}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,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;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 d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){L=u;M=u-1;M<0&&(M=a.length-1);for(var b=
-0,c=l+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),f=Q+L+d,g=Q+L+e,j=f,d=Q+M+d,e=Q+M+e,n=g;j+=F;d+=F;e+=F;n+=F;A.faces.push(new THREE.Face4(j,d,e,n,null,null,w));w&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
-null,t));if(t){var d=z.maxY,e=z.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,q=c.bevelEnabled!==void 0?c.bevelEnabled:!0,n=c.curveSegments!==
-void 0?c.curveSegments:12,l=c.steps!==void 0?c.steps:1,s=c.bendPath,m=c.extrudePath,p,o=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,z=this.shapebb;if(m)p=m.getPoints(n),l=p.length,o=!0,q=!1;q||(j=i=k=0);var v,x,y,A=this,F=this.vertices.length;s&&a.addWrapPath(s);n=r?a.extractAllSpacedPoints(n):a.extractAllPoints(n);s=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=n.length;x<y;x++)v=n[x],THREE.Shape.Utils.isClockWise(v)&&
-(n[x]=v.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,n);r=s;x=0;for(y=n.length;x<y;x++)v=n[x],s=s.concat(v);var u,D,B,G,I,E,J=s.length,O=m.length,C=[];u=0;D=r.length;L=D-1;for(M=u+1;u<D;u++,L++,M++)L===D&&(L=0),M===D&&(M=0),C[u]=d(r[u],r[L],r[M]);var K=[],H,N=C.concat();x=0;for(y=n.length;x<y;x++){v=n[x];H=[];u=0;D=v.length;L=D-1;for(M=u+1;u<D;u++,L++,M++)L===D&&(L=0),M===D&&(M=0),H[u]=d(v[u],v[L],v[M]);K.push(H);N=N.concat(H)}for(B=0;B<k;B++){G=B/k;I=i*(1-G);G=j*Math.sin(G*Math.PI/2);u=
-0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,-I);x=0;for(y=n.length;x<y;x++){v=n[x];H=K[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-I)}}G=j;for(u=0;u<J;u++)E=q?b(s[u],N[u],G):s[u],o?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=l;B++)for(u=0;u<J;u++)E=q?b(s[u],N[u],G):s[u],o?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/l*B);for(B=k-1;B>=0;B--){G=B/k;I=i*(1-G);G=j*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,h+I);x=0;for(y=n.length;x<y;x++){v=n[x];
-H=K[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),o?f(E.x,E.y+p[l-1].y,p[l-1].x+I):f(E.x,E.y,h+I)}}if(q){q=J*0;for(u=0;u<O;u++)j=m[u],e(j[2]+q,j[1]+q,j[0]+q);q=J*(l+k*2);for(u=0;u<O;u++)j=m[u],e(j[0]+q,j[1]+q,j[2]+q)}else{for(u=0;u<O;u++)j=m[u],e(j[2],j[1],j[0]);for(u=0;u<O;u++)j=m[u],e(j[0]+J*l,j[1]+J*l,j[2]+J*l)}var L,M,Q=0;g(r);Q+=r.length;x=0;for(y=n.length;x<y;x++)v=n[x],g(v),Q+=v.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;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),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){J=u;N=u-1;N<0&&(N=a.length-1);for(var b=
+0,c=l+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
+null,t));if(t){var d=z.maxY,e=z.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,j=c.bevelSegments!==void 0?c.bevelSegments:3,q=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
+void 0?c.curveSegments:12,l=c.steps!==void 0?c.steps:1,s=c.bendPath,m=c.extrudePath,p,n=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,z=this.shapebb;if(m)p=m.getPoints(o),l=p.length,n=!0,q=!1;q||(k=i=j=0);var v,x,y,A=this,F=this.vertices.length;s&&a.addWrapPath(s);o=r?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=o.length;x<y;x++)v=o[x],THREE.Shape.Utils.isClockWise(v)&&
+(o[x]=v.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(y=o.length;x<y;x++)v=o[x],s=s.concat(v);var u,D,B,G,I,E,K=s.length,O=m.length,C=[];u=0;D=r.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[u]=d(r[u],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(y=o.length;x<y;x++){v=o[x];H=[];u=0;D=v.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[u]=d(v[u],v[J],v[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=
+0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,-I);x=0;for(y=o.length;x<y;x++){v=o[x];H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-I)}}G=k;for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],n?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=l;B++)for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],n?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,h+I);x=0;for(y=o.length;x<y;x++){v=o[x];
+H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),n?f(E.x,E.y+p[l-1].y,p[l-1].x+I):f(E.x,E.y,h+I)}}if(q){q=K*0;for(u=0;u<O;u++)k=m[u],e(k[2]+q,k[1]+q,k[0]+q);q=K*(l+j*2);for(u=0;u<O;u++)k=m[u],e(k[0]+q,k[1]+q,k[2]+q)}else{for(u=0;u<O;u++)k=m[u],e(k[2],k[1],k[0]);for(u=0;u<O;u++)k=m[u],e(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;g(r);Q+=r.length;x=0;for(y=o.length;x<y;x++)v=o[x],g(v),Q+=v.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 d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),j=d(f.faces[h].b,f.faces[h].c),k=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,k,a);b(f.faces[h].b,j,
-i,a);b(f.faces[h].c,k,j,a);b(i,j,k,a)}f.faces=a.faces}g.faces=f.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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,
+i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces}g.faces=f.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=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}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=e.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 d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(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,e=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 h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,f=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(g*j-e),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);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,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),j=[],k=0;for(d=0;d<f;d++){var q=2*d/f,n=i*Math.sin(q*g),q=i*Math.cos(q*g);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,h,n)))-1);j.push(k)}c.push(j)}for(var l,s,m,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){j=d==f-1;e=c[b][j?0:d+1];h=c[b][j?f-1:d];i=c[b-1][j?
-f-1:d];j=c[b-1][j?0:d+1];n=b/(g-1);l=(b-1)/(g-1);s=(d+1)/f;var q=d/f,k=new THREE.UV(1-s,n),n=new THREE.UV(1-q,n),q=new THREE.UV(1-q,l),p=new THREE.UV(1-s,l);b<c.length-1&&(l=this.vertices[e].position.clone(),s=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([k,n,q]));b>1&&(l=
-this.vertices[e].position.clone(),s=this.vertices[i].position.clone(),m=this.vertices[j].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([k,q,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,f=c/2,b=b||1,d=d||1,e=b+1,h=d+1,i=a/b,k=c/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<e;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*k-f),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+e*a,c+e*(a+1),c+1+e*(a+1),c+1+e*a),g.normal.copy(j),g.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
+b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};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,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],j=0;for(d=0;d<f;d++){var q=2*d/f,o=i*Math.sin(q*g),q=i*Math.cos(q*g);(b==0||b==e)&&d>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,h,o)))-1);k.push(j)}c.push(k)}for(var l,s,m,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){k=d==f-1;e=c[b][k?0:d+1];h=c[b][k?f-1:d];i=c[b-1][k?
+f-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);l=(b-1)/(g-1);s=(d+1)/f;var q=d/f,j=new THREE.UV(1-s,o),o=new THREE.UV(1-q,o),q=new THREE.UV(1-q,l),p=new THREE.UV(1-s,l);b<c.length-1&&(l=this.vertices[e].position.clone(),s=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([j,o,q]));b>1&&(l=
+this.vertices[e].position.clone(),s=this.vertices[i].position.clone(),m=this.vertices[k].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,i,k,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([j,q,p]))}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 d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,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]},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,d=
-0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,j,k,q,n,l,s,m,p,o=c.glyphs[a]||c.glyphs["?"];if(o){if(o.o){c=o._cachedOutline||(o._cachedOutline=o.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,
-k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;l=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(l,s,i,k);if(e=f[f.length-1]){q=e.x;n=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,t=THREE.Shape.Utils.b2(r,q,l,i),r=THREE.Shape.Utils.b2(r,n,s,k);f.push(new THREE.Vector2(t,r))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,l=c[a++]*b+d,s=c[a++]*-b,m=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,k,l,s,m,p),e=f[f.length-1]){q=e.x;n=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,t=THREE.Shape.Utils.b3(r,q,l,
-m,i),r=THREE.Shape.Utils.b3(r,n,s,p,k),f.push(new THREE.Vector2(t,r))}}}return{offset:o.ha*b,points:f,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<g;j++)e[j]=j;else for(j=0;j<g;j++)e[j]=g-1-j;var q=2*g;for(j=g-1;g>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=j;g<=i&&(i=0);j=i+1;g<=j&&(j=0);k=j+1;g<=k&&(k=0);var n;a:{n=a;var l=i,s=j,m=k,p=g,o=e,r=void 0,t=void 0,w=void 0,
-z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=n[o[l]].x,w=n[o[l]].y,z=n[o[s]].x,v=n[o[s]].y,x=n[o[m]].x,y=n[o[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))n=!1;else{for(r=0;r<p;r++)if(!(r==l||r==s||r==m)){var A=n[o[r]].x,F=n[o[r]].y,u=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,J=void 0,O=void 0,C=void 0,K=void 0,H=void 0,N=void 0,u=B=I=void 0,u=x-z,D=y-v,B=t-x,G=w-y,I=z-t,E=v-w,J=A-t,O=F-w,C=A-z,K=F-v,H=A-x,N=F-y,u=u*K-D*C,I=I*O-E*J,B=B*N-G*H;if(u>=0&&B>=0&&I>=0){n=!1;break a}}n=!0}}if(n){f.push([a[e[i]],
-a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<g;i++,k++)e[i]=e[k];g--;q=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,q,o,l,s,m,p,n=c.glyphs[a]||c.glyphs["?"];if(n){if(n.o){c=n._cachedOutline||(n._cachedOutline=n.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
+j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;l=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(l,s,i,j);if(e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,t=THREE.Shape.Utils.b2(r,q,l,i),r=THREE.Shape.Utils.b2(r,o,s,j);f.push(new THREE.Vector2(t,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,l=c[a++]*b+d,s=c[a++]*-b,m=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,j,l,s,m,p),e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,t=THREE.Shape.Utils.b3(r,q,l,
+m,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),f.push(new THREE.Vector2(t,r))}}}return{offset:n.ha*b,points:f,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var q=2*g;for(k=g-1;g>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var l=i,s=k,m=j,p=g,n=e,r=void 0,t=void 0,w=void 0,
+z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=o[n[l]].x,w=o[n[l]].y,z=o[n[s]].x,v=o[n[s]].y,x=o[n[m]].x,y=o[n[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==l||r==s||r==m)){var A=o[n[r]].x,F=o[n[r]].y,u=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,u=B=I=void 0,u=x-z,D=y-v,B=t-x,G=w-y,I=z-t,E=v-w,K=A-t,O=F-w,C=A-z,L=F-v,H=A-x,M=F-y,u=u*L-D*C,I=I*O-E*K,B=B*M-G*H;if(u>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
+a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;q=2*g}}if(d)return h;return f};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,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
 this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.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 d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}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,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){k.vertexColors=[];for(var j,l,m,o=0;o<4;o++){m=i[o];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[o]=j}}g.push(k);(!e.supportUVs||n.length!=0)&&f.push([n[a],n[b],n[c],n[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},q={},n=[],l,s,m,p,o,r=a.faceVertexUvs[0];l=0;for(s=r.length;l<s;l++){m=0;for(p=r[l].length;m<p;m++)o=d[l]["abcd".charAt(m)],n[o]||(n[o]=r[l][m])}var t;l=0;for(s=d.length;l<s;l++)if(o=d[l],j.push(o.centroid),i.push(new THREE.Vertex(o.centroid)),e.supportUVs&&n.length!=0){t=new THREE.UV;if(o instanceof THREE.Face3)t.u=n[o.a].u+n[o.b].u+n[o.c].u,t.v=n[o.a].v+n[o.b].v+n[o.c].v,t.u/=3,t.v/=3;else if(o instanceof THREE.Face4)t.u=
-n[o.a].u+n[o.b].u+n[o.c].u+n[o.d].u,t.v=n[o.a].v+n[o.b].v+n[o.c].v+n[o.d].v,t.u/=4,t.v/=4;n.push(t)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var w=0,r=h.length,z,v,x={},y={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(l in s){t=s[l];z=l.split("_");v=z[0];z=z[1];A(v,[v,z]);A(z,[v,z]);m=0;for(p=t.length;m<p;m++)o=t[m],F(v,o,l),F(z,o,l);t.length<2&&(q[l]=!0)}for(l in s)if(t=s[l],o=t[0],t=t[1],z=l.split("_"),v=z[0],z=z[1],p=new THREE.Vector3,q[l]?(p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.5)):(p.addSelf(j[o]),p.addSelf(j[t]),p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.25)),
-k[l]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&n.length!=0)t=new THREE.UV,t.u=n[v].u+n[z].u,t.v=n[v].v+n[z].v,t.u/=2,t.v/=2,n.push(t);var u,D;z=["123","12","2","23"];p=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];l=0;for(s=j.length;l<s;l++)o=d[l],t=r+l,o instanceof THREE.Face3?(w=b(o.a,o.b),v=b(o.b,o.c),u=b(o.c,o.a),c(t,k[w],o.b,k[v],o,z),c(t,k[v],o.c,k[u],o,p),c(t,k[u],o.a,k[w],
-o,A)):o instanceof THREE.Face4?(w=b(o.a,o.b),v=b(o.b,o.c),u=b(o.c,o.d),D=b(o.d,o.a),c(t,k[w],o.b,k[v],o,F),c(t,k[v],o.c,k[u],o,B),c(t,k[u],o.d,k[D],o,G),c(t,k[D],o.a,k[w],o,I)):console.log("face should be a face!",o);d=i;i=new THREE.Vector3;k=new THREE.Vector3;l=0;for(s=h.length;l<s;l++)if(x[l]!==void 0){i.set(0,0,0);k.set(0,0,0);o=new THREE.Vector3(0,0,0);t=0;for(m in y[l])i.addSelf(j[m]),t++;w=0;r=x[l].length;for(m=0;m<r;m++)q[b(x[l][m][0],x[l][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
-r;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),k.addSelf(t);k.divideScalar(r);o.addSelf(h[l].position);o.multiplyScalar(r-3);o.addSelf(i);o.addSelf(k.multiplyScalar(2));o.divideScalar(r);d[l].position=o}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,l,m,n=0;n<4;n++){m=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[n]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},o=[],l,s,m,p,n,r=a.faceVertexUvs[0];l=0;for(s=r.length;l<s;l++){m=0;for(p=r[l].length;m<p;m++)n=d[l]["abcd".charAt(m)],o[n]||(o[n]=r[l][m])}var t;l=0;for(s=d.length;l<s;l++)if(n=d[l],k.push(n.centroid),i.push(new THREE.Vertex(n.centroid)),e.supportUVs&&o.length!=0){t=new THREE.UV;if(n instanceof THREE.Face3)t.u=o[n.a].u+o[n.b].u+o[n.c].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v,t.u/=3,t.v/=3;else if(n instanceof THREE.Face4)t.u=
+o[n.a].u+o[n.b].u+o[n.c].u+o[n.d].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v+o[n.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var w=0,r=h.length,z,v,x={},y={},A=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(l in s){t=s[l];z=l.split("_");v=z[0];z=z[1];A(v,[v,z]);A(z,[v,z]);m=0;for(p=t.length;m<p;m++)n=t[m],F(v,n,l),F(z,n,l);t.length<2&&(q[l]=!0)}for(l in s)if(t=s[l],n=t[0],t=t[1],z=l.split("_"),v=z[0],z=z[1],p=new THREE.Vector3,q[l]?(p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.5)):(p.addSelf(k[n]),p.addSelf(k[t]),p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.25)),
+j[l]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[v].u+o[z].u,t.v=o[v].v+o[z].v,t.u/=2,t.v/=2,o.push(t);var u,D;z=["123","12","2","23"];p=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];l=0;for(s=k.length;l<s;l++)n=d[l],t=r+l,n instanceof THREE.Face3?(w=b(n.a,n.b),v=b(n.b,n.c),u=b(n.c,n.a),c(t,j[w],n.b,j[v],n,z),c(t,j[v],n.c,j[u],n,p),c(t,j[u],n.a,j[w],
+n,A)):n instanceof THREE.Face4?(w=b(n.a,n.b),v=b(n.b,n.c),u=b(n.c,n.d),D=b(n.d,n.a),c(t,j[w],n.b,j[v],n,F),c(t,j[v],n.c,j[u],n,B),c(t,j[u],n.d,j[D],n,G),c(t,j[D],n.a,j[w],n,I)):console.log("face should be a face!",n);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(s=h.length;l<s;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);n=new THREE.Vector3(0,0,0);t=0;for(m in y[l])i.addSelf(k[m]),t++;w=0;r=x[l].length;for(m=0;m<r;m++)q[b(x[l][m][0],x[l][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
+r;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);n.addSelf(h[l].position);n.multiplyScalar(r-3);n.addSelf(i);n.addSelf(j.multiplyScalar(2));n.divideScalar(r);d[l].position=n}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;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 d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;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)==
@@ -199,66 +200,66 @@ a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse);
 else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),q=e.color;h=e.specular;i=e.ambient;var n=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
-e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(q);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=n;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};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(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),q=e.color;h=e.specular;i=e.ambient;var o=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
+e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(q);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=o;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};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,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHttpRequest,e=b+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?g&&(h==0&&(h=f.getResponseHeader("Content-Length")),g({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",e,!0);
 f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function j(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,k));g.push(o)}}
-function k(b,c){var d,e,f,g,h,i,j,k,l,o,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];o=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,o));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function n(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function l(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=o[e];var n=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];o=d[e*4+2];n=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[o*3],v=r[o*3+1];o=r[o*3+2];var w=r[n*3],x=r[n*3+1];n=r[n*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
-3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,v,o),new THREE.Vector3(w,x,n)],null,j))}}var m=this,p=0,o,r=[],t=[],w,z,v,x,y,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);o={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
-p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};o.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=o.header_bytes;b=o.vertex_index_bytes*3+o.material_index_bytes;A=o.vertex_index_bytes*
-4+o.material_index_bytes;w=o.ntri_flat*b;z=o.ntri_smooth*(b+o.normal_index_bytes*3);v=o.ntri_flat_uv*(b+o.uv_index_bytes*3);x=o.ntri_smooth_uv*(b+o.normal_index_bytes*3+o.uv_index_bytes*3);y=o.nquad_flat*A;b=o.nquad_smooth*(A+o.normal_index_bytes*4);A=o.nquad_flat_uv*(A+o.uv_index_bytes*4);p+=function(b){var c=o.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
-p+=function(b){var c=o.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(o.nnormals*3);p+=function(b){var c=o.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(o.ntri_flat*2);z=w+z+c(o.ntri_smooth*2);v=z+v+c(o.ntri_flat_uv*2);x=v+x+c(o.ntri_smooth_uv*2);y=x+y+c(o.nquad_flat*2);
-b=y+b+c(o.nquad_smooth*2);A=b+A+c(o.nquad_flat_uv*2);(function(a){var b=o.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,c)}})(z);(function(a){var b=o.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,d)}})(v);(function(a){var b=o.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
-c)}})(b);(function(a){var b=o.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(A);(function(a){var b=o.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=o.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=o.nquad_flat;b&&n(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-o.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(y);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.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
+function j(b,c){var d,e,f,g,h,i,j,k,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function l(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var o=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[n*3],v=r[n*3+1];n=r[n*3+2];var w=r[o*3],x=r[o*3+1];o=r[o*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
+3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,v,n),new THREE.Vector3(w,x,o)],null,j))}}var m=this,p=0,n,r=[],t=[],w,z,v,x,y,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);n={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
+p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};n.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=n.header_bytes;b=n.vertex_index_bytes*3+n.material_index_bytes;A=n.vertex_index_bytes*
+4+n.material_index_bytes;w=n.ntri_flat*b;z=n.ntri_smooth*(b+n.normal_index_bytes*3);v=n.ntri_flat_uv*(b+n.uv_index_bytes*3);x=n.ntri_smooth_uv*(b+n.normal_index_bytes*3+n.uv_index_bytes*3);y=n.nquad_flat*A;b=n.nquad_smooth*(A+n.normal_index_bytes*4);A=n.nquad_flat_uv*(A+n.uv_index_bytes*4);p+=function(b){var c=n.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
+p+=function(b){var c=n.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(n.nnormals*3);p+=function(b){var c=n.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(n.ntri_flat*2);z=w+z+c(n.ntri_smooth*2);v=z+v+c(n.ntri_flat_uv*2);x=v+x+c(n.ntri_smooth_uv*2);y=x+y+c(n.nquad_flat*2);
+b=y+b+c(n.nquad_smooth*2);A=b+A+c(n.nquad_flat_uv*2);(function(a){var b=n.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=n.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(v);(function(a){var b=n.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=n.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=n.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=n.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=n.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+n.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(y);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,d,g){P=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=c("//dae:library_images/dae:image",e,"image");$=c("//dae:library_materials/dae:material",y,"material");aa=c("//dae:library_effects/dae:effect",B,"effect");S=c("//dae:library_geometries/dae:geometry",p,"geometry");R=c("//dae:library_controllers/dae:controller",h,"controller");U=c("//dae:library_animations/dae:animation",I,"animation");ba=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(f(T.nodes[a]));b();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(f(T.nodes[a]));b();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];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 d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
 THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=R[c.url];if(!f||!f.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=T.getChildById(c.skeleton[0],!0)||T.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var o=[],n=[];for(h=0;h<a.vertices.length;h++)n.push(new THREE.Vertex(new THREE.Vector3));d(c,o,e);h=o;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<o.length;h++)if(o[h].type=="JOINT")for(i=0;i<o[h].weights.length;i++)j=o[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=n[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,o[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:n})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=R[a.controllers[e].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=R[a.controllers[e].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
 new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=S[i.url],k={},o=0,n;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){n=j[h];var p=aa[$[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=k[n.symbol]=p.material;o++}j=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)o=
-i.faces[h],o.materials=[k[o.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(o=0;o<k.targets.length;o++)if(p=S[k.targets[o]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=S[i.url],k={},n=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=aa[$[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;n++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)n=
+i.faces[h],n.materials=[k[n.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(n=0;n<k.targets.length;n++)if(p=S[k.targets[n]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function l(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function o(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function v(){this.semantic=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function l(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function n(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function v(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function y(){this.name=this.id="";this.instance_effect=null}function A(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
-if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function K(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function M(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 Q(a,b){var c="";c+=M(a.x,b)+",";c+=M(a.y,b)+",";c+=M(a.z,b);return c}var P=null,Y=null,T,ca=null,V={},Z={},U={},R={},S={},$={},aa={},ba,da,W,X,ea=THREE.SmoothShading;e.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};h.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 j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
+if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(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 Q(a,b){var c="";c+=N(a.x,b)+",";c+=N(a.y,b)+",";c+=N(a.z,b);return c}var P=null,Y=null,T,ca=null,V={},Z={},U={},R={},S={},$={},aa={},ba,da,W,X,ea=THREE.SmoothShading;e.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};h.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 k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new v).parse(d))}}return b};
-j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=K(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new v).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new v).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var o=e[l],m=c[g+o.offset];switch(o.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[o.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.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 q).parse(c))}}return this};q.prototype.getChannelForTransform=
+k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=L(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new v).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new v).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.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 q).parse(c))}}return this};q.prototype.getChannelForTransform=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.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};q.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 q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new l).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.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};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=K(a.textContent);this.updateMatrix();return this};n.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;
+this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};o.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};l.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=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.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=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).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 o(this)).parse(c)}}return this};o.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
+(new n(this)).parse(c)}}return this};n.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};o.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,o=0,m=3,n=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":n.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(m=a.vcount[o++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=Q(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<n.length;f++)e=s[n[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*m}};r.prototype=new t;r.prototype.constructor=r;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=L(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 v).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;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 "bool_array":for(var d=N(c.textContent).split(/\s+/),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
+return this};n.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=Q(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*m}};r.prototype=new t;r.prototype.constructor=r;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=J(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 v).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=J(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=J(a,"set",-1);this.offset=J(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;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 "bool_array":for(var d=M(c.textContent).split(/\s+/),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
 x.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),d=new THREE.Matrix4;d.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(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};y.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 G).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.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=K(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+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 G).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.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 d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=Z[this.effect.surface.init_from]))a.map=
 THREE.ImageUtils.loadTexture(da+d.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=d.color.getHex():b||(a[c]=d.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=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
@@ -266,57 +267,57 @@ if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textConten
 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};B.prototype.create=function(){if(this.shader==null)return null};B.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};
 B.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};B.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};B.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 F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.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 x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.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,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};J.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 v).parse(c))}}return this};
-J.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=
+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 x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new K(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.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,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};K.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 v).parse(c))}}return this};
+K.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 d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
 200))ca=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:g,geometries:S}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,j,k,q,n,l,s,m,p,o,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=q.length;j<
-k;)n=new THREE.Vertex,n.position.x=q[j++]*b,n.position.y=q[j++]*b,n.position.z=q[j++]*b,d.vertices.push(n);j=0;for(k=w.length;j<k;){b=w[j++];q=b&1;i=b&2;c=b&4;g=b&8;l=b&16;n=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[j++],p.b=w[j++],p.c=w[j++],p.d=w[j++],q=4):(p=new THREE.Face3,p.a=w[j++],p.b=w[j++],p.c=w[j++],q=3);if(i)i=w[j++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)o=a.uvs[c],s=w[j++],t=o[s*2],s=o[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){o=a.uvs[c];r=[];
-for(g=0;g<q;g++)s=w[j++],t=o[s*2],s=o[s*2+1],r[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(l)l=w[j++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.normal=g;if(n)for(c=0;c<q;c++)l=w[j++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.vertexNormals.push(g);if(m)n=w[j++],n=new THREE.Color(v[n]),p.color=n;if(b)for(c=0;c<q;c++)n=w[j++],n=new THREE.Color(v[n]),p.vertexColors.push(n);d.faces.push(p)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,j,k,q,n,l,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
-s=a.morphTargets[c].vertices;i=0;for(j=s.length;i<j;i+=3)k=s[i]*b,q=s[i+1]*b,n=s[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(k,q,n)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(k[b],k[b+1],k[b+2]),j.push(q)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,q,o,l,s,m,p,n,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
+j;)o=new THREE.Vertex,o.position.x=q[k++]*b,o.position.y=q[k++]*b,o.position.z=q[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;g=b&8;l=b&16;o=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],q=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],q=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)n=a.uvs[c],s=w[k++],t=n[s*2],s=n[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){n=a.uvs[c];r=[];
+for(g=0;g<q;g++)s=w[k++],t=n[s*2],s=n[s*2+1],r[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(l)l=w[k++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.normal=g;if(o)for(c=0;c<q;c++)l=w[k++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.vertexNormals.push(g);if(m)o=w[k++],o=new THREE.Color(v[o]),p.color=o;if(b)for(c=0;c<q;c++)o=w[k++],o=new THREE.Color(v[o]),p.vertexColors.push(o);d.faces.push(p)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,j,q,o,l,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,q=s[i+1]*b,o=s[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(j,q,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function g(){var a;for(n in B.objects)if(!C.objects[n])if(o=B.objects[n],o.geometry!==void 0){if(A=C.geometries[o.geometry]){a=!1;for(H=0;H<o.materials.length;H++)D=C.materials[o.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=o.position;z=o.rotation;v=o.quaternion;x=o.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(A,D);a.name=n;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=o.visible;C.scene.add(a);C.objects[n]=a;if(o.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(o.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;o.trigger&&o.trigger.toLowerCase()!="none"&&(b=
-{type:o.trigger,object:o},C.triggers[a.name]=b)}}else w=o.position,z=o.rotation,v=o.quaternion,x=o.scale,v=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=o.visible!==void 0?o.visible:!1,C.scene.add(a),C.objects[n]=a,C.empties[n]=a,o.trigger&&o.trigger.toLowerCase()!="none"&&(b={type:o.trigger,object:o},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
-b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:J,totalTextures:O,loadedModels:J-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,j=THREE.Loader.prototype.extractUrlbase(b),k,q,n,l,s,m,p,o,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,J,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(n in B.objects)if(o=B.objects[n],o.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var K=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);K&&C.scene.scale.set(K[0],K[1],K[2]);(a||r||K)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(o in B.objects)if(!C.objects[o])if(n=B.objects[o],n.geometry!==void 0){if(A=C.geometries[n.geometry]){a=!1;for(H=0;H<n.materials.length;H++)D=C.materials[n.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=n.position;z=n.rotation;v=n.quaternion;x=n.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=n.visible;C.scene.add(a);C.objects[o]=a;if(n.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(n.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;n.trigger&&n.trigger.toLowerCase()!="none"&&(b=
+{type:n.trigger,object:n},C.triggers[a.name]=b)}}else w=n.position,z=n.rotation,v=n.quaternion,x=n.scale,v=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=n.visible!==void 0?n.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,n.trigger&&n.trigger.toLowerCase()!="none"&&(b={type:n.trigger,object:n},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
+b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,l,s,m,p,n,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(o in B.objects)if(n=B.objects[o],n.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
 r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(l in B.lights)r=B.lights[l],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance,
 t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[l]=t;for(m in B.fogs)l=B.fogs[m],l.type=="linear"?u=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(u=new THREE.FogExp2(0,l.density)),r=l.color,u.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];r=B.defaults.bgcolor;C.bgColor=new THREE.Color;
-C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(k in B.geometries)if(m=B.geometries[k],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();J=I;for(k in B.geometries)m=B.geometries[k],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[k]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[k]=A):m.type=="sphere"?
-(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[k]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[k]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[k]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[k]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(k)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
-f(k)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(k),"");for(p in B.textures)if(k=B.textures[p],k.url instanceof Array){E+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){k=B.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var H=0;H<k.url.length;H++)m[H]=d(k.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,
-B.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){u={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(u[k.wrap[0]]!==void 0)m.wrapS=u[k.wrap[0]];if(u[k.wrap[1]]!==void 0)m.wrapT=
-u[k.wrap[1]]}}C.textures[p]=m}for(q in B.materials){p=B.materials[q];for(y in p.parameters)if(y=="envMap"||y=="map"||y=="lightMap")p.parameters[y]=C.textures[p.parameters[y]];else if(y=="shading")p.parameters[y]=p.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")p.parameters[y]=THREE[p.parameters[y]]?THREE[p.parameters[y]]:THREE.NormalBlending;else if(y=="combine")p.parameters[y]=p.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(y==
-"vertexColors")if(p.parameters[y]=="face")p.parameters[y]=THREE.FaceColors;else if(p.parameters[y])p.parameters[y]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=p.parameters.color;u=p.parameters.specular;b=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=C.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
-p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=C.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(u);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[q]=p}g();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
+(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
+f(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
+B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){u={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(u[j.wrap[0]]!==void 0)m.wrapS=u[j.wrap[0]];if(u[j.wrap[1]]!==void 0)m.wrapT=
+u[j.wrap[1]]}}C.textures[p]=m}for(q in B.materials){p=B.materials[q];for(y in p.parameters)if(y=="envMap"||y=="map"||y=="lightMap")p.parameters[y]=C.textures[p.parameters[y]];else if(y=="shading")p.parameters[y]=p.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")p.parameters[y]=THREE[p.parameters[y]]?THREE[p.parameters[y]]:THREE.NormalBlending;else if(y=="combine")p.parameters[y]=p.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(y==
+"vertexColors")if(p.parameters[y]=="face")p.parameters[y]=THREE.FaceColors;else if(p.parameters[y])p.parameters[y]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=p.parameters.color;u=p.parameters.specular;b=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=C.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
+p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=C.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(u);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[q]=p}g();i.callbackSync(C);h()};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 d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,f,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.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),d=1,g=0;g<8;g++){for(var f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,p,o=a.length;i<o;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*b,k=k/16383*b,p=p/16383*b,j+=d,k+=g,p+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,t,w,z=a.length;for(b=0;b<z;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;r=d;var v=e,x=f,y=g.materials[0],A=j[v*3],F=j[v*3+1],v=j[v*3+2],u=j[x*3],D=j[x*3+1],x=j[x*3+2];r=new THREE.Vector3(j[r*3],j[r*3+1],j[r*3+2]);v=new THREE.Vector3(A,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[r,v,x],null,y));g=k[d*2];d=k[d*2+
-1];i=k[e*2];r=k[e*2+1];t=k[f*2];w=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,w));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,p,n=a.length;i<n;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*b,k=k/16383*b,p=p/16383*b,j+=d,k+=g,p+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(e[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,t,w,z=a.length;for(b=0;b<z;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;r=d;var v=e,x=f,y=g.materials[0],A=k[v*3],F=k[v*3+1],v=k[v*3+2],u=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);v=new THREE.Vector3(A,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[r,v,x],null,y));g=j[d*2];d=j[d*2+
+1];i=j[e*2];r=j[e*2+1];t=j[f*2];w=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,w));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 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,f,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=j;g[f]=this.lerp(k[a],k[a+3],e);g[f+1]=this.lerp(k[a+1],k[a+4],e);g[f+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
-2]=j;c=a+this.yd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=j+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[c+2],e)};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,f,e,h){var i=f+1,j=f+this.yd,k=f+this.zd,q=i+this.yd,n=i+this.zd,l=f+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[f],o=this.field[i],r=this.field[j],t=this.field[q],w=this.field[k],z=this.field[n],v=this.field[l],x=this.field[s];p<e&&(m|=1);o<e&&(m|=2);r<e&&(m|=8);t<e&&(m|=4);w<e&&(m|=16);z<e&&(m|=32);v<e&&(m|=128);x<e&&(m|=64);var y=THREE.edgeTable[m];if(y===0)return 0;
-var A=this.delta,F=a+A,u=c+A,A=g+A;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,o));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,o,t));y&4&&(this.compNorm(j),this.compNorm(q),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,g,r,t));y&8&&(this.compNorm(f),this.compNorm(j),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,r));y&16&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,w,z));
-y&32&&(this.compNorm(n),this.compNorm(s),this.VIntY(n*3,this.vlist,this.nlist,15,e,F,c,A,z,x));y&64&&(this.compNorm(l),this.compNorm(s),this.VIntX(l*3,this.vlist,this.nlist,18,e,a,u,A,v,x));y&128&&(this.compNorm(k),this.compNorm(l),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,w,v));y&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,o,z));y&1024&&(this.compNorm(q),
-this.compNorm(s),this.VIntZ(q*3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(j),this.compNorm(l),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,g,r,v));m<<=4;for(e=f=0;THREE.triTable[m+e]!=-1;)a=m+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+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,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
+2]=k;c=a+this.yd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};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,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,q=i+this.yd,o=i+this.zd,l=f+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[f],n=this.field[i],r=this.field[k],t=this.field[q],w=this.field[j],z=this.field[o],v=this.field[l],x=this.field[s];p<e&&(m|=1);n<e&&(m|=2);r<e&&(m|=8);t<e&&(m|=4);w<e&&(m|=16);z<e&&(m|=32);v<e&&(m|=128);x<e&&(m|=64);var y=THREE.edgeTable[m];if(y===0)return 0;
+var A=this.delta,F=a+A,u=c+A,A=g+A;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,n));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,n,t));y&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,u,g,r,t));y&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,r));y&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,A,w,z));
+y&32&&(this.compNorm(o),this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,e,F,c,A,z,x));y&64&&(this.compNorm(l),this.compNorm(s),this.VIntX(l*3,this.vlist,this.nlist,18,e,a,u,A,v,x));y&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,A,w,v));y&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,n,z));y&1024&&(this.compNorm(q),
+this.compNorm(s),this.VIntZ(q*3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,u,g,r,v));m<<=4;for(e=f=0;THREE.triTable[m+e]!=-1;)a=m+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(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,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,j=c*this.size,k=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var l=Math.floor(k-h);l<1&&(l=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var s,m,p,o,r,t;q<i;q++){k=this.size2*q;m=q/this.size-g;r=m*m;for(m=n;m<j;m++){p=k+this.size*m;s=m/this.size-c;t=s*s;for(s=l;s<h;s++)o=s/this.size-a,o=f/(1.0E-6+o*o+t+r)-e,o>0&&(this.field[p+s]+=o)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,j=this.size,k=this.yd,q=this.zd,n=this.field,l=j*Math.sqrt(a/c);l>j&&(l=j);for(g=0;g<l;g++)if(f=g/j,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<j;f++){i=g+f*k;for(e=0;e<j;e++)n[q*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
-i,j,k=this.size,q=this.yd,n=this.zd,l=this.field,s=k*Math.sqrt(a/c);s>k&&(s=k);for(f=0;f<s;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*q;for(g=0;g<k;g++){j=i+g;for(e=0;e<k;e++)l[n*e+j]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,j,k=this.size,q=this.yd,n=this.zd,l=this.field,s=k*Math.sqrt(a/c);s>k&&(s=k);for(e=0;e<s;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=n*e;for(f=0;f<k;f++){j=i+f*q;for(g=0;g<k;g++)l[j+g]+=h}}};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,f,e,h,i,j,k,q,n=this.size-2;for(e=1;e<n;e++){q=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<n;f++){k=q+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<n;g++)h=(g-this.halfsize)/this.halfsize,c=k+g,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,j,k,q,n,l;for(e=0;e<f.count;e++)n=e*3,k=n+1,l=n+2,h=f.positionArray[n],
-i=f.positionArray[k],j=f.positionArray[l],q=new THREE.Vector3(h,i,j),h=f.normalArray[n],i=f.normalArray[k],j=f.normalArray[l],n=new THREE.Vector3(h,i,j),n.normalize(),k=new THREE.Vertex(q),c.vertices.push(k),g.push(n);q=f.count/3;for(e=0;e<q;e++)n=(a+e)*3,k=n+1,l=n+2,h=g[n],i=g[k],j=g[l],n=new THREE.Face3(n,k,l,[h,i,j]),c.faces.push(n);a+=q;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);
+h>this.size-1&&(h=this.size-1);for(var s,m,p,n,r,t;q<i;q++){j=this.size2*q;m=q/this.size-g;r=m*m;for(m=o;m<k;m++){p=j+this.size*m;s=m/this.size-c;t=s*s;for(s=l;s<h;s++)n=s/this.size-a,n=f/(1.0E-6+n*n+t+r)-e,n>0&&(this.field[p+s]+=n)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,l=k*Math.sqrt(a/c);l>k&&(l=k);for(g=0;g<l;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)o[q*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
+i,k,j=this.size,q=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(f=0;f<s;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*q;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)l[o*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,q=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(e=0;e<s;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<j;f++){k=i+f*q;for(g=0;g<j;g++)l[k+g]+=h}}};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,f,e,h,i,k,j,q,o=this.size-2;for(e=1;e<o;e++){q=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){j=q+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=j+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,k,j,q,o,l;for(e=0;e<f.count;e++)o=e*3,j=o+1,l=o+2,h=f.positionArray[o],
+i=f.positionArray[j],k=f.positionArray[l],q=new THREE.Vector3(h,i,k),h=f.normalArray[o],i=f.normalArray[j],k=f.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(q),c.vertices.push(j),g.push(o);q=f.count/3;for(e=0;e<q;e++)o=(a+e)*3,j=o+1,l=o+2,h=g[o],i=g[j],k=g[l],o=new THREE.Face3(o,j,l,[h,i,k]),c.faces.push(o);a+=q;f.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,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -345,20 +346,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,d,g,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>f?this.hits.push(g):this.hits.unshift(g),f=d;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 d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.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),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,k=c.mesh.geometry.vertices[e.c].position,j=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,k,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,f,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;f.set(0,0,0);h.sub(b,c);i.sub(d,b);f.cross(h,i);h=f.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)f.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=f.dot(c)-f.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)>
 Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-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 d=0,g=0,f=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-j=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;g>d&&(j=1,d=g);f>d&&(j=2,d=f);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>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 d=0,g=0,f=0,e=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+k=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);f>d&&(k=2,d=f);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-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 d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-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,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
-1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:l}},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}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);n.width=a;n.height=d;l.width=a;l.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||q!==b.fov){i=b.aspect;j=b.near;k=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*j/125,z=j*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*j/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11=
-2*j/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,n,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,l,!0);m.updateMatrixWorld();d.call(c,m,s)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:l}},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}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11=
+2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,l,!0);m.updateMatrixWorld();d.call(c,m,s)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
 b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};

+ 57 - 57
build/custom/ThreeWebGL.js

@@ -233,63 +233,63 @@ d.getUniformLocation(w.program,"screenPosition");w.uniforms.modelViewMatrix=d.ge
 Ga._shadowPass=!0;Na._shadowPass=!0})();this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){ma.width=a;ma.height=b;this.setViewport(0,0,ma.width,ma.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ha=c;Da=e;d.viewport(Pa,Qa,Ha,Da)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};
 this.setClearColorHex=function(a,b){Q.setHex(a);S=b;d.clearColor(Q.r,Q.g,Q.b,S)};this.setClearColor=function(a,b){Q.copy(a);S=b;d.clearColor(Q.r,Q.g,Q.b,S)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){pa(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer);
-d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
-d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,C=a.lights,u=a.fog;na=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);D.info.render.calls=0;D.info.render.vertices=0;D.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(Ka);b.projectionMatrix.flattenToArray(La);za.multiply(b.projectionMatrix,b.matrixWorldInverse);i(za);pa(c);(this.autoClear||e)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);qa(q,b,!0);var k=g,m=k.object,y=k.buffer,x=void 0,x=x=void 0,x=m.material;if(x instanceof THREE.MeshFaceMaterial){if(x=y.materialIndex,x>=0)x=m.geometry.materials[x],x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null)}else if(x)x.transparent?
-(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(r);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),qa(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(M(a.overrideMaterial.blending),
-ia(a.overrideMaterial.depthTest),ka(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,C,u,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,C,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),j(a.__webglObjects,!0,"opaque",b,C,u,!1),n(a.__webglObjectsImmediate,"opaque",b,C,u,!1),j(a.__webglObjects,!1,"transparent",b,C,u,!0),n(a.__webglObjectsImmediate,"transparent",b,C,u,
-!0));if(a.__webglSprites.length){q=w.attributes;C=w.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(w.program);ra=w.program;sa=wa=ya=-1;Va||(d.enableVertexAttribArray(w.attributes.position),d.enableVertexAttribArray(w.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,w.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,w.elementBuffer);
-d.uniformMatrix4fv(C.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(C.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(r);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&
-(m.useScreenCoordinates?(d.uniform1i(C.useScreenCoordinates,1),d.uniform3f(C.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(C.useScreenCoordinates,0),d.uniform1i(C.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(C.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Da:1),e[0]=b*u*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(C.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(C.uvOffset,m.uvOffset.x,m.uvOffset.y),
-d.uniform2f(C.alignment,m.alignment.x,m.alignment.y),d.uniform1f(C.opacity,m.opacity),d.uniform3f(C.color,m.color.r,m.color.g,m.color.b),d.uniform1f(C.rotation,m.rotation),d.uniform2fv(C.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),M(m.blending),oa(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Oa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
-(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,i=void 0,h=void 0,j=void 0;if(!f.__webglInit)if(f.__webglInit=
-!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var j=h,q=void 0,l=void 0,n=void 0,r=void 0,k=void 0,m=void 0,p=void 0,x={},w=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)n=j.faces[q],r=n.materialIndex,m=r!==void 0?r:-1,x[m]===void 0&&
-(x[m]={hash:m,counter:0}),p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w}),k=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(x[m].counter+=1,p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w})),n instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),
-j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=Ea++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();
-q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){n=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(n=q.numMorphTargets;l<n;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}D.info.memory.geometries++;r=f;k=r.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;n=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(r,
-j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;x=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;w=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(x)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=new Float32Array(q*4);if(w)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
-0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(n*3);j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];r=0;for(k=j.numMorphTargets;r<k;r++)j.__morphTargetsArrays.push(new Float32Array(q*
-3))}j.__needsSmoothNormals=x===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=w;j.__normalType=x;j.__webglFaceCount=n*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var r=l.attributes[n],k={},F;for(F in r)k[F]=r[F];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*
-m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=n,r.needsUpdate=!0,k.__original=r;j.__webglCustomAttributesList.push(k)}}j.__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(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=j.vertices.length,
-j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
-THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],y(g.__webglObjects,j,f);else f instanceof
-THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,y(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof
-THREE.Ribbon||f instanceof THREE.Line)I(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&I(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(F=a.__webglObjects[f].object,i=F.geometry,h=n=l=void 0,F instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],
-h=c(F,l),n=h.attributes&&u(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||n)if(n=d.DYNAMIC_DRAW,r=!i.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,G=void 0,L=void 0,v=void 0,Z=void 0,$=void 0,X=void 0,P=void 0,R=E=L=void 0,z=void 0,A=void 0,B=void 0,Y=s=void 0,aa=void 0,T=s=$=P=void 0,U=void 0,M=B=A=z=v=void 0,J=s=B=A=z=M=B=A=z=M=B=A=z=void 0,W=void 0,N=L=void 0,S=void 0,V=void 0,ca=void 0,da=void 0,H=R=V=
-W=0,Q=0,ba=J=E=0,O=v=Y=0,t=0,ea=void 0,O=l.__vertexArray,S=l.__uvArray,t=l.__uv2Array,N=l.__normalArray,G=l.__tangentArray,aa=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,Z=l.__skinIndexArray,ga=l.__skinWeightArray,M=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,o=void 0,o=l.__faceArray,ea=l.__lineArray,ha=l.__needsSmoothNormals,P=l.__vertexColorType,X=l.__uvType,L=l.__normalType,$=F.geometry,ia=$.__dirtyElements,ka=$.__dirtyUvs,pa=$.__dirtyNormals,qa=$.__dirtyTangents,ta=
-$.__dirtyColors,ca=$.__dirtyMorphTargets,da=$.vertices,x=l.faces3,w=l.faces4,fa=$.faces,oa=$.faceVertexUvs[0],ra=$.faceVertexUvs[1],ja=$.skinVerticesA,la=$.skinVerticesB,ma=$.skinIndices,na=$.skinWeights,sa=$.morphTargets;if($.__dirtyVertices){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=da[s.a].position,A=da[s.b].position,B=da[s.c].position,O[V]=z.x,O[V+1]=z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,V+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=da[s.a].position,A=da[s.b].position,
-B=da[s.c].position,s=da[s.d].position,O[V]=z.x,O[V+1]=z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,O[V+9]=s.x,O[V+10]=s.y,O[V+11]=s.z,V+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,O,n)}if(ca){V=0;for(ca=sa.length;V<ca;V++){k=O=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+
-5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,O+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,s=sa[V].vertices[s.d].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,da[O+9]=s.x,da[O+10]=s.y,da[O+11]=s.z,O+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[V]);d.bufferData(d.ARRAY_BUFFER,M[V],n)}}if(na.length){k=0;for(m=x.length;k<
-m;k++)s=fa[x[k]],z=na[s.a],A=na[s.b],B=na[s.c],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+
-11]=1,z=la[s.a],A=la[s.b],B=la[s.c],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,v+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=na[s.a],A=na[s.b],B=na[s.c],M=na[s.d],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,ga[v+12]=M.x,ga[v+13]=M.y,ga[v+14]=M.z,ga[v+15]=M.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],M=ma[s.d],Z[v]=z.x,Z[v+1]=z.y,
-Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,Z[v+12]=M.x,Z[v+13]=M.y,Z[v+14]=M.z,Z[v+15]=M.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],M=ja[s.d],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,T[v+12]=M.x,T[v+13]=M.y,T[v+14]=M.z,T[v+15]=1,z=la[s.a],A=la[s.b],B=la[s.c],s=la[s.d],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=
-B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,U[v+12]=s.x,U[v+13]=s.y,U[v+14]=s.z,U[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,Z,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,n))}if(ta&&P){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],
-v=s.vertexColors,Z=s.color,v.length===3&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2]):U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,Y+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],v=s.vertexColors,Z=s.color,v.length===4&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2],v=v[3]):v=U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,aa[Y+9]=v.r,aa[Y+10]=v.g,aa[Y+11]=v.b,Y+=12;Y>0&&
-(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,aa,n))}if(qa&&$.hasTangents){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,J+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],$=$[3],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,
-G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,G[J+12]=$.x,G[J+13]=$.y,G[J+14]=$.z,G[J+15]=$.w,J+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,G,n)}if(pa&&L){k=0;for(m=x.length;k<m;k++)if(s=fa[x[k]],G=s.vertexNormals,L=s.normal,G.length===3&&ha)for(J=0;J<3;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<3;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;k=0;for(m=w.length;k<m;k++)if(s=fa[w[k]],G=s.vertexNormals,L=s.normal,G.length===4&&ha)for(J=0;J<4;J++)L=
-G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<4;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,N,n)}if(ka&&oa&&X){k=0;for(m=x.length;k<m;k++)if(E=x[k],E=oa[E],E!==void 0)for(J=0;J<3;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;k=0;for(m=w.length;k<m;k++)if(E=w[k],E=oa[E],E!==void 0)for(J=0;J<4;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;R>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,S,n))}if(ka&&ra&&
-X){k=0;for(m=x.length;k<m;k++)if(E=x[k],R=ra[E],R!==void 0)for(J=0;J<3;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;k=0;for(m=w.length;k<m;k++)if(E=w[k],R=ra[E],R!==void 0)for(J=0;J<4;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;H>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,n))}if(ia){k=0;for(m=x.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+2,Q+=3,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+2,ea[ba+4]=W+1,ea[ba+5]=W+2,ba+=6,W+=3;k=0;for(m=w.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=
-W+3,o[Q+3]=W+1,o[Q+4]=W+2,o[Q+5]=W+3,Q+=6,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+3,ea[ba+4]=W+1,ea[ba+5]=W+2,ea[ba+6]=W+2,ea[ba+7]=W+3,ba+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,o,n);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,n)}if(p){J=0;for(W=p.length;J<W;J++)if(o=p[J],o.__original.needsUpdate){t=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<
-m;k++)s=fa[x[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],t+=3;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],o.array[t+3]=o.value[s.d],t+=4}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)ea=o.value[x[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,t+=3;k=0;for(m=w.length;k<m;k++)ea=o.value[w[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,o.array[t+3]=ea,t+=4}}else if(o.size===2)if(o.boundTo===
-void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<
-m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}}else if(o.size===3)if(H=o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],
-B=o.value[s.c],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+
-9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],
-o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=
-w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}else if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+
-3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,
-o.buffer);d.bufferData(d.ARRAY_BUFFER,o.array,n)}}r&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=
-!1;h.attributes&&K(h)}else if(F instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;F=d.DYNAMIC_DRAW;k=j=k=r=r=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;x=h.__vertexArray;n=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<p;r++)k=m[r].position,j=r*3,x[j]=k.x,x[j+1]=k.y,x[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,F)}if(w){for(r=0;r<l;r++)k=q[r],j=r*3,n[j]=k.r,n[j+1]=k.g,n[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,
-h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,n,F)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(F instanceof THREE.Line){h=c(F,l);n=h.attributes&&u(h);if(i.__dirtyVertices||i.__dirtyColors||n){F=i;j=d.DYNAMIC_DRAW;p=q=W=m=fa=void 0;m=F.vertices;l=F.colors;p=m.length;n=l.length;x=F.__vertexArray;r=F.__colorArray;w=F.__dirtyColors;k=F.__webglCustomAttributesList;R=ba=Q=H=W=fa=void 0;if(F.__dirtyVertices){for(fa=0;fa<p;fa++)W=m[fa].position,q=fa*3,x[q]=W.x,x[q+1]=W.y,x[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,
-F.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,j)}if(w){for(m=0;m<n;m++)p=l[m],q=m*3,r[q]=p.r,r[q+1]=p.g,r[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,F.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,j)}if(k){fa=0;for(W=k.length;fa<W;fa++)if(R=k[fa],R.needsUpdate&&(R.boundTo===void 0||R.boundTo==="vertices")){q=0;Q=R.value.length;if(R.size===1)for(H=0;H<Q;H++)R.array[H]=R.value[H];else if(R.size===2)for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,q+=2;else if(R.size===3)if(R.type===
-"c")for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.r,R.array[q+1]=ba.g,R.array[q+2]=ba.b,q+=3;else for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,q+=3;else if(R.size===4)for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,R.array[q+3]=ba.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.array,j)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;h.attributes&&K(h)}else if(F instanceof THREE.ParticleSystem)h=c(F,l),n=h.attributes&&
-u(h),(i.__dirtyVertices||i.__dirtyColors||F.sortParticles||n)&&e(i,d.DYNAMIC_DRAW,F),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&K(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&
-(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var n,k,m;n=m=j=0;for(k=b.length;n<k;n++)h=b[n],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=la?n=m:(n=Math.ceil(la*m/(j+m)),j=la-n);h={directional:n,point:j};j=m=0;for(n=b.length;j<n;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&
-e instanceof THREE.SkinnedMesh)r=e.bones.length;var p;a:{n=a.fragmentShader;k=a.vertexShader;var j=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:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,
-shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,e=[];i?e.push(i):(e.push(n),e.push(k));for(u in c)e.push(u),e.push(c[u]);i=e.join();u=0;for(e=ca.length;u<e;u++)if(ca[u].code===i){p=ca[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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.perPixel?"#define PHONG_PER_PIXEL":"",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");
+d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);if(c.__webglCustomAttributesList)for(e in e=void 0,c.__webglCustomAttributesList)d.deleteBuffer(c.__webglCustomAttributesList[e].buffer);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
+d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=
+function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,C=a.lights,u=a.fog;na=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);D.info.render.calls=0;D.info.render.vertices=0;D.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(Ka);
+b.projectionMatrix.flattenToArray(La);za.multiply(b.projectionMatrix,b.matrixWorldInverse);i(za);pa(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);qa(q,b,!0);var k=g,m=k.object,y=k.buffer,x=void 0,x=x=void 0,x=m.material;if(x instanceof THREE.MeshFaceMaterial){if(x=
+y.materialIndex,x>=0)x=m.geometry.materials[x],x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null)}else if(x)x.transparent?(k.transparent=x,k.opaque=null):(k.opaque=x,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(r);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),
+qa(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(M(a.overrideMaterial.blending),ia(a.overrideMaterial.depthTest),ka(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,C,u,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,C,u,!1,a.overrideMaterial)):(M(THREE.NormalBlending),j(a.__webglObjects,!0,
+"opaque",b,C,u,!1),n(a.__webglObjectsImmediate,"opaque",b,C,u,!1),j(a.__webglObjects,!1,"transparent",b,C,u,!0),n(a.__webglObjectsImmediate,"transparent",b,C,u,!0));if(a.__webglSprites.length){q=w.attributes;C=w.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(w.program);ra=w.program;sa=wa=ya=-1;Va||(d.enableVertexAttribArray(w.attributes.position),d.enableVertexAttribArray(w.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,w.vertexBuffer);
+d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,w.elementBuffer);d.uniformMatrix4fv(C.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(C.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);
+a.__webglSprites.sort(r);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&(m.useScreenCoordinates?(d.uniform1i(C.useScreenCoordinates,1),d.uniform3f(C.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(C.useScreenCoordinates,0),d.uniform1i(C.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(C.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/
+(m.scaleByViewport?Da:1),e[0]=b*u*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(C.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(C.uvOffset,m.uvOffset.x,m.uvOffset.y),d.uniform2f(C.alignment,m.alignment.x,m.alignment.y),d.uniform1f(C.opacity,m.opacity),d.uniform3f(C.color,m.color.r,m.color.g,m.color.b),d.uniform1f(C.rotation,m.rotation),d.uniform2fv(C.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),M(m.blending),oa(m.map,0),d.drawElements(d.TRIANGLES,
+6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Oa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,i=void 0,h=void 0,j=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var j=h,q=void 0,l=void 0,n=void 0,r=void 0,
+k=void 0,m=void 0,p=void 0,x={},w=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)n=j.faces[q],r=n.materialIndex,m=r!==void 0?r:-1,x[m]===void 0&&(x[m]={hash:m,counter:0}),p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w}),k=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(x[m].counter+=1,p=x[m].hash+"_"+x[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]=
+{faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w})),n instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=Ea++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=
+d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){n=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(n=q.numMorphTargets;l<n;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}D.info.memory.geometries++;
+r=f;k=r.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;n=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(r,j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;x=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;w=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(x)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=
+new Float32Array(q*4);if(w)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(n*3);
+j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];r=0;for(k=j.numMorphTargets;r<k;r++)j.__morphTargetsArrays.push(new Float32Array(q*3))}j.__needsSmoothNormals=x===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=w;j.__normalType=x;j.__webglFaceCount=n*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var r=l.attributes[n],k={},F;for(F in r)k[F]=r[F];if(!k.__webglInitialized||
+k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=n,r.needsUpdate=!0,k.__original=r;j.__webglCustomAttributesList.push(k)}}j.__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(f instanceof THREE.Ribbon){if(h=f.geometry,
+!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=j.vertices.length,j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,j=h,q=f,l=j.vertices.length,
+j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),D.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=
+!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],y(g.__webglObjects,j,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,y(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,
+1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)I(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&I(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(F=
+a.__webglObjects[f].object,i=F.geometry,h=n=l=void 0,F instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],h=c(F,l),n=h.attributes&&u(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||n)if(n=d.DYNAMIC_DRAW,r=!i.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,G=void 0,L=void 0,v=void 0,Z=void 0,$=void 0,X=void 0,P=void 0,R=E=L=void 0,z=void 0,A=void 0,B=void 0,Y=s=void 0,
+aa=void 0,T=s=$=P=void 0,U=void 0,M=B=A=z=v=void 0,J=s=B=A=z=M=B=A=z=M=B=A=z=void 0,W=void 0,N=L=void 0,S=void 0,V=void 0,ca=void 0,da=void 0,H=R=V=W=0,Q=0,ba=J=E=0,O=v=Y=0,t=0,ea=void 0,O=l.__vertexArray,S=l.__uvArray,t=l.__uv2Array,N=l.__normalArray,G=l.__tangentArray,aa=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,Z=l.__skinIndexArray,ga=l.__skinWeightArray,M=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,o=void 0,o=l.__faceArray,ea=l.__lineArray,ha=l.__needsSmoothNormals,
+P=l.__vertexColorType,X=l.__uvType,L=l.__normalType,$=F.geometry,ia=$.__dirtyElements,ka=$.__dirtyUvs,pa=$.__dirtyNormals,qa=$.__dirtyTangents,ta=$.__dirtyColors,ca=$.__dirtyMorphTargets,da=$.vertices,x=l.faces3,w=l.faces4,fa=$.faces,oa=$.faceVertexUvs[0],ra=$.faceVertexUvs[1],ja=$.skinVerticesA,la=$.skinVerticesB,ma=$.skinIndices,na=$.skinWeights,sa=$.morphTargets;if($.__dirtyVertices){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=da[s.a].position,A=da[s.b].position,B=da[s.c].position,O[V]=z.x,O[V+1]=
+z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,V+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=da[s.a].position,A=da[s.b].position,B=da[s.c].position,s=da[s.d].position,O[V]=z.x,O[V+1]=z.y,O[V+2]=z.z,O[V+3]=A.x,O[V+4]=A.y,O[V+5]=A.z,O[V+6]=B.x,O[V+7]=B.y,O[V+8]=B.z,O[V+9]=s.x,O[V+10]=s.y,O[V+11]=s.z,V+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,O,n)}if(ca){V=0;for(ca=sa.length;V<ca;V++){k=O=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=
+sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,O+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=sa[V].vertices[s.a].position,A=sa[V].vertices[s.b].position,B=sa[V].vertices[s.c].position,s=sa[V].vertices[s.d].position,da=M[V],da[O]=z.x,da[O+1]=z.y,da[O+2]=z.z,da[O+3]=A.x,da[O+4]=A.y,da[O+5]=A.z,da[O+6]=B.x,da[O+7]=B.y,da[O+8]=B.z,da[O+9]=s.x,da[O+
+10]=s.y,da[O+11]=s.z,O+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[V]);d.bufferData(d.ARRAY_BUFFER,M[V],n)}}if(na.length){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=na[s.a],A=na[s.b],B=na[s.c],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,
+Z[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,z=la[s.a],A=la[s.b],B=la[s.c],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,v+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=na[s.a],A=na[s.b],B=na[s.c],M=na[s.d],ga[v]=z.x,ga[v+1]=z.y,ga[v+2]=z.z,ga[v+3]=z.w,ga[v+4]=A.x,ga[v+5]=A.y,ga[v+6]=A.z,ga[v+7]=A.w,
+ga[v+8]=B.x,ga[v+9]=B.y,ga[v+10]=B.z,ga[v+11]=B.w,ga[v+12]=M.x,ga[v+13]=M.y,ga[v+14]=M.z,ga[v+15]=M.w,z=ma[s.a],A=ma[s.b],B=ma[s.c],M=ma[s.d],Z[v]=z.x,Z[v+1]=z.y,Z[v+2]=z.z,Z[v+3]=z.w,Z[v+4]=A.x,Z[v+5]=A.y,Z[v+6]=A.z,Z[v+7]=A.w,Z[v+8]=B.x,Z[v+9]=B.y,Z[v+10]=B.z,Z[v+11]=B.w,Z[v+12]=M.x,Z[v+13]=M.y,Z[v+14]=M.z,Z[v+15]=M.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],M=ja[s.d],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,T[v+12]=M.x,T[v+
+13]=M.y,T[v+14]=M.z,T[v+15]=1,z=la[s.a],A=la[s.b],B=la[s.c],s=la[s.d],U[v]=z.x,U[v+1]=z.y,U[v+2]=z.z,U[v+3]=1,U[v+4]=A.x,U[v+5]=A.y,U[v+6]=A.z,U[v+7]=1,U[v+8]=B.x,U[v+9]=B.y,U[v+10]=B.z,U[v+11]=1,U[v+12]=s.x,U[v+13]=s.y,U[v+14]=s.z,U[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,
+Z,n),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,n))}if(ta&&P){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],v=s.vertexColors,Z=s.color,v.length===3&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2]):U=T=s=Z,aa[Y]=s.r,aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,Y+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],v=s.vertexColors,Z=s.color,v.length===4&&P===THREE.VertexColors?(s=v[0],T=v[1],U=v[2],v=v[3]):v=U=T=s=Z,aa[Y]=s.r,
+aa[Y+1]=s.g,aa[Y+2]=s.b,aa[Y+3]=T.r,aa[Y+4]=T.g,aa[Y+5]=T.b,aa[Y+6]=U.r,aa[Y+7]=U.g,aa[Y+8]=U.b,aa[Y+9]=v.r,aa[Y+10]=v.g,aa[Y+11]=v.b,Y+=12;Y>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,aa,n))}if(qa&&$.hasTangents){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,J+=12;k=0;for(m=w.length;k<m;k++)s=
+fa[w[k]],$=s.vertexTangents,Y=$[0],aa=$[1],P=$[2],$=$[3],G[J]=Y.x,G[J+1]=Y.y,G[J+2]=Y.z,G[J+3]=Y.w,G[J+4]=aa.x,G[J+5]=aa.y,G[J+6]=aa.z,G[J+7]=aa.w,G[J+8]=P.x,G[J+9]=P.y,G[J+10]=P.z,G[J+11]=P.w,G[J+12]=$.x,G[J+13]=$.y,G[J+14]=$.z,G[J+15]=$.w,J+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,G,n)}if(pa&&L){k=0;for(m=x.length;k<m;k++)if(s=fa[x[k]],G=s.vertexNormals,L=s.normal,G.length===3&&ha)for(J=0;J<3;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<
+3;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;k=0;for(m=w.length;k<m;k++)if(s=fa[w[k]],G=s.vertexNormals,L=s.normal,G.length===4&&ha)for(J=0;J<4;J++)L=G[J],N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;else for(J=0;J<4;J++)N[E]=L.x,N[E+1]=L.y,N[E+2]=L.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,N,n)}if(ka&&oa&&X){k=0;for(m=x.length;k<m;k++)if(E=x[k],E=oa[E],E!==void 0)for(J=0;J<3;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;k=0;for(m=w.length;k<m;k++)if(E=w[k],E=oa[E],E!==void 0)for(J=
+0;J<4;J++)N=E[J],S[R]=N.u,S[R+1]=N.v,R+=2;R>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,S,n))}if(ka&&ra&&X){k=0;for(m=x.length;k<m;k++)if(E=x[k],R=ra[E],R!==void 0)for(J=0;J<3;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;k=0;for(m=w.length;k<m;k++)if(E=w[k],R=ra[E],R!==void 0)for(J=0;J<4;J++)S=R[J],t[H]=S.u,t[H+1]=S.v,H+=2;H>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,n))}if(ia){k=0;for(m=x.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+2,
+Q+=3,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+2,ea[ba+4]=W+1,ea[ba+5]=W+2,ba+=6,W+=3;k=0;for(m=w.length;k<m;k++)o[Q]=W,o[Q+1]=W+1,o[Q+2]=W+3,o[Q+3]=W+1,o[Q+4]=W+2,o[Q+5]=W+3,Q+=6,ea[ba]=W,ea[ba+1]=W+1,ea[ba+2]=W,ea[ba+3]=W+3,ea[ba+4]=W+1,ea[ba+5]=W+2,ea[ba+6]=W+2,ea[ba+7]=W+3,ba+=8,W+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,o,n);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,n)}if(p){J=0;for(W=
+p.length;J<W;J++)if(o=p[J],o.__original.needsUpdate){t=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],t+=3;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],o.array[t]=o.value[s.a],o.array[t+1]=o.value[s.b],o.array[t+2]=o.value[s.c],o.array[t+3]=o.value[s.d],t+=4}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)ea=o.value[x[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,
+t+=3;k=0;for(m=w.length;k<m;k++)ea=o.value[w[k]],o.array[t]=ea,o.array[t+1]=ea,o.array[t+2]=ea,o.array[t+3]=ea,t+=4}}else if(o.size===2)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,
+o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,t+=6;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=A.x,o.array[t+3]=A.y,o.array[t+4]=B.x,o.array[t+5]=B.y,o.array[t+6]=s.x,o.array[t+7]=s.y,t+=8}}else if(o.size===3)if(H=
+o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+
+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}else{if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],t+=9;k=0;for(m=w.length;k<m;k++)s=
+B=A=z=ea=o.value[w[k]],o.array[t]=z[H[0]],o.array[t+1]=z[H[1]],o.array[t+2]=z[H[2]],o.array[t+3]=A[H[0]],o.array[t+4]=A[H[1]],o.array[t+5]=A[H[2]],o.array[t+6]=B[H[0]],o.array[t+7]=B[H[1]],o.array[t+8]=B[H[2]],o.array[t+9]=s[H[0]],o.array[t+10]=s[H[1]],o.array[t+11]=s[H[2]],t+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){k=0;for(m=x.length;k<m;k++)s=fa[x[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+
+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=fa[w[k]],z=o.value[s.a],A=o.value[s.b],B=o.value[s.c],s=o.value[s.d],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=
+s.w,t+=16}else if(o.boundTo==="faces"){k=0;for(m=x.length;k<m;k++)B=A=z=ea=o.value[x[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,t+=12;k=0;for(m=w.length;k<m;k++)s=B=A=z=ea=o.value[w[k]],o.array[t]=z.x,o.array[t+1]=z.y,o.array[t+2]=z.z,o.array[t+3]=z.w,o.array[t+4]=A.x,o.array[t+5]=A.y,o.array[t+6]=A.z,o.array[t+7]=A.w,o.array[t+8]=B.x,
+o.array[t+9]=B.y,o.array[t+10]=B.z,o.array[t+11]=B.w,o.array[t+12]=s.x,o.array[t+13]=s.y,o.array[t+14]=s.z,o.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,o.buffer);d.bufferData(d.ARRAY_BUFFER,o.array,n)}}r&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}i.__dirtyVertices=
+!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;h.attributes&&K(h)}else if(F instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;F=d.DYNAMIC_DRAW;k=j=k=r=r=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;x=h.__vertexArray;n=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<p;r++)k=m[r].position,j=r*3,x[j]=k.x,x[j+1]=k.y,x[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+x,F)}if(w){for(r=0;r<l;r++)k=q[r],j=r*3,n[j]=k.r,n[j+1]=k.g,n[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,n,F)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(F instanceof THREE.Line){h=c(F,l);n=h.attributes&&u(h);if(i.__dirtyVertices||i.__dirtyColors||n){F=i;j=d.DYNAMIC_DRAW;p=q=W=m=fa=void 0;m=F.vertices;l=F.colors;p=m.length;n=l.length;x=F.__vertexArray;r=F.__colorArray;w=F.__dirtyColors;k=F.__webglCustomAttributesList;R=ba=Q=H=W=fa=void 0;if(F.__dirtyVertices){for(fa=
+0;fa<p;fa++)W=m[fa].position,q=fa*3,x[q]=W.x,x[q+1]=W.y,x[q+2]=W.z;d.bindBuffer(d.ARRAY_BUFFER,F.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,j)}if(w){for(m=0;m<n;m++)p=l[m],q=m*3,r[q]=p.r,r[q+1]=p.g,r[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,F.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,j)}if(k){fa=0;for(W=k.length;fa<W;fa++)if(R=k[fa],R.needsUpdate&&(R.boundTo===void 0||R.boundTo==="vertices")){q=0;Q=R.value.length;if(R.size===1)for(H=0;H<Q;H++)R.array[H]=R.value[H];else if(R.size===2)for(H=
+0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,q+=2;else if(R.size===3)if(R.type==="c")for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.r,R.array[q+1]=ba.g,R.array[q+2]=ba.b,q+=3;else for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,q+=3;else if(R.size===4)for(H=0;H<Q;H++)ba=R.value[H],R.array[q]=ba.x,R.array[q+1]=ba.y,R.array[q+2]=ba.z,R.array[q+3]=ba.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.array,j)}}}i.__dirtyVertices=!1;
+i.__dirtyColors=!1;h.attributes&&K(h)}else if(F instanceof THREE.ParticleSystem)h=c(F,l),n=h.attributes&&u(h),(i.__dirtyVertices||i.__dirtyColors||F.sortParticles||n)&&e(i,d.DYNAMIC_DRAW,F),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&K(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof
+THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var n,k,m;n=m=j=0;for(k=b.length;n<k;n++)h=b[n],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=la?n=m:(n=Math.ceil(la*m/(j+m)),j=la-n);h={directional:n,
+point:j};j=m=0;for(n=b.length;j<n;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)r=e.bones.length;var p;a:{n=a.fragmentShader;k=a.vertexShader;var j=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:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,e=[];i?e.push(i):(e.push(n),e.push(k));for(u in c)e.push(u),e.push(c[u]);i=e.join();u=0;for(e=ca.length;u<e;u++)if(ca[u].code===i){p=ca[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?
+"#define GAMMA_OUTPUT":"",D.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.perPixel?"#define PHONG_PER_PIXEL":"",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","precision "+va+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
 "",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(u,L("fragment",h+n));d.attachShader(u,
 L("vertex",e+k));d.linkProgram(u);d.getProgramParameter(u,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(u,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");u.uniforms={};u.attributes={};var w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in j)e.push(w);w=e;e=0;for(j=w.length;e<j;e++)n=w[e],u.uniforms[n]=d.getUniformLocation(u,

+ 1 - 1
examples/canvas_lights_pointlights_smooth.html

@@ -101,7 +101,7 @@
 
 					geometry.computeVertexNormals();
 
-					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff } ) );
+					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, overdraw: true } ) );
 					mesh.overdraw = true;
 					scene.add( mesh );
 

+ 3 - 1
examples/canvas_sandbox.html

@@ -90,7 +90,9 @@
 
 				objects = [];
 
-				geometry = new THREE.SphereGeometry( 100, 16, 8 );
+				geometry = new THREE.IcosahedronGeometry( 1 );
+				geometry.applyMatrix( new THREE.Matrix4().setScale( 100, 100, 100 ) );
+
 				material = new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ), overdraw: true } );
 
 				for ( var i = 0; i < 10; i ++ ) {

+ 1 - 1
gui/js/Code.js

@@ -153,7 +153,7 @@ var Code = function () {
 
 				var string = '';
 				string += '\n\tvar geometry = ' + object.geometry.gui.getCode() + ';';
-				string += '\n\tvar material = ' + object.materials[ 0 ].gui.getCode() + ';';
+				string += '\n\tvar material = ' + object.material.gui.getCode() + ';';
 				string += '\n\tvar mesh = new THREE.Mesh( geometry, material );';
 
 				if ( object.position.x != 0 ) string += '\n\tmesh.position.x = ' + object.position.x + ';';

+ 20 - 15
src/extras/geometries/CubeGeometry.js

@@ -42,9 +42,9 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 	this.sides = { px: true, nx: true, py: true, ny: true, pz: true, nz: true };
 
-	if( sides != undefined ) {
+	if ( sides != undefined ) {
 
-		for( var s in sides ) {
+		for ( var s in sides ) {
 
 			if ( this.sides[ s ] != undefined ) {
 
@@ -56,15 +56,13 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 	}
 
-	this.sides.px && buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, mpx ); 	 // px
+	this.sides.px && buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, mpx ); // px
 	this.sides.nx && buildPlane( 'z', 'y',   1, - 1, depth, height, - width_half, mnx ); // nx
-	this.sides.py && buildPlane( 'x', 'z',   1,   1, width, depth, height_half, mpy );   // py
+	this.sides.py && buildPlane( 'x', 'z',   1,   1, width, depth, height_half, mpy ); // py
 	this.sides.ny && buildPlane( 'x', 'z',   1, - 1, width, depth, - height_half, mny ); // ny
-	this.sides.pz && buildPlane( 'x', 'y',   1, - 1, width, height, depth_half, mpz );   // pz
+	this.sides.pz && buildPlane( 'x', 'y',   1, - 1, width, height, depth_half, mpz ); // pz
 	this.sides.nz && buildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, mnz ); // nz
 
-	this.mergeVertices();
-
 	function buildPlane( u, v, udir, vdir, width, height, depth, material ) {
 
 		var w, ix, iy,
@@ -93,11 +91,14 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 		var gridX1 = gridX + 1,
 		gridY1 = gridY + 1,
 		segment_width = width / gridX,
-		segment_height = height / gridY;
+		segment_height = height / gridY,
+		normal = new THREE.Vector3();
+
+		normal[ w ] = depth > 0 ? 1 : - 1;
 
-		for( iy = 0; iy < gridY1; iy ++ ) {
+		for ( iy = 0; iy < gridY1; iy ++ ) {
 
-			for( ix = 0; ix < gridX1; ix ++ ) {
+			for ( ix = 0; ix < gridX1; ix ++ ) {
 
 				var vector = new THREE.Vector3();
 				vector[ u ] = ( ix * segment_width - width_half ) * udir;
@@ -110,16 +111,21 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 		}
 
-		for( iy = 0; iy < gridY; iy++ ) {
+		for ( iy = 0; iy < gridY; iy++ ) {
 
-			for( ix = 0; ix < gridX; ix++ ) {
+			for ( ix = 0; ix < gridX; ix++ ) {
 
 				var a = ix + gridX1 * iy;
 				var b = ix + gridX1 * ( iy + 1 );
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var d = ( ix + 1 ) + gridX1 * iy;
 
-				scope.faces.push( new THREE.Face4( a + offset, b + offset, c + offset, d + offset, null, null, material ) );
+				var face = new THREE.Face4( a + offset, b + offset, c + offset, d + offset );
+				face.normal.copy( normal );
+				face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
+				face.materialIndex = material;
+
+				scope.faces.push( face );
 				scope.faceVertexUvs[ 0 ].push( [
 							new THREE.UV( ix / gridX, iy / gridY ),
 							new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
@@ -133,9 +139,8 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 	}
 
-
 	this.computeCentroids();
-	this.computeFaceNormals();
+	this.mergeVertices();
 
 };
 

+ 11 - 8
src/extras/geometries/PlaneGeometry.js

@@ -15,12 +15,12 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 	gridX1 = gridX + 1,
 	gridY1 = gridY + 1,
 	segment_width = width / gridX,
-	segment_height = height / gridY;
+	segment_height = height / gridY,
+	normal = new THREE.Vector3( 0, 0, 1 );
 
+	for ( iy = 0; iy < gridY1; iy++ ) {
 
-	for( iy = 0; iy < gridY1; iy++ ) {
-
-		for( ix = 0; ix < gridX1; ix++ ) {
+		for ( ix = 0; ix < gridX1; ix++ ) {
 
 			var x = ix * segment_width - width_half;
 			var y = iy * segment_height - height_half;
@@ -31,16 +31,20 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 
 	}
 
-	for( iy = 0; iy < gridY; iy++ ) {
+	for ( iy = 0; iy < gridY; iy++ ) {
 
-		for( ix = 0; ix < gridX; ix++ ) {
+		for ( ix = 0; ix < gridX; ix++ ) {
 
 			var a = ix + gridX1 * iy;
 			var b = ix + gridX1 * ( iy + 1 );
 			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 			var d = ( ix + 1 ) + gridX1 * iy;
 
-			this.faces.push( new THREE.Face4( a, b, c, d ) );
+			var face = new THREE.Face4( a, b, c, d );
+			face.normal.copy( normal );
+			face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
+
+			this.faces.push( face );
 			this.faceVertexUvs[ 0 ].push( [
 						new THREE.UV( ix / gridX, iy / gridY ),
 						new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
@@ -53,7 +57,6 @@ THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight )
 	}
 
 	this.computeCentroids();
-	this.computeFaceNormals();
 
 };
 

+ 30 - 8
src/renderers/CanvasRenderer.js

@@ -39,7 +39,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 	_color3 = new THREE.Color(),
 	_color4 = new THREE.Color(),
 
-	_patterns = [],
+	_patterns = [], _imagedatas = [],
 
 	_near, _far,
 
@@ -868,8 +868,8 @@ THREE.CanvasRenderer = function ( parameters ) {
 			var a, b, c, d, e, f, det, idet,
 			offsetX = texture.offset.x / texture.repeat.x,
 			offsetY = texture.offset.y / texture.repeat.y,
-			width = ( texture.image.width - 1 ) * texture.repeat.x,
-			height = ( texture.image.height - 1 ) * texture.repeat.y;
+			width = texture.image.width * texture.repeat.x,
+			height = texture.image.height * texture.repeat.y;
 
 			u0 = ( u0 + offsetX ) * width;
 			v0 = ( v0 + offsetY ) * height;
@@ -888,6 +888,33 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 			det = u1 * v2 - u2 * v1;
 
+			if ( det == 0 ) {
+
+				if ( _imagedatas[ texture.id ] == undefined ) {
+
+					var canvas = document.createElement( 'canvas' )
+					canvas.width = texture.image.width;
+					canvas.height = texture.image.height;
+
+					var context = canvas.getContext( '2d' );
+					context.drawImage( texture.image, 0, 0 );
+
+					_imagedatas[ texture.id ] = context.getImageData( 0, 0, texture.image.width, texture.image.height ).data;
+
+					delete canvas;
+
+				}
+
+				var data = _imagedatas[ texture.id ];
+				var index = ( Math.floor( u0 ) + Math.floor( v0 ) * texture.image.width ) * 4;
+
+				_color.setRGB( data[ index ] / 255, data[ index + 1 ] / 255, data[ index + 2 ] / 255 );
+				fillPath( _color );
+
+				return;
+
+			}
+
 			idet = 1 / det;
 
 			a = ( v2 * x1 - v1 * x2 ) * idet;
@@ -977,11 +1004,6 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 		function smoothstep( value, min, max ) {
 
-			/*
-			if ( value <= min ) return 0;
-			if ( value >= max ) return 1;
-			*/
-
 			var x = ( value - min ) / ( max - min );
 			return x * x * ( 3 - 2 * x );
 

+ 11 - 0
src/renderers/WebGLRenderer.js

@@ -453,6 +453,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+
+		if ( geometryGroup.__webglCustomAttributesList ) {
+
+			for ( var id in geometryGroup.__webglCustomAttributesList ) {
+
+				_gl.deleteBuffer( geometryGroup.__webglCustomAttributesList[ id ].buffer );
+
+			}
+
+		}
+
 		_this.info.memory.geometries --;
 
 	};