Browse Source

CanvasRenderer and SVGRenderer using single-material system.
Also moved `.overdraw` to Material.
Code is much simpler now :)

Mr.doob 13 years ago
parent
commit
ec00f298be

File diff suppressed because it is too large
+ 565 - 571
build/Three.js


+ 91 - 99
build/custom/ThreeCanvas.js

@@ -14,89 +14,88 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 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){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var h,m,k,l,i,n,j,r,t=a.geometry,w=t.vertices,e=0,g=t.faces.length;e<g;e++)if(d=t.faces[e],j=this.origin.clone(),r=this.direction.clone(),l=a.matrixWorld,h=l.multiplyVector3(d.centroid.clone()).subSelf(j),n=h.dot(r),!(n<=0)&&(h=l.multiplyVector3(w[d.a].position.clone()),m=l.multiplyVector3(w[d.b].position.clone()),k=l.multiplyVector3(w[d.c].position.clone()),
-l=d instanceof THREE.Face4?l.multiplyVector3(w[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=r.dot(i),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=i.dot((new THREE.Vector3).sub(h,j))/n,j=j.addSelf(r.multiplyScalar(n)),d instanceof THREE.Face3)c(j,h,m,k)&&(d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(j,h,m,l)||c(j,m,k,l)))d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d)}return f}};
-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,l,i){h=!1;b=e;c=g;d=l;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,l,i,n,j){h?(h=!1,b=e<l?e<n?e:n:l<n?l:n,c=g<i?g<j?g:j:i<j?i:j,d=e>l?e>n?e:n:l>n?l:n,f=g>i?g>j?g:j:i>j?i:j):(b=e<l?e<n?e<b?e:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<i?g<j?g<c?g:c:j<c?j:c:i<j?i<c?i:c:j<c?j:c,d=e>l?e>n?e>d?e:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,f=g>i?g>j?g>f?g:f:j>f?j:f:i>j?i>f?i:f:j>f?j: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>
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,l,m,j,i,o,n,p,k=a.geometry,u=k.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=k.faces.length;e<g;e++)if(d=k.faces[e],n=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(n),o=h.dot(p),!(o<=0)&&(h=j.multiplyVector3(u[d.a].position.clone()),l=j.multiplyVector3(u[d.b].position.clone()),
+m=j.multiplyVector3(u[d.c].position.clone()),j=d instanceof THREE.Face4?j.multiplyVector3(u[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=p.dot(i),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=i.dot((new THREE.Vector3).sub(h,n))/o,n=n.addSelf(p.multiplyScalar(o)),d instanceof THREE.Face3)c(n,h,l,m)&&(d={distance:this.origin.distanceTo(n),point:n,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(n,h,l,j)||c(n,l,m,j)))d={distance:this.origin.distanceTo(n),
+point:n,face:d,object:a},f.push(d)}return f}};
+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,o,n){h?(h=!1,b=e<j?e<o?e:o:j<o?j:o,c=g<i?g<n?g:n:i<n?i:n,d=e>j?e>o?e:o:j>o?j:o,f=g>i?g>n?g:n:i>n?i:n):(b=e<j?e<o?e<b?e:b:o<b?o:b:j<o?j<b?j:b:o<b?o:b,c=g<i?g<n?g<c?g:c:n<c?n:c:i<n?i<c?i:c:n<c?n:c,d=e>j?e>o?e>d?e:d:o>d?o:d:j>o?j>d?j:d:o>d?o:d,f=g>i?g>n?g>f?g:f:n>f?n:f:i>n?i>f?i:f:n>f?n: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.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,m,k,l,i,n,j,r,t){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,k||0,l!==void 0?l:1,i||0,n||0,j||0,r||0,t!==void 0?t: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,k,l,i,n,j,r,t){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=k;this.n33=l;this.n34=i;this.n41=n;this.n42=j;this.n43=r;this.n44=t;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},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},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,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44,M=b.n11,R=b.n12,
-B=b.n13,N=b.n14,O=b.n21,s=b.n22,o=b.n23,C=b.n24,D=b.n31,T=b.n32,U=b.n33,F=b.n34,K=b.n41,I=b.n42,J=b.n43,P=b.n44;this.n11=c*M+d*O+f*D+e*K;this.n12=c*R+d*s+f*T+e*I;this.n13=c*B+d*o+f*U+e*J;this.n14=c*N+d*C+f*F+e*P;this.n21=g*M+h*O+m*D+k*K;this.n22=g*R+h*s+m*T+k*I;this.n23=g*B+h*o+m*U+k*J;this.n24=g*N+h*C+m*F+k*P;this.n31=l*M+i*O+n*D+j*K;this.n32=l*R+i*s+n*T+j*I;this.n33=l*B+i*o+n*U+j*J;this.n34=l*N+i*C+n*F+j*P;this.n41=r*M+t*O+w*D+u*K;this.n42=r*R+t*s+w*T+u*I;this.n43=r*B+t*o+w*U+u*J;this.n44=r*N+t*
-C+w*F+u*P;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=
-a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,m=this.n31,k=this.n32,l=this.n33,i=this.n34,n=this.n41,j=this.n42,r=this.n43,t=this.n44;return d*g*k*n-c*h*k*n-d*e*l*n+b*h*l*n+c*e*i*n-b*g*i*n-d*g*m*j+c*h*m*j+d*f*l*j-a*h*l*j-c*f*i*j+a*g*i*j+d*e*m*r-b*h*m*r-d*f*k*r+a*h*k*r+b*f*i*r-a*e*i*r-c*e*m*t+b*g*m*t+c*f*k*t-a*g*k*t-b*f*l*t+a*e*l*t},
-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,m=f*e,k=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,k*g+c,k*h-d*e,0,m*h-d*g,k*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(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,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,k=g*f,l=d*h,i=d*f;this.n11=m+i*c;this.n12=l*c-k;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=k*c-l;this.n32=i+m*c;this.n33=e*g;break;case "ZXY":m=g*h;k=g*f;l=d*h;i=d*f;this.n11=m-i*c;this.n12=-e*f;this.n13=l+k*c;this.n21=k+l*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;k=e*f;l=c*h;i=c*f;this.n11=g*h;this.n12=l*d-k;this.n13=m*d+i;this.n21=g*f;this.n22=i*d+m;this.n23=k*d-l;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":m=e*g;k=
-e*d;l=c*g;i=c*d;this.n11=g*h;this.n12=i-m*f;this.n13=l*f+k;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*f+l;this.n33=m-i*f;break;case "XZY":m=e*g;k=e*d;l=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=k*f-l;this.n31=l*f-k;this.n32=c*h;this.n33=i*f+m;break;default:m=e*h,k=e*f,l=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=k+l*d,this.n22=m-i*d,this.n23=-c*g,this.n31=i-m*d,this.n32=l+k*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 k=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(k+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+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var 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},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=
-a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*j*t-k*n*t+k*i*w-h*j*w-m*i*u+h*n*u;b.n12=e*n*t-f*j*t-e*i*w+d*j*w+f*i*u-d*n*u;b.n13=f*k*t-e*m*t+e*h*w-d*k*w-f*h*u+d*m*u;b.n14=e*m*i-f*k*i-e*h*n+d*k*n+f*h*j-d*m*j;b.n21=k*n*r-m*j*r-k*l*w+g*j*w+m*l*u-g*n*u;b.n22=f*j*r-e*n*r+e*l*w-c*j*w-f*l*u+c*n*u;b.n23=e*m*r-f*k*r-e*g*w+c*k*w+f*g*u-c*m*u;b.n24=
-f*k*l-e*m*l+e*g*n-c*k*n-f*g*j+c*m*j;b.n31=h*j*r-k*i*r+k*l*t-g*j*t-h*l*u+g*i*u;b.n32=e*i*r-d*j*r-e*l*t+c*j*t+d*l*u-c*i*u;b.n33=f*k*r-e*h*r+e*g*t-c*k*t-d*g*u+c*h*u;b.n34=e*h*l-d*k*l-e*g*i+c*k*i+d*g*j-c*h*j;b.n41=m*i*r-h*n*r-m*l*t+g*n*t+h*l*w-g*i*w;b.n42=d*n*r-f*i*r+f*l*t-c*n*t-d*l*w+c*i*w;b.n43=f*h*r-d*m*r-f*g*t+c*m*t+d*g*w-c*h*w;b.n44=d*m*l-f*h*l+f*g*i-c*m*i-d*g*n+c*h*n;b.multiplyScalar(1/a.determinant());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,k=a.n23*a.n12-a.n22*a.n13,l=-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*k;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*k;c[7]=a*l;c[8]=a*i;return b};
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,m,j,i,o,n,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,l||0,m||0,j!==void 0?j:1,i||0,o||0,n||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,l,m,j,i,o,n,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=l;this.n32=m;this.n33=j;this.n34=i;this.n41=o;this.n42=n;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,l=a.n23,m=a.n24,j=a.n31,i=a.n32,o=a.n33,n=a.n34,p=a.n41,k=a.n42,u=a.n43,
+v=a.n44,F=b.n11,H=b.n12,M=b.n13,K=b.n14,N=b.n21,L=b.n22,I=b.n23,s=b.n24,y=b.n31,G=b.n32,U=b.n33,R=b.n34,P=b.n41,t=b.n42,z=b.n43,r=b.n44;this.n11=c*F+d*N+f*y+e*P;this.n12=c*H+d*L+f*G+e*t;this.n13=c*M+d*I+f*U+e*z;this.n14=c*K+d*s+f*R+e*r;this.n21=g*F+h*N+l*y+m*P;this.n22=g*H+h*L+l*G+m*t;this.n23=g*M+h*I+l*U+m*z;this.n24=g*K+h*s+l*R+m*r;this.n31=j*F+i*N+o*y+n*P;this.n32=j*H+i*L+o*G+n*t;this.n33=j*M+i*I+o*U+n*z;this.n34=j*K+i*s+o*R+n*r;this.n41=p*F+k*N+u*y+v*P;this.n42=p*H+k*L+u*G+v*t;this.n43=p*M+k*
+I+u*U+v*z;this.n44=p*K+k*s+u*R+v*r;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,o=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*m*o-c*h*m*o-d*e*j*o+b*h*j*o+c*e*i*o-b*g*i*o-d*g*l*n+c*h*l*n+d*f*j*n-a*h*j*n-c*f*i*n+a*g*i*n+d*e*l*p-b*h*l*p-d*f*m*p+a*h*m*p+b*f*i*p-a*e*i*p-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=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,o=a.n34,n=a.n41,p=a.n42,k=a.n43,u=a.n44;this.n11=h*o*p-l*i*p+l*j*k-g*o*k-h*j*u+g*i*u;this.n12=f*i*p-d*o*p-f*j*k+c*o*k+d*j*u-c*i*u;this.n13=d*l*p-f*h*p+f*g*k-c*l*k-d*g*u+c*h*u;this.n14=f*h*j-d*l*j-f*g*i+c*l*i+d*g*o-c*h*o;this.n21=l*i*n-h*o*n-l*m*k+e*o*k+h*m*u-e*i*u;this.n22=d*o*n-f*i*n+
+f*m*k-b*o*k-d*m*u+b*i*u;this.n23=f*h*n-d*l*n-f*e*k+b*l*k+d*e*u-b*h*u;this.n24=d*l*m-f*h*m+f*e*i-b*l*i-d*e*o+b*h*o;this.n31=g*o*n-l*j*n+l*m*p-e*o*p-g*m*u+e*j*u;this.n32=f*j*n-c*o*n-f*m*p+b*o*p+c*m*u-b*j*u;this.n33=d*l*n-f*g*n+f*e*p-b*l*p-c*e*u+b*g*u;this.n34=f*g*m-c*l*m-f*e*j+b*l*j+c*e*o-b*g*o;this.n41=h*j*n-g*i*n-h*m*p+e*i*p+g*m*k-e*j*k;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*k+b*j*k;this.n43=d*g*n-c*h*n-d*e*p+b*h*p+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*=
+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.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,m,k;g=new THREE.Matrix4;h=b-a;m=c-d;k=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/k;g.n34=-((e+f)/k);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,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.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.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(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},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=m[h]=m[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,j=-b.z+b.w;return e>=0&&f>=0&&g>=0&&j>=0?!0:e<0&&f<0||g<0&&j<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(d=Math.min(d,g/(g-j))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,m=[],k,l,i=[],n,j=[],r,t,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector4,s=new THREE.Vector4,
-o=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,g){var j,h;f=B.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){h=j[a];var i;if(!(i=!h.visible))if(i=h instanceof THREE.Mesh)if(i=h.frustumCulled){a:{i=void 0;for(var k=h.matrixWorld,m=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),l=0;l<6;l++)if(i=D[l].x*k.n14+D[l].y*k.n24+D[l].z*k.n34+D[l].w,i<=m){i=!1;break a}i=!0}i=
-!i}if(!i)i=e[f]=e[f]||new THREE.RenderableObject,f++,d=i,O.copy(h.position),o.multiplyVector3(O),d.object=h,d.z=O.z,B.push(d)}g&&B.sort(b);return B};this.projectScene=function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,ba,W;M=t=n=l=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;
-ba=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=ba.length;B<V;B++){E=ba[B];if(E instanceof THREE.Face3)if(y=m[E.a],L=m[E.b],H=m[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-
-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[l]=i[l]||new THREE.RenderableFace3,l++,k=z,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=m[E.a],L=m[E.b],H=m[E.c],z=m[E.d],y.visible&&L.visible&&H.visible&&z.visible&&(q.doubleSided||q.flipSided!=((z.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(z.positionScreen.y-y.positionScreen.y)*
-(L.positionScreen.x-y.positionScreen.x)<0||(L.positionScreen.x-H.positionScreen.x)*(z.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(z.positionScreen.x-H.positionScreen.x)<0)))W=j[n]=j[n]||new THREE.RenderableFace4,n++,k=W,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H),k.v4.copy(z);else continue;k.normalWorld.copy(E.normal);G.multiplyVector3(k.normalWorld);k.centroidWorld.copy(E.centroid);v.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);
-H=E.vertexNormals;y=0;for(L=H.length;y<L;y++)z=k.vertexNormalsWorld[y],z.copy(H[y]),G.multiplyVector3(z);y=0;for(L=Z.length;y<L;y++)if(W=Z[y][B]){H=0;for(z=W.length;H<z;H++)k.uvs[y][H]=W[H]}k.meshMaterials=O;k.faceMaterials=E.materials;k.overdraw=ea;k.z=k.centroidScreen.z;N.push(k)}}else if(q instanceof THREE.Line){C.multiply(o,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),
-C.multiplyVector4(y.positionScreen),L=m[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[t]=w[t]||new THREE.RenderableLine,t++,r=v,r.v1.positionScreen.copy(T),r.v2.positionScreen.copy(U),r.z=Math.max(T.z,U.z),r.materials=q.materials,N.push(r)}else if(q instanceof THREE.Particle&&(s.set(q.matrixWorld.n14,q.matrixWorld.n24,q.matrixWorld.n34,1),o.multiplyVector4(s),s.z/=s.w,s.z>0&&s.z<1))v=R[M]=R[M]||new THREE.RenderableParticle,M++,u=
-v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},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=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,l=[],m,j=[],i,o,n=[],p,k,u=[],v={objects:[],lines:[],sprites:[],lights:[],
+elements:[]};new THREE.Vector3;var F=new THREE.Vector4,H=new THREE.Matrix4,M=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
+a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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(a){v.objects.length=0;v.lines.length=0;v.sprites.length=0;v.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),f=0;f<6;f++)if(c=K[f].x*d.n14+K[f].y*d.n24+K[f].z*d.n34+K[f].w,c<=e){c=!1;break a}c=!0}c?v.objects.push(a):a instanceof THREE.Line?v.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?v.sprites.push(a):a instanceof THREE.Light&&v.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return v};this.projectScene=function(I,s,y){var G=s.near,K=s.far,R,P,t,z,r,D,x,J,E,T,Z,ba,ga,da,w,A;k=o=m=h=0;v.elements.length=0;s.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+I.add(s));I.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);H.multiply(s.projectionMatrix,s.matrixWorldInverse);this.computeFrustum(H);v=this.projectGraph(I);I=0;for(R=v.objects.length;I<R;I++)if(E=v.objects[I],T=E.matrixWorld,ba=E.material,f=0,E instanceof THREE.Mesh){Z=E.geometry;ga=E.geometry.materials;z=Z.vertices;da=Z.faces;w=Z.faceVertexUvs;Z=E.matrixRotationWorld.extractRotation(T);P=0;for(t=z.length;P<t;P++)d=a(),d.positionWorld.copy(z[P].position),T.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),H.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>G&&d.positionScreen.z<K;z=0;for(P=da.length;z<P;z++){t=da[z];if(t instanceof THREE.Face3)if(r=e[t.a],D=e[t.b],x=e[t.c],r.visible&&D.visible&&x.visible&&(E.doubleSided||E.flipSided!=(x.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(x.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-
+r.positionScreen.x)<0))J=l[h]=l[h]||new THREE.RenderableFace3,h++,g=J,g.v1.copy(r),g.v2.copy(D),g.v3.copy(x);else continue;else if(t instanceof THREE.Face4)if(r=e[t.a],D=e[t.b],x=e[t.c],J=e[t.d],r.visible&&D.visible&&x.visible&&J.visible&&(E.doubleSided||E.flipSided!=((J.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(J.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0||(D.positionScreen.x-x.positionScreen.x)*(J.positionScreen.y-x.positionScreen.y)-
+(D.positionScreen.y-x.positionScreen.y)*(J.positionScreen.x-x.positionScreen.x)<0)))A=j[m]=j[m]||new THREE.RenderableFace4,m++,g=A,g.v1.copy(r),g.v2.copy(D),g.v3.copy(x),g.v4.copy(J);else continue;g.normalWorld.copy(t.normal);Z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);T.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);H.multiplyVector3(g.centroidScreen);x=t.vertexNormals;r=0;for(D=x.length;r<D;r++)J=g.vertexNormalsWorld[r],J.copy(x[r]),Z.multiplyVector3(J);
+r=0;for(D=w.length;r<D;r++)if(A=w[r][z]){x=0;for(J=A.length;x<J;x++)g.uvs[r][x]=A[x]}g.material=ba;g.faceMaterial=t.materialIndex!==null?ga[t.materialIndex]:null;g.z=g.centroidScreen.z;v.elements.push(g)}}I=0;for(R=v.lines.length;I<R;I++)if(E=v.lines[I],T=E.matrixWorld,ba=E.material,f=0,E instanceof THREE.Line){M.multiply(H,T);z=E.geometry.vertices;r=a();r.positionScreen.copy(z[0].position);M.multiplyVector4(r.positionScreen);P=1;for(t=z.length;P<t;P++)if(r=a(),r.positionScreen.copy(z[P].position),
+M.multiplyVector4(r.positionScreen),D=e[f-2],N.copy(r.positionScreen),L.copy(D.positionScreen),c(N,L))N.multiplyScalar(1/N.w),L.multiplyScalar(1/L.w),G=n[o]=n[o]||new THREE.RenderableLine,o++,i=G,i.v1.positionScreen.copy(N),i.v2.positionScreen.copy(L),i.z=Math.max(N.z,L.z),i.material=ba,v.elements.push(i)}I=0;for(R=v.sprites.length;I<R;I++)if(E=v.sprites[I],T=E.matrixWorld,E instanceof THREE.Particle&&(F.set(T.n14,T.n24,T.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))G=u[k]=u[k]||new THREE.RenderableParticle,
+k++,p=G,p.x=F.x/F.w,p.y=F.y/F.w,p.z=F.z,p.rotation=E.rotation.z,p.scale.x=E.scale.x*Math.abs(p.x-(F.x+s.projectionMatrix.n11)/(F.w+s.projectionMatrix.n14)),p.scale.y=E.scale.y*Math.abs(p.y-(F.y+s.projectionMatrix.n22)/(F.w+s.projectionMatrix.n24)),p.material=E.material,v.elements.push(p);y&&v.elements.sort(b);return v}};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,m=this.w,k=m*c+g*f-h*d,l=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=k*m+c*-e+l*-h-i*-g;b.y=l*m+c*-g+i*-e-k*-h;b.z=i*m+c*-h+k*-g-l*-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;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),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.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};
+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}};
+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.001)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};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,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,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=
+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=
 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,o){h=a.vertices[b].position;m=a.vertices[c].position;k=a.vertices[d].position;l=g[e];i=g[f];n=g[o];j=m.x-h.x;r=k.x-h.x;t=m.y-h.y;w=k.y-h.y;u=m.z-h.z;M=k.z-h.z;R=i.u-l.u;B=n.u-l.u;N=i.v-l.v;O=n.v-l.v;s=1/(R*O-B*N);T.set((O*j-N*r)*s,(O*t-N*w)*s,(O*u-N*M)*s);U.set((R*r-B*j)*s,(R*w-B*t)*s,(R*M-B*u)*s);C[b].addSelf(T);C[c].addSelf(T);C[d].addSelf(T);D[b].addSelf(U);
-D[c].addSelf(U);D[d].addSelf(U)}var b,c,d,f,e,g,h,m,k,l,i,n,j,r,t,w,u,M,R,B,N,O,s,o,C=[],D=[],T=new THREE.Vector3,U=new THREE.Vector3,F=new THREE.Vector3,K=new THREE.Vector3,I=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,D[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 J=["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++)I.copy(e.vertexNormals[d]),f=e[J[d]],o=C[f],F.copy(o),F.subSelf(I.multiplyScalar(I.dot(o))).normalize(),K.cross(e.vertexNormals[d],o),f=K.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(F.x,F.y,F.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,t){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];o=g[t];n=l.x-h.x;p=m.x-h.x;k=l.y-h.y;u=m.y-h.y;v=l.z-h.z;F=m.z-h.z;H=i.u-j.u;M=o.u-j.u;K=i.v-j.v;N=o.v-j.v;L=1/(H*N-M*K);G.set((N*n-K*p)*L,(N*k-K*u)*L,(N*v-K*F)*L);U.set((H*p-M*n)*L,(H*u-M*k)*L,(H*F-M*v)*L);s[b].addSelf(G);s[c].addSelf(G);s[d].addSelf(G);y[b].addSelf(U);
+y[c].addSelf(U);y[d].addSelf(U)}var b,c,d,f,e,g,h,l,m,j,i,o,n,p,k,u,v,F,H,M,K,N,L,I,s=[],y=[],G=new THREE.Vector3,U=new THREE.Vector3,R=new THREE.Vector3,P=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,y[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 z=["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++)t.copy(e.vertexNormals[d]),f=e[z[d]],I=s[f],R.copy(I),R.subSelf(t.multiplyScalar(t.dot(I))).normalize(),P.cross(e.vertexNormals[d],I),f=P.dot(y[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.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;
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
 THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
+a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
 !0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
@@ -116,45 +115,38 @@ THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new TH
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
 THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
-c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
-THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATE: Material array is no longer supported. Using material 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<
+this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
+THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=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.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.CanvasRenderer=function(a){function b(a){if(w!=a)j.globalAlpha=w=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}u=a}}function d(a){if(M!=a)j.strokeStyle=M=a}function f(a){if(R!=a)j.fillStyle=R=a}var e=this,g=null,h=new THREE.Projector,a=a||{},m=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-k,l,i,n,j=m.getContext("2d"),r=new THREE.Color(0),t=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,s,o,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,ba,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ca=new THREE.Color,aa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
-Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){k=a;l=b;i=Math.floor(k/2);n=Math.floor(l/2);m.width=k;m.height=
-l;ka.set(-i,-n,i,n);$.set(-i,-n,i,n);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);t=b;$.set(-i,-n,i,n)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;$.set(-i,-n,i,n)};this.clear=function(){j.setTransform(1,0,0,-1,i,n);$.isEmpty()||($.minSelf(ka),$.inflate(2),t<1&&j.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
-255)+","+t+")"),j.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,k){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(aa.r+=d.r,aa.g+=d.g,aa.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function m(a,b,c,
-d){var e,f,g,j,h=a.lights,a=0;for(e=h.length;a<e;a++)f=h[a],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,d.r+=g.r*j,d.g+=g.g*j,d.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(S.sub(f.position,b).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,d.r+=g.r*j,d.g+=g.g*j,d.b+=g.b*j)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,k,m,l,p,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
-g.map.image,p=l.width>>1,o=l.height>>1,g=e.scale.x*i,m=e.scale.y*n,h=g*p,k=m*o,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(g,-m),j.translate(-p,-o),j.drawImage(l,0,0),j.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*i,k=e.scale.y*n,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(h,k),g.program(j),
-j.restore()))}function t(a,e,f,g){b(g.opacity);c(g.blending);j.beginPath();j.moveTo(a.positionScreen.x,a.positionScreen.y);j.lineTo(e.positionScreen.x,e.positionScreen.y);j.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)j.lineWidth=B=a;a=g.linecap;if(N!=a)j.lineCap=N=a;a=g.linejoin;if(O!=a)j.lineJoin=O=a;d(g.color.getContextStyle());j.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,f,g,j,h,i,p,l){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);
-F=a.positionScreen.x;K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=f.positionScreen.x;Q=f.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[j].u,W[j].v,W[h].u,W[h].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+
-S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
-THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[j].u,W[j].v,W[h].u,W[h].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,m(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),m(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),m(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,
-Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,m(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,
-Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,
-q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,f,g,j,h,i,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,g,0,1,3,i,p,l),u(j,f,h,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=f.positionScreen.x,
-Q=f.positionScreen.y,V=g.positionScreen.x,E=g.positionScreen.y,pa=j.positionScreen.x,y=j.positionScreen.y,L=h.positionScreen.x,H=h.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,m(l,i.v1.positionWorld,
-i.vertexNormalsWorld[0],x),m(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),m(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),m(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*
-v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,m(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),
-p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,
-ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(g.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(f.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(a,b);j.closePath()}function R(a,b,c,d,e,f,g,h){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(g,h);j.lineTo(a,b);j.closePath()}function ga(a,b,c,e){if(B!=
-b)j.lineWidth=B=b;if(N!=c)j.lineCap=N=c;if(O!=e)j.lineJoin=O=e;d(a.getContextStyle());j.stroke();Y.inflate(b*2)}function ha(a){f(a.getContextStyle());j.fill()}function Ca(a,b,c,d,e,g,h,i,l,k,m,o,n){if(n.image.width!=0){if(n.needsUpdate==!0||za[n.id]==void 0){var q=n.wrapS==THREE.RepeatWrapping,r=n.wrapT==THREE.RepeatWrapping;za[n.id]=j.createPattern(n.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");n.needsUpdate=!1}f(za[n.id]);var q=n.offset.x/n.repeat.x,r=n.offset.y/n.repeat.y,
-s=(n.image.width-1)*n.repeat.x,n=(n.image.height-1)*n.repeat.y,h=(h+q)*s,i=(i+r)*n,l=(l+q)*s,k=(k+r)*n,m=(m+q)*s,o=(o+r)*n;c-=a;d-=b;e-=a;g-=b;l-=h;k-=i;m-=h;o-=i;q=1/(l*o-m*k);n=(o*c-k*e)*q;k=(o*d-k*g)*q;c=(l*e-m*c)*q;d=(l*g-m*d)*q;a=a-n*h-c*i;b=b-k*h-d*i;j.save();j.transform(n,k,c,d,a,b);j.fill();j.restore()}}function ma(a,b,c,d,e,f,g,h,i,k,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;k*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;k-=h;l-=g;m-=h;q=1/(i*m-l*k);o=(m*c-k*e)*q;k=(m*d-k*f)*q;c=(i*
-e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-k*g-d*h;j.save();j.transform(o,k,c,d,a,b);j.clip();j.drawImage(n,0,0);j.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:
-j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);e.info.render.vertices=0;e.info.render.faces=0;
-g=h.projectScene(a,k,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=g.length;xa<Ja;xa++){A=g[xa];Y.empty();if(A instanceof THREE.RenderableParticle){s=A;s.x*=i;s.y*=n;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(s,A,X,a)}else if(A instanceof THREE.RenderableLine){if(s=A.v1,o=A.v2,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(o.positionScreen.x,o.positionScreen.y),
-ka.intersects(Y)){fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&t(s,o,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(s=A.v1,o=A.v2,C=A.v3,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,C.positionScreen.x*=i,C.positionScreen.y*=n,A.overdraw&&(ia(s.positionScreen,o.positionScreen),ia(o.positionScreen,C.positionScreen),ia(C.positionScreen,s.positionScreen)),Y.add3Points(s.positionScreen.x,s.positionScreen.y,o.positionScreen.x,
-o.positionScreen.y,C.positionScreen.x,C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(s,o,C,0,1,2,A,X,a)}else X.opacity!=0&&u(s,o,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(s=A.v1,o=A.v2,C=A.v3,D=A.v4,s.positionScreen.x*=i,s.positionScreen.y*=n,o.positionScreen.x*=i,o.positionScreen.y*=n,C.positionScreen.x*=
-i,C.positionScreen.y*=n,D.positionScreen.x*=i,D.positionScreen.y*=n,T.positionScreen.copy(o.positionScreen),U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(s.positionScreen,o.positionScreen),ia(o.positionScreen,D.positionScreen),ia(D.positionScreen,s.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(o.positionScreen.x,o.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),
-Y.addPoint(D.positionScreen.x,D.positionScreen.y),ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(s,o,C,D,T,U,A,X,a)}else X.opacity!=0&&w(s,o,C,D,T,U,A,X,a)}$.addRectangle(Y)}j.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.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.CanvasRenderer=function(a){function b(a){if(F!=a)k.globalAlpha=F=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}H=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(K!=a)k.fillStyle=K=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,o,n,p,k=j.getContext("2d"),u=new THREE.Color(0),v=0,F=1,H=0,M=null,K=null,N=null,L=null,I=null,s,y,G,U,R=new THREE.RenderableVertex,P=new THREE.RenderableVertex,t,z,r,D,x,J,E,T,Z,ba,ga,da,w=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C=new THREE.Color,O=new THREE.Color,wa=[],ea,fa,ca,Y,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,W=new THREE.Rectangle,V=new THREE.Rectangle,xa=!1,X=new THREE.Color,ra=new THREE.Color,sa=new THREE.Color,Q=new THREE.Vector3,oa,pa,ya,$,qa,ta,a=16;oa=document.createElement("canvas");
+oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);ya=pa.getImageData(0,0,2,2);$=ya.data;qa=document.createElement("canvas");qa.width=qa.height=a;ta=qa.getContext("2d");ta.translate(-a/2,-a/2);ta.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;o=b;n=Math.floor(i/2);p=Math.floor(o/2);j.width=i;j.height=o;ka.set(-n,-p,n,p);W.set(-n,-p,n,p);F=1;H=0;I=
+L=N=K=M=null};this.setClearColor=function(a,b){u.copy(a);v=b;W.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){u.setHex(a);v=b;W.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);W.isEmpty()||(W.minSelf(ka),W.inflate(2),v<1&&k.clearRect(Math.floor(W.getX()),Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight())),v>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+v+")"),k.fillRect(Math.floor(W.getX()),
+Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight()))),W.empty())};this.render=function(a,j){function i(a){var b,c,d,e;X.setRGB(0,0,0);ra.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function o(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(Q.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 u(a,e,g){b(g.opacity);c(g.blending);var h,j,l,i,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,q=i.width>>1,o=i.height>>
+1,g=e.scale.x*n,l=e.scale.y*p,h=g*q,j=l*o,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,j=e.scale.y*p,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(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 v(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(N!=a)k.lineWidth=N=a;a=g.linecap;if(L!=a)k.lineCap=L=a;a=g.linejoin;if(I!=a)k.lineJoin=I=a;d(g.color.getContextStyle());k.stroke();V.inflate(g.linewidth*2)}}function F(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);t=a.positionScreen.x;z=a.positionScreen.y;
+r=d.positionScreen.x;D=d.positionScreen.y;x=f.positionScreen.x;J=f.positionScreen.y;H(t,z,r,D,x,J);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,x,J,Y[g].u,Y[g].v,Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,Q.copy(i.vertexNormalsWorld[g]),Aa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ba=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[h]),
+Ca=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Da=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[k]),Ea=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Fa=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,za(t,z,r,D,x,J,Aa,Ba,Ca,Da,Ea,Fa,q.envMap)}else q.wireframe?ha(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&&(Y=i.uvs[0],za(t,z,r,D,x,J,Y[g].u,Y[g].v,
+Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map)),c(THREE.SubtractiveBlending)),xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=B.r=C.r=X.r,A.g=B.g=C.g=X.g,A.b=B.b=C.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],B),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],C),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)),B.r=Math.max(0,Math.min(q.color.r*
+B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ca=ua(A,B,C,O),ma(t,z,r,D,x,J,0,0,1,0,0,1,ca)):(w.r=X.r,w.g=X.g,w.b=X.b,o(l,i.centroidWorld,i.normalWorld,w),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,
+1)),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)):q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(f.positionScreen.z,ea,fa),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ca=ua(A,B,C,O),ma(t,z,r,D,x,J,0,0,1,0,0,1,ca);else if(q instanceof THREE.MeshNormalMaterial)w.r=
+na(i.normalWorld.x),w.g=na(i.normalWorld.y),w.b=na(i.normalWorld.z),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)}function K(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)F(a,d,g,0,1,3,i,q,n),F(h,f,k,1,2,3,i,q,n);else if(t=a.positionScreen.x,z=a.positionScreen.y,r=d.positionScreen.x,D=d.positionScreen.y,x=f.positionScreen.x,J=f.positionScreen.y,E=g.positionScreen.x,T=g.positionScreen.y,Z=h.positionScreen.x,
+ba=h.positionScreen.y,ga=k.positionScreen.x,da=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(t,z,r,D,x,J,E,T),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=B.r=C.r=O.r=X.r,A.g=B.g=C.g=O.g=X.g,A.b=B.b=C.b=O.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
+B),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],C),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],O),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)),B.r=Math.max(0,Math.min(q.color.r*B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=Math.max(0,Math.min(q.color.r*
+O.r,1)),O.g=Math.max(0,Math.min(q.color.g*O.g,1)),O.b=Math.max(0,Math.min(q.color.b*O.b,1)),ca=ua(A,B,C,O),H(t,z,r,D,E,T),ma(t,z,r,D,E,T,0,0,1,0,0,1,ca),H(Z,ba,x,J,ga,da),ma(Z,ba,x,J,ga,da,1,0,1,1,0,1,ca)):(w.r=X.r,w.g=X.g,w.b=X.b,o(l,i.centroidWorld,i.normalWorld,w),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),M(t,z,r,D,x,J,E,T),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)):(M(t,
+z,r,D,x,J,E,T),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)w.r=na(i.normalWorld.x),w.g=na(i.normalWorld.y),w.b=na(i.normalWorld.z),M(t,z,r,D,x,J,E,T),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(g.positionScreen.z,
+ea,fa),O.r=O.g=O.b=1-la(f.positionScreen.z,ea,fa),ca=ua(A,B,C,O),H(t,z,r,D,E,T),ma(t,z,r,D,E,T,0,0,1,0,0,1,ca),H(Z,ba,x,J,ga,da),ma(Z,ba,x,J,ga,da,1,0,1,1,0,1,ca)}function H(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 M(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(N!=b)k.lineWidth=N=b;if(L!=c)k.lineCap=L=c;if(I!=e)k.lineJoin=I=e;d(a.getContextStyle());
+k.stroke();V.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||wa[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;wa[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(wa[m.id]);var p=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+p)*s,i=(i+r)*m,j=
+(j+p)*s,l=(l+r)*m,n=(n+p)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;p=1/(j*o-n*l);m=(o*c-l*e)*p;l=(o*d-l*g)*p;c=(j*e-n*c)*p;d=(j*g-n*d)*p;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;i*=o;j*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);o=(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-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
+k.drawImage(n,0,0);k.restore()}function ua(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);$[0]=e<0?0:e>255?255:e;$[1]=f<0?0:f>255?255:f;$[2]=a<0?0:a>255?255:a;$[4]=g<0?0:g>255?255:g;$[5]=h<0?0:h>255?255:h;$[6]=b<0?0:b>255?255:b;$[8]=i<0?0:i>255?255:i;$[9]=j<0?0:j>255?255:j;$[10]=c<0?0:c>255?255:c;$[12]=k<0?0:k>255?255:k;$[13]=l<0?0:l>255?255:l;$[14]=d<0?0:d>255?255:
+d;pa.putImageData(ya,0,0);ta.drawImage(oa,0,0);return qa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function 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 va,Ga,S,aa;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);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);va=0;for(Ga=h.length;va<Ga;va++)if(S=
+h[va],aa=S.material,aa=aa instanceof THREE.MeshFaceMaterial?S.faceMaterial:aa,!(aa==null||aa.opacity==0)){V.empty();if(S instanceof THREE.RenderableParticle)s=S,s.x*=n,s.y*=p,u(s,S,aa,a);else if(S instanceof THREE.RenderableLine)s=S.v1,y=S.v2,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,V.addPoint(s.positionScreen.x,s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),ka.intersects(V)&&v(s,y,S,aa,a);else if(S instanceof THREE.RenderableFace3)s=
+S.v1,y=S.v2,G=S.v3,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,G.positionScreen.x*=n,G.positionScreen.y*=p,aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,G.positionScreen),ja(G.positionScreen,s.positionScreen)),V.add3Points(s.positionScreen.x,s.positionScreen.y,y.positionScreen.x,y.positionScreen.y,G.positionScreen.x,G.positionScreen.y),ka.intersects(V)&&F(s,y,G,0,1,2,S,aa,a);else if(S instanceof THREE.RenderableFace4)s=S.v1,y=S.v2,
+G=S.v3,U=S.v4,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,G.positionScreen.x*=n,G.positionScreen.y*=p,U.positionScreen.x*=n,U.positionScreen.y*=p,R.positionScreen.copy(y.positionScreen),P.positionScreen.copy(U.positionScreen),aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,U.positionScreen),ja(U.positionScreen,s.positionScreen),ja(G.positionScreen,R.positionScreen),ja(G.positionScreen,P.positionScreen)),V.addPoint(s.positionScreen.x,
+s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(G.positionScreen.x,G.positionScreen.y),V.addPoint(U.positionScreen.x,U.positionScreen.y),ka.intersects(V)&&aa.opacity!=0&&K(s,y,G,U,R,P,S,aa,a);W.addRectangle(V)}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.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};

+ 55 - 61
build/custom/ThreeDOM.js

@@ -14,79 +14,73 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 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){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
-j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,i)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,j)||c(m,k,i,j)))d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d)}return e}};
-THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,l){h=!1;b=f;c=g;d=j;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;var h,k,l,i,j,n,m,o,p=a.geometry,r=p.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);g=0;for(f=p.faces.length;g<f;g++)if(d=p.faces[g],m=this.origin.clone(),o=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(o),!(n<=0)&&(h=i.multiplyVector3(r[d.a].position.clone()),k=i.multiplyVector3(r[d.b].position.clone()),
+l=i.multiplyVector3(r[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(r[d.d].position.clone()):null,j=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=o.dot(j),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=j.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(o.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,l)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,i)||c(m,k,l,i)))d={distance:this.origin.distanceTo(m),
+point:m,face:d,object:a},e.push(d)}return e}};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,i,j){h=!1;b=f;c=g;d=i;e=j;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
+function(f,g,i,j,n,m){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<j?g<m?g:m:j<m?j:m,d=f>i?f>n?f:n:i>n?i:n,e=g>j?g>m?g:m:j>m?j:m):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>j?g>m?g>e?g:e:m>e?m:e:j>m?j>e?j:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};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,e,g,f,h,k,i,j,l,n,m,p,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,i||0,j!==void 0?j:1,l||0,n||0,m||0,p||0,q!==void 0?q:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,i,j,l,n,m,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=i;this.n33=j;this.n34=l;this.n41=n;this.n42=m;this.n43=p;this.n44=q;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,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;
-a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44,J=b.n11,M=b.n12,
-C=b.n13,D=b.n14,H=b.n21,v=b.n22,o=b.n23,K=b.n24,z=b.n31,E=b.n32,F=b.n33,Q=b.n34,R=b.n41,S=b.n42,T=b.n43,U=b.n44;this.n11=c*J+d*H+e*z+g*R;this.n12=c*M+d*v+e*E+g*S;this.n13=c*C+d*o+e*F+g*T;this.n14=c*D+d*K+e*Q+g*U;this.n21=f*J+h*H+k*z+i*R;this.n22=f*M+h*v+k*E+i*S;this.n23=f*C+h*o+k*F+i*T;this.n24=f*D+h*K+k*Q+i*U;this.n31=j*J+l*H+n*z+m*R;this.n32=j*M+l*v+n*E+m*S;this.n33=j*C+l*o+n*F+m*T;this.n34=j*D+l*K+n*Q+m*U;this.n41=p*J+q*H+s*z+r*R;this.n42=p*M+q*v+s*E+r*S;this.n43=p*C+q*o+s*F+r*T;this.n44=p*D+q*
-K+s*Q+r*U;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=
-a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,i=this.n32,j=this.n33,l=this.n34,n=this.n41,m=this.n42,p=this.n43,q=this.n44;return d*f*i*n-c*h*i*n-d*g*j*n+b*h*j*n+c*g*l*n-b*f*l*n-d*f*k*m+c*h*k*m+d*e*j*m-a*h*j*m-c*e*l*m+a*f*l*m+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*l*p-a*g*l*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*j*q+a*g*j*q},
-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),e=1-c,g=a.x,f=a.y,h=a.z,k=e*g,i=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,i*f+c,i*h-d*g,0,k*h-d*f,i*h+d*g,e*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(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=
-f*h,i=f*e,j=d*h,l=d*e;this.n11=k+l*c;this.n12=j*c-i;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=i*c-j;this.n32=l+k*c;this.n33=g*f;break;case "ZXY":k=f*h;i=f*e;j=d*h;l=d*e;this.n11=k-l*c;this.n12=-g*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=g*h;this.n23=l-k*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":k=g*h;i=g*e;j=c*h;l=c*e;this.n11=f*h;this.n12=j*d-i;this.n13=k*d+l;this.n21=f*e;this.n22=l*d+k;this.n23=i*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":k=g*f;i=
-g*d;j=c*f;l=c*d;this.n11=f*h;this.n12=l-k*e;this.n13=j*e+i;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=k-l*e;break;case "XZY":k=g*f;i=g*d;j=c*f;l=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=k*e+l;this.n22=g*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=l*e+k;break;default:k=g*h,i=g*e,j=c*h,l=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=i+j*d,this.n22=k-l*d,this.n23=-c*f,this.n31=l-k*d,this.n32=j+i*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);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,e=THREE.Matrix4.__m2;
-d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.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=e.length();c.z=g.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},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;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*e;this.n23=
-a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*l*s-h*m*s-k*l*r+h*n*r;b.n12=g*n*q-e*m*q-g*l*s+d*m*s+e*l*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*l-e*i*l-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*j*s+f*m*s+k*j*r-f*n*r;b.n22=e*m*p-g*n*p+g*j*s-c*m*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
-e*i*j-g*k*j+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*l*p+i*j*q-f*m*q-h*j*r+f*l*r;b.n32=g*l*p-d*m*p-g*j*q+c*m*q+d*j*r-c*l*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*l+c*i*l+d*f*m-c*h*m;b.n41=k*l*p-h*n*p-k*j*q+f*n*q+h*j*s-f*l*s;b.n42=d*n*p-e*l*p+e*j*q-c*n*q-d*j*s+c*l*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*l-c*k*l-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
+THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,l||0,i!==void 0?i:1,j||0,n||0,m||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=l;this.n33=i;this.n34=j;this.n41=n;this.n42=m;this.n43=o;this.n44=p;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,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,l=a.n24,i=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,r=a.n43,
+s=a.n44,v=b.n11,C=b.n12,K=b.n13,y=b.n14,F=b.n21,G=b.n22,w=b.n23,A=b.n24,O=b.n31,I=b.n32,M=b.n33,H=b.n34,D=b.n41,t=b.n42,B=b.n43,q=b.n44;this.n11=c*v+d*F+e*O+g*D;this.n12=c*C+d*G+e*I+g*t;this.n13=c*K+d*w+e*M+g*B;this.n14=c*y+d*A+e*H+g*q;this.n21=f*v+h*F+k*O+l*D;this.n22=f*C+h*G+k*I+l*t;this.n23=f*K+h*w+k*M+l*B;this.n24=f*y+h*A+k*H+l*q;this.n31=i*v+j*F+n*O+m*D;this.n32=i*C+j*G+n*I+m*t;this.n33=i*K+j*w+n*M+m*B;this.n34=i*y+j*A+n*H+m*q;this.n41=o*v+p*F+r*O+s*D;this.n42=o*C+p*G+r*I+s*t;this.n43=o*K+p*
+w+r*M+s*B;this.n44=o*y+p*A+r*H+s*q;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,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
+c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,l=this.n32,i=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*f*l*n-c*h*l*n-d*g*i*n+b*h*i*n+c*g*j*n-b*f*j*n-d*f*k*m+c*h*k*m+d*e*i*m-a*h*i*m-c*e*j*m+a*f*j*m+d*g*k*o-b*h*k*o-d*e*l*o+a*h*l*o+b*e*j*o-a*g*j*o-c*g*k*p+b*f*k*p+c*e*l*p-a*f*l*p-b*e*i*p+a*g*i*p},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),e=1-c,g=a.x,f=a.y,h=a.z,k=e*g,l=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,l*f+c,l*h-d*g,0,k*h-d*f,l*h+d*g,e*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,e=a.n14,g=a.n21,f=a.n22,h=a.n23,k=a.n24,l=a.n31,i=a.n32,j=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,r=a.n44;this.n11=h*n*o-k*j*o+k*i*p-f*n*p-h*i*r+f*j*r;this.n12=e*j*o-d*n*o-e*i*p+c*n*p+d*i*r-c*j*r;this.n13=d*k*o-e*h*o+e*f*p-c*k*p-d*f*r+c*h*r;this.n14=e*h*i-d*k*i-e*f*j+c*k*j+d*f*n-c*h*n;this.n21=k*j*m-h*n*m-k*l*p+g*n*p+h*l*r-g*j*r;this.n22=d*n*m-e*j*m+
+e*l*p-b*n*p-d*l*r+b*j*r;this.n23=e*h*m-d*k*m-e*g*p+b*k*p+d*g*r-b*h*r;this.n24=d*k*l-e*h*l+e*g*j-b*k*j-d*g*n+b*h*n;this.n31=f*n*m-k*i*m+k*l*o-g*n*o-f*l*r+g*i*r;this.n32=e*i*m-c*n*m-e*l*o+b*n*o+c*l*r-b*i*r;this.n33=d*k*m-e*f*m+e*g*o-b*k*o-c*g*r+b*f*r;this.n34=e*f*l-c*k*l-e*g*i+b*k*i+c*g*n-b*f*n;this.n41=h*i*m-f*j*m-h*l*o+g*j*o+f*l*p-g*i*p;this.n42=c*j*m-d*i*m+d*l*o-b*j*o-c*l*p+b*i*p;this.n43=d*f*m-c*h*m-d*g*o+b*h*o+c*g*p-b*f*p;this.n44=c*h*l-d*f*l+d*g*i-b*h*i-c*g*j+b*f*j;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=f*h,l=f*e,i=d*h,j=d*e;this.n11=k+j*c;this.n12=i*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-i;this.n32=j+k*c;this.n33=g*f;break;case "ZXY":k=f*h;l=f*e;i=d*h;j=d*e;this.n11=k-j*c;this.n12=-g*e;this.n13=i+l*c;this.n21=l+i*c;this.n22=g*h;this.n23=j-k*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":k=
+g*h;l=g*e;i=c*h;j=c*e;this.n11=f*h;this.n12=i*d-l;this.n13=k*d+j;this.n21=f*e;this.n22=j*d+k;this.n23=l*d-i;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=j-k*e;this.n13=i*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+i;this.n33=k-j*e;break;case "XZY":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=k*e+j;this.n22=g*h;this.n23=l*e-i;this.n31=i*e-l;this.n32=c*h;this.n33=j*e+k;break;default:k=g*h,l=g*
+e,i=c*h,j=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+i*d,this.n22=k-j*d,this.n23=-c*f,this.n31=j-k*d,this.n32=i+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.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=e.length();c.z=g.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,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*l;c[7]=a*i;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,l;f=new THREE.Matrix4;h=b-a;k=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,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.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
-a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=k[h]=k[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,j,l=[],n,m=[],p,q,s=[],r,J,M=[],C=[],D=[],H=new THREE.Vector4,v=new THREE.Vector4,
-o=new THREE.Matrix4,K=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,f){var h,i;e=C.length=0;h=a.objects;a=0;for(c=h.length;a<c;a++){i=h[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh)if(j=i.frustumCulled){a:{j=void 0;for(var k=i.matrixWorld,l=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*k.n14+z[m].y*k.n24+z[m].z*k.n34+z[m].w,j<=l){j=!1;break a}j=!0}j=
-!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,H.copy(i.position),o.multiplyVector3(H),d.object=i,d.z=H.z,C.push(d)}f&&C.sort(b);return C};this.projectScene=function(d,e,g){var C=e.near,H=e.far,O,I,x,B,t,y,w,A,G,u,L,V,X,Y,N,W,P;J=q=n=j=D.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(O=0;O<6;O++)G=z[O],G.divideScalar(Math.sqrt(G.x*G.x+G.y*G.y+G.z*G.z));G=this.projectObjects(d,e,!0);d=0;for(O=G.length;d<O;d++)if(u=G[d].object,u.visible)if(L=u.matrixWorld,V=u.matrixRotationWorld,X=u.materials,Y=u.overdraw,h=0,u instanceof THREE.Mesh){N=u.geometry;B=N.vertices;W=
-N.faces;N=N.faceVertexUvs;I=0;for(x=B.length;I<x;I++)f=a(),f.positionWorld.copy(B[I].position),L.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen),f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>C&&f.positionScreen.z<H;B=0;for(I=W.length;B<I;B++){x=W[B];if(x instanceof THREE.Face3)if(t=k[x.a],y=k[x.b],w=k[x.c],t.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-
-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(w.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0))A=l[j]=l[j]||new THREE.RenderableFace3,j++,i=A,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=k[x.a],y=k[x.b],w=k[x.c],A=k[x.d],t.visible&&y.visible&&w.visible&&A.visible&&(u.doubleSided||u.flipSided!=((A.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(A.positionScreen.y-t.positionScreen.y)*
-(y.positionScreen.x-t.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-w.positionScreen.x)<0)))P=m[n]=m[n]||new THREE.RenderableFace4,n++,i=P,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);
-w=x.vertexNormals;t=0;for(y=w.length;t<y;t++)A=i.vertexNormalsWorld[t],A.copy(w[t]),V.multiplyVector3(A);t=0;for(y=N.length;t<y;t++)if(P=N[t][B]){w=0;for(A=P.length;w<A;w++)i.uvs[t][w]=P[w]}i.meshMaterials=X;i.faceMaterials=x.materials;i.overdraw=Y;i.z=i.centroidScreen.z;D.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;t=a();t.positionScreen.copy(B[0].position);K.multiplyVector4(t.positionScreen);I=1;for(x=B.length;I<x;I++)if(t=a(),t.positionScreen.copy(B[I].position),
-K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.positionScreen),c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),L=s[q]=s[q]||new THREE.RenderableLine,q++,p=L,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(F),p.z=Math.max(E.z,F.z),p.materials=u.materials,D.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=
-L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
+this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},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.RenderableVertex;e++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],l,i=[],j,n,m=[],o,p,r=[],s={objects:[],lines:[],sprites:[],lights:[],
+elements:[]};new THREE.Vector3;var v=new THREE.Vector4,C=new THREE.Matrix4,K=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
+a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[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=y[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);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,b.projectionMatrixInverse);
+C.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(a){s.objects.length=0;s.lines.length=0;s.sprites.length=0;s.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),e=0;e<6;e++)if(c=y[e].x*d.n14+y[e].y*d.n24+y[e].z*d.n34+y[e].w,c<=f){c=!1;break a}c=!0}c?s.objects.push(a):a instanceof THREE.Line?s.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?s.sprites.push(a):a instanceof THREE.Light&&s.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return s};this.projectScene=function(w,A,y){var I=A.near,M=A.far,H,D,t,B,q,z,x,E,u,J,L,P,S,Q,R,N;p=n=l=h=0;s.elements.length=0;A.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+w.add(A));w.updateMatrixWorld();A.matrixWorldInverse.getInverse(A.matrixWorld);C.multiply(A.projectionMatrix,A.matrixWorldInverse);this.computeFrustum(C);s=this.projectGraph(w);w=0;for(H=s.objects.length;w<H;w++)if(u=s.objects[w],J=u.matrixWorld,P=u.material,e=0,u instanceof THREE.Mesh){L=u.geometry;S=u.geometry.materials;B=L.vertices;Q=L.faces;R=L.faceVertexUvs;L=u.matrixRotationWorld.extractRotation(J);D=0;for(t=B.length;D<t;D++)d=a(),d.positionWorld.copy(B[D].position),J.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),C.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>I&&d.positionScreen.z<M;B=0;for(D=Q.length;B<D;B++){t=Q[B];if(t instanceof THREE.Face3)if(q=g[t.a],z=g[t.b],x=g[t.c],q.visible&&z.visible&&x.visible&&(u.doubleSided||u.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(z.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(z.positionScreen.x-
+q.positionScreen.x)<0))E=k[h]=k[h]||new THREE.RenderableFace3,h++,f=E,f.v1.copy(q),f.v2.copy(z),f.v3.copy(x);else continue;else if(t instanceof THREE.Face4)if(q=g[t.a],z=g[t.b],x=g[t.c],E=g[t.d],q.visible&&z.visible&&x.visible&&E.visible&&(u.doubleSided||u.flipSided!=((E.positionScreen.x-q.positionScreen.x)*(z.positionScreen.y-q.positionScreen.y)-(E.positionScreen.y-q.positionScreen.y)*(z.positionScreen.x-q.positionScreen.x)<0||(z.positionScreen.x-x.positionScreen.x)*(E.positionScreen.y-x.positionScreen.y)-
+(z.positionScreen.y-x.positionScreen.y)*(E.positionScreen.x-x.positionScreen.x)<0)))N=i[l]=i[l]||new THREE.RenderableFace4,l++,f=N,f.v1.copy(q),f.v2.copy(z),f.v3.copy(x),f.v4.copy(E);else continue;f.normalWorld.copy(t.normal);L.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);J.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);C.multiplyVector3(f.centroidScreen);x=t.vertexNormals;q=0;for(z=x.length;q<z;q++)E=f.vertexNormalsWorld[q],E.copy(x[q]),L.multiplyVector3(E);
+q=0;for(z=R.length;q<z;q++)if(N=R[q][B]){x=0;for(E=N.length;x<E;x++)f.uvs[q][x]=N[x]}f.material=P;f.faceMaterial=t.materialIndex!==null?S[t.materialIndex]:null;f.z=f.centroidScreen.z;s.elements.push(f)}}w=0;for(H=s.lines.length;w<H;w++)if(u=s.lines[w],J=u.matrixWorld,P=u.material,e=0,u instanceof THREE.Line){K.multiply(C,J);B=u.geometry.vertices;q=a();q.positionScreen.copy(B[0].position);K.multiplyVector4(q.positionScreen);D=1;for(t=B.length;D<t;D++)if(q=a(),q.positionScreen.copy(B[D].position),K.multiplyVector4(q.positionScreen),
+z=g[e-2],F.copy(q.positionScreen),G.copy(z.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),I=m[n]=m[n]||new THREE.RenderableLine,n++,j=I,j.v1.positionScreen.copy(F),j.v2.positionScreen.copy(G),j.z=Math.max(F.z,G.z),j.material=P,s.elements.push(j)}w=0;for(H=s.sprites.length;w<H;w++)if(u=s.sprites[w],J=u.matrixWorld,u instanceof THREE.Particle&&(v.set(J.n14,J.n24,J.n34,1),C.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))I=r[p]=r[p]||new THREE.RenderableParticle,p++,o=I,o.x=v.x/v.w,
+o.y=v.y/v.w,o.z=v.z,o.rotation=u.rotation.z,o.scale.x=u.scale.x*Math.abs(o.x-(v.x+A.projectionMatrix.n11)/(v.w+A.projectionMatrix.n14)),o.scale.y=u.scale.y*Math.abs(o.y-(v.y+A.projectionMatrix.n22)/(v.w+A.projectionMatrix.n24)),o.material=u.material,s.elements.push(o);y&&s.elements.sort(b);return s}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-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,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);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;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
-THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-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,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,l=k*c+f*e-h*d,i=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
+c-f*d-h*e;b.x=l*k+c*-g+i*-h-j*-f;b.y=i*k+c*-f+j*-g-l*-h;b.z=j*k+c*-h+l*-f-i*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)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)*g)/e;d=Math.sin(d*g)/e;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,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=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.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var k,i,j,l,n,m,p,q;a=b.projectScene(c,d);k=0;for(i=a.length;k<i;k++)if(n=a[k],n instanceof THREE.RenderableParticle){p=n.x*e+e;q=n.y*g+g;j=0;for(l=n.material.length;j<l;j++)if(m=n.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=q+"px"}}};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var k,l,i,j,n,m,o,p;a=b.projectScene(c,d);k=0;for(l=a.length;k<l;k++)if(n=a[k],n instanceof THREE.RenderableParticle){o=n.x*e+e;p=n.y*g+g;i=0;for(j=n.material.length;i<j;i++)if(m=n.material[i],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=o+"px",m.style.top=p+"px"}}};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};

+ 235 - 237
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,f=a.b,h=Math.max(Math.max(b,e),f),g=Math.min(Math.min(b,e),f);if(g===h)g=b=0;else{var k=h-g,g=k/h,b=b===h?(e-f)/k:e===h?2+(f-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=g;c.v=h;return c}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-g)/k:e===h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},t=0;t<a.materials.length;t++)u[a.materials[t].id]=t;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var t=0,z=k.length;t<z;t++){var v=new THREE.Vertex(k[t].position.clone());b&&b.multiplyVector3(v.position);g.push(v)}t=
-0;for(z=m.length;t<z;t++){var g=m[t],p,y,x=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(g.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(g.materialIndex!==void 0){k=h.materials[g.materialIndex];
-v=u[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);p.materialIndex=v}p.centroid.copy(g.centroid);b&&b.multiplyVector3(p.centroid);l.push(p)}t=0;for(z=o.length;t<z;t++){b=o[t];e=[];k=0;for(v=b.length;k<v;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var g=new THREE.Vertex(e[a].position.clone());c.vertices.push(g)}a=0;
-for(b=f.length;a<b;a++){var k=f[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(g=o.length;e<g;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){f=h[a];l=[];e=0;for(g=f.length;e<
-g;e++)l.push(new THREE.UV(f[e].u,f[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,f,h,g=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);k.copy(c);k.multiplyScalar(f);g.addSelf(k);k.copy(b);k.multiplyScalar(h);g.addSelf(k);return g},randomPointInFace:function(a,c,b){var e,f,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,f=c.vertices[a.b].position,
-h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;f=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,g;b?a._area1&&a._area2?(b=a._area1,g=a._area2):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c),a._area1=b,a._area2=g):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c));return THREE.GeometryUtils.random()*(b+
-g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,u,t;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
-THREE.Face4)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,t),e._area2=THREE.GeometryUtils.triangleArea(o,u,t),e._area=e._area1+e._area2;l+=e._area;m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],t={},u=0;u<a.materials.length;u++)t[a.materials[u].id]=u;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var u=0,z=k.length;u<z;u++){var v=new THREE.Vertex(k[u].position.clone());b&&b.multiplyVector3(v.position);f.push(v)}u=
+0;for(z=m.length;u<z;u++){var f=m[u],p,y,x=f.vertexNormals,w=f.vertexColors;f instanceof THREE.Face3?p=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(p=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));p.normal.copy(f.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(f.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
+v=t[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);p.materialIndex=v}p.centroid.copy(f.centroid);b&&b.multiplyVector3(p.centroid);l.push(p)}u=0;for(z=o.length;u<z;u++){b=o[u];e=[];k=0;for(v=b.length;k<v;k++)e.push(new THREE.UV(b[k].u,b[k].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
+for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materialIndex=k.materialIndex;l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<
+f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,
+h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+
+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var f=e+Math.floor((c-e)/2);return m[f]>a?b(e,f-1):m[f]<a?b(f+1,c):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,t,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,t);else if(e instanceof
+THREE.Face4)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,t,u),e._area=e._area1+e._area2;l+=e._area;m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=a.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var u=o-1<0?f-1:o-1,t=(o+1)%f,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(u*e+z)*4]/255*c]);p.push([0,-1,k[(u*e+n)*4]/255*c]);p.push([1,-1,k[(u*e+v)*4]/255*c]);
-p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(t*e+v)*4]/255*c]);p.push([0,1,k[(t*e+n)*4]/255*c]);p.push([-1,1,k[(t*e+z)*4]/255*c]);u=[];z=p.length;for(t=0;t<z;t++){var v=p[t],x=p[(t+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];u.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(t=0;t<u.length;t++)p[0]+=u[t][0],p[1]+=u[t][1],p[2]+=u[t][2];p[0]/=u.length;p[1]/=u.length;p[2]/=u.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
-255|0;m[y+2]=p[2]*255|0;m[y+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,f=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);f.add(h)}return f}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var t=o-1<0?g-1:o-1,u=(o+1)%g,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(t*e+z)*4]/255*c]);p.push([0,-1,k[(t*e+n)*4]/255*c]);p.push([1,-1,k[(t*e+v)*4]/255*c]);
+p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(u*e+v)*4]/255*c]);p.push([0,1,k[(u*e+n)*4]/255*c]);p.push([-1,1,k[(u*e+z)*4]/255*c]);t=[];z=p.length;for(u=0;u<z;u++){var v=p[u],x=p[(u+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];t.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
+255|0;m[y+2]=p[2]*255|0;m[y+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,g=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);g.add(h)}return g}};
 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",
@@ -23,77 +23,77 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};
-THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),f,h=0;c.push(0);for(f=1;f<=a;f++)b=this.getPoint(f/a),h+=b.distanceTo(e),c.push(h),e=b;return this.cacheArcLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,f=b.length,h;h=c?c:a*b[f-1];time=Date.now();for(var g=0,k=f-1,l;g<=k;)if(e=Math.floor(g+(k-g)/2),l=b[e]-h,l<0)g=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(f-1);g=b[e];return b=(e+(h-g)/(b[e+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,e=this.getPoint(0),g,h=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),h+=b.distanceTo(e),c.push(h),e=b;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),e=0,g=b.length,h;h=c?c:a*b[g-1];time=Date.now();for(var f=0,k=g-1,l;f<=k;)if(e=Math.floor(f+(k-f)/2),l=b[e]-h,l<0)f=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(g-1);f=b[e];return b=(e+(h-f)/(b[e+1]-f))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);var c=this.getPoint(c),a=this.getPoint(a),b=new THREE.Vector2;b.sub(a,c);return b.unit()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};THREE.LineCurve.prototype=new THREE.Curve;
 THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
 THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),c=new THREE.Vector2(e[2],e[3]),b=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
 THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c};
-THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),b=new THREE.Vector2(f[4],f[5]),e=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve=function(a,c,b,e){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),e=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
 THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c};
 THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,e,f,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,e,g,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=g;this.aClockwise=h};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,f){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,f){var a=(b-a)*0.5,e=(e-c)*0.5,h=f*f;return(2*c-2*b+a+e)*f*h+(-3*c+3*b-2*a-e)*h+a*f+c}};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}};
 THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(a);c.addSelf(this.v1);return c});
 THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)});
 THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,e){this.v0=a;this.v1=c;this.v2=b;this.v3=e},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)});
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,f);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,f);return c});
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,g;g=(e.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>e.length-2?a:a+1;b[3]=a>e.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(e[b[0]].x,e[b[1]].x,e[b[2]].x,e[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[b[3]].z,g);return c});
 THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
 THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,e=this.curves.length;for(b=0;b<e;b++)c+=this.curves[b].getLength(),a.push(c);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,f;c=b=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,g,k,l;l=new THREE.Vector2;g=0;for(k=a.length;g<k;g++){h=a[g];if(h.x>c)c=h.x;else if(h.x<e)e=h.x;if(h.y>b)b=h.y;else if(h.y<b)f=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:c,maxY:b,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),c,b,e,g;c=b=Number.NEGATIVE_INFINITY;e=g=Number.POSITIVE_INFINITY;var h,f,k,l;l=new THREE.Vector2;f=0;for(k=a.length;f<k;f++){h=a[f];if(h.x>c)c=h.x;else if(h.x<e)e=h.x;if(h.y>b)b=h.y;else if(h.y<b)g=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:g,maxX:c,maxY:b,centroid:l.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
-THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,f;if(!c)c=this.bends;e=0;for(f=c.length;e<f;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,f;if(!c)c=this.bends;e=0;for(f=c.length;e<f;e++)b=this.getWrapPoints(b,c[e]);return b};
-THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,f,h,g,k,l;e=0;for(f=a.length;e<f;e++)h=a[e],g=h.x,k=h.y,l=g/b.maxX,l=c.getUtoTmapping(l,g),g=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=g.x+k.x,h.y=g.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.CurvePath.prototype.getTransformedPoints=function(a,c){var b=this.getPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,g;if(!c)c=this.bends;e=0;for(g=c.length;e<g;e++)b=this.getWrapPoints(b,c[e]);return b};
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,g,h,f,k,l;e=0;for(g=a.length;e<g;e++)h=a[e],f=h.x,k=h.y,l=f/b.maxX,l=c.getUtoTmapping(l,f),f=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=f.x+k.x,h.y=f.y+k.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
 THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
 THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,f,h){var g=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
-THREE.Path.prototype.arc=function(a,c,b,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,f,h,g,k,l,m,n,o,u,t,z,v;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];u=h[1];b.length>0?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b2(v,t,o,k),v=THREE.Shape.Utils.b2(v,z,u,
-l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];u=h[1];m=h[2];n=h[3];b.length>0?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b3(v,t,o,m,k),v=THREE.Shape.Utils.b3(v,z,u,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];v=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
-for(g=1;g<=v;g++)b.push(h.getPointAt(g/v));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];u=!!h[5];n=g[g.length-2];t=g[g.length-1];g.length==0&&(n=t=0);z=v-o;var p=a*2;for(g=1;g<=p;g++)v=g/p,u||(v=1-v),v=o+v*z,h=n+k+m*Math.cos(v),v=t+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,e,f,h){var g=this.getPoints(),k,l,m,n,o;k=0;for(l=g.length;k<l;k++)m=g[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+f*n+h;return g};
-THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,f,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";e=
-this.getPoints();a=0;for(b=e.length;a<b;a++)f=e[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
-THREE.Path.prototype.toShapes=function(){var a,c,b,e,f=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var g,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(c=f.length;a<c;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&h.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=
-e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(c=f.length;a<c;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
+THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,t,u,z,v;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];t=h[1];b.length>0?(f=b[b.length-1],u=f.x,z=f.y):(f=this.actions[e-1].args,u=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b2(v,u,o,k),v=THREE.Shape.Utils.b2(v,z,t,
+l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];t=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],u=f.x,z=f.y):(f=this.actions[e-1].args,u=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b3(v,u,o,m,k),v=THREE.Shape.Utils.b3(v,z,t,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
+for(f=1;f<=v;f++)b.push(h.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];t=!!h[5];n=f[f.length-2];u=f[f.length-1];f.length==0&&(n=u=0);z=v-o;var p=a*2;for(f=1;f<=p;f++)v=f/p,t||(v=1-v),v=o+v*z,h=n+k+m*Math.cos(v),v=u+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
+THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
+this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
+e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),f,h,g,k,l,m,n,o,u,t,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(f=0;f<m.length;f++){u=m[f];t=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),t.push(n),n<h&&(h=n,g=f,k=o)}f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;var v=[m[g],b[k],b[f]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[g],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(p);t=k;n=g;k+=1;g+=-1;k<
-0&&(k+=b.length);k%=b.length;g<0&&(g+=m.length);g%=m.length;f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;v=[m[g],b[k],b[f]];v=THREE.FontUtils.Triangulate.area(v);p=[m[g],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+u>v+p&&(k=t,g=n,k<0&&(k+=b.length),k%=b.length,g<0&&(g+=m.length),g%=m.length,f=k-1>=0?k-1:b.length-1,h=g-1>=0?g-1:m.length-1);o=b.slice(0,k);u=b.slice(k);t=m.slice(g);n=m.slice(0,g);h=[m[g],m[h],b[k]];z.push([m[g],b[k],b[f]]);z.push(h);b=o.concat(t).concat(n).concat(u)}return{shape:b,
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,g,k,l,m={};h=0;for(g=e.length;h<g;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(g=b.length;h<g;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(g=f.length;h<g;h++){k=f[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(f)},
-isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
-this.b3p3(a,f)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",f=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,t,u,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){t=m[g];u=[];for(o=0;o<b.length;o++)n=b[o],n=t.distanceToSquared(n),u.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var v=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;n=f;k+=1;f+=-1;k<
+0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;v=[m[f],b[k],b[g]];v=THREE.FontUtils.Triangulate.area(v);p=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+t>v+p&&(k=u,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);t=b.slice(k);u=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];z.push([m[f],b[k],b[g]]);z.push(h);b=o.concat(u).concat(n).concat(t)}return{shape:b,
+isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
+isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
+this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var e=0;e<a.length;e++)a[e].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
 0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var n=
 {};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
-THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,g;for(b=0;b<e;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 h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,h,g,k,l,m,n=this.data.JIT.hierarchy,o,u;this.currentTime+=a*this.timeScale;u=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,z=this.hierarchy.length;t<z;t++)if(a=this.hierarchy[t],l=a.animationCache,this.JITCompile&&n[t][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[t][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[t][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){b=c[v];g=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){g=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(b,t,1);k.time<o;)g=k,k=this.getNextKeyWith(b,t,k.index+1)}else{this.stop();return}else{do g=k,k=this.getNextKeyWith(b,t,k.index+1);while(k.time<
-o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)n[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,h,g,k,l,m;f=(a.length-1)*c;h=Math.floor(f);f-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=f*f;g=f*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,b,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,b,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,b,g);return e};
-THREE.Animation.prototype.interpolate=function(a,c,b,e,f,h,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,t;this.currentTime+=a*this.timeScale;t=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,z=this.hierarchy.length;u<z;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){b=c[v];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=t){if(o<t)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
+o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",u,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var e=this.renderTarget;e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,this.cameraNX,e);e.activeCubeFace=2;a.render(b,this.cameraPY,e);e.activeCubeFace=3;a.render(b,
 this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,f,h,g){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,g);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,f);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
 THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -101,217 +101,215 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function f(a,b,e,c){var g={name:e,fps:0.6,length:c,hierarchy:[]},h,f=b.getControlPointsArray(),k=b.getLength(),p=f.length,y=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:f[h]};g.hierarchy[0]=
-b;THREE.AnimationHandler.add(g);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,g=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return g}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 g=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%g;this.phi=a>=0?a:a+g;e=this.verticalAngleMap.srcRange;
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,y=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=
+b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
-c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,c=h(b,10),g=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);g=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(g,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
+c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,g=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,u=0,t=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*o);this.rotateVertically(c*u)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);g&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);b.cross(e,
-f).normalize();e.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*o);this.rotateVertically(c*t)}c=a*this.movementSpeed;this.object.translateZ(-c*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(c*m);this.object.translateY(c*n);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);e.set(0,1,0);b.cross(e,
+g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-t)/window.innerWidth;u=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:g=!0;k=1;break;case 69:g=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
-THREE.TrackballControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;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 e=!1,f=this.STATE.NONE,h=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,n=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,b){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
-this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(c.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(c.x));e.addSelf(h.setLength(c.z));return e};this.rotateCamera=function(){var a=Math.acos(g.dot(k)/g.length()/k.length());if(a){var b=(new THREE.Vector3).cross(g,k).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,
--a);c.multiplyVector3(h);c.multiplyVector3(this.object.up);c.multiplyVector3(k);this.staticMoving?g=k:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(m.y-l.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?l=m:l.y+=(m.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var b=h.clone().crossSelf(this.object.up).setLength(a.x);
-b.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(b);this.target.addSelf(b);this.staticMoving?n=o:n.addSelf(a.sub(o,n).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
-this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,function(a){e&&(g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),n=o=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
-(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
-a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
-this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var p,t,u=e||1,v=f||1,z=k/2,x=l/2,w=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")p="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")p="y",v=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")p="x",u=h||1;var y=u+1,O=v+1;k/=u;var R=l/v;for(t=0;t<O;t++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(t*R-x)*g;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(t=0;t<v;t++)for(l=0;l<u;l++)m.faces.push(new THREE.Face4(l+
-y*t+w,l+y*(t+1)+w,l+1+y*(t+1)+w,l+1+y*t+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/u,t/v),new THREE.UV(l/u,(t+1)/v),new THREE.UV((l+1)/u,(t+1)/v),new THREE.UV((l+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,t,z,v,p,y,x;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(t=0;t<6;t++)this.materials.push(g)}t=0;p=1;z=2;y=3;v=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=
-void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,t);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,u,v);this.sides.nz&&l("x","y",-1,-1,a,c,-u,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],u=[],t=l/f,z=t*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-t*b+g,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(v,t))}m.push(o);n.push(u)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],t=m[l][k+1],z=
-this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,t,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
-1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
-A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
-k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
-1);for(var b=0,c=t+n*2,b=0;b<c;b++){var e=P*b,g=P*(b+1),h=X+S+e,f=X+S+g,m=h,e=X+T+e,g=X+T+g,o=f;m+=L;e+=L;g+=L;o+=L;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
-b,c,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,u=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(u),t=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);u=x?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)B=u[E],THREE.Shape.Utils.isClockWise(B)&&
-(u[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,u);x=z;E=0;for(I=u.length;E<I;E++)B=u[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){B=u[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=
-0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=t;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/t*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=u.length;E<I;E++){B=u[E];
-R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[t-1].y,p[t-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],g(m[2]+o,m[1]+o,m[0]+o);o=P*(t+n*2);for(C=0;C<H;C++)m=v[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],g(m[0]+P*t,m[1]+P*t,m[2]+P*t)}var S,T,X=0;f(x);X+=x.length;E=0;for(I=u.length;E<I;E++)B=u[E],f(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
+THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
+new THREE.Vector3(0,0,0);var g=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
+e.multiplyVector3(b.object.up);e.multiplyVector3(l);b.staticMoving?k=l:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(n.y-m.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=t.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=t:o.addSelf(a.sub(t,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY),m=n=b.getMouseOnScreen(a.clientX,a.clientY),o=t=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),h!==e.NONE&&(h===e.ROTATE?l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?n=b.getMouseOnScreen(a.clientX,
+a.clientY):h===e.PAN&&!b.noPan&&(t=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=l=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?m=n=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=t=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
+THREE.CubeGeometry=function(a,c,b,e,g,h,f,k){function l(a,b,c,f,k,l,o,n){var p,u,t=e||1,v=g||1,z=k/2,x=l/2,w=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")p="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")p="y",v=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")p="x",t=h||1;var y=t+1,O=v+1;k/=t;var R=l/v;for(u=0;u<O;u++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(u*R-x)*f;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(u=0;u<v;u++)for(l=0;l<t;l++)m.faces.push(new THREE.Face4(l+
+y*u+w,l+y*(u+1)+w,l+1+y*(u+1)+w,l+1+y*u+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/t,u/v),new THREE.UV(l/t,(u+1)/v),new THREE.UV((l+1)/t,(u+1)/v),new THREE.UV((l+1)/t,u/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,t=b/2,u,z,v,p,y,x;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(u=0;u<6;u++)this.materials.push(f)}u=0;p=1;z=2;y=3;v=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=
+void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,u);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,t,v);this.sides.nz&&l("x","y",-1,-1,a,c,-t,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],t=[],u=l/g,z=u*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-u*b+f,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(v,u))}m.push(o);n.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],z=
+this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),y=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,t,u,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
+1],t=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,t,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],t=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,t,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
+k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
+1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=X+S+e,g=X+S+f,m=h,e=X+T+e,f=X+T+f,o=g;m+=L;e+=L;f+=L;o+=L;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(G.vertices[h].position.z+l)/f,g=(G.vertices[g].position.z+l)/f,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
+b,c,null,null,w));if(w){var e=D.maxY,f=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/f,G.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,t=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(t),u=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);z=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
+(t[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,t);x=z;E=0;for(I=t.length;E<I;E++)B=t[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=t.length;E<I;E++){B=t[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=
+0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=u;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];
+R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[u-1].y,p[u-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],f(m[2]+o,m[1]+o,m[0]+o);o=P*(u+n*2);for(C=0;C<H;C++)m=v[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],f(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],f(m[0]+P*u,m[1]+P*u,m[2]+P*u)}var S,T,X=0;g(x);X+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
-l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=g.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),f[k]=this.vertices.length-1):f=h;l==0&&(h=e);
-for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=f;f=[]}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=g.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
-g.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),g.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,f(a,b),f(a,c),k),e(f(a,b),b,f(b,c),k),e(f(a,c),f(b,c),c,k),e(f(a,b),f(b,c),f(a,c),k))}function f(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(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=isFinite(c)?c:3,g=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 k=[],l=this.vertices;e(l[0],l[2],l[4],c);e(l[0],l[4],l[3],c);e(l[0],l[3],l[5],c);e(l[0],l[5],l[2],c);e(l[1],l[2],l[5],c);e(l[1],l[5],l[3],c);e(l[1],l[3],l[4],c);e(l[1],l[4],l[2],
-c);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var f,h=a/2,g=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(f=0;f<l;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(f*m-g),0)));for(f=0;f<e;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
+l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=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=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
+f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(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 k=[],l=this.vertices;e(l[0],l[2],l[4],c);e(l[0],l[4],l[3],c);e(l[0],l[3],l[5],c);e(l[0],l[5],l[2],c);e(l[1],l[2],l[5],c);e(l[1],l[5],l[3],c);e(l[1],l[3],l[4],c);e(l[1],l[4],l[2],c);this.boundingSphere=
+{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6),c=[],b=0;b<g+1;b++){e=b/g;var k=a*Math.cos(e*f),l=a*Math.sin(e*f),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*f),o=l*Math.cos(o*f);(b==0||b==g)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var t,z,v,f=c.length,b=0;b<f;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;g=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
-h-1:e];m=c[b-1][m?0:e+1];u=b/(f-1);t=(b-1)/(f-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,u),u=new THREE.UV(1-o,u),o=new THREE.UV(1-o,t),p=new THREE.UV(1-z,t);b<c.length-1&&(t=this.vertices[g].position.clone(),z=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(t=
-this.vertices[g].position.clone(),z=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,l,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,t=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,t)))-1);m.push(n)}c.push(m)}for(var u,z,v,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
+h-1:e];m=c[b-1][m?0:e+1];t=b/(g-1);u=(b-1)/(g-1);z=(e+1)/h;var o=e/h,n=new THREE.UV(1-z,t),t=new THREE.UV(1-o,t),o=new THREE.UV(1-o,u),p=new THREE.UV(1-z,u);b<c.length-1&&(u=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),u.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,t,o]));b>1&&(u=
+this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),u.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(f[a],c,b,e,k);e+=k.offset;g.push(k.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,c,b,e,f){var h=[],g,k,l,m,n,o,u,t,z,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
-m));f.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));f.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;t=c[a++]*b;f.quadraticCurveTo(u,t,k,m);if(g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,n,u,k),y=THREE.Shape.Utils.b2(y,o,t,m);h.push(new THREE.Vector2(x,y))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,t=c[a++]*-b,z=c[a++]*b+e,v=c[a++]*-b,f.bezierCurveTo(k,m,
-u,t,z,v),g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,n,u,z,k),y=THREE.Shape.Utils.b3(y,o,t,v,m),h.push(new THREE.Vector2(x,y))}}}return{offset:p.ha*b,points:h,path:f}}}};
-(function(a){var c=function(a){for(var c=a.length,f=0,h=c-1,g=0;g<c;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<f;m++)g[m]=m;else for(m=0;m<f;m++)g[m]=f-1-m;var o=2*f;for(m=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;f<=l&&(l=0);m=l+1;f<=m&&(m=0);n=m+1;f<=n&&(n=0);var u;a:{u=a;var t=l,z=m,v=n,p=f,y=g,x=void 0,w=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,L=void 0,w=u[y[t]].x,A=u[y[t]].y,D=u[y[z]].x,B=u[y[z]].y,E=u[y[v]].x,I=u[y[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))u=!1;else{for(x=0;x<p;x++)if(!(x==t||x==z||x==v)){var G=u[y[x]].x,L=u[y[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,K=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,K=B-A,P=G-w,H=L-A,Q=G-D,O=L-B,R=G-E,U=L-I,C=C*O-F*Q,N=N*H-K*P,J=J*U-M*R;if(C>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[g[l]],
-a[g[m]],a[g[n]]]);k.push([g[l],g[m],g[n]]);l=m;for(n=m+1;n<f;l++,n++)g[l]=g[n];f--;o=2*f}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,c,b,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,g=b/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(g))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(g))*Math.sin(h);k.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,g=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(f,h,g,k,[c[f],c[h],c[g],c[k]]);l.normal.addSelf(c[f]);l.normal.addSelf(c[h]);l.normal.addSelf(c[g]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
-this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,c,b,e,f,h,g){function k(a,b,c,e,g,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(g*(2+c)*0.5*Math.cos(a),g*(2+c)*Math.sin(a)*0.5,h*g*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,g=c/this.segmentsT*2*Math.PI,f=k(l,g,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=l.x-f.x;b.y=l.y-f.y;b.z=l.z-f.z;e.x=l.x+f.x;e.y=l.y+f.y;e.z=l.z+f.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=l*e.x+g*h.x;f.y+=l*e.y+g*h.y;f.z+=l*e.z+g*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],g=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,e,h));this.faceVertexUvs[0].push([g,l,m,n])}this.computeCentroids();
+this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,t,u,z,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
+m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;t=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var y=f/divisions,x=THREE.Shape.Utils.b2(y,n,t,k),y=THREE.Shape.Utils.b2(y,o,u,m);h.push(new THREE.Vector2(x,y))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,t=c[a++]*b+e,u=c[a++]*-b,z=c[a++]*b+e,v=c[a++]*-b,g.bezierCurveTo(k,m,
+t,u,z,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)y=f/divisions,x=THREE.Shape.Utils.b3(y,n,t,z,k),y=THREE.Shape.Utils.b3(y,o,u,v,m),h.push(new THREE.Vector2(x,y))}}}return{offset:p.ha*b,points:h,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var u=l,z=m,v=n,p=g,y=f,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,L=void 0,w=t[y[u]].x,A=t[y[u]].y,D=t[y[z]].x,B=t[y[z]].y,E=t[y[v]].x,I=t[y[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==z||x==v)){var G=t[y[x]].x,L=t[y[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,K=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,K=B-A,P=G-w,H=L-A,Q=G-D,O=L-B,R=G-E,U=L-I,C=C*O-F*Q,N=N*H-K*P,J=J*U-M*R;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
+this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
+this.faceVertexUvs[0].push([a[g].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
+THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(g.useOldVertexColors){m.vertexColors=[];for(var p,n,t,u=0;u<4;u++){t=l[u];p=new THREE.Color;p.setRGB(0,0,0);for(var v=0;v<t.length;v++)n=k.vertexColors[t[v]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=t.length;p.g/=t.length;p.b/=t.length;m.vertexColors[u]=p}}f.push(m);(!g.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],f=[],h=[],g=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],u,t,z,v,p,y=a.faceVertexUvs[0];u=0;for(t=y.length;u<t;u++){z=0;for(v=y[u].length;z<v;z++)p=e[u]["abcd".charAt(z)],o[p]||(o[p]=y[u][z])}var x;u=0;for(t=e.length;u<t;u++)if(p=e[u],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),g.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
-o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,g,h,f,k={};e=0;for(g=a.faces.length;e<g;e++)h=a.faces[e],h instanceof THREE.Face3?(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.a),c(k,f,e)):h instanceof THREE.Face4&&(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.d),c(k,f,e),f=b(h.d,h.a),c(k,f,e));return k}(a);var w,A,D=0,y=k.length,B;for(u in v)if(p=v[u],x=p[0],w=
-p[1],B=u.split("_"),t=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[u]=y+e.length+D,l.push(new THREE.Vertex(A)),D++,g.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[t].u+o[B].u,x.v=o[t].v+o[B].v,x.u/=2,x.v/=2,o.push(x);u=0;for(t=m.length;u<t;u++)p=e[u],x=y+u,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,l){var m=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){m.vertexColors=[];for(var n,p,u,t=0;t<4;t++){u=l[t];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)p=k.vertexColors[u[v]-1],n.r+=p.r,n.g+=p.g,n.b+=p.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[t]=n}}g.push(m);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,z,v,p,y=a.faceVertexUvs[0];t=0;for(u=y.length;t<u;t++){z=0;for(v=y[t].length;z<v;z++)p=e[t]["abcd".charAt(z)],o[p]||(o[p]=y[t][z])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
+o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var w,A,D=0,y=k.length,B;for(t in v)if(p=v[t],x=p[0],w=
+p[1],B=t.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[t]=y+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],x=y+t,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
 c(x,n[w],p.b,n[B],p,["123","12","2","23"]),c(x,n[B],p.c,n[D],p,["123","23","3","31"]),c(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(x,n[w],p.b,n[B],p,["1234","12","2","23"]),c(x,n[B],p.c,n[D],p,["1234","23","3","34"]),c(x,n[D],p.d,n[A],p,["1234","34","4","41"]),c(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
-b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(u in v)p=v[u],B=u.split("_"),t=B[0],B=B[1],l(t,[t,B]),l(B,[t,B]),x=p[0],w=p[1],n(t,x),w?n(t,w):n(t,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;u=0;for(t=k.length;u<t;u++)if(E[u]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);y=0;for(z in I[u])l.addSelf(m[z]),y++;l.divideScalar(y);y=E[u].length;for(z=0;z<y;z++)p=E[u][z],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(y);
-v.addSelf(k[u].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[u].position=v}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(t in v)p=v[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);y=0;for(z in I[t])l.addSelf(m[z]),y++;l.divideScalar(y);y=E[t].length;for(z=0;z<y;z++)p=E[t][z],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(y);
+v.addSelf(k[t].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[t].position=v}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function f(a,b,g,h,f,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=g;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+g)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g,k,l;k="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.colorDiffuse)g.color=h(a.colorDiffuse);
-else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpecular);if(a.colorAmbient)g.ambient=h(a.colorAmbient);if(a.transparency)g.opacity=a.transparency;if(a.specularCoef)g.shininess=a.specularCoef;a.mapDiffuse&&c&&f(g,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(g,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(g,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=g.color;k=g.specular;l=g.ambient;var u=g.shininess;n.tNormal.texture=g.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
-g.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=u;if(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[k](g);return g}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
+if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
+else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var t=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
+f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,c=f.callback,b=f.texture_path,e=f.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
-c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,f,h){var g=new XMLHttpRequest,k=e+"/"+a,l=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+g.status+"]"):g.readyState==3?h&&(l==0&&(l=g.getResponseHeader("Content-Length")),h({total:l,loaded:g.responseText.length})):g.readyState==2&&(l=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var f=function(b){function c(a,b){var e=n(a,b),g=n(a,b+1),f=n(a,b+2),h=n(a,b+3),k=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function f(a,b){var c=n(a,b),e=n(a,b+1),g=n(a,b+2);return(n(a,b+3)<<24)+(g<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
-e,g;c=f(a,b);e=f(a,b+B);g=f(a,b+E);b=l(a,b+I);y.faces.push(new THREE.Face3(c,e,g,null,null,b))}function u(b){var c,e,g,h,m,n,o;c=f(a,b);e=f(a,b+B);g=f(a,b+E);h=l(a,b+I);m=f(a,b+G);n=f(a,b+L);o=f(a,b+C);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[o*3],u=A[o*3+1];o=A[o*3+2];y.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(t,u,o)],null,h))}function t(b){var c,e,g,h;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);b=l(a,b+N);y.faces.push(new THREE.Face4(c,
-e,g,h,null,null,b))}function z(b){var c,e,g,h,m,n,o,p,t;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);m=l(a,b+N);n=f(a,b+K);o=f(a,b+P);p=f(a,b+H);t=f(a,b+Q);var b=A[o*3],u=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[t*3],v=A[t*3+1];t=A[t*3+2];y.faces.push(new THREE.Face4(c,e,g,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,u,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,t)],null,m))}function v(b){var c,e,g,h;c=f(a,b);e=f(a,b+O);g=f(a,b+R);b=D[c*2];h=D[c*
-2+1];c=D[e*2];var l=y.faceVertexUvs[0];e=D[e*2+1];var m=D[g*2];g=D[g*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,g));l.push(o)}function p(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+U);g=f(a,b+S);h=f(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[g*2];var o=y.faceVertexUvs[0];g=D[g*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,g));p.push(new THREE.UV(n,h));o.push(p)}var y=this,x=0,w,A=[],D=[],
-B,E,I,G,L,C,F,J,M,N,K,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,
-x+16+20),ntri_smooth_uv:f(a,x+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;L=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*
+THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,e=g.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
+c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
+f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),h=n(a,b+2),g=n(a,b+3),k=(g<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(g>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
+e,f;c=g(a,b);e=g(a,b+B);f=g(a,b+E);b=l(a,b+I);y.faces.push(new THREE.Face3(c,e,f,null,null,b))}function t(b){var c,e,f,h,m,n,o;c=g(a,b);e=g(a,b+B);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);n=g(a,b+L);o=g(a,b+C);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var u=A[o*3],t=A[o*3+1];o=A[o*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(u,t,o)],null,h))}function u(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);b=l(a,b+N);y.faces.push(new THREE.Face4(c,
+e,f,h,null,null,b))}function z(b){var c,e,f,h,m,n,o,p,u;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);n=g(a,b+K);o=g(a,b+P);p=g(a,b+H);u=g(a,b+Q);var b=A[o*3],t=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[u*3],v=A[u*3+1];u=A[u*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,t,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,u)],null,m))}function v(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+R);b=D[c*2];h=D[c*
+2+1];c=D[e*2];var l=y.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function p(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+U);f=g(a,b+S);h=g(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=y.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,h));n.push(p)}var y=this,x=0,w,A=[],D=[],
+B,E,I,G,L,C,F,J,M,N,K,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,
+x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;L=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*
 4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;R=w.uv_index_bytes*2;U=w.uv_index_bytes;S=w.uv_index_bytes*2;T=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;W=w.vertex_index_bytes*4+w.material_index_bytes;X=w.ntri_flat*b;V=w.ntri_smooth*(b+w.normal_index_bytes*
-3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*W;b=w.nquad_smooth*(W+w.normal_index_bytes*4);W=w.nquad_flat_uv*(W+w.uv_index_bytes*4);x+=function(b){for(var e,f,h,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),f=c(a,b+w.vertex_coordinate_bytes),h=c(a,b+w.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,h)));return w.nvertices*k}(x);x+=function(b){for(var c,e,g,f=w.normal_coordinate_bytes*
-3,h=b+w.nnormals*f;b<h;b+=f)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),g=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,g/127);return w.nnormals*f}(x);x+=function(b){for(var e,f,h=w.uv_coordinate_bytes*2,k=b+w.nuvs*h;b<k;b+=h)e=c(a,b),f=c(a,b+w.uv_coordinate_bytes),D.push(e,f);return w.nuvs*h}(x);X=x+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=c+w.uv_index_bytes*3,g=a+w.ntri_flat_uv*e;for(b=a;b<g;b+=e)o(b),v(b+c);return g-a})(V);
-(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,g=a+w.ntri_smooth_uv*e;for(b=a;b<g;b+=e)u(b),v(b+c);return g-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,g=a+w.nquad_flat_uv*e;for(b=a;b<g;b+=e)t(b),p(b+c);return g-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=c+w.uv_index_bytes*4,g=a+w.nquad_smooth_uv*e;for(b=a;b<g;b+=e)z(b),p(b+
-c);return g-a})(W);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)t(b);return e-a})(Y);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
-THREE.ColladaLoader=function(){function a(a,e,f){V=a;e=e||$;f!==void 0&&(a=f.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",g,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",p,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
+3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*W;b=w.nquad_smooth*(W+w.normal_index_bytes*4);W=w.nquad_flat_uv*(W+w.uv_index_bytes*4);x+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),g=c(a,b+w.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,g)));return w.nvertices*k}(x);x+=function(b){for(var c,e,f,h=w.normal_coordinate_bytes*
+3,g=b+w.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),f=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,g=w.uv_coordinate_bytes*2,k=b+w.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);X=x+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=c+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),v(b+c);return f-a})(V);
+(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(b=a;b<f;b+=e)t(b),v(b+c);return f-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),p(b+c);return f-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=c+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(b=a;b<f;b+=e)z(b),p(b+
+c);return f-a})(W);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)t(b);return e-a})(X);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(Y);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,e,g){V=a;e=e||$;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",f,"image");ga=c("//dae:library_materials/dae:material",I,"material");ha=c("//dae:library_effects/dae:effect",J,"effect");ba=c("//dae:library_geometries/dae:geometry",p,"geometry");aa=c("//dae:library_controllers/dae:controller",k,"controller");ca=c("//dae:library_animations/dae:animation",N,"animation");ia=c(".//dae:library_visual_scenes/dae:visual_scene",
 n,"visual_scene");da=[];ea=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));b();for(var l in ca);l={scene:Z,morphs:da,skins:ea,dae:{images:fa,materials:ga,effects:ha,geometries:ba,controllers:aa,animations:ca,visualScenes:ia,scene:Y}};e&&e(l);return l}function c(a,b,c){for(var a=V.evaluate(a,V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),e={},g=a.iterateNext(),f=0;g;){g=(new b).parse(g);if(g.id.length==0)g.id=c+f++;e[g.id]=g;g=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var g=ca[e],f=0;f<g.sampler.length;f++){var h=g.sampler[f];h.create();a=Math.min(a,h.startTime);b=Math.max(b,h.endTime);c=Math.max(c,h.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,g){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)}g&&a.world.multiply(g,a.world);b.push(a);for(g=0;g<a.nodes.length;g++)e(a.nodes[g],b,c,a.world)}function f(a,c,g){var f=aa[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 h=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
-for(g=0;g<h.frames;g++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,g);k=t;l=f.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var w=0;w<l.weights[v].length;w++){var x=l.weights[v][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
-m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+g,vertices:u})}}}function h(a){var b=new THREE.Object3D,c,e,g;b.name=a.id||"";b.matrixAutoUpdate=!1;b.matrix=a.matrix;for(g=0;g<a.controllers.length;g++){var k=aa[a.controllers[g].url];
-switch(k.type){case "skin":if(ba[k.skin.source]){var l=new v;l.url=k.skin.source;l.instance_material=a.controllers[g].instance_material;a.geometries.push(l);c=a.controllers[g]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l),
-e=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var k=a.geometries[g],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});
-k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(c!==void 0)f(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;o=e instanceof t?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var u=ba[o.targets[p]];if(u.mesh&&
-u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);b.add(l)}}for(g=0;g<a.nodes.length;g++)b.add(h(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=
-this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}
-function t(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
-{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function L(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
-this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;
-this.duration=0}function H(a){var b=a.getAttribute("id");if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?
-parseInt(a.getAttribute(b),10):c}function T(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=
-a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "source":g=(new E).parse(g);b[g.id]=g;break;case "targets":c=this.parseInputs(g);break;default:console.log(g.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],g=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=g.read();break;case "MORPH_WEIGHT":this.weights=g.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=
-a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var g=0;g<a.childNodes.length;g++){var f=a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=O(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 E).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),g=b[e.source];if(e.semantic=="JOINT")this.joints=g.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
-g.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,g=[],f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":g.push((new B).parse(h));break;case "v":c=R(h.textContent);break;case "vcount":e=R(h.textContent)}}for(f=h=0;f<e.length;f++){for(var k=e[f],l=[],m=0;m<k;m++){for(var o={},n=0;n<g.length;n++){var p=g[n],t=c[h+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);h+=g.length}for(m=
-0;m<l.length;m++)l[m].index=f;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var g=e.shift(),f=g.indexOf(".")>=0,h=g.indexOf("(")>=0,k;if(f)e=g.split("."),g=e.shift(),e.shift();else if(h){k=g.split("(");g=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(g==a)return c.info={sid:g,dotSyntax:f,arrSyntax:h,arrIndices:k},
-c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};
-o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new t).parse(b));
-break;case "instance_geometry":this.geometries.push((new v).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=
-[];c=1E6;b=-1E6;for(var e in ca)for(var g=ca[e],f=0;f<g.channel.length;f++){var h=g.channel[f],k=g.sampler[f];e=h.target.split("/")[0];if(e==this.id)k.create(),h.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(h)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=
-e){b=a;for(var g={},l=f=void 0,f=0;f<this.channels.length;f++)l=this.channels[f],g[l.sid]=l;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(k=this.transforms[f],l=g[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}h=n!==void 0?n instanceof THREE.Matrix4?h.multiply(h,n):h.multiply(h,k.matrix):h.multiply(h,k.matrix)}else h=h.multiply(h,k.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();
-return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};u.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],
-this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};t.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=
-a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};
-p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=X(a.position);g[e]===void 0&&(g[e]={v:a,index:c});return g[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));
-break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var g={};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
-g);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,g,f,h=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(g=0;g<k.length;g++)switch(l=k[g],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<h.length;){var u=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[n++]);for(g=0;g<p;g++)for(f=0;f<k.length;f++)switch(l=k[f],source=W[l.source],m=h[e+g*k.length+l.offset],
-numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;p==3?z=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
-x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(f=0;f<t.length;f++)g=w[t[f]],b.faceVertexUvs[f].push([g[0],g[1],g[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=
-a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
-"param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",
-0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=U(c.textContent).split(/\s+/),g=[],f=0;f<e.length;f++)g.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=g;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;
-break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=
-new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==
-null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var g=e.iterateNext(),f=[];g;)f.push(g),g=e.iterateNext();e=f;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};L.prototype.create=function(){var a={},b=this.transparency!==
-void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=
-e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};
-F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=
-function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
-(new C(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};
-J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new L(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=
-(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new K(this)).parse(c))}}return this};K.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,g,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){g=a.split("(");a=g.shift();for(b=0;b<g.length;b++)g[b]=
-parseInt(g[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=g;this.member=f;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=
-c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:f,geometries:ba}};
-THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a,c,b){var e,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,l,m,n,o,u,t,z,v,p,y,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)u=new THREE.Vertex,u.position.x=o[m++]*b,u.position.y=
-o[m++]*b,u.position.z=o[m++]*b,e.vertices.push(u);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;f=b&8;t=b&16;u=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],z=A[m++],w=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(w,z);if(f)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(f=0;f<o;f++)z=A[m++],w=y[z*2],z=y[z*2+1],x[f]=new THREE.UV(w,
-z);e.faceVertexUvs[c][l]=x}if(t)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.normal=f;if(u)for(c=0;c<o;c++)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.vertexNormals.push(f);if(v)u=A[m++],u=new THREE.Color(B[u]),p.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(B[u]),p.vertexColors.push(u);e.faces.push(p)}}})(f);(function(){var b,c,f,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,l,m,n,o,u,t,z;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];t=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
-b,u=z[l+2]*b,t.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[c];
+h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function g(a,c,f){var h=aa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
+for(f=0;f<g.frames;f++){var u=[],t=[];for(k=0;k<a.vertices.length;k++)t.push(new THREE.Vertex(new THREE.Vector3));e(c,u,f);k=u;l=h.skin;for(n=0;n<k.length;n++)if(m=k[n],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var w=0;w<l.weights[v].length;w++){var x=l.weights[v][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
+m.sid+"'.";}for(k=0;k<u.length;k++)if(u[k].type=="JOINT")for(l=0;l<u[k].weights.length;l++)m=u[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=t[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,u[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:t})}}}function h(a){var b=new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=aa[a.controllers[f].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=
+new v;l.url=k.skin.source;l.instance_material=a.controllers[f].instance_material;a.geometries.push(l);c=a.controllers[f]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var p=ha[ga[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=
+k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)g(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(e!==void 0){m=k;n=e instanceof u?aa[e.url]:e;if(!n||!n.morph)console.log("could not find morph controller!");else{n=n.morph;for(p=0;p<n.targets.length;p++){var t=ba[n.targets[p]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
+m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);a.geometries.length>1?b.add(l):b=l}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function l(){this.weights=this.targets=this.source=this.method=null}function m(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function n(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function L(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function P(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
+if(W[b]!=void 0)return W[b];W[b]=(new E(b)).parse(a);return W[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function T(a,
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function X(a,b){var c="";c+=T(a.x,b)+",";c+=T(a.y,b)+",";c+=T(a.z,b);return c}var V=null,Z=null,Y,$=null,W={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new m).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=
+0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new B).parse(e))}}return b};
+m.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=O(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);b[h.id]=h;break;case "joints":c=
+h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};m.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new B).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=
+a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new B).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":e=R(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],u=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=u;break;case "WEIGHT":n.weight=b[p.source].data[u]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,
+b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));break;case "instance_geometry":this.geometries.push((new v).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];
+if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=
+this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,n,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){n=m.output[l];break}g=n!==void 0?n instanceof THREE.Matrix4?g.multiply(g,n):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[a].matrix)};t.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};v.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=X(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":H(e);break;case "vertices":this.vertices=(new D).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var f=
+{};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,u=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":u.push(l.set)}for(;e<g.length;){var t=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=W[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);t.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],
+source.data[n+1],source.data[n+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var z;p==3?z=new THREE.Face3(t[0],t[1],t[2],[v[0],v[1],v[2]],x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(t[0],t[1],t[2],t[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(h=0;h<u.length;h++)f=
+w[u[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));
+break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
+"input"&&(input=(new B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
+U(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[e]);
+break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);
+this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=V.evaluate(".//dae:float",
+c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};L.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof G)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid&&(e=fa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
+c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new C(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new F(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new L(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new P(this)).parse(c));break;case "channel":this.channel.push((new K(this)).parse(c))}}return this};K.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
+P.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
+200))$=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a,c,b){var e,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,t,u,z,v,p,y,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*b,t.position.y=
+o[m++]*b,t.position.z=o[m++]*b,e.vertices.push(t);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;u=b&16;t=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],z=A[m++],w=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(w,z);if(g)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(g=0;g<o;g++)z=A[m++],w=y[z*2],z=y[z*2+1],x[g]=new THREE.UV(w,
+z);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(c=0;c<o;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(b)for(c=0;c<o;c++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,t,u,z;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(m=z.length;l<m;l+=3)n=z[l]*b,o=z[l+1]*
+b,t=z[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function k(){for(t in F.objects)if(!H.objects[t])if(x=F.objects[t],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;for(O=0;O<x.materials.length;O++)L=H.materials[x.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;q=x.quaternion;
-s=x.scale;q=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);object=new THREE.Mesh(B,L);object.name=t;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(x.castsShadow)a=
-new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
-x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[t]=object,H.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,t,z,v,p,y,x,w,A,D,B,E,I,G,
-L,C,F,J,M,N,K,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in F.objects)if(x=F.objects[t],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;for(O=0;O<x.materials.length;O++)L=H.materials[x.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;q=x.quaternion;
+s=x.scale;q=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);object=new THREE.Mesh(B,L);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(x.castsShadow)a=
+new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(c){H.geometries[a]=c;k();M-=1;b.onLoadComplete();n()}}function m(a){return function(b){H.geometries[a]=b}}function n(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,t,u,z,v,p,y,x,w,A,D,B,E,I,G,
+L,C,F,J,M,N,K,P,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
 Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(v in F.cameras)A=F.cameras[v],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[v]=E;for(z in F.lights)v=F.lights[z],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:
 1,v.type=="directional"?(w=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[z]=C;for(p in F.fogs)z=F.fogs[p],z.type=="linear"?I=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density)),A=z.color,I.color.setRGB(A[0],A[1],A[2]),H.fogs[p]=I;if(H.cameras&&
 F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,b.onLoadStart();K=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,
 null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=B):p.type=="icosahedron"?
 (B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load(e(p.url,F.urlBaseType),l(o)):p.type=="ascii_mesh"?J.load(e(p.url,F.urlBaseType),l(o)):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(y in F.textures)if(o=F.textures[y],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;for(y in F.textures){o=F.textures[y];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];
 if(o.url instanceof Array){G=[];for(var O=0;O<o.url.length;O++)G[O]=e(o.url[O],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],
-o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[y]=G}for(u in F.materials){y=F.materials[u];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=H.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?
+o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[y]=G}for(t in F.materials){y=F.materials[t];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=H.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?
 THREE[y.parameters[D]]:THREE.NormalBlending;else if(D=="combine")y.parameters[D]=y.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(y.parameters[D]=="face")y.parameters[D]=THREE.FaceColors;else if(y.parameters[D])y.parameters[D]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=y.parameters.color;
 J=y.parameters.specular;p=y.parameters.ambient;I=y.parameters.shininess;a.tNormal.texture=H.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=H.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
-a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);H.materials[u]=y}k();b.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,f=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,g=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
-c,f,h,g,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,f=0;f<8;f++){for(var h=0,g=0;g<c;++g){var k=a.charCodeAt(g+e);h+=k>>1^-(k&1);b[8*g+f]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(f=g=0;f<c;f++)k=a.charCodeAt(f+e),h[f]=g-k,k==0&&g++;return[b,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,f,h){var g=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,g,l){for(var m,n,p,y=a.length;l<y;l+=g)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=f,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(g[0],8,3);(function(a,
-b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(g[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],L=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,L,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g)};
+a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);H.materials[t]=y}k();b.callbackSync(H);n()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
+c,g,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,p,y=a.length;l<y;l+=f)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=g,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(f[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
+b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],L=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,L,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
+1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.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,f){return a+(c-a)*f};this.VIntX=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k+g*this.delta;c[h+1]=l;c[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+g*this.delta;c[h+
-2]=m;c=a+this.yd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.VIntZ=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+g*this.delta;c=a+this.zd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};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,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,t=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[u],B=this.field[t],E=this.field[z];p<g&&(v|=1);y<g&&(v|=2);x<g&&(v|=8);w<g&&(v|=4);A<g&&(v|=16);D<g&&(v|=32);B<g&&(v|=128);E<g&&(v|=64);var I=THREE.edgeTable[v];if(I===0)return 0;
-var G=this.delta,L=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,L,c,f,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));
-I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,g,L,c,G,D,E));I&64&&(this.compNorm(t),this.compNorm(z),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,g,L,c,f,y,D));I&1024&&(this.compNorm(o),
-this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,g,L,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));v<<=4;for(g=h=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+
-3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=c[f];this.normalArray[l+1]=c[f+1];this.normalArray[l+2]=c[f+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);
-k>this.size-1&&(k=this.size-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-f;x=v*v;for(v=u;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=t;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-g,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,t=m*Math.sqrt(a/c);t>m&&(t=m);for(f=0;f<t;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)u[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,
-l,m,n=this.size,o=this.yd,u=this.zd,t=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)t[u*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};this.reset=function(){var a;for(a=
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,f,h,g,k,l,m,n,o,u=this.size-2;for(g=1;g<u;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,u,t;for(g=0;g<h.count;g++)u=
-g*3,n=u+1,t=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[t],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[t],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(u);nfaces=h.count/3;for(g=0;g<nfaces;g++)u=(a+g)*3,n=u+1,t=u+2,o=f[u],k=f[n],l=f[t],u=new THREE.Face3(u,n,t,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
+2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[z];p<f&&(v|=1);y<f&&(v|=2);x<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);D<f&&(v|=32);B<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I===0)return 0;
+var G=this.delta,L=a+G,C=c+G,G=g+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,L,c,g,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,p,x));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));
+I&32&&(this.compNorm(t),this.compNorm(z),this.VIntY(t*3,this.vlist,this.nlist,15,f,L,c,G,D,E));I&64&&(this.compNorm(u),this.compNorm(z),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,L,c,g,y,D));I&1024&&(this.compNorm(o),
+this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,f,L,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+
+3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);
+k>this.size-1&&(k=this.size-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-g;x=v*v;for(v=t;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=u;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-f,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,
+l,m,n=this.size,o=this.yd,t=this.zd,u=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)u[t*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var a;for(a=
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,g,h,f,k,l,m,n,o,t=this.size-2;for(f=1;f<t;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,t,u;for(f=0;f<h.count;f++)t=
+f*3,n=t+1,u=t+2,k=h.positionArray[t],l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(t);nfaces=h.count/3;for(f=0;f<nfaces;f++)t=(a+f)*3,n=t+1,u=t+2,o=g[t],k=g[n],l=g[u],t=new THREE.Face3(t,n,u,[o,k,l]),c.faces.push(t);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
 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,
@@ -338,23 +336,23 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,f,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],e=this.rayCast(a,g),e<Number.MAX_VALUE)g.distance=e,e>h?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,f,h=0;h<c.numFaces;h++){var g=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[g.a].position,l=c.mesh.geometry.vertices[g.b].position,m=c.mesh.geometry.vertices[g.c].position,n=g instanceof THREE.Face4?c.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-g instanceof THREE.Face4&&(g=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),g=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,f,h,g){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(g.doubleSided||g.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;g=h.dot(c)-h.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=k*f))return Number.MAX_VALUE;g/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(g);k.addSelf(a.origin);Math.abs(h.x)>
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,f=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,f=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,f=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,f=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return g};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,n=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,g,h,f){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
+Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,g=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,f=0,h=0,g=0,k=0,l=0,m=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,m=!1,g=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,g=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=b.direction.y,
-m=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,m=!1,l=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,l=1);if(m)return-1;m=0;f>e&&(m=1,e=f);h>e&&(m=2,e=h);switch(m){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
-e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,g=0,h=0,f=0,k=0,l=0,m=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,m=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+m=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,m=!1,l=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,l=1);if(m)return-1;m=0;g>e&&(m=1,e=g);h>e&&(m=2,e=h);switch(m){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,l)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,g=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,1,1,1E4);t.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;u.width=a;u.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var y=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;g.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;y.n11=2*m/(D-x);y.n13=(D+x)/(D-x);f.projectionMatrix=y.clone();x=-A*l-w;D=A*l-w;y.n11=2*m/(D-x);y.n13=
-(D+x)/(D-x);h.projectionMatrix=y.clone()}f.matrix=b.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(b.position);f.near=m;f.far=b.far;e.call(c,a,f,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,u,!0);e.call(c,z,t)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,f,h,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);f=a/2;h=e};this.render=function(a,b){this.clear();g.fov=b.fov;g.aspect=0.5*b.aspect;g.near=b.near;g.far=
-b.far;g.updateProjectionMatrix();g.position.copy(b.position);g.target.copy(b.target);g.translateX(c.separation);g.lookAt(g.target);k.projectionMatrix=g.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,f,h);e.call(c,a,g);this.setViewport(f,0,f,h);e.call(c,a,k,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,g=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var y=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;y.n11=2*m/(D-x);y.n13=(D+x)/(D-x);g.projectionMatrix=y.clone();x=-A*l-w;D=A*l-w;y.n11=2*m/(D-x);y.n13=
+(D+x)/(D-x);h.projectionMatrix=y.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(b.position);g.near=m;g.far=b.far;e.call(c,a,g,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,t,!0);e.call(c,z,u)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
+b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};

+ 79 - 85
build/custom/ThreeSVG.js

@@ -14,89 +14,88 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 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){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var i,k,h,j,m,n,l,p,q=a.geometry,v=q.vertices,e=0,g=q.faces.length;e<g;e++)if(d=q.faces[e],l=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,i=j.multiplyVector3(d.centroid.clone()).subSelf(l),n=i.dot(p),!(n<=0)&&(i=j.multiplyVector3(v[d.a].position.clone()),k=j.multiplyVector3(v[d.b].position.clone()),h=j.multiplyVector3(v[d.c].position.clone()),
-j=d instanceof THREE.Face4?j.multiplyVector3(v[d.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(m),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=m.dot((new THREE.Vector3).sub(i,l))/n,l=l.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(l,i,k,h)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,i,k,j)||c(l,k,h,j)))d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d)}return f}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,i=!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,m){i=!1;b=e;c=g;d=j;f=m;a()};this.addPoint=function(e,g){i?(i=!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,m,n,l){i?(i=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=e>j?e>n?e:n:j>n?j:n,f=g>m?g>l?g:l:m>l?m:l):(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<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l: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>m?g>l?g>f?g:f:l>f?l:f:m>l?m>f?m:f:l>f?l:f);a()};this.addRectangle=function(e){i?(i=!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(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};THREE.Matrix3=function(){this.m=[]};
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,i,n,k,j,o,l,q,r=a.geometry,v=r.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=r.faces.length;e<g;e++)if(d=r.faces[e],l=this.origin.clone(),q=this.direction.clone(),k=a.matrixWorld,h=k.multiplyVector3(d.centroid.clone()).subSelf(l),o=h.dot(q),!(o<=0)&&(h=k.multiplyVector3(v[d.a].position.clone()),i=k.multiplyVector3(v[d.b].position.clone()),
+n=k.multiplyVector3(v[d.c].position.clone()),k=d instanceof THREE.Face4?k.multiplyVector3(v[d.d].position.clone()):null,j=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=q.dot(j),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=j.dot((new THREE.Vector3).sub(h,l))/o,l=l.addSelf(q.multiplyScalar(o)),d instanceof THREE.Face3)c(l,h,i,n)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,h,i,k)||c(l,i,n,k)))d={distance:this.origin.distanceTo(l),
+point:l,face:d,object:a},f.push(d)}return f}};
+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,k,j){h=!1;b=e;c=g;d=k;f=j;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,k,j,o,l){h?(h=!1,b=e<k?e<o?e:o:k<o?k:o,c=g<j?g<l?g:l:j<l?j:l,d=e>k?e>o?e:o:k>o?k:o,f=g>j?g>l?g:l:j>l?j:l):(b=e<k?e<o?e<b?e:b:o<b?o:b:k<o?k<b?k:b:o<b?o:b,c=g<j?g<l?g<c?g:c:l<c?l:c:j<l?j<c?j:c:l<c?l:c,d=e>k?e>o?e>d?e:d:o>d?o:d:k>o?k>d?k:d:o>d?o:d,f=g>j?g>l?g>f?g:f:l>f?l:f:j>l?j>f?j:f:l>f?l: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.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,i,k,h,j,m,n,l,p,q){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,i||0,k||0,h||0,j!==void 0?j:1,m||0,n||0,l||0,p||0,q!==void 0?q: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,i,k,h,j,m,n,l,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=i;this.n31=k;this.n32=h;this.n33=j;this.n34=m;this.n41=n;this.n42=l;this.n43=p;this.n44=q;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},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},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44,C=b.n11,K=b.n12,
-t=b.n13,w=b.n14,z=b.n21,y=b.n22,o=b.n23,E=b.n24,D=b.n31,F=b.n32,G=b.n33,A=b.n34,M=b.n41,N=b.n42,O=b.n43,S=b.n44;this.n11=c*C+d*z+f*D+e*M;this.n12=c*K+d*y+f*F+e*N;this.n13=c*t+d*o+f*G+e*O;this.n14=c*w+d*E+f*A+e*S;this.n21=g*C+i*z+k*D+h*M;this.n22=g*K+i*y+k*F+h*N;this.n23=g*t+i*o+k*G+h*O;this.n24=g*w+i*E+k*A+h*S;this.n31=j*C+m*z+n*D+l*M;this.n32=j*K+m*y+n*F+l*N;this.n33=j*t+m*o+n*G+l*O;this.n34=j*w+m*E+n*A+l*S;this.n41=p*C+q*z+v*D+u*M;this.n42=p*K+q*y+v*F+u*N;this.n43=p*t+q*o+v*G+u*O;this.n44=p*w+q*
-E+v*A+u*S;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=
-a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,k=this.n31,h=this.n32,j=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,q=this.n44;return d*g*h*n-c*i*h*n-d*e*j*n+b*i*j*n+c*e*m*n-b*g*m*n-d*g*k*l+c*i*k*l+d*f*j*l-a*i*j*l-c*f*m*l+a*g*m*l+d*e*k*p-b*i*k*p-d*f*h*p+a*i*h*p+b*f*m*p-a*e*m*p-c*e*k*q+b*g*k*q+c*f*h*q-a*g*h*q-b*f*j*q+a*e*j*q},
-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,i=a.z,k=f*e,h=f*g;this.set(k*e+c,k*g-d*i,k*i+d*g,0,k*g+d*i,h*g+c,h*i-d*e,0,k*i-d*g,h*i+d*e,f*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=
-g*i,h=g*f,j=d*i,m=d*f;this.n11=k+m*c;this.n12=j*c-h;this.n13=e*d;this.n21=e*f;this.n22=e*i;this.n23=-c;this.n31=h*c-j;this.n32=m+k*c;this.n33=e*g;break;case "ZXY":k=g*i;h=g*f;j=d*i;m=d*f;this.n11=k-m*c;this.n12=-e*f;this.n13=j+h*c;this.n21=h+j*c;this.n22=e*i;this.n23=m-k*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":k=e*i;h=e*f;j=c*i;m=c*f;this.n11=g*i;this.n12=j*d-h;this.n13=k*d+m;this.n21=g*f;this.n22=m*d+k;this.n23=h*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":k=e*g;h=
-e*d;j=c*g;m=c*d;this.n11=g*i;this.n12=m-k*f;this.n13=j*f+h;this.n21=f;this.n22=e*i;this.n23=-c*i;this.n31=-d*i;this.n32=h*f+j;this.n33=k-m*f;break;case "XZY":k=e*g;h=e*d;j=c*g;m=c*d;this.n11=g*i;this.n12=-f;this.n13=d*i;this.n21=k*f+m;this.n22=e*i;this.n23=h*f-j;this.n31=j*f-h;this.n32=c*i;this.n33=m*f+k;break;default:k=e*i,h=e*f,j=c*i,m=c*f,this.n11=g*i,this.n12=-g*f,this.n13=d,this.n21=h+j*d,this.n22=k-m*d,this.n23=-c*g,this.n31=m-k*d,this.n32=j+h*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,i=d+d,a=b*e,k=b*g;b*=i;var h=c*g;c*=i;d*=i;e*=f;g*=f;f*=i;this.n11=1-(h+d);this.n12=k-f;this.n13=b+g;this.n21=k+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+h);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},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=
-a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-h*n*q+h*m*v-i*l*v-k*m*u+i*n*u;b.n12=e*n*q-f*l*q-e*m*v+d*l*v+f*m*u-d*n*u;b.n13=f*h*q-e*k*q+e*i*v-d*h*v-f*i*u+d*k*u;b.n14=e*k*m-f*h*m-e*i*n+d*h*n+f*i*l-d*k*l;b.n21=h*n*p-k*l*p-h*j*v+g*l*v+k*j*u-g*n*u;b.n22=f*l*p-e*n*p+e*j*v-c*l*v-f*j*u+c*n*u;b.n23=e*k*p-f*h*p-e*g*v+c*h*v+f*g*u-c*k*u;b.n24=
-f*h*j-e*k*j+e*g*n-c*h*n-f*g*l+c*k*l;b.n31=i*l*p-h*m*p+h*j*q-g*l*q-i*j*u+g*m*u;b.n32=e*m*p-d*l*p-e*j*q+c*l*q+d*j*u-c*m*u;b.n33=f*h*p-e*i*p+e*g*q-c*h*q-d*g*u+c*i*u;b.n34=e*i*j-d*h*j-e*g*m+c*h*m+d*g*l-c*i*l;b.n41=k*m*p-i*n*p-k*j*q+g*n*q+i*j*v-g*m*v;b.n42=d*n*p-f*m*p+f*j*q-c*n*q-d*j*v+c*m*v;b.n43=f*i*p-d*k*p-f*g*q+c*k*q+d*g*v-c*i*v;b.n44=d*k*j-f*i*j+f*g*m-c*k*m-d*g*n+c*i*n;b.multiplyScalar(1/a.determinant());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,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,h=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*h;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*i;c[5]=a*k;c[6]=a*h;c[7]=a*j;c[8]=a*m;return b};
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,i,n,k,j,o,l,q,r){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,n||0,k!==void 0?k:1,j||0,o||0,l||0,q||0,r!==void 0?r: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,i,n,k,j,o,l,q,r){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=i;this.n32=n;this.n33=k;this.n34=j;this.n41=o;this.n42=l;this.n43=q;this.n44=r;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,i=a.n23,n=a.n24,k=a.n31,j=a.n32,o=a.n33,l=a.n34,q=a.n41,r=a.n42,v=a.n43,
+x=a.n44,w=b.n11,D=b.n12,t=b.n13,u=b.n14,H=b.n21,F=b.n22,z=b.n23,O=b.n24,G=b.n31,L=b.n32,B=b.n33,I=b.n34,J=b.n41,A=b.n42,K=b.n43,y=b.n44;this.n11=c*w+d*H+f*G+e*J;this.n12=c*D+d*F+f*L+e*A;this.n13=c*t+d*z+f*B+e*K;this.n14=c*u+d*O+f*I+e*y;this.n21=g*w+h*H+i*G+n*J;this.n22=g*D+h*F+i*L+n*A;this.n23=g*t+h*z+i*B+n*K;this.n24=g*u+h*O+i*I+n*y;this.n31=k*w+j*H+o*G+l*J;this.n32=k*D+j*F+o*L+l*A;this.n33=k*t+j*z+o*B+l*K;this.n34=k*u+j*O+o*I+l*y;this.n41=q*w+r*H+v*G+x*J;this.n42=q*D+r*F+v*L+x*A;this.n43=q*t+r*
+z+v*B+x*K;this.n44=q*u+r*O+v*I+x*y;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,i=this.n31,n=this.n32,k=this.n33,j=this.n34,o=this.n41,l=this.n42,q=this.n43,r=this.n44;return d*g*n*o-c*h*n*o-d*e*k*o+b*h*k*o+c*e*j*o-b*g*j*o-d*g*i*l+c*h*i*l+d*f*k*l-a*h*k*l-c*f*j*l+a*g*j*l+d*e*i*q-b*h*i*q-d*f*n*q+a*h*n*q+b*f*j*q-a*e*j*q-c*e*i*r+b*g*i*r+c*f*n*r-a*g*n*r-b*f*k*r+a*e*k*r},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,i=f*e,n=f*g;this.set(i*e+c,i*g-d*h,i*h+d*g,0,i*g+d*h,n*g+c,n*h-d*e,0,i*h-d*g,n*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,i=a.n24,n=a.n31,k=a.n32,j=a.n33,o=a.n34,l=a.n41,q=a.n42,r=a.n43,v=a.n44;this.n11=h*o*q-i*j*q+i*k*r-g*o*r-h*k*v+g*j*v;this.n12=f*j*q-d*o*q-f*k*r+c*o*r+d*k*v-c*j*v;this.n13=d*i*q-f*h*q+f*g*r-c*i*r-d*g*v+c*h*v;this.n14=f*h*k-d*i*k-f*g*j+c*i*j+d*g*o-c*h*o;this.n21=i*j*l-h*o*l-i*n*r+e*o*r+h*n*v-e*j*v;this.n22=d*o*l-f*j*l+
+f*n*r-b*o*r-d*n*v+b*j*v;this.n23=f*h*l-d*i*l-f*e*r+b*i*r+d*e*v-b*h*v;this.n24=d*i*n-f*h*n+f*e*j-b*i*j-d*e*o+b*h*o;this.n31=g*o*l-i*k*l+i*n*q-e*o*q-g*n*v+e*k*v;this.n32=f*k*l-c*o*l-f*n*q+b*o*q+c*n*v-b*k*v;this.n33=d*i*l-f*g*l+f*e*q-b*i*q-c*e*v+b*g*v;this.n34=f*g*n-c*i*n-f*e*k+b*i*k+c*e*o-b*g*o;this.n41=h*k*l-g*j*l-h*n*q+e*j*q+g*n*r-e*k*r;this.n42=c*j*l-d*k*l+d*n*q-b*j*q-c*n*r+b*k*r;this.n43=d*g*l-c*h*l-d*e*q+b*h*q+c*e*r-b*g*r;this.n44=c*h*n-d*g*n+d*e*k-b*h*k-c*e*j+b*g*j;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 i=g*h,n=g*f,k=d*h,j=d*f;this.n11=i+j*c;this.n12=k*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-k;this.n32=j+i*c;this.n33=e*g;break;case "ZXY":i=g*h;n=g*f;k=d*h;j=d*f;this.n11=i-j*c;this.n12=-e*f;this.n13=k+n*c;this.n21=n+k*c;this.n22=e*h;this.n23=j-i*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":i=
+e*h;n=e*f;k=c*h;j=c*f;this.n11=g*h;this.n12=k*d-n;this.n13=i*d+j;this.n21=g*f;this.n22=j*d+i;this.n23=n*d-k;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":i=e*g;n=e*d;k=c*g;j=c*d;this.n11=g*h;this.n12=j-i*f;this.n13=k*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+k;this.n33=i-j*f;break;case "XZY":i=e*g;n=e*d;k=c*g;j=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=i*f+j;this.n22=e*h;this.n23=n*f-k;this.n31=k*f-n;this.n32=c*h;this.n33=j*f+i;break;default:i=e*h,n=e*
+f,k=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+k*d,this.n22=i-j*d,this.n23=-c*g,this.n31=j-i*d,this.n32=k+n*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,i=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=i-f;this.n13=b+g;this.n21=i+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);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,i=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;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*i;c[6]=a*n;c[7]=a*k;c[8]=a*j;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,i,k,h;g=new THREE.Matrix4;i=b-a;k=c-d;h=e-f;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/h;g.n34=-((e+f)/h);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,i,n;g=new THREE.Matrix4;h=b-a;i=c-d;n=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((e+f)/n);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.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(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},update:function(a,b,c){this.matrixAutoUpdate&&
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
-this.remove(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;return e>=0&&f>=0&&g>=0&&i>=0?!0:e<0&&f<0||g<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,i,k=[],h,j,m=[],n,l=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector4,y=new THREE.Vector4,
-o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,
-a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectObjects=function(a,c,g){var i,k;f=t.length=0;i=a.objects;a=0;for(c=i.length;a<c;a++){k=i[a];var h;if(!(h=!k.visible))if(h=k instanceof THREE.Mesh)if(h=k.frustumCulled){a:{h=void 0;for(var j=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),l=0;l<6;l++)if(h=D[l].x*j.n14+D[l].y*j.n24+D[l].z*j.n34+D[l].w,h<=m){h=!1;break a}h=!0}h=
-!h}if(!h)h=e[f]=e[f]||new THREE.RenderableObject,f++,d=h,z.copy(k.position),o.multiplyVector3(z),d.object=k,d.z=z.z,t.push(d)}g&&t.sort(b);return t};this.projectScene=function(d,e,f){var t=e.near,S=e.far,z,P,I,L,r,J,H,s,x,B,Q,U,W,X,R,V,T;C=q=n=j=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+
-o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(z=0;z<6;z++)x=D[z],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(z=x.length;d<z;d++)if(B=x[d].object,B.visible)if(Q=B.matrixWorld,U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){R=B.geometry;L=R.vertices;V=
-R.faces;R=R.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),Q.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<S;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(r=k[I.a],J=k[I.b],H=k[I.c],r.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-
-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0))s=m[j]=m[j]||new THREE.RenderableFace3,j++,h=s,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[I.a],J=k[I.b],H=k[I.c],s=k[I.d],r.visible&&J.visible&&H.visible&&s.visible&&(B.doubleSided||B.flipSided!=((s.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(s.positionScreen.y-r.positionScreen.y)*
-(J.positionScreen.x-r.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(s.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(s.positionScreen.x-H.positionScreen.x)<0)))T=l[n]=l[n]||new THREE.RenderableFace4,n++,h=T,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H),h.v4.copy(s);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);
-H=I.vertexNormals;r=0;for(J=H.length;r<J;r++)s=h.vertexNormalsWorld[r],s.copy(H[r]),U.multiplyVector3(s);r=0;for(J=R.length;r<J;r++)if(T=R[r][L]){H=0;for(s=T.length;H<s;H++)h.uvs[r][H]=T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),
-E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=
-Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+-1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},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=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,i=[],n,k=[],j,o,l=[],q,r,v=[],x={objects:[],lines:[],sprites:[],lights:[],
+elements:[]};new THREE.Vector3;var w=new THREE.Vector4,D=new THREE.Matrix4,t=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,F=new THREE.Vector4;this.computeFrustum=function(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
+a.n24);u[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[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=u[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(a){x.objects.length=0;x.lines.length=0;x.sprites.length=0;x.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),f=0;f<6;f++)if(c=u[f].x*d.n14+u[f].y*d.n24+u[f].z*d.n34+u[f].w,c<=e){c=!1;break a}c=!0}c?x.objects.push(a):a instanceof THREE.Line?x.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?x.sprites.push(a):a instanceof THREE.Light&&x.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return x};this.projectScene=function(z,u,G){var L=u.near,B=u.far,I,J,A,K,y,C,E,s,p,M,N,Q,T,R,S,P;r=o=n=h=0;x.elements.length=0;u.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+z.add(u));z.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);D.multiply(u.projectionMatrix,u.matrixWorldInverse);this.computeFrustum(D);x=this.projectGraph(z);z=0;for(I=x.objects.length;z<I;z++)if(p=x.objects[z],M=p.matrixWorld,Q=p.material,f=0,p instanceof THREE.Mesh){N=p.geometry;T=p.geometry.materials;K=N.vertices;R=N.faces;S=N.faceVertexUvs;N=p.matrixRotationWorld.extractRotation(M);J=0;for(A=K.length;J<A;J++)d=a(),d.positionWorld.copy(K[J].position),M.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),D.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>L&&d.positionScreen.z<B;K=0;for(J=R.length;K<J;K++){A=R[K];if(A instanceof THREE.Face3)if(y=e[A.a],C=e[A.b],E=e[A.c],y.visible&&C.visible&&E.visible&&(p.doubleSided||p.flipSided!=(E.positionScreen.x-y.positionScreen.x)*(C.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(C.positionScreen.x-
+y.positionScreen.x)<0))s=i[h]=i[h]||new THREE.RenderableFace3,h++,g=s,g.v1.copy(y),g.v2.copy(C),g.v3.copy(E);else continue;else if(A instanceof THREE.Face4)if(y=e[A.a],C=e[A.b],E=e[A.c],s=e[A.d],y.visible&&C.visible&&E.visible&&s.visible&&(p.doubleSided||p.flipSided!=((s.positionScreen.x-y.positionScreen.x)*(C.positionScreen.y-y.positionScreen.y)-(s.positionScreen.y-y.positionScreen.y)*(C.positionScreen.x-y.positionScreen.x)<0||(C.positionScreen.x-E.positionScreen.x)*(s.positionScreen.y-E.positionScreen.y)-
+(C.positionScreen.y-E.positionScreen.y)*(s.positionScreen.x-E.positionScreen.x)<0)))P=k[n]=k[n]||new THREE.RenderableFace4,n++,g=P,g.v1.copy(y),g.v2.copy(C),g.v3.copy(E),g.v4.copy(s);else continue;g.normalWorld.copy(A.normal);N.multiplyVector3(g.normalWorld);g.centroidWorld.copy(A.centroid);M.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);D.multiplyVector3(g.centroidScreen);E=A.vertexNormals;y=0;for(C=E.length;y<C;y++)s=g.vertexNormalsWorld[y],s.copy(E[y]),N.multiplyVector3(s);
+y=0;for(C=S.length;y<C;y++)if(P=S[y][K]){E=0;for(s=P.length;E<s;E++)g.uvs[y][E]=P[E]}g.material=Q;g.faceMaterial=A.materialIndex!==null?T[A.materialIndex]:null;g.z=g.centroidScreen.z;x.elements.push(g)}}z=0;for(I=x.lines.length;z<I;z++)if(p=x.lines[z],M=p.matrixWorld,Q=p.material,f=0,p instanceof THREE.Line){t.multiply(D,M);K=p.geometry.vertices;y=a();y.positionScreen.copy(K[0].position);t.multiplyVector4(y.positionScreen);J=1;for(A=K.length;J<A;J++)if(y=a(),y.positionScreen.copy(K[J].position),t.multiplyVector4(y.positionScreen),
+C=e[f-2],H.copy(y.positionScreen),F.copy(C.positionScreen),c(H,F))H.multiplyScalar(1/H.w),F.multiplyScalar(1/F.w),L=l[o]=l[o]||new THREE.RenderableLine,o++,j=L,j.v1.positionScreen.copy(H),j.v2.positionScreen.copy(F),j.z=Math.max(H.z,F.z),j.material=Q,x.elements.push(j)}z=0;for(I=x.sprites.length;z<I;z++)if(p=x.sprites[z],M=p.matrixWorld,p instanceof THREE.Particle&&(w.set(M.n14,M.n24,M.n34,1),D.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))L=v[r]=v[r]||new THREE.RenderableParticle,r++,q=L,q.x=w.x/w.w,
+q.y=w.y/w.w,q.z=w.z,q.rotation=p.rotation.z,q.scale.x=p.scale.x*Math.abs(q.x-(w.x+u.projectionMatrix.n11)/(w.w+u.projectionMatrix.n14)),q.scale.y=p.scale.y*Math.abs(q.y-(w.y+u.projectionMatrix.n22)/(w.w+u.projectionMatrix.n24)),q.material=p.material,x.elements.push(q);G&&x.elements.sort(b);return x}};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,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;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,i=this.z,k=this.w,h=k*c+g*f-i*d,j=k*d+i*c-e*f,m=k*f+e*d-g*c,c=-e*
-c-g*d-i*f;b.x=h*k+c*-e+j*-i-m*-g;b.y=j*k+c*-g+m*-e-h*-i;b.z=m*k+c*-i+h*-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;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),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.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};
+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,i=this.w,n=i*c+g*f-h*d,k=i*d+h*c-e*f,j=i*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=n*i+c*-e+k*-h-j*-g;b.y=k*i+c*-g+j*-e-n*-h;b.z=j*i+c*-h+n*-g-k*-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.001)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};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,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,i=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){i.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)i.addSelf(e.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],i.sub(g.position,c.position),k.sub(b.position,c.position),i.crossSelf(k);i.isZero()||i.normalize();e.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,i=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),i.sub(b.position,c.position),h.crossSelf(i);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,o){i=a.vertices[b].position;k=a.vertices[c].position;h=a.vertices[d].position;j=g[e];m=g[f];n=g[o];l=k.x-i.x;p=h.x-i.x;q=k.y-i.y;v=h.y-i.y;u=k.z-i.z;C=h.z-i.z;K=m.u-j.u;t=n.u-j.u;w=m.v-j.v;z=n.v-j.v;y=1/(K*z-t*w);F.set((z*l-w*p)*y,(z*q-w*v)*y,(z*u-w*C)*y);G.set((K*p-t*l)*y,(K*v-t*q)*y,(K*C-t*u)*y);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);D[b].addSelf(G);
-D[c].addSelf(G);D[d].addSelf(G)}var b,c,d,f,e,g,i,k,h,j,m,n,l,p,q,v,u,C,K,t,w,z,y,o,E=[],D=[],F=new THREE.Vector3,G=new THREE.Vector3,A=new THREE.Vector3,M=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,D[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 O=["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++)N.copy(e.vertexNormals[d]),f=e[O[d]],o=E[f],A.copy(o),A.subSelf(N.multiplyScalar(N.dot(o))).normalize(),M.cross(e.vertexNormals[d],o),f=M.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.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,K){h=a.vertices[b].position;i=a.vertices[c].position;n=a.vertices[d].position;k=g[e];j=g[f];o=g[K];l=i.x-h.x;q=n.x-h.x;r=i.y-h.y;v=n.y-h.y;x=i.z-h.z;w=n.z-h.z;D=j.u-k.u;t=o.u-k.u;u=j.v-k.v;H=o.v-k.v;F=1/(D*H-t*u);L.set((H*l-u*q)*F,(H*r-u*v)*F,(H*x-u*w)*F);B.set((D*q-t*l)*F,(D*v-t*r)*F,(D*w-t*x)*F);O[b].addSelf(L);O[c].addSelf(L);O[d].addSelf(L);G[b].addSelf(B);
+G[c].addSelf(B);G[d].addSelf(B)}var b,c,d,f,e,g,h,i,n,k,j,o,l,q,r,v,x,w,D,t,u,H,F,z,O=[],G=[],L=new THREE.Vector3,B=new THREE.Vector3,I=new THREE.Vector3,J=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,G[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 K=["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++)A.copy(e.vertexNormals[d]),f=e[K[d]],z=O[f],I.copy(z),I.subSelf(A.multiplyScalar(A.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.dot(G[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.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;
-THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
-THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
-THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
+THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
 THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
-a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
+a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
 !0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
@@ -111,29 +110,24 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
-c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
-THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATE: Material array is no longer supported. Using material 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<
+this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
+THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=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.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
-THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
-THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,g,i,h,j){e.info.render.vertices+=3;e.info.render.faces++;A=d(M++);
-A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");h instanceof THREE.MeshBasicMaterial?t.copy(h.color):h instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,i,w),t.r=Math.max(0,Math.min(h.color.r*w.r,1)),t.g=Math.max(0,Math.min(h.color.g*w.g,1)),t.b=Math.max(0,Math.min(h.color.b*w.b,1))):t.copy(h.color):h instanceof THREE.MeshDepthMaterial?(E=1-h.__2near/(h.__farPlusNear-
-i.z*h.__farMinusNear),t.setRGB(E,E,E)):h instanceof THREE.MeshNormalMaterial&&t.setRGB(f(i.normalWorld.x),f(i.normalWorld.y),f(i.normalWorld.z));h.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+h.wireframeLinewidth+"; stroke-opacity: "+h.opacity+"; stroke-linecap: "+h.wireframeLinecap+"; stroke-linejoin: "+h.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+h.opacity);k.appendChild(A)}function c(b,c,g,i,h,j,l){e.info.render.vertices+=
-4;e.info.render.faces++;A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(l,h,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):
-t.copy(j.color):j instanceof THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-h.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(f(h.normalWorld.x),f(h.normalWorld.y),f(h.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+
-"; fill-opacity: "+j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,g=null,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,m,n,l,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),
-y=new THREE.Color(0),o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){h=a;j=b;m=h/2;n=j/2;k.setAttribute("viewBox",-m+" "+-n+" "+h+" "+j);k.setAttribute("width",h);k.setAttribute("height",j);u.set(-m,-n,m,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(a,d){var f,h,j,r,t,w,s,x;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;g=i.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);f=0;for(h=s.length;f<h;f++)j=s[f],r=j.color,j instanceof THREE.AmbientLight?(z.r+=r.r,z.g+=r.g,z.b+=r.b):j instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):j instanceof THREE.PointLight&&(o.r+=r.r,o.g+=r.g,o.b+=r.b)}f=0;for(h=g.length;f<
-h;f++)if(s=g[f],C.empty(),s instanceof THREE.RenderableParticle){l=s;l.x*=m;l.y*=-n;j=0;for(r=s.materials.length;j<r;)j++}else if(s instanceof THREE.RenderableLine){if(l=s.v1,p=s.v2,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){j=0;for(r=s.materials.length;j<r;)if((x=s.materials[j++])&&x.opacity!=0){t=l;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),O==0&&G[B].setAttribute("shape-rendering","crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(s instanceof
-THREE.RenderableFace3){if(l=s.v1,p=s.v2,q=s.v3,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){j=0;for(r=s.meshMaterials.length;j<r;)if(x=s.meshMaterials[j++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&
-x.opacity!=0&&b(l,p,q,s,x,a)}else x&&x.opacity!=0&&b(l,p,q,s,x,a)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,p=s.v2,q=s.v3,v=s.v4,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,v.positionScreen.x*=m,v.positionScreen.y*=-n,C.addPoint(l.positionScreen.x,l.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),
-u.intersects(C))){j=0;for(r=s.meshMaterials.length;j<r;)if(x=s.meshMaterials[j++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&x.opacity!=0&&c(l,p,q,v,s,x,a)}else x&&x.opacity!=0&&c(l,p,q,v,s,x,a)}}};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.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
-THREE.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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(O.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),A==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,j,o,l,q,r,v,x=new THREE.Rectangle,w=new THREE.Rectangle,D=!1,t=new THREE.Color,u=new THREE.Color,H=new THREE.Color,F=new THREE.Color,z,O=new THREE.Vector3,G=[],L=[],B,I,J,A=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":A=1;break;case "low":A=0}};this.setSize=function(a,b){n=a;k=b;j=n/2;o=k/2;i.setAttribute("viewBox",-j+" "+-o+" "+n+" "+k);i.setAttribute("width",n);i.setAttribute("height",k);x.set(-j,-o,j,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,n){var C,E,s,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(k,n,this.sortElements);e=f.elements;
+g=f.lights;J=I=0;if(D=g.length>0){u.setRGB(0,0,0);H.setRGB(0,0,0);F.setRGB(0,0,0);C=0;for(E=g.length;C<E;C++)p=g[C],s=p.color,p instanceof THREE.AmbientLight?(u.r+=s.r,u.g+=s.g,u.b+=s.b):p instanceof THREE.DirectionalLight?(H.r+=s.r,H.g+=s.g,H.b+=s.b):p instanceof THREE.PointLight&&(F.r+=s.r,F.g+=s.g,F.b+=s.b)}C=0;for(E=e.length;C<E;C++)if(s=e[C],p=s.material,p=p instanceof THREE.MeshFaceMaterial?s.faceMaterial:p,!(p==null||p.opacity==0))if(w.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
+j,l.y*=-o,m=0,ml=s.materials.length;else if(s instanceof THREE.RenderableLine){if(l=s.v1,q=s.v2,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),x.intersects(w)){s=l;var M=q,N=J++;L[N]==null&&(L[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),A==0&&L[N].setAttribute("shape-rendering","crispEdges"));B=L[N];B.setAttribute("x1",s.positionScreen.x);
+B.setAttribute("y1",s.positionScreen.y);B.setAttribute("x2",M.positionScreen.x);B.setAttribute("y2",M.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(B.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(B))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,q=s.v2,r=s.v3,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=
+j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),x.intersects(w)){var M=l,N=q,G=r;d.info.render.vertices+=3;d.info.render.faces++;B=b(I++);B.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
+t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(z=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(z,z,z)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style",
+"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,q=s.v2,r=s.v3,v=s.v4,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=
+-o,v.positionScreen.x*=j,v.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),w.addPoint(v.positionScreen.x,v.positionScreen.y),x.intersects(w))){var M=l,N=q,G=r,O=v;d.info.render.vertices+=4;d.info.render.faces++;B=b(I++);B.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+
+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(z=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(z,z,z)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),
+c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}};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.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};

+ 192 - 196
build/custom/ThreeWebGL.js

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

+ 1 - 1
examples/canvas_geometry_birds.html

@@ -420,7 +420,7 @@
 
 					bird = birds[ i ];
 
-					color = bird.materials[ 0 ].color;
+					color = bird.material.color;
 					color.r = color.g = color.b = ( 500 - bird.position.z ) / 1000;
 
 					bird.rotation.y = Math.atan2( - boid.velocity.z, boid.velocity.x );

+ 1 - 1
examples/canvas_geometry_cube.html

@@ -66,7 +66,7 @@
 
 				for ( var i = 0; i < 6; i ++ ) {
 
-					materials.push( [ new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ] );
+					materials.push( new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
 
 				}
 

+ 4 - 9
examples/canvas_geometry_earth.html

@@ -42,11 +42,8 @@
 		<script>
 
 			var container, stats;
-
 			var camera, scene, renderer;
-
 			var mesh;
-
 			var mouseX = 0, mouseY = 0;
 
 			var windowHalfX = window.innerWidth / 2;
@@ -64,15 +61,13 @@
 
 				scene = new THREE.Scene();
 
-				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 300, 300, 3, 3 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ) );
-				mesh.overdraw = true;
+				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 300, 300, 3, 3 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ), overdraw: true } ) );
 				mesh.position.y = - 250;
 				mesh.rotation.x = - 90 * Math.PI / 180;
-				scene.add(mesh);
+				scene.add( mesh );
 
-				mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ) );
-				mesh.overdraw = true;
-				scene.add(mesh);
+				mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ), overdraw: true } ) );
+				scene.add( mesh );
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 1 - 2
examples/canvas_geometry_panorama.html

@@ -79,7 +79,6 @@
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials ), new THREE.MeshFaceMaterial() );
 				mesh.scale.x = - 1;
-				mesh.overdraw = true;
 				scene.add( mesh );
 
 				renderer = new THREE.CanvasRenderer();
@@ -100,7 +99,7 @@
 			function loadTexture( path ) {
 
 				var texture = new THREE.Texture( texture_placeholder );
-				var material = new THREE.MeshBasicMaterial( { map: texture } );
+				var material = new THREE.MeshBasicMaterial( { map: texture, overdraw: true } );
 
 				var image = new Image();
 				image.onload = function () {

+ 1 - 2
examples/canvas_geometry_panorama_fisheye.html

@@ -79,7 +79,6 @@
 
 				mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials ), new THREE.MeshFaceMaterial() );
 				mesh.scale.x = - 1;
-				mesh.overdraw = true;
 				scene.add( mesh );
 
 				for ( var i = 0, l = mesh.geometry.vertices.length; i < l; i ++ ) {
@@ -110,7 +109,7 @@
 			function loadTexture( path ) {
 
 				var texture = new THREE.Texture( texture_placeholder );
-				var material = new THREE.MeshBasicMaterial( { map: texture } );
+				var material = new THREE.MeshBasicMaterial( { map: texture, overdraw: true } );
 
 				var image = new Image();
 				image.onload = function () {

+ 1 - 2
examples/canvas_geometry_terrain.html

@@ -67,7 +67,7 @@
 				scene = new THREE.Scene();
 
 				var data = generateHeight( 1024, 1024 );
-				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTexture( data, 1024, 1024 ) ) } );
+				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTexture( data, 1024, 1024 ) ), overdraw: true } );
 
 				var quality = 16, step = 1024 / quality;
 				var plane = new THREE.PlaneGeometry( 2000, 2000, quality - 1, quality - 1 );
@@ -83,7 +83,6 @@
 
 				mesh = new THREE.Mesh( plane, material );
 				mesh.rotation.x = -90 * Math.PI / 180;
-				mesh.overdraw = true;
 				scene.add( mesh );
 
 				renderer = new THREE.CanvasRenderer();

+ 1 - 2
examples/canvas_geometry_text.html

@@ -89,7 +89,7 @@
 				text3d.computeBoundingBox();
 				var centerOffset = -0.5 * ( text3d.boundingBox.x[ 1 ] - text3d.boundingBox.x[ 0 ] );
 
-				var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: false } );
+				var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
 				text = new THREE.Mesh( text3d, textMaterial );
 
 				text.doubleSided = false;
@@ -100,7 +100,6 @@
 
 				text.rotation.x = 0;
 				text.rotation.y = Math.PI * 2;
-				text.overdraw = true;
 
 				parent = new THREE.Object3D();
 				parent.add( text );

+ 3 - 3
examples/canvas_interactive_particles.html

@@ -146,16 +146,16 @@
 
 					if ( INTERSECTED != intersects[ 0 ].object ) {
 
-						if ( INTERSECTED ) INTERSECTED.materials[ 0 ].program = programStroke;
+						if ( INTERSECTED ) INTERSECTED.material.program = programStroke;
 
 						INTERSECTED = intersects[ 0 ].object;
-						INTERSECTED.materials[ 0 ].program = programFill;
+						INTERSECTED.material.program = programFill;
 
 					}
 
 				} else {
 
-					if ( INTERSECTED ) INTERSECTED.materials[ 0 ].program = programStroke;
+					if ( INTERSECTED ) INTERSECTED.material.program = programStroke;
 
 					INTERSECTED = null;
 

+ 1 - 2
examples/canvas_lights_pointlights.html

@@ -99,8 +99,7 @@
 				loader = new THREE.JSONLoader();
 				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
 
-					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ) );
-					mesh.overdraw = true;
+					mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, overdraw: true } ) );
 					scene.add( mesh );
 
 				} );

+ 9 - 10
examples/canvas_materials.html

@@ -70,15 +70,15 @@
 
 				var materials = [
 
-					{ material: new THREE.MeshBasicMaterial( { color: 0x00ffff, wireframe: true } ), overdraw: false, doubleSided: true },
-					{ material: new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.AdditiveBlending } ), overdraw: false, doubleSided: true },
-					{ material: new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), overdraw: true, doubleSided: false },
-					{ material: new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ), overdraw: true, doubleSided: false },
-					{ material: new THREE.MeshDepthMaterial(), overdraw: true, doubleSided: false },
-					{ material: new THREE.MeshNormalMaterial(), overdraw: true, doubleSided: false },
-					{ material: new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
-					{ material: new THREE.MeshLambertMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
-					{ material: new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), overdraw: false, doubleSided: false }
+					{ material: new THREE.MeshBasicMaterial( { color: 0x00ffff, wireframe: true } ), doubleSided: true },
+					{ material: new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.AdditiveBlending } ), doubleSided: true },
+					{ material: new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, overdraw: true } ), doubleSided: false },
+					{ material: new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading, overdraw: true } ), doubleSided: false },
+					{ material: new THREE.MeshDepthMaterial( { overdraw: true } ), doubleSided: false },
+					{ material: new THREE.MeshNormalMaterial( { overdraw: true } ), doubleSided: false },
+					{ material: new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), doubleSided: false },
+					{ material: new THREE.MeshLambertMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), doubleSided: false },
+					{ material: new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), doubleSided: false }
 
 				];
 
@@ -96,7 +96,6 @@
 				for ( var i = 0, l = materials.length; i < l; i ++ ) {
 
 					var sphere = new THREE.Mesh( geometry, materials[ i ].material );
-					sphere.overdraw = materials[ i ].overdraw;
 					sphere.doubleSided = materials[ i ].doubleSided;
 
 					sphere.position.x = ( i % 5 ) * 200 - 400;

+ 1 - 2
examples/canvas_materials_depth.html

@@ -81,12 +81,11 @@
 				// Spheres
 
 				geometry = new THREE.CubeGeometry( 100, 100, 100 );
-				material = new THREE.MeshDepthMaterial( { near: 1, far: 2000 } );
+				material = new THREE.MeshDepthMaterial( { near: 1, far: 2000, overdraw: true } );
 
 				for ( var i = 0; i < 20; i ++ ) {
 
 					cube = new THREE.Mesh( geometry, material );
-					cube.overdraw = true;
 
 					cube.position.x = ( i % 5 ) * 200 - 400;
 					cube.position.z = Math.floor( i / 5 ) * 200 - 350;

+ 1 - 2
examples/canvas_materials_normal.html

@@ -64,8 +64,7 @@
 				loader = new THREE.JSONLoader();
 				loader.load( 'obj/WaltHeadLo.js', function ( geometry ) {
 
-					mesh = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial() );
-					mesh.overdraw = true;
+					mesh = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial( { overdraw: true } ) );
 					scene.add( mesh );
 
 				} );

+ 1 - 2
examples/canvas_materials_reflection.html

@@ -68,8 +68,7 @@
 
 					geometry.computeVertexNormals();
 
-					mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
-					mesh.overdraw = true;
+					mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ), overdraw: true } ) );
 					scene.add( mesh );
 
 				} );

+ 2 - 3
examples/canvas_materials_video.html

@@ -82,7 +82,7 @@
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.LinearFilter;
 
-				var material = new THREE.MeshBasicMaterial( { map: texture } );
+				var material = new THREE.MeshBasicMaterial( { map: texture, overdraw: true } );
 
 				imageReflection = document.createElement( 'canvas' );
 				imageReflection.width = 480;
@@ -100,7 +100,7 @@
 				textureReflection.minFilter = THREE.LinearFilter;
 				textureReflection.magFilter = THREE.LinearFilter;
 
-				var materialReflection = new THREE.MeshBasicMaterial( { map: textureReflection } );
+				var materialReflection = new THREE.MeshBasicMaterial( { map: textureReflection, overdraw: true } );
 
 				//
 
@@ -108,7 +108,6 @@
 
 				mesh = new THREE.Mesh( plane, material );
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;
-				mesh.overdraw = true;
 				scene.add(mesh);
 
 				mesh = new THREE.Mesh( plane, materialReflection );

+ 1 - 1
examples/canvas_particles_shapes.html

@@ -94,7 +94,7 @@
 				text3d.computeBoundingBox();
 				var centerOffset = -0.5 * ( text3d.boundingBox.x[ 1 ] - text3d.boundingBox.x[ 0 ] );
 
-				var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: false } );
+				var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: true } );
 
 				text = new THREE.Mesh( text3d, textMaterial );
 

+ 1 - 2
examples/canvas_performance.html

@@ -75,12 +75,11 @@
 				// Spheres
 
 				geometry = new THREE.SphereGeometry( 100, 26, 18 );
-				material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, opacity: 1 } );
+				material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, overdraw: true } );
 
 				for ( var i = 0; i < 20; i ++ ) {
 
 					sphere = new THREE.Mesh( geometry, material );
-					sphere.overdraw = true;
 
 					sphere.position.x = ( i % 5 ) * 200 - 400;
 					sphere.position.z = Math.floor( i / 5 ) * 200 - 400;

+ 1 - 2
examples/canvas_sandbox.html

@@ -91,12 +91,11 @@
 				objects = [];
 
 				geometry = new THREE.SphereGeometry( 100, 16, 8 );
-				material = new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } );
+				material = new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ), overdraw: true } );
 
 				for ( var i = 0; i < 10; i ++ ) {
 
 					sphere = new THREE.Mesh( geometry, material );
-					sphere.overdraw = true;
 
 					sphere.position.x = Math.random() * 1000 - 500;
 					sphere.position.y = Math.random() * 1000 - 500;

+ 5 - 3
examples/misc_ubiquity_test.html

@@ -128,9 +128,11 @@
 				mesh.doubleSided = true;
 				group.add( mesh );
 
+				/*
 				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) );
 				mesh.doubleSided = true;
 				group.add( mesh );
+				*/
 
 				// LIGHTS
 
@@ -194,9 +196,9 @@
 				qrcode.rotation.z += 0.02;
 				*/
 
-				//canvasRenderer.render( scene, camera );
-				//svgRenderer.render( scene, camera );
-				webglRenderer.render( scene, camera );
+				canvasRenderer.render( scene, camera );
+				svgRenderer.render( scene, camera );
+				// webglRenderer.render( scene, camera );
 
 			}
 

+ 9 - 10
src/core/Projector.js

@@ -144,8 +144,8 @@ THREE.Projector = function() {
 
 		var near = camera.near, far = camera.far,
 		o, ol, v, vl, f, fl, n, nl, c, cl, u, ul, object,
-		objectMatrixWorld, objectMatrixWorldRotation, objectMaterials, objectOverdraw,
-		geometry, vertices, vertex, vertexPositionScreen,
+		objectMatrixWorld, objectMatrixWorldRotation, objectMaterial,
+		geometry, geometryMaterials, vertices, vertex, vertexPositionScreen,
 		faces, face, faceVertexNormals, normal, faceVertexUvs, uvs,
 		v1, v2, v3, v4;
 
@@ -178,14 +178,14 @@ THREE.Projector = function() {
 			object = _renderData.objects[ o ];
 
 			objectMatrixWorld = object.matrixWorld;
-			objectMaterials = object.materials;
-			objectOverdraw = object.overdraw;
+			objectMaterial = object.material;
 
 			_vertexCount = 0;
 
 			if ( object instanceof THREE.Mesh ) {
 
 				geometry = object.geometry;
+				geometryMaterials = object.geometry.materials;
 				vertices = geometry.vertices;
 				faces = geometry.faces;
 				faceVertexUvs = geometry.faceVertexUvs;
@@ -298,9 +298,8 @@ THREE.Projector = function() {
 
 					}
 
-					_face.meshMaterials = objectMaterials;
-					_face.faceMaterials = face.materials;
-					_face.overdraw = objectOverdraw;
+					_face.material = objectMaterial;
+					_face.faceMaterial = face.materialIndex !== null ? geometryMaterials[ face.materialIndex ] : null;
 
 					_face.z = _face.centroidScreen.z;
 
@@ -317,7 +316,7 @@ THREE.Projector = function() {
 			object = _renderData.lines[ o ];
 
 			objectMatrixWorld = object.matrixWorld;
-			objectMaterials = object.materials;
+			objectMaterial = object.material;
 
 			_vertexCount = 0;
 
@@ -354,7 +353,7 @@ THREE.Projector = function() {
 
 						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
 
-						_line.materials = objectMaterials;
+						_line.material = objectMaterial;
 
 						_renderData.elements.push( _line );
 
@@ -389,7 +388,7 @@ THREE.Projector = function() {
 					_particle.scale.x = object.scale.x * Math.abs( _particle.x - ( _vector4.x + camera.projectionMatrix.n11 ) / ( _vector4.w + camera.projectionMatrix.n14 ) );
 					_particle.scale.y = object.scale.y * Math.abs( _particle.y - ( _vector4.y + camera.projectionMatrix.n22 ) / ( _vector4.w + camera.projectionMatrix.n24 ) );
 
-					_particle.materials = object.materials;
+					_particle.material = object.material;
 
 					_renderData.elements.push( _particle );
 

+ 2 - 0
src/materials/Material.js

@@ -24,6 +24,8 @@ THREE.Material = function ( parameters ) {
 
 	this.alphaTest = parameters.alphaTest !== undefined ? parameters.alphaTest : 0;
 
+	this.overdraw = parameters.overdraw !== undefined ? parameters.overdraw : false; // Boolean for fixing antialiasing gaps in CanvasRenderer 
+
 }
 
 THREE.MaterialCount = 0;

+ 5 - 1
src/objects/Mesh.js

@@ -11,8 +11,12 @@ THREE.Mesh = function ( geometry, material ) {
 	this.geometry = geometry;
 	this.material = material;
 
-	this.overdraw = false; // TODO: Move to material?
+	if ( material instanceof Array ) {
 
+		console.warn( 'DEPRECATE: Material array is no longer supported. Using material 0...' );
+		this.material = material[ 0 ];
+
+	}
 
 	if ( this.geometry ) {
 

+ 12 - 67
src/renderers/CanvasRenderer.js

@@ -173,7 +173,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 	this.render = function ( scene, camera ) {
 
-		var e, el, element, m, ml, fm, fml, material;
+		var e, el, element, material;
 
 		this.autoClear ? this.clear() : _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
 
@@ -201,6 +201,11 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 			element = _elements[ e ];
 
+			material = element.material;
+			material = material instanceof THREE.MeshFaceMaterial ? element.faceMaterial : material;
+
+			if ( material == null || material.opacity == 0 ) continue;
+
 			_bboxRect.empty();
 
 			if ( element instanceof THREE.RenderableParticle ) {
@@ -208,14 +213,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				_v1 = element;
 				_v1.x *= _canvasWidthHalf; _v1.y *= _canvasHeightHalf;
 
-				m = 0; ml = element.materials.length;
-
-				while( m < ml ) {
-
-					material = element.materials[ m ++ ];
-					material.opacity != 0 && renderParticle( _v1, element, material, scene );
-
-				}
+				renderParticle( _v1, element, material, scene );
 
 			} else if ( element instanceof THREE.RenderableLine ) {
 
@@ -229,14 +227,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				if ( _clipRect.intersects( _bboxRect ) ) {
 
-					m = 0; ml = element.materials.length;
-
-					while ( m < ml ) {
-
-						material = element.materials[ m ++ ];
-						material.opacity != 0 && renderLine( _v1, _v2, element, material, scene );
-
-					}
+					renderLine( _v1, _v2, element, material, scene );
 
 				}
 
@@ -249,7 +240,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				_v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf;
 				_v3.positionScreen.x *= _canvasWidthHalf; _v3.positionScreen.y *= _canvasHeightHalf;
 
-				if ( element.overdraw ) {
+				if ( material.overdraw ) {
 
 					expand( _v1.positionScreen, _v2.positionScreen );
 					expand( _v2.positionScreen, _v3.positionScreen );
@@ -263,30 +254,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				if ( _clipRect.intersects( _bboxRect ) ) {
 
-					m = 0; ml = element.meshMaterials.length;
-
-					while ( m < ml ) {
-
-						material = element.meshMaterials[ m ++ ];
-
-						if ( material instanceof THREE.MeshFaceMaterial ) {
-
-							fm = 0; fml = element.faceMaterials.length;
-
-							while ( fm < fml ) {
-
-								material = element.faceMaterials[ fm ++ ];
-								material && material.opacity != 0 && renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material, scene );
-
-							}
-
-							continue;
-
-						}
-
-						material.opacity != 0 && renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material, scene );
-
-					}
+					renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material, scene );
 
 				}
 
@@ -302,7 +270,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				_v5.positionScreen.copy( _v2.positionScreen );
 				_v6.positionScreen.copy( _v4.positionScreen );
 
-				if ( element.overdraw ) {
+				if ( material.overdraw ) {
 
 					expand( _v1.positionScreen, _v2.positionScreen );
 					expand( _v2.positionScreen, _v4.positionScreen );
@@ -320,30 +288,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				if ( _clipRect.intersects( _bboxRect ) ) {
 
-					m = 0; ml = element.meshMaterials.length;
-
-					while ( m < ml ) {
-
-						material = element.meshMaterials[ m ++ ];
-
-						if ( material instanceof THREE.MeshFaceMaterial ) {
-
-							fm = 0; fml = element.faceMaterials.length;
-
-							while ( fm < fml ) {
-
-								material = element.faceMaterials[ fm ++ ];
-								material && material.opacity != 0 && renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material, scene );
-
-							}
-
-							continue;
-
-						}
-
-						material.opacity != 0 && renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material, scene );
-
-					}
+					material.opacity != 0 && renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material, scene );
 
 				}
 

+ 10 - 63
src/renderers/SVGRenderer.js

@@ -81,7 +81,7 @@ THREE.SVGRenderer = function () {
 
 	this.render = function ( scene, camera ) {
 
-		var e, el, m, ml, fm, fml, element, material;
+		var e, el, element, material;
 
 		this.autoClear && this.clear();
 
@@ -106,6 +106,11 @@ THREE.SVGRenderer = function () {
 
 			element = _elements[ e ];
 
+			material = element.material;
+			material = material instanceof THREE.MeshFaceMaterial ? element.faceMaterial : material;
+
+			if ( material == null || material.opacity == 0 ) continue;
+
 			_bboxRect.empty();
 
 			if ( element instanceof THREE.RenderableParticle ) {
@@ -115,12 +120,7 @@ THREE.SVGRenderer = function () {
 
 				m = 0; ml = element.materials.length;
 
-				while ( m < ml ) {
-
-					material = element.materials[ m ++ ];
-					material && renderParticle( _v1, element, material, scene );
-
-				}
+				renderParticle( _v1, element, material, scene );
 
 			} else if ( element instanceof THREE.RenderableLine ) {
 
@@ -138,14 +138,7 @@ THREE.SVGRenderer = function () {
 
 				}
 
-				m = 0; ml = element.materials.length;
-
-				while ( m < ml ) {
-
-					material = element.materials[ m ++ ];
-					material && material.opacity != 0 && renderLine( _v1, _v2, element, material, scene );
-
-				}
+				renderLine( _v1, _v2, element, material, scene );
 
 			} else if ( element instanceof THREE.RenderableFace3 ) {
 
@@ -165,30 +158,7 @@ THREE.SVGRenderer = function () {
 
 				}
 
-				m = 0; ml = element.meshMaterials.length;
-
-				while ( m < ml ) {
-
-					material = element.meshMaterials[ m ++ ];
-
-					if ( material instanceof THREE.MeshFaceMaterial ) {
-
-						fm = 0; fml = element.faceMaterials.length;
-
-						while ( fm < fml ) {
-
-							material = element.faceMaterials[ fm ++ ];
-							material && material.opacity != 0 && renderFace3( _v1, _v2, _v3, element, material, scene );
-
-						}
-
-						continue;
-
-					}
-
-					material && material.opacity != 0 && renderFace3( _v1, _v2, _v3, element, material, scene );
-
-				}
+				renderFace3( _v1, _v2, _v3, element, material, scene );
 
 			} else if ( element instanceof THREE.RenderableFace4 ) {
 
@@ -210,30 +180,7 @@ THREE.SVGRenderer = function () {
 
 				}
 
-				m = 0; ml = element.meshMaterials.length;
-
-				while ( m < ml ) {
-
-					material = element.meshMaterials[ m ++ ];
-
-					if ( material instanceof THREE.MeshFaceMaterial ) {
-
-						fm = 0; fml = element.faceMaterials.length;
-
-						while ( fm < fml ) {
-
-							material = element.faceMaterials[ fm ++ ];
-							material && material.opacity != 0 && renderFace4( _v1, _v2, _v3, _v4, element, material, scene );
-
-						}
-
-						continue;
-
-					}
-
-					material && material.opacity != 0 && renderFace4( _v1, _v2, _v3, _v4, element, material, scene );
-
-				}
+				renderFace4( _v1, _v2, _v3, _v4, element, material, scene );
 
 			}
 

+ 2 - 3
src/renderers/renderables/RenderableFace3.js

@@ -14,9 +14,8 @@ THREE.RenderableFace3 = function () {
 	this.normalWorld = new THREE.Vector3();
 	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
 
-	this.meshMaterials = null;
-	this.faceMaterials = null;
-	this.overdraw = false;
+	this.material = null;
+	this.faceMaterial = null;
 	this.uvs = [[]];
 
 	this.z = null;

+ 2 - 3
src/renderers/renderables/RenderableFace4.js

@@ -15,9 +15,8 @@ THREE.RenderableFace4 = function () {
 	this.normalWorld = new THREE.Vector3();
 	this.vertexNormalsWorld = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
 
-	this.meshMaterials = null;
-	this.faceMaterials = null;
-	this.overdraw = false;
+	this.material = null;
+	this.faceMaterial = null;
 	this.uvs = [[]];
 
 	this.z = null;

+ 1 - 1
src/renderers/renderables/RenderableLine.js

@@ -9,6 +9,6 @@ THREE.RenderableLine = function () {
 	this.v1 = new THREE.RenderableVertex();
 	this.v2 = new THREE.RenderableVertex();
 
-	this.materials = null;
+	this.material = null;
 
 };

+ 1 - 1
src/renderers/renderables/RenderableParticle.js

@@ -11,6 +11,6 @@ THREE.RenderableParticle = function () {
 	this.rotation = null;
 	this.scale = new THREE.Vector2();
 
-	this.materials = null;
+	this.material = null;
 
 };

Some files were not shown because too many files changed in this diff