Browse Source

Reverted to proper Matrix4.multiply() (thanks @lukem1)

Mr.doob 14 years ago
parent
commit
4b2de9b91d
6 changed files with 525 additions and 547 deletions
  1. 250 250
      build/Three.js
  2. 47 47
      build/custom/ThreeCanvas.js
  3. 38 38
      build/custom/ThreeDOM.js
  4. 52 52
      build/custom/ThreeSVG.js
  5. 138 138
      build/custom/ThreeWebGL.js
  6. 0 22
      src/core/Matrix4.js

+ 250 - 250
build/Three.js

@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,d){return b.distance-d.distance});return e},intersectObject:function(b){function c(b,d,c){var e,c=c.matrixWorld.getPosition();e=c.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(e));return c.distanceTo(b)}function d(b,d,c,e){var e=e.clone().subSelf(d),c=c.clone().subSelf(d),
-f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),g=c.dot(c),c=c.dot(f),f=1/(b*g-d*d),g=(g*e-d*c)*f,b=(b*c-d*e)*f;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,g,j,k,m,o,p,t,n,u,v=b.geometry,
-y=v.vertices,B=[],e=0;for(f=v.faces.length;e<f;e++)if(g=v.faces[e],n=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(y[g.a].position.clone()),k=o.multiplyVector3(y[g.b].position.clone()),m=o.multiplyVector3(y[g.c].position.clone()),o=g instanceof THREE.Face4?o.multiplyVector3(y[g.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),t=u.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(j,n))/t,n=n.addSelf(u.multiplyScalar(p)),
-g instanceof THREE.Face3)d(n,j,k,m)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},B.push(g));else if(g instanceof THREE.Face4&&(d(n,j,k,o)||d(n,k,m,o)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},B.push(g);return B}else return[]}};
-THREE.Rectangle=function(){function b(){g=e-c;j=f-d}var c,d,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,p,t){k=!1;c=g;d=j;e=p;f=t;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,f=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,f=f>j?f:j);b()};this.add3Points=
-function(g,j,p,t,n,u){k?(k=!1,c=g<p?g<n?g:n:p<n?p:n,d=j<t?j<u?j:u:t<u?t:u,e=g>p?g>n?g:n:p>n?p:n,f=j>t?j>u?j:u:t>u?t:u):(c=g<p?g<n?g<c?g:c:n<c?n:c:p<n?p<c?p:c:n<c?n:c,d=j<t?j<u?j<d?j:d:u<d?u:d:t<u?t<d?t:d:u<d?u:d,e=g>p?g>n?g>e?g:e:n>e?n:e:p>n?p>e?p:e:n>e?n:e,f=j>t?j>u?j>f?j:f:u>f?u:f:t>u?t>f?t:f:u>f?u:f);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),f=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
+f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),g=c.dot(c),c=c.dot(f),f=1/(b*g-d*d),g=(g*e-d*c)*f,b=(b*c-d*e)*f;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,g,j,k,m,p,n,t,o,u,v=b.geometry,
+y=v.vertices,B=[],e=0;for(f=v.faces.length;e<f;e++)if(g=v.faces[e],o=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(y[g.a].position.clone()),k=p.multiplyVector3(y[g.b].position.clone()),m=p.multiplyVector3(y[g.c].position.clone()),p=g instanceof THREE.Face4?p.multiplyVector3(y[g.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),t=u.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(j,o))/t,o=o.addSelf(u.multiplyScalar(n)),
+g instanceof THREE.Face3)d(o,j,k,m)&&(g={distance:this.origin.distanceTo(o),point:o,face:g,object:b},B.push(g));else if(g instanceof THREE.Face4&&(d(o,j,k,p)||d(o,k,m,p)))g={distance:this.origin.distanceTo(o),point:o,face:g,object:b},B.push(g);return B}else return[]}};
+THREE.Rectangle=function(){function b(){g=e-c;j=f-d}var c,d,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,n,t){k=!1;c=g;d=j;e=n;f=t;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,f=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,f=f>j?f:j);b()};this.add3Points=
+function(g,j,n,t,o,u){k?(k=!1,c=g<n?g<o?g:o:n<o?n:o,d=j<t?j<u?j:u:t<u?t:u,e=g>n?g>o?g:o:n>o?n:o,f=j>t?j>u?j:u:t>u?t:u):(c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=j<t?j<u?j<d?j:d:u<d?u:d:t<u?t<d?t:d:u<d?u:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o:e,f=j>t?j>u?j>f?j:f:u>f?u:f:t>u?t>f?t:f:u>f?u:f);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),f=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
 g.getBottom()?f:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(f,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;f=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,g,j,k,m,o,p,t,n,u,v,y){this.set(b||1,c||0,d||0,e||0,f||0,g||1,j||0,k||0,m||0,o||0,p||1,t||0,n||0,u||0,v||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,m,o,p,t,n,u,v,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=p;this.n34=t;this.n41=n;this.n42=u;this.n43=v;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,g,j,k,m,p,n,t,o,u,v,y){this.set(b||1,c||0,d||0,e||0,f||0,g||1,j||0,k||0,m||0,p||0,n||1,t||0,o||0,u||0,v||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,m,p,n,t,o,u,v,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=n;this.n34=t;this.n41=o;this.n42=u;this.n43=v;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23*
 e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,n=b.n33,u=b.n34,v=b.n41,y=b.n42,B=b.n43,z=b.n44,I=c.n11,A=c.n12,G=c.n13,F=c.n14,C=c.n21,M=c.n22,
-J=c.n23,O=c.n24,w=c.n31,W=c.n32,R=c.n33,S=c.n34;this.n11=d*I+e*C+f*w;this.n12=d*A+e*M+f*W;this.n13=d*G+e*J+f*R;this.n14=d*F+e*O+f*S+g;this.n21=j*I+k*C+m*w;this.n22=j*A+k*M+m*W;this.n23=j*G+k*J+m*R;this.n24=j*F+k*O+m*S+o;this.n31=p*I+t*C+n*w;this.n32=p*A+t*M+n*W;this.n33=p*G+t*J+n*R;this.n34=p*F+t*O+n*S+u;this.n41=v*I+y*C+B*w;this.n42=v*A+y*M+B*W;this.n43=v*G+y*J+B*R;this.n44=v*F+y*O+B*S+z;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
-this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
-this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,t=this.n34,n=this.n41,u=this.n42,v=this.n43,y=this.n44;return e*j*o*n-d*k*o*n-e*g*p*n+c*k*p*n+d*g*t*n-c*j*t*n-e*j*m*u+d*k*m*u+e*f*p*u-b*k*p*u-d*f*t*u+b*j*t*u+e*g*m*v-c*k*m*v-e*f*o*v+b*k*o*v+c*f*t*v-b*g*t*v-d*g*m*y+c*j*m*y+d*f*o*y-b*j*o*y-c*f*p*y+b*g*p*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
-this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
-this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
-this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,
-c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,g=b.x,j=b.y,k=b.z,m=f*g,o=f*j;this.set(m*
-g+d,m*j-e*k,m*k+e*j,0,m*j+e*k,o*j+d,o*k-e*g,0,m*k-e*j,o*k+e*g,f*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*g;this.n12=-f*e;this.n13=d;this.n21=k*g+b*e;this.n22=-k*e+b*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=b*f;return this},
-setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,m=c*j;c*=k;var o=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(o+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,n=b.n33,u=b.n34,v=b.n41,y=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*y-o*n*y+o*t*B-k*u*B-m*t*z+k*n*z;c.n12=g*n*y-f*u*y-g*t*B+e*u*B+f*t*z-e*n*z;c.n13=f*o*y-g*m*y+g*k*B-e*o*B-f*k*z+e*m*z;c.n14=g*m*t-f*o*t-g*k*n+e*o*n+f*k*u-e*m*u;c.n21=o*n*v-m*u*v-o*p*B+j*u*B+m*p*z-j*n*z;c.n22=f*u*v-g*n*v+g*p*B-d*u*B-f*p*z+d*n*z;c.n23=g*m*v-f*o*v-g*j*B+d*o*B+f*j*z-d*m*z;c.n24=
-f*o*p-g*m*p+g*j*n-d*o*n-f*j*u+d*m*u;c.n31=k*u*v-o*t*v+o*p*y-j*u*y-k*p*z+j*t*z;c.n32=g*t*v-e*u*v-g*p*y+d*u*y+e*p*z-d*t*z;c.n33=f*o*v-g*k*v+g*j*y-d*o*y-e*j*z+d*k*z;c.n34=g*k*p-e*o*p-g*j*t+d*o*t+e*j*u-d*k*u;c.n41=m*t*v-k*n*v-m*p*y+j*n*y+k*p*B-j*t*B;c.n42=e*n*v-f*t*v+f*p*y-d*n*y-e*p*B+d*t*B;c.n43=f*k*v-e*m*v-f*j*y+d*m*y+e*j*B-d*k*B;c.n44=e*m*p-f*k*p+f*j*t-d*m*t-e*j*n+d*k*n;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*o;d[7]=b*p;d[8]=b*t;return c};
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,n=b.n31,t=b.n32,o=b.n33,u=b.n34,v=b.n41,y=b.n42,B=b.n43,z=b.n44,I=c.n11,A=c.n12,G=c.n13,F=c.n14,C=c.n21,M=c.n22,
+L=c.n23,O=c.n24,w=c.n31,W=c.n32,S=c.n33,T=c.n34,h=c.n41,R=c.n42,J=c.n43,P=c.n44;this.n11=d*I+e*C+f*w+g*h;this.n12=d*A+e*M+f*W+g*R;this.n13=d*G+e*L+f*S+g*J;this.n14=d*F+e*O+f*T+g*P;this.n21=j*I+k*C+m*w+p*h;this.n22=j*A+k*M+m*W+p*R;this.n23=j*G+k*L+m*S+p*J;this.n24=j*F+k*O+m*T+p*P;this.n31=n*I+t*C+o*w+u*h;this.n32=n*A+t*M+o*W+u*R;this.n33=n*G+t*L+o*S+u*J;this.n34=n*F+t*O+o*T+u*P;this.n41=v*I+y*C+B*w+z*h;this.n42=v*A+y*M+B*W+z*R;this.n43=v*G+y*L+B*S+z*J;this.n44=v*F+y*O+B*T+z*P;return this},multiplyToArray:function(b,
+c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
+b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,n=this.n33,t=this.n34,o=this.n41,u=this.n42,v=this.n43,y=this.n44;return e*j*p*o-d*k*p*o-e*g*n*o+c*k*n*o+d*g*t*o-c*j*t*o-e*j*m*u+d*k*m*u+e*f*n*u-b*k*n*u-d*f*t*u+b*j*t*u+e*g*m*v-c*k*m*v-e*f*p*v+b*k*p*v+c*f*t*v-b*g*t*v-d*g*m*y+c*j*m*y+d*f*p*y-b*j*p*y-c*f*n*y+b*g*n*y},transpose:function(){var b;b=this.n21;this.n21=
+this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
+this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
+this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
+c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
+c){var d=Math.cos(c),e=Math.sin(c),f=1-d,g=b.x,j=b.y,k=b.z,m=f*g,p=f*j;this.set(m*g+d,m*j-e*k,m*k+e*j,0,m*j+e*k,p*j+d,p*k-e*g,0,m*k-e*j,p*k+e*g,f*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
+return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*g;this.n12=-f*e;this.n13=d;this.n21=k*g+b*e;this.n22=
+-k*e+b*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=b*f;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,m=c*j;c*=k;var p=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(p+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=
+b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,n=b.n31,t=b.n32,o=b.n33,u=b.n34,v=b.n41,y=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*y-p*o*y+p*t*B-k*u*B-m*t*z+k*o*z;c.n12=g*o*y-f*u*y-g*t*B+e*u*B+f*t*z-e*o*z;c.n13=f*p*y-g*m*y+g*k*B-e*p*B-f*k*z+e*m*z;c.n14=g*m*t-f*p*t-g*k*o+e*p*o+f*k*u-e*m*u;c.n21=p*o*v-m*u*v-p*n*B+j*u*B+m*n*z-j*o*z;c.n22=f*u*v-g*o*v+g*n*B-d*u*B-f*n*z+d*o*z;c.n23=g*m*v-f*p*v-g*j*B+d*p*B+f*j*z-d*m*z;c.n24=
+f*p*n-g*m*n+g*j*o-d*p*o-f*j*u+d*m*u;c.n31=k*u*v-p*t*v+p*n*y-j*u*y-k*n*z+j*t*z;c.n32=g*t*v-e*u*v-g*n*y+d*u*y+e*n*z-d*t*z;c.n33=f*p*v-g*k*v+g*j*y-d*p*y-e*j*z+d*k*z;c.n34=g*k*n-e*p*n-g*j*t+d*p*t+e*j*u-d*k*u;c.n41=m*t*v-k*o*v-m*n*y+j*o*y+k*n*B-j*t*B;c.n42=e*o*v-f*t*v+f*n*y-d*o*y-e*n*B+d*t*B;c.n43=f*k*v-e*m*v-f*j*y+d*m*y+e*j*B-d*k*B;c.n44=e*m*n-f*k*n+f*j*t-d*m*t-e*j*o+d*k*o;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*p;d[7]=b*n;d[8]=b*t;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)};
-THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,m,o;j=new THREE.Matrix4;k=c-b;m=d-e;o=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+f)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,m,p;j=new THREE.Matrix4;k=c-b;m=d-e;p=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((g+f)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){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.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._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
@@ -49,8 +49,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,f=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-f),f=Math.sin(-f),g=Math.cos(d),d=Math.sin(d),j=b*c,k=e*f;this.w=j*g-k*d;this.x=j*d+k*g;this.y=e*c*g+b*f*d;this.z=b*f*g-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);this.x=b.x*e;this.y=b.y*
 e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*g+d*k-e*j;this.y=d*b+f*j+e*g-c*k;this.z=e*b+f*k+c*j-d*g;this.w=f*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,g=this.x,j=this.y,k=this.z,m=this.w,o=m*d+j*f-k*e,p=
-m*e+k*d-g*f,t=m*f+g*e-j*d,d=-g*d-j*e-k*f;c.x=o*m+d*-g+p*-k-t*-j;c.y=p*m+d*-j+t*-g-o*-k;c.z=t*m+d*-k+o*-j-p*-g;return c}};
+multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*g+d*k-e*j;this.y=d*b+f*j+e*g-c*k;this.z=e*b+f*k+c*j-d*g;this.w=f*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,g=this.x,j=this.y,k=this.z,m=this.w,p=m*d+j*f-k*e,n=
+m*e+k*d-g*f,t=m*f+g*e-j*d,d=-g*d-j*e-k*f;c.x=p*m+d*-g+n*-k-t*-j;c.y=n*m+d*-j+t*-g-p*-k;c.z=t*m+d*-k+p*-j-n*-g;return c}};
 THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,e,f,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,f,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
@@ -59,16 +59,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f
 d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(b&&g.vertexNormals.length){k.set(0,0,0);c=0;for(d=g.vertexNormals.length;c<d;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[g.a],d=this.vertices[g.b],j=this.vertices[g.c],k.sub(j.position,d.position),m.sub(c.position,d.position),k.crossSelf(m);k.isZero()||
 k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,h,e,f,g){k=b.vertices[d].position;m=b.vertices[c].position;o=b.vertices[h].position;p=j[e];t=j[f];n=j[g];u=m.x-k.x;v=o.x-k.x;y=m.y-k.y;B=o.y-k.y;z=m.z-k.z;I=o.z-k.z;A=t.u-p.u;G=n.u-p.u;F=t.v-p.v;C=n.v-p.v;M=1/(A*C-G*F);W.set((C*u-F*v)*
-M,(C*y-F*B)*M,(C*z-F*I)*M);R.set((A*v-G*u)*M,(A*B-G*y)*M,(A*I-G*z)*M);O[d].addSelf(W);O[c].addSelf(W);O[h].addSelf(W);w[d].addSelf(R);w[c].addSelf(R);w[h].addSelf(R)}var c,d,e,f,g,j,k,m,o,p,t,n,u,v,y,B,z,I,A,G,F,C,M,J,O=[],w=[],W=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3,h=new THREE.Vector3,Q=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)O[c]=new THREE.Vector3,w[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
-THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var L=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)Q.copy(g.vertexNormals[e]),f=g[L[e]],J=O[f],S.copy(J),S.subSelf(Q.multiplyScalar(Q.dot(J))).normalize(),h.cross(g.vertexNormals[e],J),f=h.dot(w[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(S.x,S.y,S.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,h,e,f,g){k=b.vertices[d].position;m=b.vertices[c].position;p=b.vertices[h].position;n=j[e];t=j[f];o=j[g];u=m.x-k.x;v=p.x-k.x;y=m.y-k.y;B=p.y-k.y;z=m.z-k.z;I=p.z-k.z;A=t.u-n.u;G=o.u-n.u;F=t.v-n.v;C=o.v-n.v;M=1/(A*C-G*F);W.set((C*u-F*v)*
+M,(C*y-F*B)*M,(C*z-F*I)*M);S.set((A*v-G*u)*M,(A*B-G*y)*M,(A*I-G*z)*M);O[d].addSelf(W);O[c].addSelf(W);O[h].addSelf(W);w[d].addSelf(S);w[c].addSelf(S);w[h].addSelf(S)}var c,d,e,f,g,j,k,m,p,n,t,o,u,v,y,B,z,I,A,G,F,C,M,L,O=[],w=[],W=new THREE.Vector3,S=new THREE.Vector3,T=new THREE.Vector3,h=new THREE.Vector3,R=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)O[c]=new THREE.Vector3,w[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
+THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var J=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)R.copy(g.vertexNormals[e]),f=g[J[e]],L=O[f],T.copy(L),T.subSelf(R.multiplyScalar(R.dot(L))).normalize(),h.cross(g.vertexNormals[e],L),f=h.dot(w[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(T.x,T.y,T.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function c(b,d,c){b[d]===
 void 0?(b[d]={set:{},array:[]},b[d].set[c]=1,b[d].array.push(c)):b[d].set[c]===void 0&&(b[d].set[c]=1,b[d].array.push(c))}var d,e,f,g,j,k={};d=0;for(e=this.faces.length;d<e;d++)j=this.faces[d],j instanceof THREE.Face3?(f=b(j.a,j.b),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.a,j.c),c(k,f,d)):j instanceof THREE.Face4&&(f=b(j.b,j.d),c(k,f,d),f=b(j.a,j.b),c(k,f,d),f=b(j.a,j.d),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.c,j.d),c(k,f,d));d=0;for(e=this.edges.length;d<e;d++){j=this.edges[d];f=j.vertexIndices[0];g=j.vertexIndices[1];
 j.faceIndices=k[b(f,g)].array;for(f=0;f<j.faceIndices.length;f++)g=j.faceIndices[f],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,d,c,e,f,g,j){b=(c-b)*0.5;e=(e-d)*0.5;return(2*(d-c)+b+e)*j+(-3*(d-c)-2*b-e)*g+b*f+d}this.points=b;var d=[],e={x:0,y:0,z:0},f,g,j,k,m,o,p,t,n;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){f=(this.points.length-1)*b;g=Math.floor(f);j=f-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;o=this.points[d[0]];p=this.points[d[1]];
-t=this.points[d[2]];n=this.points[d[3]];k=j*j;m=j*k;e.x=c(o.x,p.x,t.x,n.x,j,k,m);e.y=c(o.y,p.y,t.y,n.y,j,k,m);e.z=c(o.z,p.z,t.z,n.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;b<c;b++)d=this.points[b],e[b]=[d.x,d.y,d.z];return e};this.getLength=function(b){var d,c,e=d=d=0,f=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);c=this.points.length*b;f.copy(this.points[0]);for(b=1;b<c;b++)d=b/c,position=this.getPoint(d),g.copy(position),
-k+=g.distanceTo(f),f.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=e&&(j[d]=k,e=d);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var d,c,e,f,g,j,k=[],m=new THREE.Vector3,o=this.getLength();k.push(m.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){c=o.chunks[d]-o.chunks[d-1];j=Math.ceil(b*c/o.total);f=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(c=1;c<j-1;c++)e=f+c*(1/j)*(g-f),position=this.getPoint(e),k.push(m.copy(position).clone());
+THREE.Spline=function(b){function c(b,d,c,e,f,g,j){b=(c-b)*0.5;e=(e-d)*0.5;return(2*(d-c)+b+e)*j+(-3*(d-c)-2*b-e)*g+b*f+d}this.points=b;var d=[],e={x:0,y:0,z:0},f,g,j,k,m,p,n,t,o;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){f=(this.points.length-1)*b;g=Math.floor(f);j=f-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;p=this.points[d[0]];n=this.points[d[1]];
+t=this.points[d[2]];o=this.points[d[3]];k=j*j;m=j*k;e.x=c(p.x,n.x,t.x,o.x,j,k,m);e.y=c(p.y,n.y,t.y,o.y,j,k,m);e.z=c(p.z,n.z,t.z,o.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;b<c;b++)d=this.points[b],e[b]=[d.x,d.y,d.z];return e};this.getLength=function(b){var d,c,e=d=d=0,f=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);c=this.points.length*b;f.copy(this.points[0]);for(b=1;b<c;b++)d=b/c,position=this.getPoint(d),g.copy(position),
+k+=g.distanceTo(f),f.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=e&&(j[d]=k,e=d);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var d,c,e,f,g,j,k=[],m=new THREE.Vector3,p=this.getLength();k.push(m.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){c=p.chunks[d]-p.chunks[d-1];j=Math.ceil(b*c/p.total);f=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(c=1;c<j-1;c++)e=f+c*(1/j)*(g-f),position=this.getPoint(e),k.push(m.copy(position).clone());
 k.push(m.copy(this.points[d]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,f){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
@@ -127,13 +127,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
 this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,g,j,k,m,o,p,t,n,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var y=v.egdes=this.geometry.edges,B=v.edgeFaces=[];f=0;var z=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],z.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
-d.normal;b=0;for(c=y.length;b<c;b++)k=y[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],g=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",p=z[f]+0):d.b===j?(m="b",p=z[f]+1):d.c===j?(m="c",p=z[f]+2):d.d===j&&(m="d",p=z[f]+3),d.a===k?(m+="a",t=z[f]+0):d.b===k?(m+="b",t=z[f]+1):d.c===k?(m+="c",t=z[f]+2):d.d===k&&(m+="d",t=z[f]+3),e.a===j?(o="a",n=z[g]+0):e.b===j?(o="b",n=z[g]+1):e.c===j?(o="c",n=z[g]+2):e.d===j&&(o="d",n=z[g]+3),e.a===k?(o+="a",u=z[g]+0):e.b===k?(o+="b",u=z[g]+
-1):e.c===k?(o+="c",u=z[g]+2):e.d===k&&(o+="d",u=z[g]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?p>t&&(d=p,p=t,t=d):p<t&&(d=p,p=t,t=d),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>u&&(d=n,n=u,u=d):n<u&&(d=n,n=u,u=d),d=new THREE.Face4(p,t,n,u),d.normal.set(1,0,0),B.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,g=f.length,j,k,m,o,p,t=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];j instanceof THREE.Face4?(o=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(o=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
-for(k=0;k<o;k++)p=b[j[t[k]]],c.push(new THREE.Vertex(p.position.clone()))}for(g=0;g<f.length-1;g++){b=d[g];for(j=g+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,g,j,k,m,o,p,t,n,u,v,y,B=0,z=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){g=c[z[v]];k=b[g];for(y=0;y<f;y++)if(j=d[z[y]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(B++,B===1&&(o=k,p=m,t=g,n=j,u=z[v]),B===2))return u+=z[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[o,p,m,k],indices:[t,n,
-j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[o,k,m,p],indices:[t,g,j,n],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,g,j,k,m,p,n,t,o,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var y=v.egdes=this.geometry.edges,B=v.edgeFaces=[];f=0;var z=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],z.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
+d.normal;b=0;for(c=y.length;b<c;b++)k=y[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],g=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",n=z[f]+0):d.b===j?(m="b",n=z[f]+1):d.c===j?(m="c",n=z[f]+2):d.d===j&&(m="d",n=z[f]+3),d.a===k?(m+="a",t=z[f]+0):d.b===k?(m+="b",t=z[f]+1):d.c===k?(m+="c",t=z[f]+2):d.d===k&&(m+="d",t=z[f]+3),e.a===j?(p="a",o=z[g]+0):e.b===j?(p="b",o=z[g]+1):e.c===j?(p="c",o=z[g]+2):e.d===j&&(p="d",o=z[g]+3),e.a===k?(p+="a",u=z[g]+0):e.b===k?(p+="b",u=z[g]+
+1):e.c===k?(p+="c",u=z[g]+2):e.d===k&&(p+="d",u=z[g]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?n>t&&(d=n,n=t,t=d):n<t&&(d=n,n=t,t=d),p==="ac"||p==="ad"||p==="ca"||p==="da"?o>u&&(d=o,o=u,u=d):o<u&&(d=o,o=u,u=d),d=new THREE.Face4(n,t,o,u),d.normal.set(1,0,0),B.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,g=f.length,j,k,m,p,n,t=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];j instanceof THREE.Face4?(p=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(p=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
+for(k=0;k<p;k++)n=b[j[t[k]]],c.push(new THREE.Vertex(n.position.clone()))}for(g=0;g<f.length-1;g++){b=d[g];for(j=g+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,g,j,k,m,p,n,t,o,u,v,y,B=0,z=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){g=c[z[v]];k=b[g];for(y=0;y<f;y++)if(j=d[z[y]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(B++,B===1&&(p=k,n=m,t=g,o=j,u=z[v]),B===2))return u+=z[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[p,n,m,k],indices:[t,o,
+j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,m,n],indices:[t,g,j,o],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -142,55 +142,55 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,h=1,e=b.z+b.w,f=d.z+d.w,g=-b.z+b.w,j=-d.z+d.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&&(h=Math.min(h,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(h=Math.min(h,g/(g-j))),h<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-h),!0))}var e,f,g=[],j,k,m=[],o,p,t=[],n,u=[],v,y,B=[],z,I,A=[],G=new THREE.Vector4,F=new THREE.Vector4,
-C=new THREE.Matrix4,M=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Vector4,w=new THREE.Vector4;this.projectVector=function(b,d){C.multiply(d.projectionMatrix,d.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,d){C.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],h,k,m;f=0;k=
-b.objects;b=0;for(h=k.length;b<h;b++){m=k[b];var o;if(!(o=!m.visible))if(o=m instanceof THREE.Mesh){a:{o=void 0;for(var t=m.matrixWorld,p=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++)if(o=J[n].x*t.n14+J[n].y*t.n24+J[n].z*t.n34+J[n].w,o<=p){o=!1;break a}o=!0}o=!o}if(!o)o=g[f]=g[f]||new THREE.RenderableObject,f++,e=o,G.copy(m.position),C.multiplyVector3(G),e.object=m,e.z=G.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,f,g){var h=[],
-G=f.near,L=f.far,N,T,P,Y,V,Z,U,ea,ia,D,H,$,ca,aa,oa,va,pa;I=y=n=p=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);C.multiply(f.projectionMatrix,f.matrixWorldInverse);J[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);J[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);J[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);J[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);J[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);J[5].set(C.n41+C.n31,C.n42+C.n32,
-C.n43+C.n33,C.n44+C.n34);for(N=0;N<6;N++)ia=J[N],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(e,f,!0);e=0;for(N=ia.length;e<N;e++)if(D=ia[e].object,D.visible)if(H=D.matrixWorld,$=D.matrixRotationWorld,ca=D.materials,aa=D.overdraw,k=0,D instanceof THREE.Mesh){oa=D.geometry;Y=oa.vertices;va=oa.faces;oa=oa.faceVertexUvs;T=0;for(P=Y.length;T<P;T++)j=b(),j.positionWorld.copy(Y[T].position),H.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),C.multiplyVector4(j.positionScreen),
-j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>G&&j.positionScreen.z<L;Y=0;for(T=va.length;Y<T;Y++){P=va[Y];if(P instanceof THREE.Face3)if(V=m[P.a],Z=m[P.b],U=m[P.c],V.visible&&Z.visible&&U.visible&&(D.doubleSided||D.flipSided!=(U.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(U.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0))ea=t[p]=t[p]||new THREE.RenderableFace3,p++,o=ea,o.v1.copy(V),
-o.v2.copy(Z),o.v3.copy(U);else continue;else if(P instanceof THREE.Face4)if(V=m[P.a],Z=m[P.b],U=m[P.c],ea=m[P.d],V.visible&&Z.visible&&U.visible&&ea.visible&&(D.doubleSided||D.flipSided!=((ea.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(ea.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0||(Z.positionScreen.x-U.positionScreen.x)*(ea.positionScreen.y-U.positionScreen.y)-(Z.positionScreen.y-U.positionScreen.y)*(ea.positionScreen.x-U.positionScreen.x)<
-0)))pa=u[n]=u[n]||new THREE.RenderableFace4,n++,o=pa,o.v1.copy(V),o.v2.copy(Z),o.v3.copy(U),o.v4.copy(ea);else continue;o.normalWorld.copy(P.normal);$.multiplyVector3(o.normalWorld);o.centroidWorld.copy(P.centroid);H.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);U=P.vertexNormals;V=0;for(Z=U.length;V<Z;V++)ea=o.vertexNormalsWorld[V],ea.copy(U[V]),$.multiplyVector3(ea);V=0;for(Z=oa.length;V<Z;V++)if(pa=oa[V][Y]){U=0;for(ea=pa.length;U<ea;U++)o.uvs[V][U]=
-pa[U]}o.meshMaterials=ca;o.faceMaterials=P.materials;o.overdraw=aa;o.z=o.centroidScreen.z;h.push(o)}}else if(D instanceof THREE.Line){M.multiply(C,H);Y=D.geometry.vertices;V=b();V.positionScreen.copy(Y[0].position);M.multiplyVector4(V.positionScreen);T=1;for(P=Y.length;T<P;T++)if(V=b(),V.positionScreen.copy(Y[T].position),M.multiplyVector4(V.positionScreen),Z=m[k-2],O.copy(V.positionScreen),w.copy(Z.positionScreen),d(O,w))O.multiplyScalar(1/O.w),w.multiplyScalar(1/w.w),H=B[y]=B[y]||new THREE.RenderableLine,
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,h=1,e=b.z+b.w,f=d.z+d.w,g=-b.z+b.w,j=-d.z+d.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&&(h=Math.min(h,e/(e-f))),g<0?c=Math.max(c,g/(g-j)):j<0&&(h=Math.min(h,g/(g-j))),h<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-h),!0))}var e,f,g=[],j,k,m=[],p,n,t=[],o,u=[],v,y,B=[],z,I,A=[],G=new THREE.Vector4,F=new THREE.Vector4,
+C=new THREE.Matrix4,M=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Vector4,w=new THREE.Vector4;this.projectVector=function(b,d){C.multiply(d.projectionMatrix,d.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,d){C.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],h,k,m;f=0;k=
+b.objects;b=0;for(h=k.length;b<h;b++){m=k[b];var p;if(!(p=!m.visible))if(p=m instanceof THREE.Mesh){a:{p=void 0;for(var t=m.matrixWorld,n=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),o=0;o<6;o++)if(p=L[o].x*t.n14+L[o].y*t.n24+L[o].z*t.n34+L[o].w,p<=n){p=!1;break a}p=!0}p=!p}if(!p)p=g[f]=g[f]||new THREE.RenderableObject,f++,e=p,G.copy(m.position),C.multiplyVector3(G),e.object=m,e.z=G.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,f,g){var h=[],
+G=f.near,J=f.far,P,Q,N,Y,V,Z,U,ea,ia,D,H,$,ca,aa,oa,va,pa;I=y=o=n=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);C.multiply(f.projectionMatrix,f.matrixWorldInverse);L[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);L[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);L[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);L[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);L[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);L[5].set(C.n41+C.n31,C.n42+C.n32,
+C.n43+C.n33,C.n44+C.n34);for(P=0;P<6;P++)ia=L[P],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(e,f,!0);e=0;for(P=ia.length;e<P;e++)if(D=ia[e].object,D.visible)if(H=D.matrixWorld,$=D.matrixRotationWorld,ca=D.materials,aa=D.overdraw,k=0,D instanceof THREE.Mesh){oa=D.geometry;Y=oa.vertices;va=oa.faces;oa=oa.faceVertexUvs;Q=0;for(N=Y.length;Q<N;Q++)j=b(),j.positionWorld.copy(Y[Q].position),H.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),C.multiplyVector4(j.positionScreen),
+j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>G&&j.positionScreen.z<J;Y=0;for(Q=va.length;Y<Q;Y++){N=va[Y];if(N instanceof THREE.Face3)if(V=m[N.a],Z=m[N.b],U=m[N.c],V.visible&&Z.visible&&U.visible&&(D.doubleSided||D.flipSided!=(U.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(U.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0))ea=t[n]=t[n]||new THREE.RenderableFace3,n++,p=ea,p.v1.copy(V),
+p.v2.copy(Z),p.v3.copy(U);else continue;else if(N instanceof THREE.Face4)if(V=m[N.a],Z=m[N.b],U=m[N.c],ea=m[N.d],V.visible&&Z.visible&&U.visible&&ea.visible&&(D.doubleSided||D.flipSided!=((ea.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(ea.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0||(Z.positionScreen.x-U.positionScreen.x)*(ea.positionScreen.y-U.positionScreen.y)-(Z.positionScreen.y-U.positionScreen.y)*(ea.positionScreen.x-U.positionScreen.x)<
+0)))pa=u[o]=u[o]||new THREE.RenderableFace4,o++,p=pa,p.v1.copy(V),p.v2.copy(Z),p.v3.copy(U),p.v4.copy(ea);else continue;p.normalWorld.copy(N.normal);$.multiplyVector3(p.normalWorld);p.centroidWorld.copy(N.centroid);H.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);C.multiplyVector3(p.centroidScreen);U=N.vertexNormals;V=0;for(Z=U.length;V<Z;V++)ea=p.vertexNormalsWorld[V],ea.copy(U[V]),$.multiplyVector3(ea);V=0;for(Z=oa.length;V<Z;V++)if(pa=oa[V][Y]){U=0;for(ea=pa.length;U<ea;U++)p.uvs[V][U]=
+pa[U]}p.meshMaterials=ca;p.faceMaterials=N.materials;p.overdraw=aa;p.z=p.centroidScreen.z;h.push(p)}}else if(D instanceof THREE.Line){M.multiply(C,H);Y=D.geometry.vertices;V=b();V.positionScreen.copy(Y[0].position);M.multiplyVector4(V.positionScreen);Q=1;for(N=Y.length;Q<N;Q++)if(V=b(),V.positionScreen.copy(Y[Q].position),M.multiplyVector4(V.positionScreen),Z=m[k-2],O.copy(V.positionScreen),w.copy(Z.positionScreen),d(O,w))O.multiplyScalar(1/O.w),w.multiplyScalar(1/w.w),H=B[y]=B[y]||new THREE.RenderableLine,
 y++,v=H,v.v1.positionScreen.copy(O),v.v2.positionScreen.copy(w),v.z=Math.max(O.z,w.z),v.materials=D.materials,h.push(v)}else if(D instanceof THREE.Particle&&(F.set(D.matrixWorld.n14,D.matrixWorld.n24,D.matrixWorld.n34,1),C.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))H=A[I]=A[I]||new THREE.RenderableParticle,I++,z=H,z.x=F.x/F.w,z.y=F.y/F.w,z.z=F.z,z.rotation=D.rotation.z,z.scale.x=D.scale.x*Math.abs(z.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),z.scale.y=D.scale.y*Math.abs(z.y-(F.y+
 f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),z.materials=D.materials,h.push(z);g&&h.sort(c);return h}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var m,o,p,t,n,u,v,y;b=c.projectScene(d,e);m=0;for(o=b.length;m<o;m++)if(n=b[m],n instanceof THREE.RenderableParticle){v=n.x*f+f;y=n.y*g+g;p=0;for(t=n.material.length;p<t;p++)if(u=n.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=y+"px"}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var m,p,n,t,o,u,v,y;b=c.projectScene(d,e);m=0;for(p=b.length;m<p;m++)if(o=b[m],o instanceof THREE.RenderableParticle){v=o.x*f+f;y=o.y*g+g;n=0;for(t=o.material.length;n<t;n++)if(u=o.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=y+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(z!=b)v.globalAlpha=z=b}function d(b){if(I!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}I=b}}function e(b){if(A!=b.hex)A=b.hex,v.strokeStyle="#"+g(A.toString(16))}function f(b){if(G!=b.hex)G=b.hex,v.fillStyle="#"+g(G.toString(16))}function g(b){for(;b.length<6;)b="0"+b;return b}
-var j=this,k=null,m=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,n,u,v=o.getContext("2d"),y=new THREE.Color(0),B=0,z=1,I=0,A=null,G=null,F=null,C=null,M=null,J,O,w,W,R=new THREE.RenderableVertex,S=new THREE.RenderableVertex,h,Q,L,N,T,P,Y,V,Z,U,ea,ia,D=new THREE.Color(0),H=new THREE.Color(0),$=new THREE.Color(0),ca=new THREE.Color(0),aa=new THREE.Color(0),oa,va,pa,ta,$a,ab,bb,cb,db,eb,Da=new THREE.Rectangle,wa=new THREE.Rectangle,na=new THREE.Rectangle,
-Sa=!1,ua=new THREE.Color,qa=new THREE.Color,Na=new THREE.Color,Oa=new THREE.Color,ja=new THREE.Vector3,La,Ma,Ta,xa,E,Pa,b=16;La=document.createElement("canvas");La.width=La.height=2;Ma=La.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Ta=Ma.getImageData(0,0,2,2);xa=Ta.data;E=document.createElement("canvas");E.width=E.height=b;Pa=E.getContext("2d");Pa.translate(-b/2,-b/2);Pa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,d){p=b;t=d;n=p/2;u=t/2;o.width=p;o.height=t;Da.set(-n,-u,n,u);z=1;I=0;M=C=F=G=A=null};this.setClearColor=function(b,d){y=b;B=d};this.setClearColorHex=function(b,d){y.setHex(b);B=d};this.clear=function(){v.setTransform(1,0,0,-1,n,u);if(!wa.isEmpty())wa.inflate(1),wa.minSelf(Da),y.hex==0&&B==0?v.clearRect(wa.getX(),wa.getY(),wa.getWidth(),wa.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
-255)+","+B+")",v.fillRect(wa.getX(),wa.getY(),wa.getWidth(),wa.getHeight())),wa.empty()};this.render=function(b,g){function o(b){var d,c,e,h=b.lights;qa.setRGB(0,0,0);Na.setRGB(0,0,0);Oa.setRGB(0,0,0);b=0;for(d=h.length;b<d;b++)c=h[b],e=c.color,c instanceof THREE.AmbientLight?(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b):c instanceof THREE.DirectionalLight?(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b):c instanceof THREE.PointLight&&(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b)}function t(b,d,c,e){var h,f,g,j,k=b.lights,b=0;for(h=k.length;b<
-h;b++)f=k[b],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(ja.sub(f.position,d).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(d.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)))}function p(b,h,g){c(g.opacity);d(g.blending);var j,k,m,o,aa,t;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)o=g.map.image,aa=o.width>>1,t=o.height>>
-1,g=h.scale.x*n,m=h.scale.y*u,j=g*aa,k=m*t,na.set(b.x-j,b.y-k,b.x+j,b.y+k),Da.instersects(na)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-aa,-t),v.drawImage(o,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*n,k=h.scale.y*u,na.set(b.x-j,b.y-k,b.x+j,b.y+k),Da.instersects(na)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function z(b,h,f,g){c(g.opacity);d(g.blending);
-v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)v.lineWidth=F=b;b=g.linecap;if(C!=b)v.lineCap=C=b;b=g.linejoin;if(M!=b)v.lineJoin=M=b;e(g.color);v.stroke();na.inflate(g.linewidth*2)}}function y(b,e,f,k,m,o,p,n,u){j.data.vertices+=3;j.data.faces++;c(n.opacity);d(n.blending);h=b.positionScreen.x;Q=b.positionScreen.y;L=e.positionScreen.x;N=e.positionScreen.y;T=f.positionScreen.x;
-P=f.positionScreen.y;B(h,Q,L,N,T,P);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ta=p.uvs[0],K(h,Q,L,N,T,P,n.map.image,ta[k].u,ta[k].v,ta[m].u,ta[m].v,ta[o].u,ta[o].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,ja.copy(p.vertexNormalsWorld[0]),$a=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,ab=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(p.vertexNormalsWorld[1]),bb=(ja.x*b.n11+ja.y*b.n12+
-ja.z*b.n13)*0.5+0.5,cb=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(p.vertexNormalsWorld[2]),db=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,eb=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,K(h,Q,L,N,T,P,n.envMap.image,$a,ab,bb,cb,db,eb)}else n.wireframe?G(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ta=p.uvs[0],K(h,Q,L,N,T,P,n.map.image,ta[k].u,ta[k].v,
-ta[m].u,ta[m].v,ta[o].u,ta[o].v)),d(THREE.SubtractiveBlending)),Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(H.r=$.r=ca.r=qa.r,H.g=$.g=ca.g=qa.g,H.b=$.b=ca.b=qa.b,t(u,p.v1.positionWorld,p.vertexNormalsWorld[0],H),t(u,p.v2.positionWorld,p.vertexNormalsWorld[1],$),t(u,p.v3.positionWorld,p.vertexNormalsWorld[2],ca),aa.r=($.r+ca.r)*0.5,aa.g=($.g+ca.g)*0.5,aa.b=($.b+ca.b)*0.5,pa=Qa(H,$,ca,aa),K(h,Q,L,N,T,P,pa,0,0,1,0,0,1)):(ua.r=qa.r,ua.g=qa.g,ua.b=qa.b,t(u,p.centroidWorld,
-p.normalWorld,ua),D.r=Math.max(0,Math.min(n.color.r*ua.r,1)),D.g=Math.max(0,Math.min(n.color.g*ua.g,1)),D.b=Math.max(0,Math.min(n.color.b*ua.b,1)),D.updateHex(),n.wireframe?G(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(D)):n.wireframe?G(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)oa=g.near,va=g.far,H.r=H.g=H.b=1-Ea(b.positionScreen.z,oa,va),$.r=$.g=$.b=1-Ea(e.positionScreen.z,oa,va),ca.r=ca.g=ca.b=
-1-Ea(f.positionScreen.z,oa,va),aa.r=($.r+ca.r)*0.5,aa.g=($.g+ca.g)*0.5,aa.b=($.b+ca.b)*0.5,pa=Qa(H,$,ca,aa),K(h,Q,L,N,T,P,pa,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)D.r=Ka(p.normalWorld.x),D.g=Ka(p.normalWorld.y),D.b=Ka(p.normalWorld.z),D.updateHex(),n.wireframe?G(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(D)}function A(b,e,f,k,m,o,n,p,u){j.data.vertices+=4;j.data.faces++;c(p.opacity);d(p.blending);if(p.map||p.envMap)y(b,e,k,0,1,3,n,p,u),y(m,f,o,1,2,3,n,p,
-u);else if(h=b.positionScreen.x,Q=b.positionScreen.y,L=e.positionScreen.x,N=e.positionScreen.y,T=f.positionScreen.x,P=f.positionScreen.y,Y=k.positionScreen.x,V=k.positionScreen.y,Z=m.positionScreen.x,U=m.positionScreen.y,ea=o.positionScreen.x,ia=o.positionScreen.y,p instanceof THREE.MeshBasicMaterial)I(h,Q,L,N,T,P,Y,V),p.wireframe?G(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Aa(p.color);else if(p instanceof THREE.MeshLambertMaterial)Sa?!p.wireframe&&p.shading==THREE.SmoothShading&&
-n.vertexNormalsWorld.length==4?(H.r=$.r=ca.r=aa.r=qa.r,H.g=$.g=ca.g=aa.g=qa.g,H.b=$.b=ca.b=aa.b=qa.b,t(u,n.v1.positionWorld,n.vertexNormalsWorld[0],H),t(u,n.v2.positionWorld,n.vertexNormalsWorld[1],$),t(u,n.v4.positionWorld,n.vertexNormalsWorld[3],ca),t(u,n.v3.positionWorld,n.vertexNormalsWorld[2],aa),pa=Qa(H,$,ca,aa),B(h,Q,L,N,Y,V),K(h,Q,L,N,Y,V,pa,0,0,1,0,0,1),B(Z,U,T,P,ea,ia),K(Z,U,T,P,ea,ia,pa,1,0,1,1,0,1)):(ua.r=qa.r,ua.g=qa.g,ua.b=qa.b,t(u,n.centroidWorld,n.normalWorld,ua),D.r=Math.max(0,Math.min(p.color.r*
-ua.r,1)),D.g=Math.max(0,Math.min(p.color.g*ua.g,1)),D.b=Math.max(0,Math.min(p.color.b*ua.b,1)),D.updateHex(),I(h,Q,L,N,T,P,Y,V),p.wireframe?G(D,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Aa(D)):(I(h,Q,L,N,T,P,Y,V),p.wireframe?G(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Aa(p.color));else if(p instanceof THREE.MeshNormalMaterial)D.r=Ka(n.normalWorld.x),D.g=Ka(n.normalWorld.y),D.b=Ka(n.normalWorld.z),D.updateHex(),I(h,Q,L,N,T,P,Y,V),p.wireframe?G(D,p.wireframeLinewidth,
-p.wireframeLinecap,p.wireframeLinejoin):Aa(D);else if(p instanceof THREE.MeshDepthMaterial)oa=g.near,va=g.far,H.r=H.g=H.b=1-Ea(b.positionScreen.z,oa,va),$.r=$.g=$.b=1-Ea(e.positionScreen.z,oa,va),ca.r=ca.g=ca.b=1-Ea(k.positionScreen.z,oa,va),aa.r=aa.g=aa.b=1-Ea(f.positionScreen.z,oa,va),pa=Qa(H,$,ca,aa),B(h,Q,L,N,Y,V),K(h,Q,L,N,Y,V,pa,0,0,1,0,0,1),B(Z,U,T,P,ea,ia),K(Z,U,T,P,ea,ia,pa,1,0,1,1,0,1)}function B(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()}
-function I(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function G(b,d,c,h){if(F!=d)v.lineWidth=F=d;if(C!=c)v.lineCap=C=c;if(M!=h)v.lineJoin=M=h;e(b);v.stroke();na.inflate(d*2)}function Aa(b){f(b);v.fill()}function K(b,d,c,e,h,f,g,j,k,m,o,aa,p){var n,t;n=g.width-1;t=g.height-1;j*=n;k*=t;m*=n;o*=t;aa*=n;p*=t;c-=b;e-=d;h-=b;f-=d;m-=j;o-=k;aa-=j;p-=k;n=m*p-aa*o;n!=0&&(t=1/n,n=(p*c-o*h)*t,o=(p*e-o*f)*t,c=(m*h-aa*c)*t,e=(m*f-aa*e)*t,
-b=b-n*j-c*k,d=d-o*j-e*k,v.save(),v.transform(n,o,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function Qa(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),o=~~(e.r*255),aa=~~(e.g*255),e=~~(e.b*255);xa[0]=h<0?0:h>255?255:h;xa[1]=f<0?0:f>255?255:f;xa[2]=b<0?0:b>255?255:b;xa[4]=g<0?0:g>255?255:g;xa[5]=j<0?0:j>255?255:j;xa[6]=d<0?0:d>255?255:d;xa[8]=k<0?0:k>255?255:k;xa[9]=m<0?0:m>255?255:m;xa[10]=c<0?0:c>255?
-255:c;xa[12]=o<0?0:o>255?255:o;xa[13]=aa<0?0:aa>255?255:aa;xa[14]=e<0?0:e>255?255:e;Ma.putImageData(Ta,0,0);Pa.drawImage(La,0,0);return E}function Ea(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ba(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ra,hb,X,da,fa,ga,ha,la;this.autoClear?this.clear():v.setTransform(1,0,0,-1,n,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Sa=
-b.lights.length>0)&&o(b);Ra=0;for(hb=k.length;Ra<hb;Ra++){X=k[Ra];na.empty();if(X instanceof THREE.RenderableParticle){J=X;J.x*=n;J.y*=u;da=0;for(fa=X.materials.length;da<fa;)la=X.materials[da++],la.opacity!=0&&p(J,X,la,b)}else if(X instanceof THREE.RenderableLine){if(J=X.v1,O=X.v2,J.positionScreen.x*=n,J.positionScreen.y*=u,O.positionScreen.x*=n,O.positionScreen.y*=u,na.addPoint(J.positionScreen.x,J.positionScreen.y),na.addPoint(O.positionScreen.x,O.positionScreen.y),Da.instersects(na)){da=0;for(fa=
-X.materials.length;da<fa;)la=X.materials[da++],la.opacity!=0&&z(J,O,X,la,b)}}else if(X instanceof THREE.RenderableFace3){if(J=X.v1,O=X.v2,w=X.v3,J.positionScreen.x*=n,J.positionScreen.y*=u,O.positionScreen.x*=n,O.positionScreen.y*=u,w.positionScreen.x*=n,w.positionScreen.y*=u,X.overdraw&&(Ba(J.positionScreen,O.positionScreen),Ba(O.positionScreen,w.positionScreen),Ba(w.positionScreen,J.positionScreen)),na.add3Points(J.positionScreen.x,J.positionScreen.y,O.positionScreen.x,O.positionScreen.y,w.positionScreen.x,
-w.positionScreen.y),Da.instersects(na)){da=0;for(fa=X.meshMaterials.length;da<fa;)if(la=X.meshMaterials[da++],la instanceof THREE.MeshFaceMaterial){ga=0;for(ha=X.faceMaterials.length;ga<ha;)(la=X.faceMaterials[ga++])&&la.opacity!=0&&y(J,O,w,0,1,2,X,la,b)}else la.opacity!=0&&y(J,O,w,0,1,2,X,la,b)}}else if(X instanceof THREE.RenderableFace4&&(J=X.v1,O=X.v2,w=X.v3,W=X.v4,J.positionScreen.x*=n,J.positionScreen.y*=u,O.positionScreen.x*=n,O.positionScreen.y*=u,w.positionScreen.x*=n,w.positionScreen.y*=
-u,W.positionScreen.x*=n,W.positionScreen.y*=u,R.positionScreen.copy(O.positionScreen),S.positionScreen.copy(W.positionScreen),X.overdraw&&(Ba(J.positionScreen,O.positionScreen),Ba(O.positionScreen,W.positionScreen),Ba(W.positionScreen,J.positionScreen),Ba(w.positionScreen,R.positionScreen),Ba(w.positionScreen,S.positionScreen)),na.addPoint(J.positionScreen.x,J.positionScreen.y),na.addPoint(O.positionScreen.x,O.positionScreen.y),na.addPoint(w.positionScreen.x,w.positionScreen.y),na.addPoint(W.positionScreen.x,
-W.positionScreen.y),Da.instersects(na))){da=0;for(fa=X.meshMaterials.length;da<fa;)if(la=X.meshMaterials[da++],la instanceof THREE.MeshFaceMaterial){ga=0;for(ha=X.faceMaterials.length;ga<ha;)(la=X.faceMaterials[ga++])&&la.opacity!=0&&A(J,O,w,W,R,S,X,la,b)}else la.opacity!=0&&A(J,O,w,W,R,S,X,la,b)}wa.addRectangle(na)}v.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,d,c){var e,h,f,g;e=0;for(h=b.lights.length;e<h;e++)f=b.lights[e],f instanceof THREE.DirectionalLight?(g=d.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&&(W.sub(f.position,d.centroidWorld),W.normalize(),g=d.normalWorld.dot(W)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function c(d,c,k,m,p,n){j.data.vertices+=3;j.data.faces++;h=e(Q++);h.setAttribute("d",
-"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?G?(C.r=M.r,C.g=M.g,C.b=M.b,b(n,m,C),F.r=Math.max(0,Math.min(p.color.r*C.r,1)),F.g=Math.max(0,Math.min(p.color.g*C.g,1)),F.b=Math.max(0,Math.min(p.color.b*C.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(w=1-p.__2near/(p.__farPlusNear-
-m.z*p.__farMinusNear),F.setRGB(w,w,w)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?h.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):h.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(h)}function d(d,c,k,m,
-p,n,t){j.data.vertices+=4;j.data.faces++;h=e(Q++);h.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?G?(C.r=M.r,C.g=M.g,C.b=M.b,b(t,p,C),F.r=Math.max(0,Math.min(n.color.r*C.r,1)),F.g=Math.max(0,Math.min(n.color.g*C.g,1)),F.b=Math.max(0,Math.min(n.color.b*
-C.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(w=1-n.__2near/(n.__farPlusNear-p.z*n.__farMinusNear),F.setRGB(w,w,w)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(f(p.normalWorld.x),f(p.normalWorld.y),f(p.normalWorld.z));n.wireframe?h.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):h.setAttribute("style",
-"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(h)}function e(b){R[b]==null&&(R[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),N==0&&R[b].setAttribute("shape-rendering","crispEdges"));return R[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,n,u,v,y,B,z,I=new THREE.Rectangle,A=new THREE.Rectangle,G=
-!1,F=new THREE.Color(16777215),C=new THREE.Color(16777215),M=new THREE.Color(0),J=new THREE.Color(0),O=new THREE.Color(0),w,W=new THREE.Vector3,R=[],S=[],h,Q,L,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":N=1;break;case "low":N=0}};this.setSize=function(b,d){p=b;t=d;n=p/2;u=t/2;o.setAttribute("viewBox",-n+" "+-u+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);I.set(-n,-u,
-n,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,e){var f,p,t,F,C,w,D,H;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);L=Q=0;if(G=b.lights.length>0){D=b.lights;M.setRGB(0,0,0);J.setRGB(0,0,0);O.setRGB(0,0,0);f=0;for(p=D.length;f<p;f++)t=D[f],F=t.color,t instanceof THREE.AmbientLight?(M.r+=F.r,M.g+=F.g,M.b+=F.b):t instanceof THREE.DirectionalLight?(J.r+=F.r,J.g+=F.g,J.b+=F.b):t instanceof
-THREE.PointLight&&(O.r+=F.r,O.g+=F.g,O.b+=F.b)}f=0;for(p=k.length;f<p;f++)if(D=k[f],A.empty(),D instanceof THREE.RenderableParticle){v=D;v.x*=n;v.y*=-u;t=0;for(F=D.materials.length;t<F;)t++}else if(D instanceof THREE.RenderableLine){if(v=D.v1,y=D.v2,v.positionScreen.x*=n,v.positionScreen.y*=-u,y.positionScreen.x*=n,y.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),I.instersects(A)){t=0;for(F=D.materials.length;t<F;)if((H=D.materials[t++])&&
-H.opacity!=0){C=v;w=y;var W=L++;S[W]==null&&(S[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),N==0&&S[W].setAttribute("shape-rendering","crispEdges"));h=S[W];h.setAttribute("x1",C.positionScreen.x);h.setAttribute("y1",C.positionScreen.y);h.setAttribute("x2",w.positionScreen.x);h.setAttribute("y2",w.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(h.setAttribute("style","fill: none; stroke: ##"+g(H.color.hex.toString(16))+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+
-H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),o.appendChild(h))}}}else if(D instanceof THREE.RenderableFace3){if(v=D.v1,y=D.v2,B=D.v3,v.positionScreen.x*=n,v.positionScreen.y*=-u,y.positionScreen.x*=n,y.positionScreen.y*=-u,B.positionScreen.x*=n,B.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),I.instersects(A)){t=0;for(F=D.meshMaterials.length;t<
-F;)if(H=D.meshMaterials[t++],H instanceof THREE.MeshFaceMaterial){C=0;for(w=D.faceMaterials.length;C<w;)(H=D.faceMaterials[C++])&&H.opacity!=0&&c(v,y,B,D,H,b)}else H&&H.opacity!=0&&c(v,y,B,D,H,b)}}else if(D instanceof THREE.RenderableFace4&&(v=D.v1,y=D.v2,B=D.v3,z=D.v4,v.positionScreen.x*=n,v.positionScreen.y*=-u,y.positionScreen.x*=n,y.positionScreen.y*=-u,B.positionScreen.x*=n,B.positionScreen.y*=-u,z.positionScreen.x*=n,z.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,
+var j=this,k=null,m=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,t,o,u,v=p.getContext("2d"),y=new THREE.Color(0),B=0,z=1,I=0,A=null,G=null,F=null,C=null,M=null,L,O,w,W,S=new THREE.RenderableVertex,T=new THREE.RenderableVertex,h,R,J,P,Q,N,Y,V,Z,U,ea,ia,D=new THREE.Color(0),H=new THREE.Color(0),$=new THREE.Color(0),ca=new THREE.Color(0),aa=new THREE.Color(0),oa,va,pa,ta,$a,ab,bb,cb,db,eb,Da=new THREE.Rectangle,wa=new THREE.Rectangle,na=new THREE.Rectangle,
+Sa=!1,ua=new THREE.Color,qa=new THREE.Color,Na=new THREE.Color,Oa=new THREE.Color,ja=new THREE.Vector3,La,Ma,Ta,xa,E,Pa,b=16;La=document.createElement("canvas");La.width=La.height=2;Ma=La.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Ta=Ma.getImageData(0,0,2,2);xa=Ta.data;E=document.createElement("canvas");E.width=E.height=b;Pa=E.getContext("2d");Pa.translate(-b/2,-b/2);Pa.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,d){n=b;t=d;o=n/2;u=t/2;p.width=n;p.height=t;Da.set(-o,-u,o,u);z=1;I=0;M=C=F=G=A=null};this.setClearColor=function(b,d){y=b;B=d};this.setClearColorHex=function(b,d){y.setHex(b);B=d};this.clear=function(){v.setTransform(1,0,0,-1,o,u);if(!wa.isEmpty())wa.inflate(1),wa.minSelf(Da),y.hex==0&&B==0?v.clearRect(wa.getX(),wa.getY(),wa.getWidth(),wa.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
+255)+","+B+")",v.fillRect(wa.getX(),wa.getY(),wa.getWidth(),wa.getHeight())),wa.empty()};this.render=function(b,g){function p(b){var d,c,e,h=b.lights;qa.setRGB(0,0,0);Na.setRGB(0,0,0);Oa.setRGB(0,0,0);b=0;for(d=h.length;b<d;b++)c=h[b],e=c.color,c instanceof THREE.AmbientLight?(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b):c instanceof THREE.DirectionalLight?(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b):c instanceof THREE.PointLight&&(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b)}function t(b,d,c,e){var h,f,g,j,k=b.lights,b=0;for(h=k.length;b<
+h;b++)f=k[b],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(ja.sub(f.position,d).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(d.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)))}function n(b,h,g){c(g.opacity);d(g.blending);var j,k,m,p,aa,t;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)p=g.map.image,aa=p.width>>1,t=p.height>>
+1,g=h.scale.x*o,m=h.scale.y*u,j=g*aa,k=m*t,na.set(b.x-j,b.y-k,b.x+j,b.y+k),Da.instersects(na)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-aa,-t),v.drawImage(p,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*o,k=h.scale.y*u,na.set(b.x-j,b.y-k,b.x+j,b.y+k),Da.instersects(na)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function z(b,h,f,g){c(g.opacity);d(g.blending);
+v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)v.lineWidth=F=b;b=g.linecap;if(C!=b)v.lineCap=C=b;b=g.linejoin;if(M!=b)v.lineJoin=M=b;e(g.color);v.stroke();na.inflate(g.linewidth*2)}}function y(b,e,f,k,m,p,n,o,u){j.data.vertices+=3;j.data.faces++;c(o.opacity);d(o.blending);h=b.positionScreen.x;R=b.positionScreen.y;J=e.positionScreen.x;P=e.positionScreen.y;Q=f.positionScreen.x;
+N=f.positionScreen.y;B(h,R,J,P,Q,N);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(ta=n.uvs[0],K(h,R,J,P,Q,N,o.map.image,ta[k].u,ta[k].v,ta[m].u,ta[m].v,ta[p].u,ta[p].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,ja.copy(n.vertexNormalsWorld[0]),$a=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,ab=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(n.vertexNormalsWorld[1]),bb=(ja.x*b.n11+ja.y*b.n12+
+ja.z*b.n13)*0.5+0.5,cb=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(n.vertexNormalsWorld[2]),db=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,eb=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,K(h,R,J,P,Q,N,o.envMap.image,$a,ab,bb,cb,db,eb)}else o.wireframe?G(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Aa(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(ta=n.uvs[0],K(h,R,J,P,Q,N,o.map.image,ta[k].u,ta[k].v,
+ta[m].u,ta[m].v,ta[p].u,ta[p].v)),d(THREE.SubtractiveBlending)),Sa?!o.wireframe&&o.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(H.r=$.r=ca.r=qa.r,H.g=$.g=ca.g=qa.g,H.b=$.b=ca.b=qa.b,t(u,n.v1.positionWorld,n.vertexNormalsWorld[0],H),t(u,n.v2.positionWorld,n.vertexNormalsWorld[1],$),t(u,n.v3.positionWorld,n.vertexNormalsWorld[2],ca),aa.r=($.r+ca.r)*0.5,aa.g=($.g+ca.g)*0.5,aa.b=($.b+ca.b)*0.5,pa=Qa(H,$,ca,aa),K(h,R,J,P,Q,N,pa,0,0,1,0,0,1)):(ua.r=qa.r,ua.g=qa.g,ua.b=qa.b,t(u,n.centroidWorld,
+n.normalWorld,ua),D.r=Math.max(0,Math.min(o.color.r*ua.r,1)),D.g=Math.max(0,Math.min(o.color.g*ua.g,1)),D.b=Math.max(0,Math.min(o.color.b*ua.b,1)),D.updateHex(),o.wireframe?G(D,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Aa(D)):o.wireframe?G(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Aa(o.color);else if(o instanceof THREE.MeshDepthMaterial)oa=g.near,va=g.far,H.r=H.g=H.b=1-Ea(b.positionScreen.z,oa,va),$.r=$.g=$.b=1-Ea(e.positionScreen.z,oa,va),ca.r=ca.g=ca.b=
+1-Ea(f.positionScreen.z,oa,va),aa.r=($.r+ca.r)*0.5,aa.g=($.g+ca.g)*0.5,aa.b=($.b+ca.b)*0.5,pa=Qa(H,$,ca,aa),K(h,R,J,P,Q,N,pa,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)D.r=Ka(n.normalWorld.x),D.g=Ka(n.normalWorld.y),D.b=Ka(n.normalWorld.z),D.updateHex(),o.wireframe?G(D,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Aa(D)}function A(b,e,f,k,m,p,o,n,u){j.data.vertices+=4;j.data.faces++;c(n.opacity);d(n.blending);if(n.map||n.envMap)y(b,e,k,0,1,3,o,n,u),y(m,f,p,1,2,3,o,n,
+u);else if(h=b.positionScreen.x,R=b.positionScreen.y,J=e.positionScreen.x,P=e.positionScreen.y,Q=f.positionScreen.x,N=f.positionScreen.y,Y=k.positionScreen.x,V=k.positionScreen.y,Z=m.positionScreen.x,U=m.positionScreen.y,ea=p.positionScreen.x,ia=p.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(h,R,J,P,Q,N,Y,V),n.wireframe?G(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&
+o.vertexNormalsWorld.length==4?(H.r=$.r=ca.r=aa.r=qa.r,H.g=$.g=ca.g=aa.g=qa.g,H.b=$.b=ca.b=aa.b=qa.b,t(u,o.v1.positionWorld,o.vertexNormalsWorld[0],H),t(u,o.v2.positionWorld,o.vertexNormalsWorld[1],$),t(u,o.v4.positionWorld,o.vertexNormalsWorld[3],ca),t(u,o.v3.positionWorld,o.vertexNormalsWorld[2],aa),pa=Qa(H,$,ca,aa),B(h,R,J,P,Y,V),K(h,R,J,P,Y,V,pa,0,0,1,0,0,1),B(Z,U,Q,N,ea,ia),K(Z,U,Q,N,ea,ia,pa,1,0,1,1,0,1)):(ua.r=qa.r,ua.g=qa.g,ua.b=qa.b,t(u,o.centroidWorld,o.normalWorld,ua),D.r=Math.max(0,Math.min(n.color.r*
+ua.r,1)),D.g=Math.max(0,Math.min(n.color.g*ua.g,1)),D.b=Math.max(0,Math.min(n.color.b*ua.b,1)),D.updateHex(),I(h,R,J,P,Q,N,Y,V),n.wireframe?G(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(D)):(I(h,R,J,P,Q,N,Y,V),n.wireframe?G(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color));else if(n instanceof THREE.MeshNormalMaterial)D.r=Ka(o.normalWorld.x),D.g=Ka(o.normalWorld.y),D.b=Ka(o.normalWorld.z),D.updateHex(),I(h,R,J,P,Q,N,Y,V),n.wireframe?G(D,n.wireframeLinewidth,
+n.wireframeLinecap,n.wireframeLinejoin):Aa(D);else if(n instanceof THREE.MeshDepthMaterial)oa=g.near,va=g.far,H.r=H.g=H.b=1-Ea(b.positionScreen.z,oa,va),$.r=$.g=$.b=1-Ea(e.positionScreen.z,oa,va),ca.r=ca.g=ca.b=1-Ea(k.positionScreen.z,oa,va),aa.r=aa.g=aa.b=1-Ea(f.positionScreen.z,oa,va),pa=Qa(H,$,ca,aa),B(h,R,J,P,Y,V),K(h,R,J,P,Y,V,pa,0,0,1,0,0,1),B(Z,U,Q,N,ea,ia),K(Z,U,Q,N,ea,ia,pa,1,0,1,1,0,1)}function B(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()}
+function I(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function G(b,d,c,h){if(F!=d)v.lineWidth=F=d;if(C!=c)v.lineCap=C=c;if(M!=h)v.lineJoin=M=h;e(b);v.stroke();na.inflate(d*2)}function Aa(b){f(b);v.fill()}function K(b,d,c,e,h,f,g,j,k,m,p,aa,n){var o,t;o=g.width-1;t=g.height-1;j*=o;k*=t;m*=o;p*=t;aa*=o;n*=t;c-=b;e-=d;h-=b;f-=d;m-=j;p-=k;aa-=j;n-=k;o=m*n-aa*p;o!=0&&(t=1/o,o=(n*c-p*h)*t,p=(n*e-p*f)*t,c=(m*h-aa*c)*t,e=(m*f-aa*e)*t,
+b=b-o*j-c*k,d=d-p*j-e*k,v.save(),v.transform(o,p,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function Qa(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),aa=~~(e.g*255),e=~~(e.b*255);xa[0]=h<0?0:h>255?255:h;xa[1]=f<0?0:f>255?255:f;xa[2]=b<0?0:b>255?255:b;xa[4]=g<0?0:g>255?255:g;xa[5]=j<0?0:j>255?255:j;xa[6]=d<0?0:d>255?255:d;xa[8]=k<0?0:k>255?255:k;xa[9]=m<0?0:m>255?255:m;xa[10]=c<0?0:c>255?
+255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=aa<0?0:aa>255?255:aa;xa[14]=e<0?0:e>255?255:e;Ma.putImageData(Ta,0,0);Pa.drawImage(La,0,0);return E}function Ea(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ba(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ra,hb,X,da,fa,ga,ha,la;this.autoClear?this.clear():v.setTransform(1,0,0,-1,o,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Sa=
+b.lights.length>0)&&p(b);Ra=0;for(hb=k.length;Ra<hb;Ra++){X=k[Ra];na.empty();if(X instanceof THREE.RenderableParticle){L=X;L.x*=o;L.y*=u;da=0;for(fa=X.materials.length;da<fa;)la=X.materials[da++],la.opacity!=0&&n(L,X,la,b)}else if(X instanceof THREE.RenderableLine){if(L=X.v1,O=X.v2,L.positionScreen.x*=o,L.positionScreen.y*=u,O.positionScreen.x*=o,O.positionScreen.y*=u,na.addPoint(L.positionScreen.x,L.positionScreen.y),na.addPoint(O.positionScreen.x,O.positionScreen.y),Da.instersects(na)){da=0;for(fa=
+X.materials.length;da<fa;)la=X.materials[da++],la.opacity!=0&&z(L,O,X,la,b)}}else if(X instanceof THREE.RenderableFace3){if(L=X.v1,O=X.v2,w=X.v3,L.positionScreen.x*=o,L.positionScreen.y*=u,O.positionScreen.x*=o,O.positionScreen.y*=u,w.positionScreen.x*=o,w.positionScreen.y*=u,X.overdraw&&(Ba(L.positionScreen,O.positionScreen),Ba(O.positionScreen,w.positionScreen),Ba(w.positionScreen,L.positionScreen)),na.add3Points(L.positionScreen.x,L.positionScreen.y,O.positionScreen.x,O.positionScreen.y,w.positionScreen.x,
+w.positionScreen.y),Da.instersects(na)){da=0;for(fa=X.meshMaterials.length;da<fa;)if(la=X.meshMaterials[da++],la instanceof THREE.MeshFaceMaterial){ga=0;for(ha=X.faceMaterials.length;ga<ha;)(la=X.faceMaterials[ga++])&&la.opacity!=0&&y(L,O,w,0,1,2,X,la,b)}else la.opacity!=0&&y(L,O,w,0,1,2,X,la,b)}}else if(X instanceof THREE.RenderableFace4&&(L=X.v1,O=X.v2,w=X.v3,W=X.v4,L.positionScreen.x*=o,L.positionScreen.y*=u,O.positionScreen.x*=o,O.positionScreen.y*=u,w.positionScreen.x*=o,w.positionScreen.y*=
+u,W.positionScreen.x*=o,W.positionScreen.y*=u,S.positionScreen.copy(O.positionScreen),T.positionScreen.copy(W.positionScreen),X.overdraw&&(Ba(L.positionScreen,O.positionScreen),Ba(O.positionScreen,W.positionScreen),Ba(W.positionScreen,L.positionScreen),Ba(w.positionScreen,S.positionScreen),Ba(w.positionScreen,T.positionScreen)),na.addPoint(L.positionScreen.x,L.positionScreen.y),na.addPoint(O.positionScreen.x,O.positionScreen.y),na.addPoint(w.positionScreen.x,w.positionScreen.y),na.addPoint(W.positionScreen.x,
+W.positionScreen.y),Da.instersects(na))){da=0;for(fa=X.meshMaterials.length;da<fa;)if(la=X.meshMaterials[da++],la instanceof THREE.MeshFaceMaterial){ga=0;for(ha=X.faceMaterials.length;ga<ha;)(la=X.faceMaterials[ga++])&&la.opacity!=0&&A(L,O,w,W,S,T,X,la,b)}else la.opacity!=0&&A(L,O,w,W,S,T,X,la,b)}wa.addRectangle(na)}v.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,d,c){var e,h,f,g;e=0;for(h=b.lights.length;e<h;e++)f=b.lights[e],f instanceof THREE.DirectionalLight?(g=d.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&&(W.sub(f.position,d.centroidWorld),W.normalize(),g=d.normalWorld.dot(W)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function c(d,c,k,m,n,o){j.data.vertices+=3;j.data.faces++;h=e(R++);h.setAttribute("d",
+"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?G?(C.r=M.r,C.g=M.g,C.b=M.b,b(o,m,C),F.r=Math.max(0,Math.min(n.color.r*C.r,1)),F.g=Math.max(0,Math.min(n.color.g*C.g,1)),F.b=Math.max(0,Math.min(n.color.b*C.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(w=1-n.__2near/(n.__farPlusNear-
+m.z*n.__farMinusNear),F.setRGB(w,w,w)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));n.wireframe?h.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):h.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(h)}function d(d,c,k,m,
+n,o,t){j.data.vertices+=4;j.data.faces++;h=e(R++);h.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?F.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?G?(C.r=M.r,C.g=M.g,C.b=M.b,b(t,n,C),F.r=Math.max(0,Math.min(o.color.r*C.r,1)),F.g=Math.max(0,Math.min(o.color.g*C.g,1)),F.b=Math.max(0,Math.min(o.color.b*
+C.b,1)),F.updateHex()):F.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(w=1-o.__2near/(o.__farPlusNear-n.z*o.__farMinusNear),F.setRGB(w,w,w)):o instanceof THREE.MeshNormalMaterial&&F.setRGB(f(n.normalWorld.x),f(n.normalWorld.y),f(n.normalWorld.z));o.wireframe?h.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):h.setAttribute("style",
+"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+o.opacity);p.appendChild(h)}function e(b){S[b]==null&&(S[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&S[b].setAttribute("shape-rendering","crispEdges"));return S[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,o,u,v,y,B,z,I=new THREE.Rectangle,A=new THREE.Rectangle,G=
+!1,F=new THREE.Color(16777215),C=new THREE.Color(16777215),M=new THREE.Color(0),L=new THREE.Color(0),O=new THREE.Color(0),w,W=new THREE.Vector3,S=[],T=[],h,R,J,P=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,d){n=b;t=d;o=n/2;u=t/2;p.setAttribute("viewBox",-o+" "+-u+" "+n+" "+t);p.setAttribute("width",n);p.setAttribute("height",t);I.set(-o,-u,
+o,u)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,e){var f,n,t,F,C,w,D,H;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);J=R=0;if(G=b.lights.length>0){D=b.lights;M.setRGB(0,0,0);L.setRGB(0,0,0);O.setRGB(0,0,0);f=0;for(n=D.length;f<n;f++)t=D[f],F=t.color,t instanceof THREE.AmbientLight?(M.r+=F.r,M.g+=F.g,M.b+=F.b):t instanceof THREE.DirectionalLight?(L.r+=F.r,L.g+=F.g,L.b+=F.b):t instanceof
+THREE.PointLight&&(O.r+=F.r,O.g+=F.g,O.b+=F.b)}f=0;for(n=k.length;f<n;f++)if(D=k[f],A.empty(),D instanceof THREE.RenderableParticle){v=D;v.x*=o;v.y*=-u;t=0;for(F=D.materials.length;t<F;)t++}else if(D instanceof THREE.RenderableLine){if(v=D.v1,y=D.v2,v.positionScreen.x*=o,v.positionScreen.y*=-u,y.positionScreen.x*=o,y.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),I.instersects(A)){t=0;for(F=D.materials.length;t<F;)if((H=D.materials[t++])&&
+H.opacity!=0){C=v;w=y;var W=J++;T[W]==null&&(T[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),P==0&&T[W].setAttribute("shape-rendering","crispEdges"));h=T[W];h.setAttribute("x1",C.positionScreen.x);h.setAttribute("y1",C.positionScreen.y);h.setAttribute("x2",w.positionScreen.x);h.setAttribute("y2",w.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(h.setAttribute("style","fill: none; stroke: ##"+g(H.color.hex.toString(16))+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+
+H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),p.appendChild(h))}}}else if(D instanceof THREE.RenderableFace3){if(v=D.v1,y=D.v2,B=D.v3,v.positionScreen.x*=o,v.positionScreen.y*=-u,y.positionScreen.x*=o,y.positionScreen.y*=-u,B.positionScreen.x*=o,B.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),I.instersects(A)){t=0;for(F=D.meshMaterials.length;t<
+F;)if(H=D.meshMaterials[t++],H instanceof THREE.MeshFaceMaterial){C=0;for(w=D.faceMaterials.length;C<w;)(H=D.faceMaterials[C++])&&H.opacity!=0&&c(v,y,B,D,H,b)}else H&&H.opacity!=0&&c(v,y,B,D,H,b)}}else if(D instanceof THREE.RenderableFace4&&(v=D.v1,y=D.v2,B=D.v3,z=D.v4,v.positionScreen.x*=o,v.positionScreen.y*=-u,y.positionScreen.x*=o,y.positionScreen.y*=-u,B.positionScreen.x*=o,B.positionScreen.y*=-u,z.positionScreen.x*=o,z.positionScreen.y*=-u,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(y.positionScreen.x,
 y.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),I.instersects(A))){t=0;for(F=D.meshMaterials.length;t<F;)if(H=D.meshMaterials[t++],H instanceof THREE.MeshFaceMaterial){C=0;for(w=D.faceMaterials.length;C<w;)(H=D.faceMaterials[C++])&&H.opacity!=0&&d(v,y,B,z,D,H,b)}else H&&H.opacity!=0&&d(v,y,B,z,D,H,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
@@ -223,79 +223,79 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_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;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,d,c){var e,f,g,j=b.vertices,k=j.length,m=b.colors,o=m.length,p=b.__vertexArray,n=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){_projScreenMatrix.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=j[e].position,_vector3.copy(f),_projScreenMatrix.multiplyVector3(_vector3),t[e]=[_vector3.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)f=j[t[e][1]].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;for(e=0;e<o;e++)g=
-e*3,color=m[t[e][1]],n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b}else{if(u)for(e=0;e<k;e++)f=j[e].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;if(v)for(e=0;e<o;e++)color=m[e],g=e*3,n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b}if(u||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,p,d);if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,n,d)}function d(b,d,c,e,f){e.program||S.initMaterial(e,d,c,f);var g=e.program,
-j=g.uniforms,k=e.uniforms;g!=L&&(h.useProgram(g),L=g);h.uniformMatrix4fv(j.projectionMatrix,!1,_projectionMatrixArray);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,p,o=0,n=0,t=0,u,v,z,y,B=_lights,A=B.directional.colors,F=B.directional.positions,I=B.point.colors,C=B.point.positions,G=B.point.distances,D=0,E=0,c=p=y=0;for(m=d.length;c<m;c++)if(p=d[c],u=p.color,v=p.position,z=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)o+=u.r,n+=u.g,t+=u.b;else if(p instanceof THREE.DirectionalLight)y=D*3,A[y]=u.r*z,A[y+1]=u.g*z,A[y+2]=u.b*z,F[y]=v.x,F[y+1]=v.y,F[y+2]=v.z,D+=1;else if(p instanceof
-THREE.PointLight)p=E*3,I[p]=u.r*z,I[p+1]=u.g*z,I[p+2]=u.b*z,C[p]=v.x,C[p+1]=v.y,C[p+2]=v.z,G[E]=y,E+=1;for(c=D*3;c<A.length;c++)A[c]=0;for(c=E*3;c<I.length;c++)I[c]=0;B.point.length=E;B.directional.length=D;B.ambient[0]=o;B.ambient[1]=n;B.ambient[2]=t;c=_lights;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;
+THREE.WebGLRenderer=function(b){function c(b,d,c){var e,f,g,j=b.vertices,k=j.length,m=b.colors,p=m.length,n=b.__vertexArray,o=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){_projScreenMatrix.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=j[e].position,_vector3.copy(f),_projScreenMatrix.multiplyVector3(_vector3),t[e]=[_vector3.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)f=j[t[e][1]].position,g=e*3,n[g]=f.x,n[g+1]=f.y,n[g+2]=f.z;for(e=0;e<p;e++)g=
+e*3,color=m[t[e][1]],o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b}else{if(u)for(e=0;e<k;e++)f=j[e].position,g=e*3,n[g]=f.x,n[g+1]=f.y,n[g+2]=f.z;if(v)for(e=0;e<p;e++)color=m[e],g=e*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b}if(u||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,n,d);if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,o,d)}function d(b,d,c,e,f){e.program||T.initMaterial(e,d,c,f);var g=e.program,
+j=g.uniforms,k=e.uniforms;g!=J&&(h.useProgram(g),J=g);h.uniformMatrix4fv(j.projectionMatrix,!1,_projectionMatrixArray);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof
+THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,p,n=0,o=0,t=0,u,v,z,y,B=_lights,A=B.directional.colors,F=B.directional.positions,I=B.point.colors,C=B.point.positions,G=B.point.distances,D=0,E=0,c=p=y=0;for(m=d.length;c<m;c++)if(p=d[c],u=p.color,v=p.position,z=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)n+=u.r,o+=u.g,t+=u.b;else if(p instanceof THREE.DirectionalLight)y=D*3,A[y]=u.r*z,A[y+1]=u.g*z,A[y+2]=u.b*z,F[y]=v.x,F[y+1]=v.y,F[y+2]=v.z,D+=1;else if(p instanceof
+THREE.PointLight)p=E*3,I[p]=u.r*z,I[p+1]=u.g*z,I[p+2]=u.b*z,C[p]=v.x,C[p+1]=v.y,C[p+2]=v.z,G[E]=y,E+=1;for(c=D*3;c<A.length;c++)A[c]=0;for(c=E*3;c<I.length;c++)I[c]=0;B.point.length=E;B.directional.length=D;B.ambient[0]=n;B.ambient[1]=o;B.ambient[2]=t;c=_lights;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;
 k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,
 k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=_canvas.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof
-THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var H in k)if(n=g.uniforms[H])if(m=k[H],o=m.type,c=m.value,o=="i")h.uniform1i(n,c);else if(o=="f")h.uniform1f(n,c);else if(o=="fv1")h.uniform1fv(n,c);else if(o=="fv")h.uniform3fv(n,c);else if(o=="v2")h.uniform2f(n,c.x,c.y);else if(o=="v3")h.uniform3f(n,c.x,c.y,c.z);else if(o=="v4")h.uniform4f(n,c.x,c.y,c.z,c.w);else if(o=="c")h.uniform3f(n,
-c.r,c.g,c.b);else if(o=="t"&&(h.uniform1i(n,c),m=m.texture))if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(o=0;o<6;++o)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,h.RGBA,h.UNSIGNED_BYTE,m.image[o])}else{m.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(o=0;o<6;++o)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+
-o,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,m.image[o]);m.__webglInit=!0}M(h.TEXTURE_CUBE_MAP,m,m.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else J(m,c);h.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);h.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&h.uniform3f(j.cameraPosition,
+THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var H in k)if(o=g.uniforms[H])if(m=k[H],n=m.type,c=m.value,n=="i")h.uniform1i(o,c);else if(n=="f")h.uniform1f(o,c);else if(n=="fv1")h.uniform1fv(o,c);else if(n=="fv")h.uniform3fv(o,c);else if(n=="v2")h.uniform2f(o,c.x,c.y);else if(n=="v3")h.uniform3f(o,c.x,c.y,c.z);else if(n=="v4")h.uniform4f(o,c.x,c.y,c.z,c.w);else if(n=="c")h.uniform3f(o,
+c.r,c.g,c.b);else if(n=="t"&&(h.uniform1i(o,c),m=m.texture))if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(n=0;n<6;++n)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,h.RGBA,h.UNSIGNED_BYTE,m.image[n])}else{m.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(n=0;n<6;++n)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+
+n,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,m.image[n]);m.__webglInit=!0}M(h.TEXTURE_CUBE_MAP,m,m.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else L(m,c);h.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);h.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&h.uniform3f(j.cameraPosition,
 b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==null&&h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&h.uniformMatrix4fv(j.viewMatrix,!1,_viewMatrixArray);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=
 -d[1].position.y,b[2]=-d[1].position.z,h.uniform3fv(j.directionalLightDirection,b),h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray),h.uniformMatrix4fv(j.viewMatrix,!1,_viewMatrixArray);e.skinning&&(h.uniformMatrix4fv(j.cameraInverseMatrix,!1,_viewMatrixArray),h.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices));return g}function e(b,c,e,f,g,j){if(f.opacity!=0){var k,b=d(b,c,e,f,j).attributes;if(!f.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,
-3,h.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;e<f.numSupportedMorphTargets&&e<m.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[e]]),
-h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=o[m[e]],e++;else{var m=[],p=-1,n=0,o=j.morphTargetInfluences,t,u=o.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);e<f.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&o[t]>p&&(n=t,p=o[n]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n]);h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[n]=1;p=-1;e++}}f.program.uniforms.morphTargetInfluences!==
+3,h.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;e<f.numSupportedMorphTargets&&e<m.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[e]]),
+h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=n[m[e]],e++;else{var m=[],p=-1,o=0,n=j.morphTargetInfluences,t,u=n.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);e<f.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&n[t]>p&&(o=t,p=n[o]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[o]=1;p=-1;e++}}f.program.uniforms.morphTargetInfluences!==
 null&&h.uniform1fv(f.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=0&&(c=g.__webglCustomAttributes[k],h.bindBuffer(h.ARRAY_BUFFER,c.buffer),h.vertexAttribPointer(b[k],c.size,h.FLOAT,!1,0,0));b.color>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,!1,0,0));b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,
 !1,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.vertexAttribPointer(b.uv2,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));
 f.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,
-4,h.FLOAT,!1,0,0));j instanceof THREE.Mesh?(f.wireframe?(h.lineWidth(f.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount,h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),S.data.vertices+=g.__webglFaceCount,S.data.faces+=g.__webglFaceCount/3,S.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(f.linewidth),
-h.drawArrays(j,0,g.__webglLineCount),S.data.drawCalls++):j instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),S.data.drawCalls++):j instanceof THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),S.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,
-b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,m,o,p,n,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],g=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],o=c[t+7],n=c[t+8],e=(e+j+k)/3,f=(f+m+o)/3,g=(g+p+n)/3,c[t]=e,c[t+1]=f,c[t+2]=g,c[t+3]=e,c[t+4]=f,c[t+5]=g,c[t+6]=e,c[t+7]=f,c[t+8]=g}h.bufferData(h.ARRAY_BUFFER,
-b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(d.attributes.normal);h.vertexAttribPointer(d.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,0,b.count);b.count=0}function g(b){if(P!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),P=b.doubleSided;if(Y!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),Y=b.flipSided}function j(b){Z!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),Z=b)}function k(b,d,c){U!=b&&(b?h.enable(h.POLYGON_OFFSET_FILL):
+4,h.FLOAT,!1,0,0));j instanceof THREE.Mesh?(f.wireframe?(h.lineWidth(f.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount,h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),T.data.vertices+=g.__webglFaceCount,T.data.faces+=g.__webglFaceCount/3,T.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(f.linewidth),
+h.drawArrays(j,0,g.__webglLineCount),T.data.drawCalls++):j instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),T.data.drawCalls++):j instanceof THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),T.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,
+b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,m,n,p,o,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],g=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],n=c[t+7],o=c[t+8],e=(e+j+k)/3,f=(f+m+n)/3,g=(g+p+o)/3,c[t]=e,c[t+1]=f,c[t+2]=g,c[t+3]=e,c[t+4]=f,c[t+5]=g,c[t+6]=e,c[t+7]=f,c[t+8]=g}h.bufferData(h.ARRAY_BUFFER,
+b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(d.attributes.normal);h.vertexAttribPointer(d.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,0,b.count);b.count=0}function g(b){if(N!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),N=b.doubleSided;if(Y!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),Y=b.flipSided}function j(b){Z!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),Z=b)}function k(b,d,c){U!=b&&(b?h.enable(h.POLYGON_OFFSET_FILL):
 h.disable(h.POLYGON_OFFSET_FILL),U=b);if(b&&(_oldPolygonOffsetFactor!=d||_oldPolygonOffsetUnits!=c))h.polygonOffset(d,c),_oldPolygonOffsetFactor=d,_oldPolygonOffsetUnits=c}function m(b){_frustum[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);_frustum[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);_frustum[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);_frustum[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);_frustum[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-
-b.n34);_frustum[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=_frustum[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function o(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=_frustum[e].x*d.n14+_frustum[e].y*d.n24+_frustum[e].z*d.n34+_frustum[e].w,b<=c)return!1;return!0}function p(b,d){b.list[b.count]=d;b.count+=1}function t(b){var d,c,e=b.object,f=b.opaque,g=b.transparent;
-g.count=0;b=f.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?p(g,c):p(f,c)}function n(b){var d,c,e,f,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=g.materials.length;b<e;b++)if(d=g.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(f=h.materials[d])&&(f.transparent?p(k,f):p(j,f))}else(f=d)&&(f.transparent?p(k,f):p(j,f))}function u(b,d){return d.z-b.z}function v(b){h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(0.1,
-1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var d,c=b.lights.length,e,f=b.lights,g=[],j,k,m,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){g[0]=-e.position.x;g[1]=-e.position.y;g[2]=-e.position.z;for(p=0;p<n;p++)e=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,
-k=e.materials[0],k.program||S.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,o=k.attributes,L!==k&&(h.useProgram(k),L=k,h.uniformMatrix4fv(m.projectionMatrix,!1,_projectionMatrixArray),h.uniformMatrix4fv(m.viewMatrix,!1,_viewMatrixArray),h.uniform3fv(m.directionalLightDirection,g)),e.matrixWorld.flattenToArray(e._objectMatrixArray),h.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,j.__webglVertexBuffer),h.vertexAttribPointer(o.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
-j.__webglNormalBuffer),h.vertexAttribPointer(o.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);V=-1;L=D.program;h.useProgram(D.program);h.uniformMatrix4fv(D.projectionLocation,
-!1,_projectionMatrixArray);h.uniform1f(D.darknessLocation,D.darkness);h.bindBuffer(h.ARRAY_BUFFER,D.vertexBuffer);h.vertexAttribPointer(D.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(D.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,D.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(T)}function y(b,d){var c,e,f;c=_sprite.attributes;var g=
-_sprite.uniforms,j=_viewportHeight/_viewportWidth,k,m=[],o=_viewportWidth*0.5,p=_viewportHeight*0.5,n=!0;h.useProgram(_sprite.program);L=_sprite.program;V=-1;ca||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),ca=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
+b.n34);_frustum[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=_frustum[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function p(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=_frustum[e].x*d.n14+_frustum[e].y*d.n24+_frustum[e].z*d.n34+_frustum[e].w,b<=c)return!1;return!0}function n(b,d){b.list[b.count]=d;b.count+=1}function t(b){var d,c,e=b.object,f=b.opaque,g=b.transparent;
+g.count=0;b=f.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?n(g,c):n(f,c)}function o(b){var d,c,e,f,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=g.materials.length;b<e;b++)if(d=g.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(f=h.materials[d])&&(f.transparent?n(k,f):n(j,f))}else(f=d)&&(f.transparent?n(k,f):n(j,f))}function u(b,d){return d.z-b.z}function v(b){h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(0.1,
+1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var d,c=b.lights.length,e,f=b.lights,g=[],j,k,m,n,p,o=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){g[0]=-e.position.x;g[1]=-e.position.y;g[2]=-e.position.z;for(p=0;p<o;p++)e=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,
+k=e.materials[0],k.program||T.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,n=k.attributes,J!==k&&(h.useProgram(k),J=k,h.uniformMatrix4fv(m.projectionMatrix,!1,_projectionMatrixArray),h.uniformMatrix4fv(m.viewMatrix,!1,_viewMatrixArray),h.uniform3fv(m.directionalLightDirection,g)),e.matrixWorld.flattenToArray(e._objectMatrixArray),h.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,j.__webglVertexBuffer),h.vertexAttribPointer(n.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
+j.__webglNormalBuffer),h.vertexAttribPointer(n.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);V=-1;J=D.program;h.useProgram(D.program);h.uniformMatrix4fv(D.projectionLocation,
+!1,_projectionMatrixArray);h.uniform1f(D.darknessLocation,D.darkness);h.bindBuffer(h.ARRAY_BUFFER,D.vertexBuffer);h.vertexAttribPointer(D.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(D.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,D.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(Q)}function y(b,d){var c,e,f;c=_sprite.attributes;var g=
+_sprite.uniforms,j=_viewportHeight/_viewportWidth,k,m=[],n=_viewportWidth*0.5,p=_viewportHeight*0.5,o=!0;h.useProgram(_sprite.program);J=_sprite.program;V=-1;ca||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),ca=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
 _sprite.elementBuffer);h.uniformMatrix4fv(g.projectionMatrix,!1,_projectionMatrixArray);h.activeTexture(h.TEXTURE0);h.uniform1i(g.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&
-(f.useScreenCoordinates?(h.uniform1i(g.useScreenCoordinates,1),h.uniform3f(g.screenPosition,(f.position.x-o)/o,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(h.uniform1i(g.useScreenCoordinates,0),h.uniform1i(g.affectedByDistance,f.affectedByDistance?1:0),h.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?_viewportHeight:1),m[0]=k*j*f.scale.x,m[1]=k*f.scale.y,h.uniform2f(g.uvScale,f.uvScale.x,f.uvScale.y),h.uniform2f(g.uvOffset,f.uvOffset.x,
-f.uvOffset.y),h.uniform2f(g.alignment,f.alignment.x,f.alignment.y),h.uniform1f(g.opacity,f.opacity),h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!n?(h.enable(h.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(h.disable(h.DEPTH_TEST),n=!1),C(f.blending),J(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(T)}function B(b,d){var c,e,f=b.__webglLensFlares.length,g,j,k,m=new THREE.Vector3,o=_viewportHeight/_viewportWidth,
-p=_viewportWidth*0.5,n=_viewportHeight*0.5,t=16/_viewportHeight,u=[t*o,t],v=[1,1,0],z=[1,1],y=H.uniforms;c=H.attributes;h.useProgram(H.program);L=H.program;V=-1;$||(h.enableVertexAttribArray(H.attributes.vertex),h.enableVertexAttribArray(H.attributes.uv),$=!0);h.uniform1i(y.occlusionMap,0);h.uniform1i(y.map,1);h.bindBuffer(h.ARRAY_BUFFER,H.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,H.elementBuffer);
-h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,H.occlusionTexture);h.activeTexture(h.TEXTURE1);for(e=0;e<f;e++)if(c=b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,z[0]=v[0]*p+p,z[1]=v[1]*n+n,H.hasVertexTexture||z[0]>0&&z[0]<_viewportWidth&&z[1]>0&&z[1]<_viewportHeight){h.bindTexture(h.TEXTURE_2D,H.tempTexture);
+(f.useScreenCoordinates?(h.uniform1i(g.useScreenCoordinates,1),h.uniform3f(g.screenPosition,(f.position.x-n)/n,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(h.uniform1i(g.useScreenCoordinates,0),h.uniform1i(g.affectedByDistance,f.affectedByDistance?1:0),h.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?_viewportHeight:1),m[0]=k*j*f.scale.x,m[1]=k*f.scale.y,h.uniform2f(g.uvScale,f.uvScale.x,f.uvScale.y),h.uniform2f(g.uvOffset,f.uvOffset.x,
+f.uvOffset.y),h.uniform2f(g.alignment,f.alignment.x,f.alignment.y),h.uniform1f(g.opacity,f.opacity),h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!o?(h.enable(h.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(h.disable(h.DEPTH_TEST),o=!1),C(f.blending),L(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(Q)}function B(b,d){var c,e,f=b.__webglLensFlares.length,g,j,k,m=new THREE.Vector3,n=_viewportHeight/_viewportWidth,
+p=_viewportWidth*0.5,o=_viewportHeight*0.5,t=16/_viewportHeight,u=[t*n,t],v=[1,1,0],z=[1,1],y=H.uniforms;c=H.attributes;h.useProgram(H.program);J=H.program;V=-1;$||(h.enableVertexAttribArray(H.attributes.vertex),h.enableVertexAttribArray(H.attributes.uv),$=!0);h.uniform1i(y.occlusionMap,0);h.uniform1i(y.map,1);h.bindBuffer(h.ARRAY_BUFFER,H.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,H.elementBuffer);
+h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,H.occlusionTexture);h.activeTexture(h.TEXTURE1);for(e=0;e<f;e++)if(c=b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,z[0]=v[0]*p+p,z[1]=v[1]*o+o,H.hasVertexTexture||z[0]>0&&z[0]<_viewportWidth&&z[1]>0&&z[1]<_viewportHeight){h.bindTexture(h.TEXTURE_2D,H.tempTexture);
 h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,z[0]-8,z[1]-8,16,16,0);h.uniform1i(y.renderType,0);h.uniform2fv(y.scale,u);h.uniform3fv(y.screenPosition,v);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,H.occlusionTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,z[0]-8,z[1]-8,16,16,0);h.uniform1i(y.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,H.tempTexture);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);c.positionScreen.x=
-v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();h.uniform1i(y.renderType,2);h.enable(h.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(k=c.lensFlares[g],k.opacity>0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/_viewportHeight,u[0]=t*o,u[1]=t,h.uniform3fv(y.screenPosition,v),h.uniform2fv(y.scale,u),h.uniform1f(y.rotation,k.rotation),h.uniform1f(y.opacity,k.opacity),C(k.blending),J(k.texture,1),h.drawElements(h.TRIANGLES,
-6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(T)}function z(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function I(b){var d,e,f,g;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];a:{for(var j=g=void 0,k=void 0,m=void 0,o=void 0,o=f.__materials,j=0,k=o.length;j<k;j++)if(m=o[j],m.attributes)for(g in m.attributes)if(m.attributes[g].needsUpdate){g=
-!0;break a}g=!1}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||g)if(g=f,j=b,k=h.DYNAMIC_DRAW,g.__inittedArrays){var p=o=m=void 0,n=void 0,t=p=void 0,u=void 0,v=void 0,z=void 0,y=void 0,B=void 0,A=void 0,F=void 0,I=void 0,C=void 0,D=void 0,G=void 0,H=void 0,E=n=z=n=v=u=void 0,w=void 0,x=w=E=u=void 0,J=void 0,O=x=w=E=p=p=t=z=n=x=w=E=J=x=w=E=J=x=w=E=void 0,L=0,M=0,W=0,V=0,P=0,S=0,N=0,T=0,Y=0,K=0,Q=0,w=E=0,R=g.__vertexArray,
+v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();h.uniform1i(y.renderType,2);h.enable(h.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(k=c.lensFlares[g],k.opacity>0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/_viewportHeight,u[0]=t*n,u[1]=t,h.uniform3fv(y.screenPosition,v),h.uniform2fv(y.scale,u),h.uniform1f(y.rotation,k.rotation),h.uniform1f(y.opacity,k.opacity),C(k.blending),L(k.texture,1),h.drawElements(h.TRIANGLES,
+6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(Q)}function z(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function I(b){var d,e,f,g;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];a:{for(var j=g=void 0,k=void 0,m=void 0,n=void 0,n=f.__materials,j=0,k=n.length;j<k;j++)if(m=n[j],m.attributes)for(g in m.attributes)if(m.attributes[g].needsUpdate){g=
+!0;break a}g=!1}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||g)if(g=f,j=b,k=h.DYNAMIC_DRAW,g.__inittedArrays){var p=n=m=void 0,o=void 0,t=p=void 0,u=void 0,v=void 0,z=void 0,y=void 0,B=void 0,A=void 0,F=void 0,I=void 0,C=void 0,D=void 0,G=void 0,H=void 0,E=o=z=o=v=u=void 0,w=void 0,x=w=E=u=void 0,L=void 0,O=x=w=E=p=p=t=z=o=x=w=E=L=x=w=E=L=x=w=E=void 0,J=0,M=0,W=0,V=0,P=0,R=0,N=0,T=0,Q=0,K=0,Y=0,w=E=0,S=g.__vertexArray,
 $=g.__uvArray,ca=g.__uv2Array,Z=g.__normalArray,U=g.__tangentArray,X=g.__colorArray,da=g.__skinVertexAArray,fa=g.__skinVertexBArray,ga=g.__skinIndexArray,ha=g.__skinWeightArray,ia=g.__morphTargetsArrays,ea=g.__webglCustomAttributes,x=void 0,ra=g.__faceArray,sa=g.__lineArray,fb=g.__needsSmoothNormals,B=g.__vertexColorType,y=g.__uvType,A=g.__normalType,ka=j.geometry,Ua=ka.__dirtyVertices,Va=ka.__dirtyElements,Ja=ka.__dirtyUvs,Wa=ka.__dirtyNormals,Xa=ka.__dirtyTangents,Ya=ka.__dirtyColors,Za=ka.__dirtyMorphTargets,
-Fa=ka.vertices,gb=g.faces,kb=ka.faces,ib=ka.faceVertexUvs[0],jb=ka.faceVertexUvs[1],Ga=ka.skinVerticesA,Ha=ka.skinVerticesB,Ia=ka.skinIndices,za=ka.skinWeights,Ca=j instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,ya=ka.morphTargets;if(ea)for(O in ea)ea[O].offset=0,ea[O].offsetSrc=0;m=0;for(o=gb.length;m<o;m++)if(p=gb[m],n=kb[p],ib&&(F=ib[p]),jb&&(I=jb[p]),p=n.vertexNormals,t=n.normal,u=n.vertexColors,v=n.color,z=n.vertexTangents,n instanceof THREE.Face3){if(Ua)C=Fa[n.a].position,D=Fa[n.b].position,
-G=Fa[n.c].position,R[M]=C.x,R[M+1]=C.y,R[M+2]=C.z,R[M+3]=D.x,R[M+4]=D.y,R[M+5]=D.z,R[M+6]=G.x,R[M+7]=G.y,R[M+8]=G.z,M+=9;if(ea)for(O in ea)if(x=ea[O],x.__original.needsUpdate)E=x.offset,w=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[n.a],x.array[E+1]=x.value[n.b],x.array[E+2]=x.value[n.c]):x.boundTo==="faces"?(x.array[E+0]=x.value[w],x.array[E+1]=x.value[w],x.array[E+2]=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[w+0],x.array[E+
-1]=x.value[w+1],x.array[E+2]=x.value[w+2],x.offsetSrc+=3),x.offset+=3):(x.boundTo===void 0||x.boundTo==="vertices"?(C=x.value[n.a],D=x.value[n.b],G=x.value[n.c]):x.boundTo==="faces"?(C=x.value[w],D=x.value[w],G=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(C=x.value[w+0],D=x.value[w+1],G=x.value[w+2],x.offsetSrc+=3),x.size===2?(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=D.x,x.array[E+3]=D.y,x.array[E+4]=G.x,x.array[E+5]=G.y,x.offset+=6):x.size===3?(x.type==="c"?(x.array[E+0]=C.r,x.array[E+
+Fa=ka.vertices,gb=g.faces,kb=ka.faces,ib=ka.faceVertexUvs[0],jb=ka.faceVertexUvs[1],Ga=ka.skinVerticesA,Ha=ka.skinVerticesB,Ia=ka.skinIndices,za=ka.skinWeights,Ca=j instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,ya=ka.morphTargets;if(ea)for(O in ea)ea[O].offset=0,ea[O].offsetSrc=0;m=0;for(n=gb.length;m<n;m++)if(p=gb[m],o=kb[p],ib&&(F=ib[p]),jb&&(I=jb[p]),p=o.vertexNormals,t=o.normal,u=o.vertexColors,v=o.color,z=o.vertexTangents,o instanceof THREE.Face3){if(Ua)C=Fa[o.a].position,D=Fa[o.b].position,
+G=Fa[o.c].position,S[M]=C.x,S[M+1]=C.y,S[M+2]=C.z,S[M+3]=D.x,S[M+4]=D.y,S[M+5]=D.z,S[M+6]=G.x,S[M+7]=G.y,S[M+8]=G.z,M+=9;if(ea)for(O in ea)if(x=ea[O],x.__original.needsUpdate)E=x.offset,w=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[o.a],x.array[E+1]=x.value[o.b],x.array[E+2]=x.value[o.c]):x.boundTo==="faces"?(x.array[E+0]=x.value[w],x.array[E+1]=x.value[w],x.array[E+2]=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[w+0],x.array[E+
+1]=x.value[w+1],x.array[E+2]=x.value[w+2],x.offsetSrc+=3),x.offset+=3):(x.boundTo===void 0||x.boundTo==="vertices"?(C=x.value[o.a],D=x.value[o.b],G=x.value[o.c]):x.boundTo==="faces"?(C=x.value[w],D=x.value[w],G=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(C=x.value[w+0],D=x.value[w+1],G=x.value[w+2],x.offsetSrc+=3),x.size===2?(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=D.x,x.array[E+3]=D.y,x.array[E+4]=G.x,x.array[E+5]=G.y,x.offset+=6):x.size===3?(x.type==="c"?(x.array[E+0]=C.r,x.array[E+
 1]=C.g,x.array[E+2]=C.b,x.array[E+3]=D.r,x.array[E+4]=D.g,x.array[E+5]=D.b,x.array[E+6]=G.r,x.array[E+7]=G.g,x.array[E+8]=G.b):(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=C.z,x.array[E+3]=D.x,x.array[E+4]=D.y,x.array[E+5]=D.z,x.array[E+6]=G.x,x.array[E+7]=G.y,x.array[E+8]=G.z),x.offset+=9):(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=C.z,x.array[E+3]=C.w,x.array[E+4]=D.x,x.array[E+5]=D.y,x.array[E+6]=D.z,x.array[E+7]=D.w,x.array[E+8]=G.x,x.array[E+9]=G.y,x.array[E+10]=G.z,x.array[E+11]=G.w,
-x.offset+=12));if(Za){E=0;for(w=ya.length;E<w;E++)C=ya[E].vertices[n.a].position,D=ya[E].vertices[n.b].position,G=ya[E].vertices[n.c].position,x=ia[E],x[Q+0]=C.x,x[Q+1]=C.y,x[Q+2]=C.z,x[Q+3]=D.x,x[Q+4]=D.y,x[Q+5]=D.z,x[Q+6]=G.x,x[Q+7]=G.y,x[Q+8]=G.z;Q+=9}if(za.length)E=za[n.a],w=za[n.b],x=za[n.c],ha[K]=E.x,ha[K+1]=E.y,ha[K+2]=E.z,ha[K+3]=E.w,ha[K+4]=w.x,ha[K+5]=w.y,ha[K+6]=w.z,ha[K+7]=w.w,ha[K+8]=x.x,ha[K+9]=x.y,ha[K+10]=x.z,ha[K+11]=x.w,E=Ia[n.a],w=Ia[n.b],x=Ia[n.c],ga[K]=E.x,ga[K+1]=E.y,ga[K+2]=
-E.z,ga[K+3]=E.w,ga[K+4]=w.x,ga[K+5]=w.y,ga[K+6]=w.z,ga[K+7]=w.w,ga[K+8]=x.x,ga[K+9]=x.y,ga[K+10]=x.z,ga[K+11]=x.w,E=Ga[n.a],w=Ga[n.b],x=Ga[n.c],da[K]=E.x,da[K+1]=E.y,da[K+2]=E.z,da[K+3]=1,da[K+4]=w.x,da[K+5]=w.y,da[K+6]=w.z,da[K+7]=1,da[K+8]=x.x,da[K+9]=x.y,da[K+10]=x.z,da[K+11]=1,E=Ha[n.a],w=Ha[n.b],x=Ha[n.c],fa[K]=E.x,fa[K+1]=E.y,fa[K+2]=E.z,fa[K+3]=1,fa[K+4]=w.x,fa[K+5]=w.y,fa[K+6]=w.z,fa[K+7]=1,fa[K+8]=x.x,fa[K+9]=x.y,fa[K+10]=x.z,fa[K+11]=1,K+=12;if(Ya&&B)u.length==3&&B==THREE.VertexColors?(n=
-u[0],E=u[1],w=u[2]):w=E=n=v,X[Y]=n.r,X[Y+1]=n.g,X[Y+2]=n.b,X[Y+3]=E.r,X[Y+4]=E.g,X[Y+5]=E.b,X[Y+6]=w.r,X[Y+7]=w.g,X[Y+8]=w.b,Y+=9;if(Xa&&ka.hasTangents)u=z[0],v=z[1],n=z[2],U[N]=u.x,U[N+1]=u.y,U[N+2]=u.z,U[N+3]=u.w,U[N+4]=v.x,U[N+5]=v.y,U[N+6]=v.z,U[N+7]=v.w,U[N+8]=n.x,U[N+9]=n.y,U[N+10]=n.z,U[N+11]=n.w,N+=12;if(Wa&&A)if(p.length==3&&fb)for(z=0;z<3;z++)t=p[z],Z[S]=t.x,Z[S+1]=t.y,Z[S+2]=t.z,S+=3;else for(z=0;z<3;z++)Z[S]=t.x,Z[S+1]=t.y,Z[S+2]=t.z,S+=3;if(Ja&&F!==void 0&&y)for(z=0;z<3;z++)p=F[z],$[W]=
-p.u,$[W+1]=p.v,W+=2;if(Ja&&I!==void 0&&y)for(z=0;z<3;z++)p=I[z],ca[V]=p.u,ca[V+1]=p.v,V+=2;Va&&(ra[P]=L,ra[P+1]=L+1,ra[P+2]=L+2,P+=3,sa[T]=L,sa[T+1]=L+1,sa[T+2]=L,sa[T+3]=L+2,sa[T+4]=L+1,sa[T+5]=L+2,T+=6,L+=3)}else if(n instanceof THREE.Face4){if(Ua)C=Fa[n.a].position,D=Fa[n.b].position,G=Fa[n.c].position,H=Fa[n.d].position,R[M]=C.x,R[M+1]=C.y,R[M+2]=C.z,R[M+3]=D.x,R[M+4]=D.y,R[M+5]=D.z,R[M+6]=G.x,R[M+7]=G.y,R[M+8]=G.z,R[M+9]=H.x,R[M+10]=H.y,R[M+11]=H.z,M+=12;if(ea)for(O in ea)if(x=ea[O],x.__original.needsUpdate)E=
-x.offset,w=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[n.a],x.array[E+1]=x.value[n.b],x.array[E+2]=x.value[n.c],x.array[E+3]=x.value[n.d]):x.boundTo==="faces"?(x.array[E+0]=x.value[w],x.array[E+1]=x.value[w],x.array[E+2]=x.value[w],x.array[E+3]=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[w+0],x.array[E+1]=x.value[w+1],x.array[E+2]=x.value[w+2],x.array[E+3]=x.value[w+3],x.offsetSrc+=4),x.offset+=4):(x.boundTo===void 0||x.boundTo===
-"vertices"?(C=x.value[n.a],D=x.value[n.b],G=x.value[n.c],H=x.value[n.d]):x.boundTo==="faces"?(C=x.value[w],D=x.value[w],G=x.value[w],H=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(C=x.value[w+0],D=x.value[w+1],G=x.value[w+2],H=x.value[w+3],x.offsetSrc+=4),x.size===2?(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=D.x,x.array[E+3]=D.y,x.array[E+4]=G.x,x.array[E+5]=G.y,x.array[E+6]=H.x,x.array[E+7]=H.y,x.offset+=8):x.size===3?(x.type==="c"?(x.array[E+0]=C.r,x.array[E+1]=C.g,x.array[E+2]=C.b,
+x.offset+=12));if(Za){E=0;for(w=ya.length;E<w;E++)C=ya[E].vertices[o.a].position,D=ya[E].vertices[o.b].position,G=ya[E].vertices[o.c].position,x=ia[E],x[Y+0]=C.x,x[Y+1]=C.y,x[Y+2]=C.z,x[Y+3]=D.x,x[Y+4]=D.y,x[Y+5]=D.z,x[Y+6]=G.x,x[Y+7]=G.y,x[Y+8]=G.z;Y+=9}if(za.length)E=za[o.a],w=za[o.b],x=za[o.c],ha[K]=E.x,ha[K+1]=E.y,ha[K+2]=E.z,ha[K+3]=E.w,ha[K+4]=w.x,ha[K+5]=w.y,ha[K+6]=w.z,ha[K+7]=w.w,ha[K+8]=x.x,ha[K+9]=x.y,ha[K+10]=x.z,ha[K+11]=x.w,E=Ia[o.a],w=Ia[o.b],x=Ia[o.c],ga[K]=E.x,ga[K+1]=E.y,ga[K+2]=
+E.z,ga[K+3]=E.w,ga[K+4]=w.x,ga[K+5]=w.y,ga[K+6]=w.z,ga[K+7]=w.w,ga[K+8]=x.x,ga[K+9]=x.y,ga[K+10]=x.z,ga[K+11]=x.w,E=Ga[o.a],w=Ga[o.b],x=Ga[o.c],da[K]=E.x,da[K+1]=E.y,da[K+2]=E.z,da[K+3]=1,da[K+4]=w.x,da[K+5]=w.y,da[K+6]=w.z,da[K+7]=1,da[K+8]=x.x,da[K+9]=x.y,da[K+10]=x.z,da[K+11]=1,E=Ha[o.a],w=Ha[o.b],x=Ha[o.c],fa[K]=E.x,fa[K+1]=E.y,fa[K+2]=E.z,fa[K+3]=1,fa[K+4]=w.x,fa[K+5]=w.y,fa[K+6]=w.z,fa[K+7]=1,fa[K+8]=x.x,fa[K+9]=x.y,fa[K+10]=x.z,fa[K+11]=1,K+=12;if(Ya&&B)u.length==3&&B==THREE.VertexColors?(o=
+u[0],E=u[1],w=u[2]):w=E=o=v,X[Q]=o.r,X[Q+1]=o.g,X[Q+2]=o.b,X[Q+3]=E.r,X[Q+4]=E.g,X[Q+5]=E.b,X[Q+6]=w.r,X[Q+7]=w.g,X[Q+8]=w.b,Q+=9;if(Xa&&ka.hasTangents)u=z[0],v=z[1],o=z[2],U[N]=u.x,U[N+1]=u.y,U[N+2]=u.z,U[N+3]=u.w,U[N+4]=v.x,U[N+5]=v.y,U[N+6]=v.z,U[N+7]=v.w,U[N+8]=o.x,U[N+9]=o.y,U[N+10]=o.z,U[N+11]=o.w,N+=12;if(Wa&&A)if(p.length==3&&fb)for(z=0;z<3;z++)t=p[z],Z[R]=t.x,Z[R+1]=t.y,Z[R+2]=t.z,R+=3;else for(z=0;z<3;z++)Z[R]=t.x,Z[R+1]=t.y,Z[R+2]=t.z,R+=3;if(Ja&&F!==void 0&&y)for(z=0;z<3;z++)p=F[z],$[W]=
+p.u,$[W+1]=p.v,W+=2;if(Ja&&I!==void 0&&y)for(z=0;z<3;z++)p=I[z],ca[V]=p.u,ca[V+1]=p.v,V+=2;Va&&(ra[P]=J,ra[P+1]=J+1,ra[P+2]=J+2,P+=3,sa[T]=J,sa[T+1]=J+1,sa[T+2]=J,sa[T+3]=J+2,sa[T+4]=J+1,sa[T+5]=J+2,T+=6,J+=3)}else if(o instanceof THREE.Face4){if(Ua)C=Fa[o.a].position,D=Fa[o.b].position,G=Fa[o.c].position,H=Fa[o.d].position,S[M]=C.x,S[M+1]=C.y,S[M+2]=C.z,S[M+3]=D.x,S[M+4]=D.y,S[M+5]=D.z,S[M+6]=G.x,S[M+7]=G.y,S[M+8]=G.z,S[M+9]=H.x,S[M+10]=H.y,S[M+11]=H.z,M+=12;if(ea)for(O in ea)if(x=ea[O],x.__original.needsUpdate)E=
+x.offset,w=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[o.a],x.array[E+1]=x.value[o.b],x.array[E+2]=x.value[o.c],x.array[E+3]=x.value[o.d]):x.boundTo==="faces"?(x.array[E+0]=x.value[w],x.array[E+1]=x.value[w],x.array[E+2]=x.value[w],x.array[E+3]=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[w+0],x.array[E+1]=x.value[w+1],x.array[E+2]=x.value[w+2],x.array[E+3]=x.value[w+3],x.offsetSrc+=4),x.offset+=4):(x.boundTo===void 0||x.boundTo===
+"vertices"?(C=x.value[o.a],D=x.value[o.b],G=x.value[o.c],H=x.value[o.d]):x.boundTo==="faces"?(C=x.value[w],D=x.value[w],G=x.value[w],H=x.value[w],x.offsetSrc++):x.boundTo==="faceVertices"&&(C=x.value[w+0],D=x.value[w+1],G=x.value[w+2],H=x.value[w+3],x.offsetSrc+=4),x.size===2?(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=D.x,x.array[E+3]=D.y,x.array[E+4]=G.x,x.array[E+5]=G.y,x.array[E+6]=H.x,x.array[E+7]=H.y,x.offset+=8):x.size===3?(x.type==="c"?(x.array[E+0]=C.r,x.array[E+1]=C.g,x.array[E+2]=C.b,
 x.array[E+3]=D.r,x.array[E+4]=D.g,x.array[E+5]=D.b,x.array[E+6]=G.r,x.array[E+7]=G.g,x.array[E+8]=G.b,x.array[E+9]=H.r,x.array[E+10]=H.g,x.array[E+11]=H.b):(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=C.z,x.array[E+3]=D.x,x.array[E+4]=D.y,x.array[E+5]=D.z,x.array[E+6]=G.x,x.array[E+7]=G.y,x.array[E+8]=G.z,x.array[E+9]=H.x,x.array[E+10]=H.y,x.array[E+11]=H.z),x.offset+=12):(x.array[E+0]=C.x,x.array[E+1]=C.y,x.array[E+2]=C.z,x.array[E+3]=C.w,x.array[E+4]=D.x,x.array[E+5]=D.y,x.array[E+6]=D.z,x.array[E+
-7]=D.w,x.array[E+8]=G.x,x.array[E+9]=G.y,x.array[E+10]=G.z,x.array[E+11]=G.w,x.array[E+12]=H.x,x.array[E+13]=H.y,x.array[E+14]=H.z,x.array[E+15]=H.w,x.offset+=16));if(Za){E=0;for(w=ya.length;E<w;E++)C=ya[E].vertices[n.a].position,D=ya[E].vertices[n.b].position,G=ya[E].vertices[n.c].position,H=ya[E].vertices[n.d].position,x=ia[E],x[Q+0]=C.x,x[Q+1]=C.y,x[Q+2]=C.z,x[Q+3]=D.x,x[Q+4]=D.y,x[Q+5]=D.z,x[Q+6]=G.x,x[Q+7]=G.y,x[Q+8]=G.z,x[Q+9]=H.x,x[Q+10]=H.y,x[Q+11]=H.z;Q+=12}if(za.length)E=za[n.a],w=za[n.b],
-x=za[n.c],J=za[n.d],ha[K]=E.x,ha[K+1]=E.y,ha[K+2]=E.z,ha[K+3]=E.w,ha[K+4]=w.x,ha[K+5]=w.y,ha[K+6]=w.z,ha[K+7]=w.w,ha[K+8]=x.x,ha[K+9]=x.y,ha[K+10]=x.z,ha[K+11]=x.w,ha[K+12]=J.x,ha[K+13]=J.y,ha[K+14]=J.z,ha[K+15]=J.w,E=Ia[n.a],w=Ia[n.b],x=Ia[n.c],J=Ia[n.d],ga[K]=E.x,ga[K+1]=E.y,ga[K+2]=E.z,ga[K+3]=E.w,ga[K+4]=w.x,ga[K+5]=w.y,ga[K+6]=w.z,ga[K+7]=w.w,ga[K+8]=x.x,ga[K+9]=x.y,ga[K+10]=x.z,ga[K+11]=x.w,ga[K+12]=J.x,ga[K+13]=J.y,ga[K+14]=J.z,ga[K+15]=J.w,E=Ga[n.a],w=Ga[n.b],x=Ga[n.c],J=Ga[n.d],da[K]=E.x,
-da[K+1]=E.y,da[K+2]=E.z,da[K+3]=1,da[K+4]=w.x,da[K+5]=w.y,da[K+6]=w.z,da[K+7]=1,da[K+8]=x.x,da[K+9]=x.y,da[K+10]=x.z,da[K+11]=1,da[K+12]=J.x,da[K+13]=J.y,da[K+14]=J.z,da[K+15]=1,E=Ha[n.a],w=Ha[n.b],x=Ha[n.c],n=Ha[n.d],fa[K]=E.x,fa[K+1]=E.y,fa[K+2]=E.z,fa[K+3]=1,fa[K+4]=w.x,fa[K+5]=w.y,fa[K+6]=w.z,fa[K+7]=1,fa[K+8]=x.x,fa[K+9]=x.y,fa[K+10]=x.z,fa[K+11]=1,fa[K+12]=n.x,fa[K+13]=n.y,fa[K+14]=n.z,fa[K+15]=1,K+=16;if(Ya&&B)u.length==4&&B==THREE.VertexColors?(n=u[0],E=u[1],w=u[2],u=u[3]):u=w=E=n=v,X[Y]=
-n.r,X[Y+1]=n.g,X[Y+2]=n.b,X[Y+3]=E.r,X[Y+4]=E.g,X[Y+5]=E.b,X[Y+6]=w.r,X[Y+7]=w.g,X[Y+8]=w.b,X[Y+9]=u.r,X[Y+10]=u.g,X[Y+11]=u.b,Y+=12;if(Xa&&ka.hasTangents)u=z[0],v=z[1],n=z[2],z=z[3],U[N]=u.x,U[N+1]=u.y,U[N+2]=u.z,U[N+3]=u.w,U[N+4]=v.x,U[N+5]=v.y,U[N+6]=v.z,U[N+7]=v.w,U[N+8]=n.x,U[N+9]=n.y,U[N+10]=n.z,U[N+11]=n.w,U[N+12]=z.x,U[N+13]=z.y,U[N+14]=z.z,U[N+15]=z.w,N+=16;if(Wa&&A)if(p.length==4&&fb)for(z=0;z<4;z++)t=p[z],Z[S]=t.x,Z[S+1]=t.y,Z[S+2]=t.z,S+=3;else for(z=0;z<4;z++)Z[S]=t.x,Z[S+1]=t.y,Z[S+
-2]=t.z,S+=3;if(Ja&&F!==void 0&&y)for(z=0;z<4;z++)p=F[z],$[W]=p.u,$[W+1]=p.v,W+=2;if(Ja&&I!==void 0&&y)for(z=0;z<4;z++)p=I[z],ca[V]=p.u,ca[V+1]=p.v,V+=2;Va&&(ra[P]=L,ra[P+1]=L+1,ra[P+2]=L+3,ra[P+3]=L+1,ra[P+4]=L+2,ra[P+5]=L+3,P+=6,sa[T]=L,sa[T+1]=L+1,sa[T+2]=L,sa[T+3]=L+3,sa[T+4]=L+1,sa[T+5]=L+2,sa[T+6]=L+2,sa[T+7]=L+3,T+=8,L+=4)}if(Ca){m=0;for(o=Ca.length;m<o;m++)ra[P]=Ca[m].a,ra[P+1]=Ca[m].b,ra[P+2]=Ca[m].c,ra[P+3]=Ca[m].a,ra[P+4]=Ca[m].c,ra[P+5]=Ca[m].d,P+=6}Ua&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),
-h.bufferData(h.ARRAY_BUFFER,R,k));if(ea)for(O in ea)x=ea[O],x.__original.needsUpdate&&(h.bindBuffer(h.ARRAY_BUFFER,x.buffer),h.bufferData(h.ARRAY_BUFFER,x.array,k));if(Za){E=0;for(w=ya.length;E<w;E++)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),h.bufferData(h.ARRAY_BUFFER,ia[E],k)}Ya&&Y>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,X,k));Wa&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,Z,k));Xa&&ka.hasTangents&&
+7]=D.w,x.array[E+8]=G.x,x.array[E+9]=G.y,x.array[E+10]=G.z,x.array[E+11]=G.w,x.array[E+12]=H.x,x.array[E+13]=H.y,x.array[E+14]=H.z,x.array[E+15]=H.w,x.offset+=16));if(Za){E=0;for(w=ya.length;E<w;E++)C=ya[E].vertices[o.a].position,D=ya[E].vertices[o.b].position,G=ya[E].vertices[o.c].position,H=ya[E].vertices[o.d].position,x=ia[E],x[Y+0]=C.x,x[Y+1]=C.y,x[Y+2]=C.z,x[Y+3]=D.x,x[Y+4]=D.y,x[Y+5]=D.z,x[Y+6]=G.x,x[Y+7]=G.y,x[Y+8]=G.z,x[Y+9]=H.x,x[Y+10]=H.y,x[Y+11]=H.z;Y+=12}if(za.length)E=za[o.a],w=za[o.b],
+x=za[o.c],L=za[o.d],ha[K]=E.x,ha[K+1]=E.y,ha[K+2]=E.z,ha[K+3]=E.w,ha[K+4]=w.x,ha[K+5]=w.y,ha[K+6]=w.z,ha[K+7]=w.w,ha[K+8]=x.x,ha[K+9]=x.y,ha[K+10]=x.z,ha[K+11]=x.w,ha[K+12]=L.x,ha[K+13]=L.y,ha[K+14]=L.z,ha[K+15]=L.w,E=Ia[o.a],w=Ia[o.b],x=Ia[o.c],L=Ia[o.d],ga[K]=E.x,ga[K+1]=E.y,ga[K+2]=E.z,ga[K+3]=E.w,ga[K+4]=w.x,ga[K+5]=w.y,ga[K+6]=w.z,ga[K+7]=w.w,ga[K+8]=x.x,ga[K+9]=x.y,ga[K+10]=x.z,ga[K+11]=x.w,ga[K+12]=L.x,ga[K+13]=L.y,ga[K+14]=L.z,ga[K+15]=L.w,E=Ga[o.a],w=Ga[o.b],x=Ga[o.c],L=Ga[o.d],da[K]=E.x,
+da[K+1]=E.y,da[K+2]=E.z,da[K+3]=1,da[K+4]=w.x,da[K+5]=w.y,da[K+6]=w.z,da[K+7]=1,da[K+8]=x.x,da[K+9]=x.y,da[K+10]=x.z,da[K+11]=1,da[K+12]=L.x,da[K+13]=L.y,da[K+14]=L.z,da[K+15]=1,E=Ha[o.a],w=Ha[o.b],x=Ha[o.c],o=Ha[o.d],fa[K]=E.x,fa[K+1]=E.y,fa[K+2]=E.z,fa[K+3]=1,fa[K+4]=w.x,fa[K+5]=w.y,fa[K+6]=w.z,fa[K+7]=1,fa[K+8]=x.x,fa[K+9]=x.y,fa[K+10]=x.z,fa[K+11]=1,fa[K+12]=o.x,fa[K+13]=o.y,fa[K+14]=o.z,fa[K+15]=1,K+=16;if(Ya&&B)u.length==4&&B==THREE.VertexColors?(o=u[0],E=u[1],w=u[2],u=u[3]):u=w=E=o=v,X[Q]=
+o.r,X[Q+1]=o.g,X[Q+2]=o.b,X[Q+3]=E.r,X[Q+4]=E.g,X[Q+5]=E.b,X[Q+6]=w.r,X[Q+7]=w.g,X[Q+8]=w.b,X[Q+9]=u.r,X[Q+10]=u.g,X[Q+11]=u.b,Q+=12;if(Xa&&ka.hasTangents)u=z[0],v=z[1],o=z[2],z=z[3],U[N]=u.x,U[N+1]=u.y,U[N+2]=u.z,U[N+3]=u.w,U[N+4]=v.x,U[N+5]=v.y,U[N+6]=v.z,U[N+7]=v.w,U[N+8]=o.x,U[N+9]=o.y,U[N+10]=o.z,U[N+11]=o.w,U[N+12]=z.x,U[N+13]=z.y,U[N+14]=z.z,U[N+15]=z.w,N+=16;if(Wa&&A)if(p.length==4&&fb)for(z=0;z<4;z++)t=p[z],Z[R]=t.x,Z[R+1]=t.y,Z[R+2]=t.z,R+=3;else for(z=0;z<4;z++)Z[R]=t.x,Z[R+1]=t.y,Z[R+
+2]=t.z,R+=3;if(Ja&&F!==void 0&&y)for(z=0;z<4;z++)p=F[z],$[W]=p.u,$[W+1]=p.v,W+=2;if(Ja&&I!==void 0&&y)for(z=0;z<4;z++)p=I[z],ca[V]=p.u,ca[V+1]=p.v,V+=2;Va&&(ra[P]=J,ra[P+1]=J+1,ra[P+2]=J+3,ra[P+3]=J+1,ra[P+4]=J+2,ra[P+5]=J+3,P+=6,sa[T]=J,sa[T+1]=J+1,sa[T+2]=J,sa[T+3]=J+3,sa[T+4]=J+1,sa[T+5]=J+2,sa[T+6]=J+2,sa[T+7]=J+3,T+=8,J+=4)}if(Ca){m=0;for(n=Ca.length;m<n;m++)ra[P]=Ca[m].a,ra[P+1]=Ca[m].b,ra[P+2]=Ca[m].c,ra[P+3]=Ca[m].a,ra[P+4]=Ca[m].c,ra[P+5]=Ca[m].d,P+=6}Ua&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),
+h.bufferData(h.ARRAY_BUFFER,S,k));if(ea)for(O in ea)x=ea[O],x.__original.needsUpdate&&(h.bindBuffer(h.ARRAY_BUFFER,x.buffer),h.bufferData(h.ARRAY_BUFFER,x.array,k));if(Za){E=0;for(w=ya.length;E<w;E++)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),h.bufferData(h.ARRAY_BUFFER,ia[E],k)}Ya&&Q>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,X,k));Wa&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,Z,k));Xa&&ka.hasTangents&&
 (h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,U,k));Ja&&W>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,$,k));Ja&&V>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,k));Va&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ra,k),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,sa,k));K>0&&(h.bindBuffer(h.ARRAY_BUFFER,
 g.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,da,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,fa,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,ga,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,ha,k));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,
 delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents=!1;e.__dirtyColors=!1;var ma;f=f.__materials;e=0;for(b=f.length;e<b;e++)if(d=f[e],d.attributes)for(ma in d.attributes)d.attributes[ma].needsUpdate=!1}else if(b instanceof THREE.Ribbon){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){ma=e;b=h.DYNAMIC_DRAW;
-o=ma.vertices;f=ma.colors;y=o.length;g=f.length;B=ma.__vertexArray;j=ma.__colorArray;A=ma.__dirtyColors;if(ma.__dirtyVertices){for(k=0;k<y;k++)m=o[k].position,d=k*3,B[d]=m.x,B[d+1]=m.y,B[d+2]=m.z;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,B,b)}if(A){for(k=0;k<g;k++)color=f[k],d=k*3,j[d]=color.r,j[d+1]=color.g,j[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,j,b)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof
-THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){ma=e;b=h.DYNAMIC_DRAW;o=ma.vertices;f=ma.colors;y=o.length;g=f.length;B=ma.__vertexArray;j=ma.__colorArray;A=ma.__dirtyColors;if(ma.__dirtyVertices){for(k=0;k<y;k++)m=o[k].position,d=k*3,B[d]=m.x,B[d+1]=m.y,B[d+2]=m.z;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,B,b)}if(A){for(k=0;k<g;k++)color=f[k],d=k*3,j[d]=color.r,j[d+1]=color.g,j[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
-j,b)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)e=b.geometry,(e.__dirtyVertices||e.__dirtyColors||b.sortParticles)&&c(e,h.DYNAMIC_DRAW,b),e.__dirtyVertices=!1,e.__dirtyColors=!1}function A(b,d){var c;for(c=b.length-1;c>=0;c--)b[c].object==d&&b.splice(c,1)}function G(b){function d(b){var g=[];c=0;for(e=b.length;c<e;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,e,g,f,h,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:
-0;b.geometryGroups={};g=0;for(f=b.faces.length;g<f;g++)h=b.faces[g],j=h.materials,k=d(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),
-b.geometryGroups[n].vertices+=h}function F(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function C(b){if(b!=V){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,
-h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}V=b}}function M(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,R(d.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,R(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,R(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,R(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,
-h.TEXTURE_MAG_FILTER,W(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,W(d.minFilter)))}function J(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit=!0),M(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+
-d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function O(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,R(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,R(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,
-R(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,R(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,R(b.format),b.width,b.height,0,R(b.format),R(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,
+n=ma.vertices;f=ma.colors;y=n.length;g=f.length;B=ma.__vertexArray;j=ma.__colorArray;A=ma.__dirtyColors;if(ma.__dirtyVertices){for(k=0;k<y;k++)m=n[k].position,d=k*3,B[d]=m.x,B[d+1]=m.y,B[d+2]=m.z;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,B,b)}if(A){for(k=0;k<g;k++)color=f[k],d=k*3,j[d]=color.r,j[d+1]=color.g,j[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,j,b)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof
+THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){ma=e;b=h.DYNAMIC_DRAW;n=ma.vertices;f=ma.colors;y=n.length;g=f.length;B=ma.__vertexArray;j=ma.__colorArray;A=ma.__dirtyColors;if(ma.__dirtyVertices){for(k=0;k<y;k++)m=n[k].position,d=k*3,B[d]=m.x,B[d+1]=m.y,B[d+2]=m.z;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,B,b)}if(A){for(k=0;k<g;k++)color=f[k],d=k*3,j[d]=color.r,j[d+1]=color.g,j[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,ma.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
+j,b)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)e=b.geometry,(e.__dirtyVertices||e.__dirtyColors||b.sortParticles)&&c(e,h.DYNAMIC_DRAW,b),e.__dirtyVertices=!1,e.__dirtyColors=!1}function A(b,d){var c;for(c=b.length-1;c>=0;c--)b[c].object==d&&b.splice(c,1)}function G(b){function d(b){var g=[];c=0;for(e=b.length;c<e;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,e,g,f,h,j,k,o,m={},p=b.morphTargets!==void 0?b.morphTargets.length:
+0;b.geometryGroups={};g=0;for(f=b.faces.length;g<f;g++)h=b.faces[g],j=h.materials,k=d(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+h>65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(g),
+b.geometryGroups[o].vertices+=h}function F(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function C(b){if(b!=V){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,
+h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}V=b}}function M(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,S(d.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,S(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,S(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,S(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,
+h.TEXTURE_MAG_FILTER,W(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,W(d.minFilter)))}function L(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit=!0),M(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+
+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function O(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,S(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,S(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,
+S(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,S(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,
 h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,
-c=_viewportWidth,b=_viewportHeight);d!=N&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(_viewportX,_viewportY,c,b),N=d)}function w(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function W(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;
-default:return h.LINEAR}}function R(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;
+c=_viewportWidth,b=_viewportHeight);d!=P&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(_viewportX,_viewportY,c,b),P=d)}function w(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function W(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;
+default:return h.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}
-var S=this,h,Q=[],L=null,N=null,T=!0,P=null,Y=null,V=null,Z=null,U=null;_oldPolygonOffsetUnits=_oldPolygonOffsetFactor=null;_cullEnabled=!0;_viewportHeight=_viewportWidth=_viewportY=_viewportX=0;_frustum=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];_projScreenMatrix=new THREE.Matrix4;_projectionMatrixArray=new Float32Array(16);_viewMatrixArray=new Float32Array(16);_vector3=new THREE.Vector4;_lights={ambient:[0,0,0],directional:{length:0,
+var T=this,h,R=[],J=null,P=null,Q=!0,N=null,Y=null,V=null,Z=null,U=null;_oldPolygonOffsetUnits=_oldPolygonOffsetFactor=null;_cullEnabled=!0;_viewportHeight=_viewportWidth=_viewportY=_viewportX=0;_frustum=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];_projScreenMatrix=new THREE.Matrix4;_projectionMatrixArray=new Float32Array(16);_viewMatrixArray=new Float32Array(16);_vector3=new THREE.Vector4;_lights={ambient:[0,0,0],directional:{length:0,
 colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};_canvas=b.canvas!==void 0?b.canvas:document.createElement("canvas");_stencil=b.stencil!==void 0?b.stencil:!0;_antialias=b.antialias!==void 0?b.antialias:!1;_clearColor=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0);_clearAlpha=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=_canvas;this.sortObjects=this.autoClear=!0;try{if(!(h=
 _canvas.getContext("experimental-webgl",{antialias:_antialias,stencil:_stencil})))throw"Error creating WebGL context.";}catch(ea){console.error(ea)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+" | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);
 h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha);_cullEnabled=!0;this.context=h;var ia=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(_stencil){var D={};D.vertices=new Float32Array(12);D.faces=new Uint16Array(6);D.darkness=0.5;D.vertices[0]=-20;D.vertices[1]=-20;D.vertices[2]=-1;D.vertices[3]=20;D.vertices[4]=-20;D.vertices[5]=-1;D.vertices[6]=20;D.vertices[7]=20;D.vertices[8]=-1;D.vertices[9]=-20;D.vertices[10]=20;D.vertices[11]=
@@ -311,29 +311,29 @@ h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(
 _sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,
 "alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,
 "modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var ca=!1;this.setSize=function(b,d){_canvas.width=b;_canvas.height=d;this.setViewport(0,0,_canvas.width,_canvas.height)};this.setViewport=function(b,d,c,e){_viewportX=b;_viewportY=d;_viewportWidth=c;_viewportHeight=e;h.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight)};this.setScissor=function(b,d,c,e){h.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):
-h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){T=b;h.depthMask(b)};this.setClearColorHex=function(b,d){_clearColor.setHex(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.setClearColor=function(b,d){_clearColor.copy(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){D.darkness=
+h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Q=b;h.depthMask(b)};this.setClearColorHex=function(b,d){_clearColor.setHex(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.setClearColor=function(b,d){_clearColor.copy(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){D.darkness=
 b};this.getContext=function(){return h};this.initMaterial=function(b,d,c,e){var g,f,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");
-if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var n,m,p;n=p=k=0;for(m=d.length;n<m;n++)f=d[n],f instanceof THREE.DirectionalLight&&p++,f instanceof THREE.PointLight&&k++;k+p<=4?d=p:(d=Math.ceil(4*p/(k+p)),k=4-d);f={directional:d,point:k};p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var o;a:{n=b.fragmentShader;m=b.vertexShader;var k=b.uniforms,d=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
-lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:p},t;f=[];j?f.push(j):(f.push(n),f.push(m));for(t in c)f.push(t),f.push(c[t]);j=f.join();t=0;for(f=Q.length;t<f;t++)if(Q[t].code==j){o=Q[t].program;break a}t=h.createProgram();f=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,
+if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var o,m,p;o=p=k=0;for(m=d.length;o<m;o++)f=d[o],f instanceof THREE.DirectionalLight&&p++,f instanceof THREE.PointLight&&k++;k+p<=4?d=p:(d=Math.ceil(4*p/(k+p)),k=4-d);f={directional:d,point:k};p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var n;a:{o=b.fragmentShader;m=b.vertexShader;var k=b.uniforms,d=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:p},t;f=[];j?f.push(j):(f.push(o),f.push(m));for(t in c)f.push(t),f.push(c[t]);j=f.join();t=0;for(f=R.length;t<f;t++)if(R[t].code==j){n=R[t].program;break a}t=h.createProgram();f=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,
 "#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",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":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[ia?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#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.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-h.attachShader(t,w("fragment",f+n));h.attachShader(t,w("vertex",p+m));h.linkProgram(t);h.getProgramParameter(t,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(t,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");t.uniforms={};t.attributes={};var u;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)n.push(u);u=n;k=0;for(n=
-u.length;k<n;k++)m=u[k],t.uniforms[m]=h.getUniformLocation(t,m);n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)n.push("morphTarget"+u);for(o in d)n.push(o);o=n;u=0;for(d=o.length;u<d;u++)c=o[u],t.attributes[c]=h.getAttribLocation(t,c);Q.push({program:t,code:j});o=t}b.program=o;o=b.program.attributes;o.position>=0&&h.enableVertexAttribArray(o.position);o.color>=0&&h.enableVertexAttribArray(o.color);o.normal>=
-0&&h.enableVertexAttribArray(o.normal);o.tangent>=0&&h.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(h.enableVertexAttribArray(o.skinVertexA),h.enableVertexAttribArray(o.skinVertexB),h.enableVertexAttribArray(o.skinIndex),h.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(g in b.attributes)o[g]!==void 0&&o[g]>=0&&h.enableVertexAttribArray(o[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;o.morphTarget0>=0&&(h.enableVertexAttribArray(o.morphTarget0),
-b.numSupportedMorphTargets++);o.morphTarget1>=0&&(h.enableVertexAttribArray(o.morphTarget1),b.numSupportedMorphTargets++);o.morphTarget2>=0&&(h.enableVertexAttribArray(o.morphTarget2),b.numSupportedMorphTargets++);o.morphTarget3>=0&&(h.enableVertexAttribArray(o.morphTarget3),b.numSupportedMorphTargets++);o.morphTarget4>=0&&(h.enableVertexAttribArray(o.morphTarget4),b.numSupportedMorphTargets++);o.morphTarget5>=0&&(h.enableVertexAttribArray(o.morphTarget5),b.numSupportedMorphTargets++);o.morphTarget6>=
-0&&(h.enableVertexAttribArray(o.morphTarget6),b.numSupportedMorphTargets++);o.morphTarget7>=0&&(h.enableVertexAttribArray(o.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,p,A){var w,D,G,F,I,H,J,L,M=b.lights,N=b.fog;S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(_viewMatrixArray);
-c.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(c.projectionMatrix,c.matrixWorldInverse);m(_projScreenMatrix);this.initWebGLObjects(b);O(p);(this.autoClear||A)&&this.clear();I=b.__webglObjects.length;for(A=0;A<I;A++)if(w=b.__webglObjects[A],J=w.object,J.visible)if(!(J instanceof THREE.Mesh)||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),z(J,c),n(w),w.render=!0,this.sortObjects)w.object.renderDepth?w.z=w.object.renderDepth:(_vector3.copy(J.position),
+h.attachShader(t,w("fragment",f+o));h.attachShader(t,w("vertex",p+m));h.linkProgram(t);h.getProgramParameter(t,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(t,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");t.uniforms={};t.attributes={};var u;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)o.push(u);u=o;k=0;for(o=
+u.length;k<o;k++)m=u[k],t.uniforms[m]=h.getUniformLocation(t,m);o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)o.push("morphTarget"+u);for(n in d)o.push(n);n=o;u=0;for(d=n.length;u<d;u++)c=n[u],t.attributes[c]=h.getAttribLocation(t,c);R.push({program:t,code:j});n=t}b.program=n;n=b.program.attributes;n.position>=0&&h.enableVertexAttribArray(n.position);n.color>=0&&h.enableVertexAttribArray(n.color);n.normal>=
+0&&h.enableVertexAttribArray(n.normal);n.tangent>=0&&h.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(h.enableVertexAttribArray(n.skinVertexA),h.enableVertexAttribArray(n.skinVertexB),h.enableVertexAttribArray(n.skinIndex),h.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&h.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(h.enableVertexAttribArray(n.morphTarget0),
+b.numSupportedMorphTargets++);n.morphTarget1>=0&&(h.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(h.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(h.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(h.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(h.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=
+0&&(h.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(h.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,n,A){var w,D,G,F,I,H,J,L,M=b.lights,N=b.fog;T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(_viewMatrixArray);
+c.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(c.projectionMatrix,c.matrixWorldInverse);m(_projScreenMatrix);this.initWebGLObjects(b);O(n);(this.autoClear||A)&&this.clear();I=b.__webglObjects.length;for(A=0;A<I;A++)if(w=b.__webglObjects[A],J=w.object,J.visible)if(!(J instanceof THREE.Mesh)||p(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),z(J,c),o(w),w.render=!0,this.sortObjects)w.object.renderDepth?w.z=w.object.renderDepth:(_vector3.copy(J.position),
 _projScreenMatrix.multiplyVector3(_vector3),w.z=_vector3.z)}else w.render=!1;else w.render=!1;this.sortObjects&&b.__webglObjects.sort(u);H=b.__webglObjectsImmediate.length;for(A=0;A<H;A++)w=b.__webglObjectsImmediate[A],J=w.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),z(J,c),t(w));C(THREE.NormalBlending);for(A=0;A<I;A++)if(w=b.__webglObjects[A],w.render){J=w.object;L=w.buffer;G=w.opaque;g(J);for(w=0;w<G.count;w++)F=G.list[w],j(F.depthTest),k(F.polygonOffset,
 F.polygonOffsetFactor,F.polygonOffsetUnits),e(c,M,N,F,L,J)}for(A=0;A<H;A++)if(w=b.__webglObjectsImmediate[A],J=w.object,J.visible){G=w.opaque;g(J);for(w=0;w<G.count;w++)F=G.list[w],j(F.depthTest),k(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=d(c,M,N,F,J),J.render(function(b){f(b,D,F.shading)})}for(A=0;A<I;A++)if(w=b.__webglObjects[A],w.render){J=w.object;L=w.buffer;G=w.transparent;g(J);for(w=0;w<G.count;w++)F=G.list[w],C(F.blending),j(F.depthTest),k(F.polygonOffset,F.polygonOffsetFactor,
-F.polygonOffsetUnits),e(c,M,N,F,L,J)}for(A=0;A<H;A++)if(w=b.__webglObjectsImmediate[A],J=w.object,J.visible){G=w.transparent;g(J);for(w=0;w<G.count;w++)F=G.list[w],C(F.blending),j(F.depthTest),k(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=d(c,M,N,F,J),J.render(function(b){f(b,D,F.shading)})}b.__webglSprites.length&&y(b,c);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&B(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&
-(h.bindTexture(h.TEXTURE_2D,p.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],d=b,e=void 0,g=void 0,f=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=
+F.polygonOffsetUnits),e(c,M,N,F,L,J)}for(A=0;A<H;A++)if(w=b.__webglObjectsImmediate[A],J=w.object,J.visible){G=w.transparent;g(J);for(w=0;w<G.count;w++)F=G.list[w],C(F.blending),j(F.depthTest),k(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=d(c,M,N,F,J),J.render(function(b){f(b,D,F.shading)})}b.__webglSprites.length&&y(b,c);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&B(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&
+(h.bindTexture(h.TEXTURE_2D,n.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],d=b,e=void 0,g=void 0,f=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=
 new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(e in g=c.geometry,g.geometryGroups==void 0&&G(g),g.geometryGroups){f=g.geometryGroups[e];if(!f.__webglVertexBuffer){var j=f;j.__webglVertexBuffer=h.createBuffer();j.__webglNormalBuffer=h.createBuffer();j.__webglTangentBuffer=h.createBuffer();j.__webglColorBuffer=h.createBuffer();j.__webglUVBuffer=h.createBuffer();j.__webglUV2Buffer=h.createBuffer();j.__webglSkinVertexABuffer=
-h.createBuffer();j.__webglSkinVertexBBuffer=h.createBuffer();j.__webglSkinIndicesBuffer=h.createBuffer();j.__webglSkinWeightsBuffer=h.createBuffer();j.__webglFaceBuffer=h.createBuffer();j.__webglLineBuffer=h.createBuffer();if(j.numMorphTargets){var k=void 0,n=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(n=j.numMorphTargets;k<n;k++)j.__webglMorphTargetsBuffers.push(h.createBuffer())}for(var j=f,k=c,m=void 0,o=void 0,p=void 0,t=p=void 0,u=void 0,v=void 0,z=v=n=0,w=p=o=void 0,y=w=o=m=void 0,p=void 0,
-t=k.geometry,u=t.faces,w=j.faces,m=0,o=w.length;m<o;m++)p=w[m],p=u[p],p instanceof THREE.Face3?(n+=3,v+=1,z+=3):p instanceof THREE.Face4&&(n+=4,v+=2,z+=4);for(var m=j,o=k,B=w=u=void 0,C=void 0,B=void 0,p=[],u=0,w=o.materials.length;u<w;u++)if(B=o.materials[u],B instanceof THREE.MeshFaceMaterial){B=0;for(l=m.materials.length;B<l;B++)(C=m.materials[B])&&p.push(C)}else(C=B)&&p.push(C);m=p;j.__materials=m;a:{u=o=void 0;w=m.length;for(o=0;o<w;o++)if(u=m[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=
-!0;break a}o=!1}a:{w=u=void 0;p=m.length;for(u=0;u<p;u++)if(w=m[u],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{p=u=void 0;B=m.length;for(u=0;u<B;u++)if(p=m[u],p.vertexColors){p=p.vertexColors;break a}p=!1}j.__vertexArray=new Float32Array(n*3);if(w)j.__normalArray=new Float32Array(n*3);if(t.hasTangents)j.__tangentArray=new Float32Array(n*4);if(p)j.__colorArray=
-new Float32Array(n*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*
-6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=w==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=p;j.__normalType=w;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=m.length;t<u;t++)if(o=m[t],o.attributes)for(a in j.__webglCustomAttributes={},o.attributes){p=o.attributes[a];w={};for(y in p)w[y]=
-p[y];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,v=1,w.type==="v2"?v=2:w.type==="v3"?v=3:w.type==="v4"?v=4:w.type==="c"&&(v=3),w.size=v,w.array=new Float32Array(n*v),w.buffer=h.createBuffer(),w.buffer.belongsToAttribute=a,p.needsUpdate=!0,w.__original=p;j.__webglCustomAttributes[a]=w}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?
+h.createBuffer();j.__webglSkinVertexBBuffer=h.createBuffer();j.__webglSkinIndicesBuffer=h.createBuffer();j.__webglSkinWeightsBuffer=h.createBuffer();j.__webglFaceBuffer=h.createBuffer();j.__webglLineBuffer=h.createBuffer();if(j.numMorphTargets){var k=void 0,o=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(o=j.numMorphTargets;k<o;k++)j.__webglMorphTargetsBuffers.push(h.createBuffer())}for(var j=f,k=c,m=void 0,n=void 0,p=void 0,t=p=void 0,u=void 0,v=void 0,z=v=o=0,w=p=n=void 0,y=w=n=m=void 0,p=void 0,
+t=k.geometry,u=t.faces,w=j.faces,m=0,n=w.length;m<n;m++)p=w[m],p=u[p],p instanceof THREE.Face3?(o+=3,v+=1,z+=3):p instanceof THREE.Face4&&(o+=4,v+=2,z+=4);for(var m=j,n=k,B=w=u=void 0,C=void 0,B=void 0,p=[],u=0,w=n.materials.length;u<w;u++)if(B=n.materials[u],B instanceof THREE.MeshFaceMaterial){B=0;for(l=m.materials.length;B<l;B++)(C=m.materials[B])&&p.push(C)}else(C=B)&&p.push(C);m=p;j.__materials=m;a:{u=n=void 0;w=m.length;for(n=0;n<w;n++)if(u=m[n],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){n=
+!0;break a}n=!1}a:{w=u=void 0;p=m.length;for(u=0;u<p;u++)if(w=m[u],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{p=u=void 0;B=m.length;for(u=0;u<B;u++)if(p=m[u],p.vertexColors){p=p.vertexColors;break a}p=!1}j.__vertexArray=new Float32Array(o*3);if(w)j.__normalArray=new Float32Array(o*3);if(t.hasTangents)j.__tangentArray=new Float32Array(o*4);if(p)j.__colorArray=
+new Float32Array(o*3);if(n){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*
+6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__needsSmoothNormals=w==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=p;j.__normalType=w;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=m.length;t<u;t++)if(n=m[t],n.attributes)for(a in j.__webglCustomAttributes={},n.attributes){p=n.attributes[a];w={};for(y in p)w[y]=
+p[y];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,v=1,w.type==="v2"?v=2:w.type==="v3"?v=3:w.type==="v4"?v=4:w.type==="c"&&(v=3),w.size=v,w.array=new Float32Array(o*v),w.buffer=h.createBuffer(),w.buffer.belongsToAttribute=a,p.needsUpdate=!0,w.__original=p;j.__webglCustomAttributes[a]=w}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?
 F(d.__webglShadowVolumes,f,c):F(d.__webglObjects,f,c)}else if(c instanceof THREE.LensFlare)F(d.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)e=g,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=g,f=e.vertices.length,e.__vertexArray=new Float32Array(f*3),e.__colorArray=new Float32Array(f*3),e.__webglVertexCount=f,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(d.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;
 if(!g.__webglVertexBuffer)e=g,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=g,f=e.vertices.length,e.__vertexArray=new Float32Array(f*3),e.__colorArray=new Float32Array(f*3),e.__webglLineCount=f,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(d.__webglObjects,g,c)}else if(c instanceof THREE.ParticleSystem){g=c.geometry;if(!g.__webglVertexBuffer)e=g,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=g,f=e.vertices.length,e.__vertexArray=new Float32Array(f*
 3),e.__colorArray=new Float32Array(f*3),e.__sortArray=[],e.__webglParticleCount=f,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(d.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?d.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite&&d.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)c=b.__objectsRemoved[0],d=b,c instanceof THREE.ShadowVolume?A(d.__webglShadowVolumes,
@@ -348,10 +348,10 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 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};
 THREE.ColorUtils={adjustHSV:function(b,c,d,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,f);f.h=THREE.ColorUtils.clamp(f.h+c,0,1);f.s=THREE.ColorUtils.clamp(f.s+d,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);b.setHSV(f.h,f.s,f.v)},rgbToHsv:function(b,c){var d=b.r,e=b.g,f=b.b,g=Math.max(Math.max(d,e),f),j=Math.min(Math.min(d,e),f);if(j==g)j=d=0;else{var k=g-j,j=k/g,d=d==g?(e-f)/k:e==g?2+(f-d)/k:4+(d-e)/k;d/=6;d<0&&(d+=1);d>1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=g;return c},
 clamp:function(b,c,d){return b<c?c:b>d?d:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,g=b.vertices,j=f.vertices,k=b.faces,m=f.faces,o=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=j.length;p<t;p++){var n=new THREE.Vertex(j[p].position.clone());d&&c.matrix.multiplyVector3(n.position);g.push(n)}p=0;for(t=m.length;p<t;p++){var j=m[p],u,v,y=j.vertexNormals,n=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
-j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(g=y.length;d<g;d++)v=y[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(g=n.length;d<g;d++)v=n[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}p=0;for(t=f.length;p<t;p++){e=f[p];k=[];d=0;for(g=e.length;d<g;d++)k.push(new THREE.UV(e[d].u,e[d].v));o.push(k)}}};
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,g=b.vertices,j=f.vertices,k=b.faces,m=f.faces,p=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=j.length;n<t;n++){var o=new THREE.Vertex(j[n].position.clone());d&&c.matrix.multiplyVector3(o.position);g.push(o)}n=0;for(t=m.length;n<t;n++){var j=m[n],u,v,y=j.vertexNormals,o=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
+j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(g=y.length;d<g;d++)v=y[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(g=o.length;d<g;d++)v=o[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}n=0;for(t=f.length;n<t;n++){e=f[n];k=[];d=0;for(g=e.length;d<g;d++)k.push(new THREE.UV(e[d].u,e[d].v));p.push(k)}}};
 THREE.ImageUtils={loadTexture:function(b,c,d){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;d&&d(this)};e.src=b;return f},loadTextureCube:function(b,c,d){var e,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(e=b.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;d&&d(this)},f[c].src=b[c];return g}};
-THREE.SceneUtils={addMesh:function(b,c,d,e,f,g,j,k,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),d);b.addObject(c);
+THREE.SceneUtils={addMesh:function(b,c,d,e,f,g,j,k,m,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),d);b.addObject(c);
 return c},addPanoramaCube:function(b,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,e,!0),
 new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var e=c/2,c=new THREE.Plane(c,c),f=Math.PI,g=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));THREE.SceneUtils.addMesh(b,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));THREE.SceneUtils.addMesh(b,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));THREE.SceneUtils.addMesh(b,c,1,0,e,0,g,0,f,
 new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var d,e,f=b.children.length;for(e=0;e<f;e++)d=b.children[e],c(d),THREE.SceneUtils.traverseHierarchy(d,c)}};
@@ -366,20 +366,20 @@ film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,e,f,g=2*Math.ceil(b*3)+1;g>25&&(g=25);f=(g-1)*0.5;d=Array(g);for(c=e=0;c<g;++c)d[c]=Math.exp(-((c-f)*(c-f))/(2*b*b)),e+=d[c];for(c=0;c<g;++c)d[c]/=e;return d}};
 THREE.AnimationHandler=function(){var b=[],c={},d={update:function(c){for(var d=0;d<b.length;d++)b[d].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var d=0;d<b.hierarchy.length;d++){for(var e=0;e<b.hierarchy[d].keys.length;e++){if(b.hierarchy[d].keys[e].time<
-0)b.hierarchy[d].keys[e].time=0;if(b.hierarchy[d].keys[e].rot!==void 0&&!(b.hierarchy[d].keys[e].rot instanceof THREE.Quaternion)){var k=b.hierarchy[d].keys[e].rot;b.hierarchy[d].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[d].keys[0].morphTargets!==void 0){k={};for(e=0;e<b.hierarchy[d].keys.length;e++)for(var m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++){var o=b.hierarchy[d].keys[e].morphTargets[m];k[o]=-1}b.hierarchy[d].usedMorphTargets=k;for(e=0;e<b.hierarchy[d].keys.length;e++){var p=
-{};for(o in k){for(m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++)if(b.hierarchy[d].keys[e].morphTargets[m]===o){p[o]=b.hierarchy[d].keys[e].morphTargetsInfluences[m];break}m===b.hierarchy[d].keys[e].morphTargets.length&&(p[o]=0)}b.hierarchy[d].keys[e].morphTargetsInfluences=p}}for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].time===b.hierarchy[d].keys[e-1].time&&(b.hierarchy[d].keys.splice(e,1),e--);for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].index=e}e=parseInt(b.length*
+0)b.hierarchy[d].keys[e].time=0;if(b.hierarchy[d].keys[e].rot!==void 0&&!(b.hierarchy[d].keys[e].rot instanceof THREE.Quaternion)){var k=b.hierarchy[d].keys[e].rot;b.hierarchy[d].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[d].keys[0].morphTargets!==void 0){k={};for(e=0;e<b.hierarchy[d].keys.length;e++)for(var m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++){var p=b.hierarchy[d].keys[e].morphTargets[m];k[p]=-1}b.hierarchy[d].usedMorphTargets=k;for(e=0;e<b.hierarchy[d].keys.length;e++){var n=
+{};for(p in k){for(m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++)if(b.hierarchy[d].keys[e].morphTargets[m]===p){n[p]=b.hierarchy[d].keys[e].morphTargetsInfluences[m];break}m===b.hierarchy[d].keys[e].morphTargets.length&&(n[p]=0)}b.hierarchy[d].keys[e].morphTargetsInfluences=n}}for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].time===b.hierarchy[d].keys[e-1].time&&(b.hierarchy[d].keys.splice(e,1),e--);for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].index=e}e=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(d=0;d<b.hierarchy.length;d++)b.JIT.hierarchy.push(Array(e));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var d=0;d<b.bones.length;d++)c.push(b.bones[d]);else e(b,c);return c}},e=function(b,c){c.push(b);for(var d=0;d<b.children.length;d++)e(b.children[d],c)};d.LINEAR=0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=
 2;return d}();THREE.Animation=function(b,c,d,e){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=d!==void 0?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];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 g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[d].keys[0];g.rot=this.data.hierarchy[d].keys[0];g.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,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 b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,g,j,k,m,o,p=this.data.JIT.hierarchy,t,n;this.currentTime+=b*this.timeScale;n=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],m=b.animationCache,this.JITCompile&&p[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){d=c[y];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=n){if(t<n)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<t;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,g,j,k,m,p,n=this.data.JIT.hierarchy,t,o;this.currentTime+=b*this.timeScale;o=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],m=b.animationCache,this.JITCompile&&n[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=n[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){d=c[y];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=o){if(t<o)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<t;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
 t)}m.prevKey[d]=j;m.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;e=(t-j.time)/(k.time-j.time);f=j[d];g=k[d];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(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),d.x=f[0],d.y=f[1],d.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(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d===
-"rot")THREE.Quaternion.slerp(f,g,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,g,j,k,m,o;f=(b.length-1)*c;g=Math.floor(f);f-=g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>b.length-2?g:g+1;d[3]=g>b.length-3?g:g+2;g=b[d[0]];k=b[d[1]];m=b[d[2]];o=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(g[0],k[0],m[0],o[0],f,d,j);e[1]=this.interpolate(g[1],k[1],m[1],o[1],f,d,j);e[2]=this.interpolate(g[2],k[2],m[2],o[2],f,d,j);return e};
+"rot")THREE.Quaternion.slerp(f,g,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,g,j,k,m,p;f=(b.length-1)*c;g=Math.floor(f);f-=g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>b.length-2?g:g+1;d[3]=g>b.length-3?g:g+2;g=b[d[0]];k=b[d[1]];m=b[d[2]];p=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(g[0],k[0],m[0],p[0],f,d,j);e[1]=this.interpolate(g[1],k[1],m[1],p[1],f,d,j);e[2]=this.interpolate(g[2],k[2],m[2],p[2],f,d,j);return e};
 THREE.Animation.prototype.interpolate=function(b,c,d,e,f,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);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=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
@@ -412,64 +412,64 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
 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=-b+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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,p=0,t=0,n=0,u=0,v=0,y=window.innerWidth/2,B=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*n);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,p=1,n=0,t=0,o=0,u=0,v=0,y=window.innerWidth/2,B=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*o);m&&(this.roll+=this.rollSpeed*this.delta*p);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();j.copy(this.forward);g.set(0,1,0);f.cross(g,j).normalize();g.cross(j,f).normalize();this.matrix.n11=f.x;this.matrix.n12=g.x;this.matrix.n13=j.x;this.matrix.n21=f.y;this.matrix.n22=g.y;this.matrix.n23=j.y;this.matrix.n31=f.z;this.matrix.n32=g.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(b);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(b){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(b);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-y)/window.innerWidth;v=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:n=0;break;case 70:n=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(b){u=(b.clientX-y)/window.innerWidth;v=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:m=!0;p=1;break;case 69:m=!0;p=-1;break;case 82:o=1;break;case 70:o=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var d=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var d=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,m=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
 this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var d=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(d.y);e.addSelf(this.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};
 this.rotateCamera=function(){var b=Math.acos(g.dot(j)/g.length()/j.length());if(b){var c=(new THREE.Vector3).cross(g,j).normalize(),d=new THREE.Quaternion;b*=this.rotateSpeed;d.setFromAxisAngle(c,-b);d.multiplyVector3(f);d.multiplyVector3(this.up);d.multiplyVector3(j);this.staticMoving?g=j:(d.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var b=1+(m.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(f.multiplyScalar(b),this.staticMoving?k=m:k.y+=(m.y-k.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=p.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?o=p:o.addSelf(b.sub(p,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+this.panCamera=function(){var b=n.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=n:p.addSelf(b.sub(n,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(b,c,d){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,b,c,d)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=m=this.getMouseOnScreen(b.clientX,b.clientY),o=p=this.getMouseOnScreen(b.clientX,b.clientY),d=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(b.clientX,b.clientY):e===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
+c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=m=this.getMouseOnScreen(b.clientX,b.clientY),p=n=this.getMouseOnScreen(b.clientX,b.clientY),d=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(b.clientX,b.clientY):e===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,m){function o(b,c,d,j,k,m,n,o){var t,u,v=e||1,y=f||1,R=k/2,S=m/2,h=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",y=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var Q=v+1,L=y+1;k/=v;var N=m/y;for(u=0;u<L;u++)for(m=0;m<Q;m++){var T=new THREE.Vector3;T[b]=(m*k-R)*d;T[c]=(u*N-S)*j;T[t]=n;p.vertices.push(new THREE.Vertex(T))}for(u=0;u<y;u++)for(m=0;m<v;m++)p.faces.push(new THREE.Face4(m+Q*u+
-h,m+Q*(u+1)+h,m+1+Q*(u+1)+h,m+1+Q*u+h,null,null,o)),p.faceVertexUvs[0].push([new THREE.UV(m/v,u/y),new THREE.UV(m/v,(u+1)/y),new THREE.UV((m+1)/v,(u+1)/y),new THREE.UV((m+1)/v,u/y)])}THREE.Geometry.call(this);var p=this,t=b/2,n=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var y in m)this.sides[y]!=void 0&&(this.sides[y]=
-m[y]);this.sides.px&&o("z","y",1*k,-1,d,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,d,c,t,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,d,n,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,d,-n,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=p.vertices.length;d<e;d++){for(var g=p.vertices[d],f=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(g.position.x==m.position.x&&
-g.position.y==m.position.y&&g.position.z==m.position.z){c[d]=j;f=!0;break}}if(!f)c[d]=b.length,b.push(new THREE.Vertex(g.position.clone()))}d=0;for(e=p.faces.length;d<e;d++)g=p.faces[d],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,d,e,f,g){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,p=e/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,p);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-p-(g||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,p+
-(f||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],f=this.vertices[d.a],g=this.vertices[d.b],p=this.vertices[d.c],t=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/o,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
-e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,m){function p(b,c,d,j,k,m,o,p){var t,u,v=e||1,y=f||1,S=k/2,T=m/2,h=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",y=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var R=v+1,J=y+1;k/=v;var P=m/y;for(u=0;u<J;u++)for(m=0;m<R;m++){var Q=new THREE.Vector3;Q[b]=(m*k-S)*d;Q[c]=(u*P-T)*j;Q[t]=o;n.vertices.push(new THREE.Vertex(Q))}for(u=0;u<y;u++)for(m=0;m<v;m++)n.faces.push(new THREE.Face4(m+R*u+
+h,m+R*(u+1)+h,m+1+R*(u+1)+h,m+1+R*u+h,null,null,p)),n.faceVertexUvs[0].push([new THREE.UV(m/v,u/y),new THREE.UV(m/v,(u+1)/y),new THREE.UV((m+1)/v,(u+1)/y),new THREE.UV((m+1)/v,u/y)])}THREE.Geometry.call(this);var n=this,t=b/2,o=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var y in m)this.sides[y]!=void 0&&(this.sides[y]=
+m[y]);this.sides.px&&p("z","y",1*k,-1,d,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,t,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,o,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-o,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=n.vertices.length;d<e;d++){for(var g=n.vertices[d],f=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(g.position.x==m.position.x&&
+g.position.y==m.position.y&&g.position.z==m.position.z){c[d]=j;f=!0;break}}if(!f)c[d]=b.length,b.push(new THREE.Vertex(g.position.clone()))}d=0;for(e=n.faces.length;d<e;d++)g=n.faces[d],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(b,c,d,e,f,g){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,p=Math.PI*2,n=e/2;for(m=0;m<b;m++)j(Math.sin(p*m/b)*c,Math.cos(p*m/b)*c,-n);for(m=0;m<b;m++)j(Math.sin(p*m/b)*d,Math.cos(p*m/b)*d,n);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-n-(g||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,n+
+(f||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],f=this.vertices[d.a],g=this.vertices[d.b],n=this.vertices[d.c],t=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/p,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/p,0.5+n.position.z/
+e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.IcosahedronGeometry=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=f.vertices[b].position,g=f.vertices[d].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),o=e(g.faces[k].b,g.faces[k].c),p=e(g.faces[k].c,g.faces[k].a);d(g.faces[k].a,m,p,j);d(g.faces[k].b,o,m,j);
-d(g.faces[k].c,p,o,j);d(m,o,p,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),p=e(g.faces[k].b,g.faces[k].c),n=e(g.faces[k].c,g.faces[k].a);d(g.faces[k].a,m,n,j);d(g.faces[k].b,p,m,j);
+d(g.faces[k].c,n,p,j);d(m,p,n,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],g=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.001;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=g;m==0&&(g=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-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var f,g=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var o=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(f*o-j),0)));for(f=0;f<e;f++)for(c=0;c<d;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/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var f,g=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var p=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(f*p-j),0)));for(f=0;f<e;f++)for(c=0;c<d;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/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),o=[],p=0;for(e=0;e<g;e++){var t=2*e/g,n=m*Math.sin(t*f),t=m*Math.cos(t*f);(d==0||d==j)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,n)))-1);o.push(p)}c.push(o)}for(var u,v,y,f=c.length,d=0;d<f;d++)if(g=c[d].length,d>0)for(e=0;e<g;e++){o=e==g-1;j=c[d][o?0:e+1];k=c[d][o?g-1:e];m=c[d-1][o?
-g-1:e];o=c[d-1][o?0:e+1];n=d/(f-1);u=(d-1)/(f-1);v=(e+1)/g;var t=e/g,p=new THREE.UV(1-v,n),n=new THREE.UV(1-t,n),t=new THREE.UV(1-t,u),B=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([p,n,t]));d>1&&(u=
-this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),y=this.vertices[o].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([p,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),p=[],n=0;for(e=0;e<g;e++){var t=2*e/g,o=m*Math.sin(t*f),t=m*Math.cos(t*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,o)))-1);p.push(n)}c.push(p)}for(var u,v,y,f=c.length,d=0;d<f;d++)if(g=c[d].length,d>0)for(e=0;e<g;e++){p=e==g-1;j=c[d][p?0:e+1];k=c[d][p?g-1:e];m=c[d-1][p?
+g-1:e];p=c[d-1][p?0:e+1];o=d/(f-1);u=(d-1)/(f-1);v=(e+1)/g;var t=e/g,n=new THREE.UV(1-v,o),o=new THREE.UV(1-t,o),t=new THREE.UV(1-t,u),B=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,o,t]));d>1&&(u=
+this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),y=this.vertices[p].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(b,c){function d(b,c,d){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}function e(b,c,d,e){v.faces.push(new THREE.Face4(b,c,d,e))}this.text=b;var c=c||this.parameters,f=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",m=c.style!==void 0?c.style:"normal",o=c.bezelThickness!==void 0?c.bezelThickness:10,p=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=j;THREE.FontUtils.weight=k;THREE.FontUtils.style=m;THREE.FontUtils.bezelSize=p;var k=THREE.FontUtils.drawText(b),g=k.points,n=k.faces,j=k.contour,u=k.bezel,v=this;v.vertices=[];v.faces=[];for(var y,m=g.length,B=n.length,p=u.length,k=0;k<m;k++)y=g[k],d(y.x,y.y,0);for(k=0;k<m;k++)y=g[k],d(y.x,y.y,f);if(t){for(k=0;k<p;k++)y=u[k],d(y.x,y.y,o);for(k=0;k<p;k++)y=u[k],d(y.x,y.y,f-o)}for(k=
-0;k<B;k++)f=n[k],v.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(k=0;k<B;k++)f=n[k],v.faces.push(new THREE.Face3(f[0]+m,f[1]+m,f[2]+m));var z;if(t)for(k=u.length;--k>0;){if(z){if(z.equals(j[k])){z=null;continue}}else z=j[k];o=m*2+k;n=o-1;e(o,n,n+p,o+p);for(t=0;t<m;t++)if(g[t].equals(j[k]))break;for(f=0;f<m;f++)if(g[f].equals(j[k-1]))break;e(t,f,n,o);e(o+p,n+p,f+m,t+m)}else for(k=j.length;--k>0;){if(z){if(z.equals(j[k])){z=null;continue}}else z=j[k];for(t=0;t<m;t++)if(g[t].equals(j[k]))break;for(f=
+THREE.TextGeometry.prototype.set=function(b,c){function d(b,c,d){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}function e(b,c,d,e){v.faces.push(new THREE.Face4(b,c,d,e))}this.text=b;var c=c||this.parameters,f=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",m=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,n=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=j;THREE.FontUtils.weight=k;THREE.FontUtils.style=m;THREE.FontUtils.bezelSize=n;var k=THREE.FontUtils.drawText(b),g=k.points,o=k.faces,j=k.contour,u=k.bezel,v=this;v.vertices=[];v.faces=[];for(var y,m=g.length,B=o.length,n=u.length,k=0;k<m;k++)y=g[k],d(y.x,y.y,0);for(k=0;k<m;k++)y=g[k],d(y.x,y.y,f);if(t){for(k=0;k<n;k++)y=u[k],d(y.x,y.y,p);for(k=0;k<n;k++)y=u[k],d(y.x,y.y,f-p)}for(k=
+0;k<B;k++)f=o[k],v.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(k=0;k<B;k++)f=o[k],v.faces.push(new THREE.Face3(f[0]+m,f[1]+m,f[2]+m));var z;if(t)for(k=u.length;--k>0;){if(z){if(z.equals(j[k])){z=null;continue}}else z=j[k];p=m*2+k;o=p-1;e(p,o,o+n,p+n);for(t=0;t<m;t++)if(g[t].equals(j[k]))break;for(f=0;f<m;f++)if(g[f].equals(j[k-1]))break;e(t,f,o,p);e(p+n,o+n,f+m,t+m)}else for(k=j.length;--k>0;){if(z){if(z.equals(j[k])){z=null;continue}}else z=j[k];for(t=0;t<m;t++)if(g[t].equals(j[k]))break;for(f=
 0;f<m;f++)if(g[f].equals(j[k-1]))break;e(t,f,f+m,t+m)}this.computeCentroids();this.computeFaceNormals()};
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
-{points:b,faces:[]};var d,e,f,g,j=[],k;for(k in c){b=c[k];g=[];for(d in b)e=b[d],g.push(e.x+","+e.y);var m,o;o=g.slice(1).indexOf(g[0]);var p=this.Triangulate.area(b.slice(0,o+1))<0;e=[];for(o=-1;o<g.length;){m=o+1;o=g[m];o=g.slice(m+1).indexOf(o)+m;if(o<=m)break;var t=b.slice(m,o+1);p?this.Triangulate.area(t)<0?(m>0&&j.push({shape:f,holes:e}),f=t,e=[]):e.push(t):this.Triangulate.area(t)<0?(j.push({shape:t,holes:e}),e=[]):e.push(t);o++}p&&j.push({shape:f,holes:e})}var n,u,v,y,B,z;g=[];for(k=0;k<j.length;k++){m=
-j[k];f=m.shape;e=m.holes;for(p=0;p<e.length;p++){o=e[p];v=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){B=o[t];for(d=0;d<f.length;d++)y=f[d],y=B.distanceTo(y),y<v&&(v=y,n=t,u=d)}d=u-1>=0?u-1:f.length-1;var t=n-1>=0?n-1:o.length-1,I=[];I.push(o[n]);I.push(f[u]);I.push(f[d]);v=this.Triangulate.area(I);var A=[];A.push(o[n]);A.push(o[t]);A.push(f[u]);B=this.Triangulate.area(A);y=u;z=n;u+=1;n+=-1;u<0&&(u+=f.length);u%=f.length;n<0&&(n+=o.length);n%=f.length;d=u-1>=0?u-1:f.length-1;t=n-1>=0?n-1:o.length-
-1;I=[];I.push(o[n]);I.push(f[u]);I.push(f[d]);I=this.Triangulate.area(I);A=[];A.push(o[n]);A.push(o[t]);A.push(f[u]);A=this.Triangulate.area(A);v+B>I+A&&(u=y,n=z,u<0&&(u+=f.length),u%=f.length,n<0&&(n+=o.length),n%=f.length,d=u-1>=0?u-1:f.length-1,t=n-1>=0?n-1:o.length-1);v=f.slice(0,u);B=f.slice(u);y=o.slice(n);z=o.slice(0,n);g.push(o[n]);g.push(f[u]);g.push(f[d]);g.push(o[n]);g.push(o[t]);g.push(f[u]);f=v.concat(y).concat(z).concat(B)}m.shape=f}b=[];n=[];for(k=p=0;k<j.length;k++){m=j[k];f=m.shape;
-b=b.concat(f);m=THREE.FontUtils.Triangulate(f,!0);for(u=0;u<m.length;u++)e=m[u],e[0]+=p,e[1]+=p,e[2]+=p;n=n.concat(m);p+=f.length}var G;for(u=0;u<g.length/3;u++){e=[];for(j=0;j<3;j++){k=!1;for(f=0;f<b.length&&!k;f++)G=u*3+j,b[f].equals(g[G])&&(e.push(f),k=!0);k||(b.push(g[G]),e.push(b.length-1),console.log("not found"))}n.push(e)}return{points:b,faces:n}},drawText:function(b){var c=[],d=[],e,f=this.getFace(),g=this.size/f.resolution,j=0;e=String(b).split("");for(var k=e.length,b=0;b<k;b++){var m=
-this.extractGlyphPoints(e[b],f,g,j);j+=m.offset;c.push(m.points);d=d.concat(m.points)}b=j/2;for(e=0;e<d.length;e++)d[e].x-=b;c=this.extractPoints(d,c);c.contour=d;f=[];g=[];e=[];for(var j=[],k=new THREE.Vector2,o,b=d.length;--b>=0;){if(o){if(o.equals(d[b])){o=null;m=this.Triangulate.area(e)>0;j.push(m);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else o=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var p;--b>=0;)m=d[b],k=g[e],m=m.clone().subSelf(k),p=this.bezelSize/m.length(),
-j[e]?p+=1:p=1-p,p=m.multiplyScalar(p).addSelf(k),f.unshift(p),o?o.equals(d[b])&&(o=null,e++):o=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b,
-c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,m,o,p,t,n,u,v,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));k=c.length;for(b=0;b<k;)switch(j=c[b++],j){case "m":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "l":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "q":j=c[b++]*d+e;m=c[b++]*d;t=c[b++]*d+e;n=c[b++]*d;if(g=f[f.length-1]){o=
-g.x;p=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var B=g/divisions,z=THREE.FontUtils.b2(B,o,t,j),B=THREE.FontUtils.b2(B,p,n,m);f.push(new THREE.Vector2(z,B))}}break;case "b":if(j=c[b++]*d+e,m=c[b++]*d,t=c[b++]*d+e,n=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){o=g.x;p=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)B=g/divisions,z=THREE.FontUtils.b3(B,o,t,u,j),B=THREE.FontUtils.b3(B,p,n,v,m),f.push(new THREE.Vector2(z,B))}}}return{offset:y.ha*d,points:f}}}};
-(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j<c;g=j++)f+=b[g].x*b[j].y-b[j].x*b[g].y;return f*0.5};b.Triangulate=function(b,e){var f=b.length;if(f<3)return null;var g=[],j=[],k=[],m,o,p;if(c(b)>0)for(o=0;o<f;o++)j[o]=o;else for(o=0;o<f;o++)j[o]=f-1-o;var t=2*f;for(o=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=o;f<=m&&(m=0);o=m+1;f<=o&&(o=0);p=o+1;f<=p&&(p=0);var n;a:{n=b;var u=m,v=o,y=p,B=f,z=j,I=void 0,A=void 0,G=void 0,
-F=void 0,C=void 0,M=void 0,J=void 0,O=void 0,w=void 0,A=n[z[u]].x,G=n[z[u]].y,F=n[z[v]].x,C=n[z[v]].y,M=n[z[y]].x,J=n[z[y]].y;if(1.0E-10>(F-A)*(J-G)-(C-G)*(M-A))n=!1;else{for(I=0;I<B;I++)if(!(I==u||I==v||I==y)){var O=n[z[I]].x,w=n[z[I]].y,W=void 0,R=void 0,S=void 0,h=void 0,Q=void 0,L=void 0,N=void 0,T=void 0,P=void 0,Y=void 0,V=void 0,Z=void 0,W=S=Q=void 0,W=M-F,R=J-C,S=A-M,h=G-J,Q=F-A,L=C-G,N=O-A,T=w-G,P=O-F,Y=w-C,V=O-M,Z=w-J,W=W*Y-R*P,Q=Q*T-L*N,S=S*Z-h*V;if(W>=0&&S>=0&&Q>=0){n=!1;break a}}n=!0}}if(n){t=
-j[m];n=j[o];u=j[p];g.push(b[t]);g.push(b[n]);g.push(b[u]);k.push([j[m],j[o],j[p]]);m=o;for(p=o+1;p<f;m++,p++)j[m]=j[p];f--;t=2*f}}if(e)return k;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+{points:b,faces:[]};var d,e,f,g,j=[],k;for(k in c){b=c[k];g=[];for(d in b)e=b[d],g.push(e.x+","+e.y);var m,p;p=g.slice(1).indexOf(g[0]);var n=this.Triangulate.area(b.slice(0,p+1))<0;e=[];for(p=-1;p<g.length;){m=p+1;p=g[m];p=g.slice(m+1).indexOf(p)+m;if(p<=m)break;var t=b.slice(m,p+1);n?this.Triangulate.area(t)<0?(m>0&&j.push({shape:f,holes:e}),f=t,e=[]):e.push(t):this.Triangulate.area(t)<0?(j.push({shape:t,holes:e}),e=[]):e.push(t);p++}n&&j.push({shape:f,holes:e})}var o,u,v,y,B,z;g=[];for(k=0;k<j.length;k++){m=
+j[k];f=m.shape;e=m.holes;for(n=0;n<e.length;n++){p=e[n];v=Number.POSITIVE_INFINITY;for(t=0;t<p.length;t++){B=p[t];for(d=0;d<f.length;d++)y=f[d],y=B.distanceTo(y),y<v&&(v=y,o=t,u=d)}d=u-1>=0?u-1:f.length-1;var t=o-1>=0?o-1:p.length-1,I=[];I.push(p[o]);I.push(f[u]);I.push(f[d]);v=this.Triangulate.area(I);var A=[];A.push(p[o]);A.push(p[t]);A.push(f[u]);B=this.Triangulate.area(A);y=u;z=o;u+=1;o+=-1;u<0&&(u+=f.length);u%=f.length;o<0&&(o+=p.length);o%=f.length;d=u-1>=0?u-1:f.length-1;t=o-1>=0?o-1:p.length-
+1;I=[];I.push(p[o]);I.push(f[u]);I.push(f[d]);I=this.Triangulate.area(I);A=[];A.push(p[o]);A.push(p[t]);A.push(f[u]);A=this.Triangulate.area(A);v+B>I+A&&(u=y,o=z,u<0&&(u+=f.length),u%=f.length,o<0&&(o+=p.length),o%=f.length,d=u-1>=0?u-1:f.length-1,t=o-1>=0?o-1:p.length-1);v=f.slice(0,u);B=f.slice(u);y=p.slice(o);z=p.slice(0,o);g.push(p[o]);g.push(f[u]);g.push(f[d]);g.push(p[o]);g.push(p[t]);g.push(f[u]);f=v.concat(y).concat(z).concat(B)}m.shape=f}b=[];o=[];for(k=n=0;k<j.length;k++){m=j[k];f=m.shape;
+b=b.concat(f);m=THREE.FontUtils.Triangulate(f,!0);for(u=0;u<m.length;u++)e=m[u],e[0]+=n,e[1]+=n,e[2]+=n;o=o.concat(m);n+=f.length}var G;for(u=0;u<g.length/3;u++){e=[];for(j=0;j<3;j++){k=!1;for(f=0;f<b.length&&!k;f++)G=u*3+j,b[f].equals(g[G])&&(e.push(f),k=!0);k||(b.push(g[G]),e.push(b.length-1),console.log("not found"))}o.push(e)}return{points:b,faces:o}},drawText:function(b){var c=[],d=[],e,f=this.getFace(),g=this.size/f.resolution,j=0;e=String(b).split("");for(var k=e.length,b=0;b<k;b++){var m=
+this.extractGlyphPoints(e[b],f,g,j);j+=m.offset;c.push(m.points);d=d.concat(m.points)}b=j/2;for(e=0;e<d.length;e++)d[e].x-=b;c=this.extractPoints(d,c);c.contour=d;f=[];g=[];e=[];for(var j=[],k=new THREE.Vector2,p,b=d.length;--b>=0;){if(p){if(p.equals(d[b])){p=null;m=this.Triangulate.area(e)>0;j.push(m);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else p=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var n;--b>=0;)m=d[b],k=g[e],m=m.clone().subSelf(k),n=this.bezelSize/m.length(),
+j[e]?n+=1:n=1-n,n=m.multiplyScalar(n).addSelf(k),f.unshift(n),p?p.equals(d[b])&&(p=null,e++):p=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b,
+c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,m,p,n,t,o,u,v,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));k=c.length;for(b=0;b<k;)switch(j=c[b++],j){case "m":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "l":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "q":j=c[b++]*d+e;m=c[b++]*d;t=c[b++]*d+e;o=c[b++]*d;if(g=f[f.length-1]){p=
+g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var B=g/divisions,z=THREE.FontUtils.b2(B,p,t,j),B=THREE.FontUtils.b2(B,n,o,m);f.push(new THREE.Vector2(z,B))}}break;case "b":if(j=c[b++]*d+e,m=c[b++]*d,t=c[b++]*d+e,o=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){p=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)B=g/divisions,z=THREE.FontUtils.b3(B,p,t,u,j),B=THREE.FontUtils.b3(B,n,o,v,m),f.push(new THREE.Vector2(z,B))}}}return{offset:y.ha*d,points:f}}}};
+(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j<c;g=j++)f+=b[g].x*b[j].y-b[j].x*b[g].y;return f*0.5};b.Triangulate=function(b,e){var f=b.length;if(f<3)return null;var g=[],j=[],k=[],m,p,n;if(c(b)>0)for(p=0;p<f;p++)j[p]=p;else for(p=0;p<f;p++)j[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=p;f<=m&&(m=0);p=m+1;f<=p&&(p=0);n=p+1;f<=n&&(n=0);var o;a:{o=b;var u=m,v=p,y=n,B=f,z=j,I=void 0,A=void 0,G=void 0,
+F=void 0,C=void 0,M=void 0,L=void 0,O=void 0,w=void 0,A=o[z[u]].x,G=o[z[u]].y,F=o[z[v]].x,C=o[z[v]].y,M=o[z[y]].x,L=o[z[y]].y;if(1.0E-10>(F-A)*(L-G)-(C-G)*(M-A))o=!1;else{for(I=0;I<B;I++)if(!(I==u||I==v||I==y)){var O=o[z[I]].x,w=o[z[I]].y,W=void 0,S=void 0,T=void 0,h=void 0,R=void 0,J=void 0,P=void 0,Q=void 0,N=void 0,Y=void 0,V=void 0,Z=void 0,W=T=R=void 0,W=M-F,S=L-C,T=A-M,h=G-L,R=F-A,J=C-G,P=O-A,Q=w-G,N=O-F,Y=w-C,V=O-M,Z=w-L,W=W*Y-S*N,R=R*Q-J*P,T=T*Z-h*V;if(W>=0&&T>=0&&R>=0){o=!1;break a}}o=!0}}if(o){t=
+j[m];o=j[p];u=j[n];g.push(b[t]);g.push(b[o]);g.push(b[u]);k.push([j[m],j[p],j[n]]);m=p;for(n=p+1;n<f;m++,n++)j[m]=j[n];f--;t=2*f}}if(e)return k;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
 1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,g,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,c,d,e,f,g,j){function k(b,c,d,e,g,f){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(g*(2+d)*0.5*Math.cos(b),g*(2+d)*Math.sin(b)*0.5,f*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var m=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,f=k(m,j,this.q,this.p,this.radius,this.heightScale),m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=m.x-f.x;d.y=m.y-f.y;d.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(d,e);e.cross(g,d);g.normalize();e.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=m*e.x+j*g.x;f.y+=m*e.y+j*g.y;f.z+=m*e.z+j*g.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,d,e,g));this.faceVertexUvs[0].push([j,m,o,p])}this.computeCentroids();
+f.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,d,e,g));this.faceVertexUvs[0].push([j,m,p,n])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var e=0;e<c.length;++e)b.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],d)]},createMaterial:function(b,c){function d(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function e(b,c){var e=new Image;e.onload=function(){if(!d(this.width)||!d(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)/
@@ -478,53 +478,53 @@ Math.LN2));b.image.width=c;b.image.height=e;b.image.getContext("2d").drawImage(t
 g.map.wrapT=THREE.RepeatWrapping;b.mapDiffuseOffset&&g.map.offset.set(b.mapDiffuseOffset[0],b.mapDiffuseOffset[1]);e(g.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse)j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255,g.color=j,g.opacity=b.transparency;else if(b.DbgColor)g.color=b.DbgColor;if(b.mapLight&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=b.mapLight;if(b.mapLightmapRepeat)g.lightMap.repeat.set(b.mapLightRepeat[0],
 b.mapLightRepeat[1]),g.lightMap.wrapS=g.lightMap.wrapT=THREE.RepeatWrapping;b.mapLightmapOffset&&g.lightMap.offset.set(b.mapLightmapOffset[0],b.mapLightmapOffset[1]);e(g.lightMap,c+"/"+b.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,e=b.callback,f=b.texture_path?b.texture_path:this.extractUrlbase(d),b=new Worker(d);b.onmessage=function(b){c.createModel(b.data,e,f);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,o,p,t,n,u,v,y,B,z,I,A,G=b.faces;t=b.vertices;var F=b.normals,C=b.colors,M=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&M++;for(d=0;d<M;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];o=0;for(p=t.length;o<p;)n=new THREE.Vertex,n.position.x=t[o++]*c,n.position.y=
-t[o++]*c,n.position.z=t[o++]*c,e.vertices.push(n);o=0;for(p=G.length;o<p;){c=G[o++];t=c&1;m=c&2;d=c&4;f=c&8;u=c&16;n=c&32;y=c&64;c&=128;t?(B=new THREE.Face4,B.a=G[o++],B.b=G[o++],B.c=G[o++],B.d=G[o++],t=4):(B=new THREE.Face3,B.a=G[o++],B.b=G[o++],B.c=G[o++],t=3);if(m)m=G[o++],B.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<M;d++)z=b.uvs[d],v=G[o++],A=z[v*2],v=z[v*2+1],e.faceUvs[d][m]=new THREE.UV(A,v);if(f)for(d=0;d<M;d++){z=b.uvs[d];I=[];for(f=0;f<t;f++)v=G[o++],A=z[v*2],v=z[v*2+1],I[f]=
-new THREE.UV(A,v);e.faceVertexUvs[d][m]=I}if(u)u=G[o++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],B.normal=f;if(n)for(d=0;d<t;d++)u=G[o++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],B.vertexNormals.push(f);if(y)n=G[o++],n=new THREE.Color(C[n]),B.color=n;if(c)for(d=0;d<t;d++)n=G[o++],n=new THREE.Color(C[n]),B.vertexColors.push(n);e.faces.push(B)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
-m,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],m=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,m,o,p,t,n,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;m=0;for(o=v.length;m<o;m+=3)p=v[m]*c,t=v[m+1]*
-c,n=v[m+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(p,t,n)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];o=e.morphColors[d].colors;p=b.morphColors[d].colors;c=0;for(m=p.length;c<m;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.push(t)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,p,n,t,o,u,v,y,B,z,I,A,G=b.faces;t=b.vertices;var F=b.normals,C=b.colors,M=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&M++;for(d=0;d<M;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];p=0;for(n=t.length;p<n;)o=new THREE.Vertex,o.position.x=t[p++]*c,o.position.y=
+t[p++]*c,o.position.z=t[p++]*c,e.vertices.push(o);p=0;for(n=G.length;p<n;){c=G[p++];t=c&1;m=c&2;d=c&4;f=c&8;u=c&16;o=c&32;y=c&64;c&=128;t?(B=new THREE.Face4,B.a=G[p++],B.b=G[p++],B.c=G[p++],B.d=G[p++],t=4):(B=new THREE.Face3,B.a=G[p++],B.b=G[p++],B.c=G[p++],t=3);if(m)m=G[p++],B.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<M;d++)z=b.uvs[d],v=G[p++],A=z[v*2],v=z[v*2+1],e.faceUvs[d][m]=new THREE.UV(A,v);if(f)for(d=0;d<M;d++){z=b.uvs[d];I=[];for(f=0;f<t;f++)v=G[p++],A=z[v*2],v=z[v*2+1],I[f]=
+new THREE.UV(A,v);e.faceVertexUvs[d][m]=I}if(u)u=G[p++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],B.normal=f;if(o)for(d=0;d<t;d++)u=G[p++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],B.vertexNormals.push(f);if(y)o=G[p++],o=new THREE.Color(C[o]),B.color=o;if(c)for(d=0;d<t;d++)o=G[p++],o=new THREE.Color(C[o]),B.vertexColors.push(o);e.faces.push(B)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
+m,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],m=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,m,p,n,t,o,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;m=0;for(p=v.length;m<p;m+=3)n=v[m]*c,t=v[m+1]*
+c,o=v[m+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,t,o)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];p=e.morphColors[d].colors;n=b.morphColors[d].colors;c=0;for(m=n.length;c<m;c+=3)t=new THREE.Color(16755200),t.setRGB(n[c],n[c+1],n[c+2]),p.push(t)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
 e.vertices[f],d,f))}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,e=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,d,f,e,g)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,d,e,f,g){var j=new XMLHttpRequest,k=e+"/"+b,m=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]"):j.readyState==3?g&&(m==0&&(m=j.getResponseHeader("Content-Length")),g({total:m,loaded:j.responseText.length})):j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,e){var f=function(c){function d(b,c){var e=p(b,c),f=p(b,c+1),g=p(b,c+2),h=p(b,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=p(b,c),e=p(b,c+1),g=p(b,c+2);return(p(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=p(b,c);return(p(b,c+1)<<8)+d}function o(b,c){var d=p(b,c);return d>127?d-256:d}function p(b,
-c){return b.charCodeAt(c)&255}function t(c){var d,e,g;d=f(b,c);e=f(b,c+C);g=f(b,c+M);c=m(b,c+J);THREE.BinaryLoader.prototype.f3(z,d,e,g,c)}function n(c){var d,e,g,h,j,o;d=f(b,c);e=f(b,c+C);g=f(b,c+M);h=m(b,c+J);j=f(b,c+O);o=f(b,c+w);c=f(b,c+W);THREE.BinaryLoader.prototype.f3n(z,G,d,e,g,h,j,o,c)}function u(c){var d,e,g,j;d=f(b,c);e=f(b,c+R);g=f(b,c+S);j=f(b,c+h);c=m(b,c+Q);THREE.BinaryLoader.prototype.f4(z,d,e,g,j,c)}function v(c){var d,e,g,j,o,n,p,t;d=f(b,c);e=f(b,c+R);g=f(b,c+S);j=f(b,c+h);o=m(b,
-c+Q);n=f(b,c+L);p=f(b,c+N);t=f(b,c+T);c=f(b,c+P);THREE.BinaryLoader.prototype.f4n(z,G,d,e,g,j,o,n,p,t,c)}function y(c){var d,e;d=f(b,c);e=f(b,c+Y);c=f(b,c+V);THREE.BinaryLoader.prototype.uv3(z.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[c*2],F[c*2+1])}function B(c){var d,e,g;d=f(b,c);e=f(b,c+Z);g=f(b,c+U);c=f(b,c+ea);THREE.BinaryLoader.prototype.uv4(z.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var z=this,I=0,A,G=[],F=[],C,M,J,O,w,W,R,S,h,Q,L,N,T,P,Y,V,
-Z,U,ea,ia,D,H,$,ca,aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);A={signature:b.substr(I,8),header_bytes:p(b,I+8),vertex_coordinate_bytes:p(b,I+9),normal_coordinate_bytes:p(b,I+10),uv_coordinate_bytes:p(b,I+11),vertex_index_bytes:p(b,I+12),normal_index_bytes:p(b,I+13),uv_index_bytes:p(b,I+14),material_index_bytes:p(b,I+15),nvertices:f(b,I+16),nnormals:f(b,I+16+4),nuvs:f(b,I+16+8),ntri_flat:f(b,I+16+12),ntri_smooth:f(b,I+16+16),ntri_flat_uv:f(b,I+16+20),ntri_smooth_uv:f(b,
-I+16+24),nquad_flat:f(b,I+16+28),nquad_smooth:f(b,I+16+32),nquad_flat_uv:f(b,I+16+36),nquad_smooth_uv:f(b,I+16+40)};I+=A.header_bytes;C=A.vertex_index_bytes;M=A.vertex_index_bytes*2;J=A.vertex_index_bytes*3;O=A.vertex_index_bytes*3+A.material_index_bytes;w=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;W=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;R=A.vertex_index_bytes;S=A.vertex_index_bytes*2;h=A.vertex_index_bytes*3;Q=A.vertex_index_bytes*4;L=A.vertex_index_bytes*
-4+A.material_index_bytes;N=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;T=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;P=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;Y=A.uv_index_bytes;V=A.uv_index_bytes*2;Z=A.uv_index_bytes;U=A.uv_index_bytes*2;ea=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;aa=A.vertex_index_bytes*4+A.material_index_bytes;ia=A.ntri_flat*c;D=A.ntri_smooth*(c+A.normal_index_bytes*3);H=A.ntri_flat_uv*
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,e){var f=function(c){function d(b,c){var e=n(b,c),f=n(b,c+1),g=n(b,c+2),h=n(b,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=n(b,c),e=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=n(b,c);return(n(b,c+1)<<8)+d}function p(b,c){var d=n(b,c);return d>127?d-256:d}function n(b,
+c){return b.charCodeAt(c)&255}function t(c){var d,e,g;d=f(b,c);e=f(b,c+C);g=f(b,c+M);c=m(b,c+L);THREE.BinaryLoader.prototype.f3(z,d,e,g,c)}function o(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+C);g=f(b,c+M);h=m(b,c+L);j=f(b,c+O);n=f(b,c+w);c=f(b,c+W);THREE.BinaryLoader.prototype.f3n(z,G,d,e,g,h,j,n,c)}function u(c){var d,e,g,j;d=f(b,c);e=f(b,c+S);g=f(b,c+T);j=f(b,c+h);c=m(b,c+R);THREE.BinaryLoader.prototype.f4(z,d,e,g,j,c)}function v(c){var d,e,g,j,n,o,p,t;d=f(b,c);e=f(b,c+S);g=f(b,c+T);j=f(b,c+h);n=m(b,
+c+R);o=f(b,c+J);p=f(b,c+P);t=f(b,c+Q);c=f(b,c+N);THREE.BinaryLoader.prototype.f4n(z,G,d,e,g,j,n,o,p,t,c)}function y(c){var d,e;d=f(b,c);e=f(b,c+Y);c=f(b,c+V);THREE.BinaryLoader.prototype.uv3(z.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[c*2],F[c*2+1])}function B(c){var d,e,g;d=f(b,c);e=f(b,c+Z);g=f(b,c+U);c=f(b,c+ea);THREE.BinaryLoader.prototype.uv4(z.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var z=this,I=0,A,G=[],F=[],C,M,L,O,w,W,S,T,h,R,J,P,Q,N,Y,V,
+Z,U,ea,ia,D,H,$,ca,aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);A={signature:b.substr(I,8),header_bytes:n(b,I+8),vertex_coordinate_bytes:n(b,I+9),normal_coordinate_bytes:n(b,I+10),uv_coordinate_bytes:n(b,I+11),vertex_index_bytes:n(b,I+12),normal_index_bytes:n(b,I+13),uv_index_bytes:n(b,I+14),material_index_bytes:n(b,I+15),nvertices:f(b,I+16),nnormals:f(b,I+16+4),nuvs:f(b,I+16+8),ntri_flat:f(b,I+16+12),ntri_smooth:f(b,I+16+16),ntri_flat_uv:f(b,I+16+20),ntri_smooth_uv:f(b,
+I+16+24),nquad_flat:f(b,I+16+28),nquad_smooth:f(b,I+16+32),nquad_flat_uv:f(b,I+16+36),nquad_smooth_uv:f(b,I+16+40)};I+=A.header_bytes;C=A.vertex_index_bytes;M=A.vertex_index_bytes*2;L=A.vertex_index_bytes*3;O=A.vertex_index_bytes*3+A.material_index_bytes;w=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;W=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes;T=A.vertex_index_bytes*2;h=A.vertex_index_bytes*3;R=A.vertex_index_bytes*4;J=A.vertex_index_bytes*
+4+A.material_index_bytes;P=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;Q=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;N=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;Y=A.uv_index_bytes;V=A.uv_index_bytes*2;Z=A.uv_index_bytes;U=A.uv_index_bytes*2;ea=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;aa=A.vertex_index_bytes*4+A.material_index_bytes;ia=A.ntri_flat*c;D=A.ntri_smooth*(c+A.normal_index_bytes*3);H=A.ntri_flat_uv*
 (c+A.uv_index_bytes*3);$=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ca=A.nquad_flat*aa;c=A.nquad_smooth*(aa+A.normal_index_bytes*4);aa=A.nquad_flat_uv*(aa+A.uv_index_bytes*4);I+=function(c){for(var e,f,g,h=A.vertex_coordinate_bytes*3,k=c+A.nvertices*h;c<k;c+=h)e=d(b,c),f=d(b,c+A.vertex_coordinate_bytes),g=d(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(z,e,f,g);return A.nvertices*h}(I);I+=function(c){for(var d,e,f,g=A.normal_coordinate_bytes*3,h=c+A.nnormals*
-g;c<h;c+=g)d=o(b,c),e=o(b,c+A.normal_coordinate_bytes),f=o(b,c+A.normal_coordinate_bytes*2),G.push(d/127,e/127,f/127);return A.nnormals*g}(I);I+=function(c){for(var e,f,g=A.uv_coordinate_bytes*2,h=c+A.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+A.uv_coordinate_bytes),F.push(e,f);return A.nuvs*g}(I);ia=I+ia;D=ia+D;H=D+H;$=H+$;ca=$+ca;c=ca+c;aa=c+aa;(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes,e=d+A.uv_index_bytes*3,f=b+A.ntri_flat_uv*e;for(c=b;c<f;c+=e)t(c),y(c+d);return f-b})(D);(function(b){var c,
-d=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=d+A.uv_index_bytes*3,f=b+A.ntri_smooth_uv*e;for(c=b;c<f;c+=e)n(c),y(c+d);return f-b})(H);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes,e=d+A.uv_index_bytes*4,f=b+A.nquad_flat_uv*e;for(c=b;c<f;c+=e)u(c),B(c+d);return f-b})(c);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=d+A.uv_index_bytes*4,f=b+A.nquad_smooth_uv*e;for(c=b;c<f;c+=e)v(c),B(c+d);return f-b})(aa);
-(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes,e=b+A.ntri_flat*d;for(c=b;c<e;c+=d)t(c);return e-b})(I);(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=b+A.ntri_smooth*d;for(c=b;c<e;c+=d)n(c);return e-b})(ia);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes,e=b+A.nquad_flat*d;for(c=b;c<e;c+=d)u(c);return e-b})($);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=b+A.nquad_smooth*
-d;for(c=b;c<e;c+=d)v(c);return e-b})(ca);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,g){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[g]))},f3n:function(b,c,d,e,f,g,j,k,m){var g=b.materials[g],o=c[k*3],p=c[k*3+1],k=c[k*3+2],
-t=c[m*3],n=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(t,n,m)],null,g))},f4n:function(b,c,d,e,f,g,j,k,m,o,p){var j=b.materials[j],t=c[m*3],n=c[m*3+1],m=c[m*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],y=c[p*3],B=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(d,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(t,n,m),new THREE.Vector3(u,v,o),new THREE.Vector3(y,B,p)],null,j))},uv3:function(b,
-c,d,e,f,g,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));b.push(k)},uv4:function(b,c,d,e,f,g,j,k,m){var o=[];o.push(new THREE.UV(c,d));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,j));o.push(new THREE.UV(k,m));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in w.objects)if(!L.objects[u])if(I=w.objects[u],I.geometry!==void 0){if(C=L.geometries[I.geometry]){O=[];for(P=0;P<I.materials.length;P++)O[P]=L.materials[I.materials[P]];A=I.position;r=I.rotation;q=I.quaternion;s=I.scale;q=0;O.length==0&&(O[0]=new THREE.MeshFaceMaterial);
-O.length>1&&(O=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,O);object.name=u;object.position.set(A[0],A[1],A[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=I.visible;L.scene.addObject(object);L.objects[u]=object;if(I.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);L.scene.collisions.colliders.push(b)}if(I.castsShadow)b=new THREE.ShadowVolume(C),L.scene.addChild(b),
-b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},L.triggers[object.name]=b)}}else A=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[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=I.visible!==void 0?I.visible:!1,L.scene.addObject(object),
-L.objects[u]=object,L.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},L.triggers[object.name]=b)}function m(b){return function(c){L.geometries[b]=c;k();R-=1;d.onLoadComplete();p()}}function o(b){return function(c){L.geometries[b]=c}}function p(){d.callbackProgress({totalModels:h,totalTextures:Q,loadedModels:h-R,loadedTextures:Q-S},L);d.onLoadProgress();R==0&&S==0&&c(L)}var t,n,u,v,y,B,z,I,A,G,F,C,M,J,O,w,W,R,S,h,Q,L;w=b.data;b=new THREE.BinaryLoader;W=new THREE.JSONLoader;
-S=R=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var N=!1;for(u in w.objects)if(I=w.objects[u],I.meshCollider){N=!0;break}if(N)L.scene.collisions=new THREE.CollisionSystem;if(w.transform){N=w.transform.position;G=w.transform.rotation;var T=w.transform.scale;N&&L.scene.position.set(N[0],N[1],N[2]);G&&L.scene.rotation.set(G[0],G[1],G[2]);T&&L.scene.scale.set(T[0],T[1],T[2]);(N||G||T)&&L.scene.updateMatrix()}N=function(){S-=
-1;p();d.onLoadComplete()};for(y in w.cameras){G=w.cameras[y];if(G.type=="perspective")M=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")M=new THREE.Camera,M.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);A=G.position;G=G.target;M.position.set(A[0],A[1],A[2]);M.target.position.set(G[0],G[1],G[2]);L.cameras[y]=M}for(v in w.lights){y=w.lights[v];M=y.color!==void 0?y.color:16777215;G=y.intensity!==void 0?y.intensity:1;if(y.type=="directional")A=
-y.direction,light=new THREE.DirectionalLight(M,G),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(y.type=="point")A=y.position,light=new THREE.PointLight(M,G),light.position.set(A[0],A[1],A[2]);L.scene.addLight(light);L.lights[v]=light}for(B in w.fogs)v=w.fogs[B],v.type=="linear"?J=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(J=new THREE.FogExp2(0,v.density)),G=v.color,J.color.setRGB(G[0],G[1],G[2]),L.fogs[B]=J;if(L.cameras&&w.defaults.camera)L.currentCamera=L.cameras[w.defaults.camera];
-if(L.fogs&&w.defaults.fog)L.scene.fog=L.fogs[w.defaults.fog];G=w.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(G[0],G[1],G[2]);L.bgColorAlpha=w.defaults.bgalpha;for(t in w.geometries)if(B=w.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")R+=1,d.onLoadStart();h=R;for(t in w.geometries)B=w.geometries[t],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),L.geometries[t]=C):B.type=="plane"?(C=
-new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),L.geometries[t]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),L.geometries[t]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),L.geometries[t]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),L.geometries[t]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),
-L.geometries[t]=C):B.type=="bin_mesh"?b.load({model:e(B.url,w.urlBaseType),callback:m(t)}):B.type=="ascii_mesh"?W.load({model:e(B.url,w.urlBaseType),callback:m(t)}):B.type=="embedded_mesh"&&(B=w.embeds[B.id])&&W.createModel(B,o(t),"");for(z in w.textures)if(t=w.textures[z],t.url instanceof Array){S+=t.url.length;for(b=0;b<t.url.length;b++)d.onLoadStart()}else S+=1,d.onLoadStart();Q=S;for(z in w.textures){t=w.textures[z];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];
-if(t.url instanceof Array){for(var b=[],P=0;P<t.url.length;P++)b[P]=e(t.url[P],w.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,N)}else{b=THREE.ImageUtils.loadTexture(e(t.url,w.urlBaseType),t.mapping,N);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter];if(t.repeat)b.repeat.set(t.repeat[0],t.repeat[1]),b.wrapS=b.wrapT=THREE.RepeatWrapping}L.textures[z]=b}for(n in w.materials){z=w.materials[n];for(F in z.parameters)if(F==
-"envMap"||F=="map"||F=="lightMap")z.parameters[F]=L.textures[z.parameters[F]];else if(F=="shading")z.parameters[F]=z.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")z.parameters[F]=THREE[z.parameters[F]]?THREE[z.parameters[F]]:THREE.NormalBlending;else if(F=="combine")z.parameters[F]=z.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(z.parameters[F]=="face")z.parameters[F]=THREE.FaceColors;else if(z.parameters[F])z.parameters[F]=
-THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;z=new THREE[z.type](z.parameters);L.materials[n]=z}k();d.callbackSync(L)}}};
+g;c<h;c+=g)d=p(b,c),e=p(b,c+A.normal_coordinate_bytes),f=p(b,c+A.normal_coordinate_bytes*2),G.push(d/127,e/127,f/127);return A.nnormals*g}(I);I+=function(c){for(var e,f,g=A.uv_coordinate_bytes*2,h=c+A.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+A.uv_coordinate_bytes),F.push(e,f);return A.nuvs*g}(I);ia=I+ia;D=ia+D;H=D+H;$=H+$;ca=$+ca;c=ca+c;aa=c+aa;(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes,e=d+A.uv_index_bytes*3,f=b+A.ntri_flat_uv*e;for(c=b;c<f;c+=e)t(c),y(c+d);return f-b})(D);(function(b){var c,
+d=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=d+A.uv_index_bytes*3,f=b+A.ntri_smooth_uv*e;for(c=b;c<f;c+=e)o(c),y(c+d);return f-b})(H);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes,e=d+A.uv_index_bytes*4,f=b+A.nquad_flat_uv*e;for(c=b;c<f;c+=e)u(c),B(c+d);return f-b})(c);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=d+A.uv_index_bytes*4,f=b+A.nquad_smooth_uv*e;for(c=b;c<f;c+=e)v(c),B(c+d);return f-b})(aa);
+(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes,e=b+A.ntri_flat*d;for(c=b;c<e;c+=d)t(c);return e-b})(I);(function(b){var c,d=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=b+A.ntri_smooth*d;for(c=b;c<e;c+=d)o(c);return e-b})(ia);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes,e=b+A.nquad_flat*d;for(c=b;c<e;c+=d)u(c);return e-b})($);(function(b){var c,d=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=b+A.nquad_smooth*
+d;for(c=b;c<e;c+=d)v(c);return e-b})(ca);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,g){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[g]))},f3n:function(b,c,d,e,f,g,j,k,m){var g=b.materials[g],p=c[k*3],n=c[k*3+1],k=c[k*3+2],
+t=c[m*3],o=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,n,k),new THREE.Vector3(t,o,m)],null,g))},f4n:function(b,c,d,e,f,g,j,k,m,p,n){var j=b.materials[j],t=c[m*3],o=c[m*3+1],m=c[m*3+2],u=c[p*3],v=c[p*3+1],p=c[p*3+2],y=c[n*3],B=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(d,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(t,o,m),new THREE.Vector3(u,v,p),new THREE.Vector3(y,B,n)],null,j))},uv3:function(b,
+c,d,e,f,g,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));b.push(k)},uv4:function(b,c,d,e,f,g,j,k,m){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(e,f));p.push(new THREE.UV(g,j));p.push(new THREE.UV(k,m));b.push(p)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in w.objects)if(!J.objects[u])if(I=w.objects[u],I.geometry!==void 0){if(C=J.geometries[I.geometry]){O=[];for(N=0;N<I.materials.length;N++)O[N]=J.materials[I.materials[N]];A=I.position;r=I.rotation;q=I.quaternion;s=I.scale;q=0;O.length==0&&(O[0]=new THREE.MeshFaceMaterial);
+O.length>1&&(O=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,O);object.name=u;object.position.set(A[0],A[1],A[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=I.visible;J.scene.addObject(object);J.objects[u]=object;if(I.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);J.scene.collisions.colliders.push(b)}if(I.castsShadow)b=new THREE.ShadowVolume(C),J.scene.addChild(b),
+b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},J.triggers[object.name]=b)}}else A=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[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=I.visible!==void 0?I.visible:!1,J.scene.addObject(object),
+J.objects[u]=object,J.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},J.triggers[object.name]=b)}function m(b){return function(c){J.geometries[b]=c;k();S-=1;d.onLoadComplete();n()}}function p(b){return function(c){J.geometries[b]=c}}function n(){d.callbackProgress({totalModels:h,totalTextures:R,loadedModels:h-S,loadedTextures:R-T},J);d.onLoadProgress();S==0&&T==0&&c(J)}var t,o,u,v,y,B,z,I,A,G,F,C,M,L,O,w,W,S,T,h,R,J;w=b.data;b=new THREE.BinaryLoader;W=new THREE.JSONLoader;
+T=S=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var P=!1;for(u in w.objects)if(I=w.objects[u],I.meshCollider){P=!0;break}if(P)J.scene.collisions=new THREE.CollisionSystem;if(w.transform){P=w.transform.position;G=w.transform.rotation;var Q=w.transform.scale;P&&J.scene.position.set(P[0],P[1],P[2]);G&&J.scene.rotation.set(G[0],G[1],G[2]);Q&&J.scene.scale.set(Q[0],Q[1],Q[2]);(P||G||Q)&&J.scene.updateMatrix()}P=function(){T-=
+1;n();d.onLoadComplete()};for(y in w.cameras){G=w.cameras[y];if(G.type=="perspective")M=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")M=new THREE.Camera,M.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);A=G.position;G=G.target;M.position.set(A[0],A[1],A[2]);M.target.position.set(G[0],G[1],G[2]);J.cameras[y]=M}for(v in w.lights){y=w.lights[v];M=y.color!==void 0?y.color:16777215;G=y.intensity!==void 0?y.intensity:1;if(y.type=="directional")A=
+y.direction,light=new THREE.DirectionalLight(M,G),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(y.type=="point")A=y.position,light=new THREE.PointLight(M,G),light.position.set(A[0],A[1],A[2]);J.scene.addLight(light);J.lights[v]=light}for(B in w.fogs)v=w.fogs[B],v.type=="linear"?L=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(L=new THREE.FogExp2(0,v.density)),G=v.color,L.color.setRGB(G[0],G[1],G[2]),J.fogs[B]=L;if(J.cameras&&w.defaults.camera)J.currentCamera=J.cameras[w.defaults.camera];
+if(J.fogs&&w.defaults.fog)J.scene.fog=J.fogs[w.defaults.fog];G=w.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(G[0],G[1],G[2]);J.bgColorAlpha=w.defaults.bgalpha;for(t in w.geometries)if(B=w.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")S+=1,d.onLoadStart();h=S;for(t in w.geometries)B=w.geometries[t],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),J.geometries[t]=C):B.type=="plane"?(C=
+new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),J.geometries[t]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),J.geometries[t]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),J.geometries[t]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),J.geometries[t]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),
+J.geometries[t]=C):B.type=="bin_mesh"?b.load({model:e(B.url,w.urlBaseType),callback:m(t)}):B.type=="ascii_mesh"?W.load({model:e(B.url,w.urlBaseType),callback:m(t)}):B.type=="embedded_mesh"&&(B=w.embeds[B.id])&&W.createModel(B,p(t),"");for(z in w.textures)if(t=w.textures[z],t.url instanceof Array){T+=t.url.length;for(b=0;b<t.url.length;b++)d.onLoadStart()}else T+=1,d.onLoadStart();R=T;for(z in w.textures){t=w.textures[z];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];
+if(t.url instanceof Array){for(var b=[],N=0;N<t.url.length;N++)b[N]=e(t.url[N],w.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,P)}else{b=THREE.ImageUtils.loadTexture(e(t.url,w.urlBaseType),t.mapping,P);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter];if(t.repeat)b.repeat.set(t.repeat[0],t.repeat[1]),b.wrapS=b.wrapT=THREE.RepeatWrapping}J.textures[z]=b}for(o in w.materials){z=w.materials[o];for(F in z.parameters)if(F==
+"envMap"||F=="map"||F=="lightMap")z.parameters[F]=J.textures[z.parameters[F]];else if(F=="shading")z.parameters[F]=z.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")z.parameters[F]=THREE[z.parameters[F]]?THREE[z.parameters[F]]:THREE.NormalBlending;else if(F=="combine")z.parameters[F]=z.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(z.parameters[F]=="face")z.parameters[F]=THREE.FaceColors;else if(z.parameters[F])z.parameters[F]=
+THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;z=new THREE[z.type](z.parameters);J.materials[o]=z}k();d.callbackSync(J)}}};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;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(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,g,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;c[g]=k+j*this.delta;c[g+1]=m;c[g+2]=o;f[g]=this.lerp(p[b],p[b+3],j);f[g+1]=this.lerp(p[b+1],p[b+4],j);f[g+2]=this.lerp(p[b+2],p[b+5],j)};this.VIntY=function(b,c,f,g,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;c[g]=k;c[g+1]=m+j*this.delta;c[g+
-2]=o;c=b+this.yd*3;f[g]=this.lerp(p[b],p[c],j);f[g+1]=this.lerp(p[b+1],p[c+1],j);f[g+2]=this.lerp(p[b+2],p[c+2],j)};this.VIntZ=function(b,c,f,g,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;c[g]=k;c[g+1]=m;c[g+2]=o+j*this.delta;c=b+this.zd*3;f[g]=this.lerp(p[b],p[c],j);f[g+1]=this.lerp(p[b+1],p[c+1],j);f[g+2]=this.lerp(p[b+2],p[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,g,j,k){var m=g+1,o=g+this.yd,p=g+this.zd,t=m+this.yd,n=m+this.zd,u=g+this.yd+this.zd,v=m+this.yd+this.zd,y=0,B=this.field[g],z=this.field[m],I=this.field[o],A=this.field[t],G=this.field[p],F=this.field[n],C=this.field[u],M=this.field[v];B<j&&(y|=1);z<j&&(y|=2);I<j&&(y|=8);A<j&&(y|=4);G<j&&(y|=16);F<j&&(y|=32);C<j&&(y|=128);M<j&&(y|=64);var J=THREE.edgeTable[y];if(J==0)return 0;var O=this.delta,
-w=b+O,W=c+O,O=f+O;J&1&&(this.compNorm(g),this.compNorm(m),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,f,B,z));J&2&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,3,j,w,c,f,z,A));J&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,W,f,I,A));J&8&&(this.compNorm(g),this.compNorm(o),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,f,B,I));J&16&&(this.compNorm(p),this.compNorm(n),this.VIntX(p*3,this.vlist,this.nlist,12,j,b,c,O,G,F));J&32&&(this.compNorm(n),
-this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,15,j,w,c,O,F,M));J&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,W,O,C,M));J&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,j,b,c,O,G,C));J&256&&(this.compNorm(g),this.compNorm(p),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,f,B,G));J&512&&(this.compNorm(m),this.compNorm(n),this.VIntZ(m*3,this.vlist,this.nlist,27,j,w,c,f,z,F));J&1024&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*
-3,this.vlist,this.nlist,30,j,w,W,f,A,M));J&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,W,f,I,C));y<<=4;for(j=g=0;THREE.triTable[y+j]!=-1;)b=y+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,g++;return g};this.posnormtriv=function(b,c,f,g,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,g,j,k,m,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k+j*this.delta;c[g+1]=m;c[g+2]=p;f[g]=this.lerp(n[b],n[b+3],j);f[g+1]=this.lerp(n[b+1],n[b+4],j);f[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,c,f,g,j,k,m,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k;c[g+1]=m+j*this.delta;c[g+
+2]=p;c=b+this.yd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.VIntZ=function(b,c,f,g,j,k,m,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k;c[g+1]=m;c[g+2]=p+j*this.delta;c=b+this.zd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,g,j,k){var m=g+1,p=g+this.yd,n=g+this.zd,t=m+this.yd,o=m+this.zd,u=g+this.yd+this.zd,v=m+this.yd+this.zd,y=0,B=this.field[g],z=this.field[m],I=this.field[p],A=this.field[t],G=this.field[n],F=this.field[o],C=this.field[u],M=this.field[v];B<j&&(y|=1);z<j&&(y|=2);I<j&&(y|=8);A<j&&(y|=4);G<j&&(y|=16);F<j&&(y|=32);C<j&&(y|=128);M<j&&(y|=64);var L=THREE.edgeTable[y];if(L==0)return 0;var O=this.delta,
+w=b+O,W=c+O,O=f+O;L&1&&(this.compNorm(g),this.compNorm(m),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,f,B,z));L&2&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,3,j,w,c,f,z,A));L&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,W,f,I,A));L&8&&(this.compNorm(g),this.compNorm(p),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,f,B,I));L&16&&(this.compNorm(n),this.compNorm(o),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,O,G,F));L&32&&(this.compNorm(o),
+this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,j,w,c,O,F,M));L&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,W,O,C,M));L&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,O,G,C));L&256&&(this.compNorm(g),this.compNorm(n),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,f,B,G));L&512&&(this.compNorm(m),this.compNorm(o),this.VIntZ(m*3,this.vlist,this.nlist,27,j,w,c,f,z,F));L&1024&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*
+3,this.vlist,this.nlist,30,j,w,W,f,A,M));L&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,W,f,I,C));y<<=4;for(j=g=0;THREE.triTable[y+j]!=-1;)b=y+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,g++;return g};this.posnormtriv=function(b,c,f,g,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+
 4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=c[f];this.normalArray[m+1]=c[f+1];this.normalArray[m+2]=c[f+2];this.normalArray[m+3]=c[g];this.normalArray[m+4]=c[g+1];this.normalArray[m+5]=c[g+2];this.normalArray[m+6]=c[j];this.normalArray[m+7]=c[j+1];this.normalArray[m+8]=c[j+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(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,o=c*this.size,p=b*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var n=Math.floor(o-k);n<1&&(n=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-
-1);for(var v,y,B,z,I,A;t<m;t++){p=this.size2*t;y=t/this.size-f;I=y*y;for(y=n;y<o;y++){B=p+this.size*y;v=y/this.size-c;A=v*v;for(v=u;v<k;v++)z=v/this.size-b,z=g/(1.0E-6+z*z+A+I)-j,z>0&&(this.field[B+v]+=z)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,o=this.size,p=this.yd,t=this.zd,n=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f<u;f++)if(g=f/o,g*=g,k=b/(1.0E-4+g)-c,k>0)for(g=0;g<o;g++){m=f+g*p;for(j=0;j<o;j++)n[t*j+m]+=k}};this.addPlaneY=function(b,c){var f,g,j,k,m,o,p=this.size,t=this.yd,n=
-this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(f=g/p,f*=f,k=b/(1.0E-4+f)-c,k>0){m=g*t;for(f=0;f<p;f++){o=m+f;for(j=0;j<p;j++)u[n*j+o]+=k}}};this.addPlaneZ=function(b,c){var f,g,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){m=zd*j;for(g=0;g<size;g++){o=m+g*yd;for(f=0;f<size;f++)field[o+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,g,j,k,m,o,p,t,n=this.size-2;for(j=1;j<n;j++){t=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<n;g++){p=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++)k=(f-this.halfsize)/this.halfsize,c=p+f,this.polygonize(k,m,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(g){var j,k,m,o,p,t,n,u;for(j=0;j<g.count;j++)n=j*3,p=n+1,u=n+2,k=g.positionArray[n],
-m=g.positionArray[p],o=g.positionArray[u],t=new THREE.Vector3(k,m,o),k=g.normalArray[n],m=g.normalArray[p],o=g.normalArray[u],n=new THREE.Vector3(k,m,o),n.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),f.push(n);nfaces=g.count/3;for(j=0;j<nfaces;j++)n=(b+j)*3,p=n+1,u=n+2,t=f[n],k=f[p],m=f[u],n=new THREE.Face3(n,p,u,[t,k,m]),c.faces.push(n);b+=nfaces;g.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,p=c*this.size,n=b*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var o=Math.floor(p-k);o<1&&(o=1);p=Math.floor(p+k);p>this.size-1&&(p=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 v,y,B,z,I,A;t<m;t++){n=this.size2*t;y=t/this.size-f;I=y*y;for(y=o;y<p;y++){B=n+this.size*y;v=y/this.size-c;A=v*v;for(v=u;v<k;v++)z=v/this.size-b,z=g/(1.0E-6+z*z+A+I)-j,z>0&&(this.field[B+v]+=z)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,p=this.size,n=this.yd,t=this.zd,o=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(f=0;f<u;f++)if(g=f/p,g*=g,k=b/(1.0E-4+g)-c,k>0)for(g=0;g<p;g++){m=f+g*n;for(j=0;j<p;j++)o[t*j+m]+=k}};this.addPlaneY=function(b,c){var f,g,j,k,m,p,n=this.size,t=this.yd,o=
+this.zd,u=this.field,v=n*Math.sqrt(b/c);v>n&&(v=n);for(g=0;g<v;g++)if(f=g/n,f*=f,k=b/(1.0E-4+f)-c,k>0){m=g*t;for(f=0;f<n;f++){p=m+f;for(j=0;j<n;j++)u[o*j+p]+=k}}};this.addPlaneZ=function(b,c){var f,g,j,k,m,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){m=zd*j;for(g=0;g<size;g++){p=m+g*yd;for(f=0;f<size;f++)field[p+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,g,j,k,m,p,n,t,o=this.size-2;for(j=1;j<o;j++){t=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<o;g++){n=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,m,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(g){var j,k,m,p,n,t,o,u;for(j=0;j<g.count;j++)o=j*3,n=o+1,u=o+2,k=g.positionArray[o],
+m=g.positionArray[n],p=g.positionArray[u],t=new THREE.Vector3(k,m,p),k=g.normalArray[o],m=g.normalArray[n],p=g.normalArray[u],o=new THREE.Vector3(k,m,p),o.normalize(),n=new THREE.Vertex(t),c.vertices.push(n),f.push(o);nfaces=g.count/3;for(j=0;j<nfaces;j++)o=(b+j)*3,n=o+1,u=o+2,t=f[o],k=f[n],m=f[u],o=new THREE.Face3(o,n,u,[t,k,m]),c.faces.push(o);b+=nfaces;g.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -556,20 +556,20 @@ THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,d,e,f,g=0;c=0;for(d=this.colliders.length;c<d;c++)if(f=this.colliders[c],e=this.rayCast(b,f),e<Number.MAX_VALUE)f.distance=e,e>g?this.hits.push(f):this.hits.unshift(f),g=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var e=this.rayMesh(b,c[d]);if(e.dist<Number.MAX_VALUE){c[d].distance=e.dist;c[d].faceIndex=e.faceIndex;break}d++}if(d>c.length)return null;return c[d]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],k=c.mesh.geometry.vertices[j.a].position,m=c.mesh.geometry.vertices[j.b].position,o=c.mesh.geometry.vertices[j.c].position,p=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(d,k,m,o,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-j instanceof THREE.Face4&&(j=this.rayTriangle(d,k,m,p,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(d,m,o,p,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],k=c.mesh.geometry.vertices[j.a].position,m=c.mesh.geometry.vertices[j.b].position,p=c.mesh.geometry.vertices[j.c].position,n=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(d,k,m,p,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+j instanceof THREE.Face4&&(j=this.rayTriangle(d,k,m,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(d,m,p,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,e,f,g){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);j.sub(d,c);k.sub(e,d);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*f))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);Math.abs(g.x)>Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(b=k.y-c.y,g=d.y-c.y,
 f=e.y-c.y,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y);c=g*e-d*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(b*e-k*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=g*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,d);var e=THREE.CollisionSystem.__r;e.origin.copy(b.origin);e.direction.copy(b.direction);d.multiplyVector3(e.origin);d.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,g=0,j=0,k=0,m=0,o=!0;d.origin.x<c.min.x?(e=c.min.x-d.origin.x,e/=d.direction.x,o=!1,j=-1):d.origin.x>c.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,o=!1,j=1);d.origin.y<c.min.y?(f=c.min.y-d.origin.y,f/=d.direction.y,o=!1,k=-1):d.origin.y>c.max.y&&(f=c.max.y-d.origin.y,f/=d.direction.y,
-o=!1,k=1);d.origin.z<c.min.z?(g=c.min.z-d.origin.z,g/=d.direction.z,o=!1,m=-1):d.origin.z>c.max.z&&(g=c.max.z-d.origin.z,g/=d.direction.z,o=!1,m=1);if(o)return-1;o=0;f>e&&(o=1,e=f);g>e&&(o=2,e=g);switch(o){case 0:k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,g=0,j=0,k=0,m=0,p=!0;d.origin.x<c.min.x?(e=c.min.x-d.origin.x,e/=d.direction.x,p=!1,j=-1):d.origin.x>c.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,p=!1,j=1);d.origin.y<c.min.y?(f=c.min.y-d.origin.y,f/=d.direction.y,p=!1,k=-1):d.origin.y>c.max.y&&(f=c.max.y-d.origin.y,f/=d.direction.y,
+p=!1,k=1);d.origin.z<c.min.z?(g=c.min.z-d.origin.z,g/=d.direction.z,p=!1,m=-1):d.origin.z>c.max.z&&(g=c.max.z-d.origin.z,g/=d.direction.z,p=!1,m=1);if(p)return-1;p=0;f>e&&(p=1,e=f);g>e&&(p=2,e=g);switch(p){case 0:k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*
 e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,m)}return e};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),e=c.point.dot(c.normal);if(d<0)d=(e-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var e=d.dot(b.direction.clone());if(e<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-e*e);if(d>=0)return Math.abs(e)-Math.sqrt(d);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(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=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]),d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,j=new THREE.Matrix4,k=new THREE.Matrix4,m,o,p;f.useTarget=g.useTarget=!1;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);t.width=b;t.height=e;n.width=b;n.height=e};this.render=function(b,d){d.update(null,!0);if(m!==d.aspect||o!==d.near||p!==d.fov){m=d.aspect;o=d.near;p=d.fov;var z=d.projectionMatrix.clone(),I=125/30*0.5,A=I*o/125,G=o*Math.tan(p*Math.PI/360),F;j.n14=I;k.n14=-I;I=-G*m+A;F=G*m+A;z.n11=2*o/(F-I);z.n13=(F+I)/(F-I);f.projectionMatrix=z.clone();I=-G*m-A;F=G*m-A;z.n11=2*o/(F-I);
-z.n13=(F+I)/(F-I);g.projectionMatrix=z.clone()}f.matrix=d.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(d.position);f.near=o;f.far=d.far;e.call(c,b,f,t,!0);g.matrix=d.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(d.position);g.near=o;g.far=d.far;e.call(c,b,g,n,!0);e.call(c,v,u)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,j=new THREE.Matrix4,k=new THREE.Matrix4,m,p,n;f.useTarget=g.useTarget=!1;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),o=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);t.width=b;t.height=e;o.width=b;o.height=e};this.render=function(b,d){d.update(null,!0);if(m!==d.aspect||p!==d.near||n!==d.fov){m=d.aspect;p=d.near;n=d.fov;var z=d.projectionMatrix.clone(),I=125/30*0.5,A=I*p/125,G=p*Math.tan(n*Math.PI/360),F;j.n14=I;k.n14=-I;I=-G*m+A;F=G*m+A;z.n11=2*p/(F-I);z.n13=(F+I)/(F-I);f.projectionMatrix=z.clone();I=-G*m-A;F=G*m-A;z.n11=2*p/(F-I);
+z.n13=(F+I)/(F-I);g.projectionMatrix=z.clone()}f.matrix=d.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(d.position);f.near=p;f.far=d.far;e.call(c,b,f,t,!0);g.matrix=d.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(d.position);g.near=p;g.far=d.far;e.call(c,b,g,o,!0);e.call(c,v,u)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,d=this.setSize,e=this.render,f,g,j=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,e){d.call(c,b,e);f=b/2;g=e};this.render=function(b,d){this.clear();j.fov=d.fov;j.aspect=0.5*d.aspect;j.near=d.near;j.far=d.far;
 j.updateProjectionMatrix();j.position.copy(d.position);j.target.position.copy(d.target.position);j.translateX(c.separation);k.projectionMatrix=j.projectionMatrix;k.position.copy(d.position);k.target.position.copy(d.target.position);k.translateX(-c.separation);this.setViewport(0,0,f,g);e.call(c,b,j);this.setViewport(f,0,f,g);e.call(c,b,k,!1)}};

+ 47 - 47
build/custom/ThreeCanvas.js

@@ -24,20 +24,20 @@ THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[
 THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,k,m,p,l,n,i,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=j;this.n32=k;this.n33=m;this.n34=p;this.n41=l;this.n42=n;this.n43=i;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,j=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,n=a.n34,i=a.n41,q=a.n42,v=a.n43,t=a.n44,G=b.n11,K=b.n12,x=b.n13,B=b.n14,o=b.n21,M=b.n22,
-r=b.n23,u=b.n24,y=b.n31,Q=b.n32,$=b.n33,Z=b.n34;this.n11=c*G+d*o+e*y;this.n12=c*K+d*M+e*Q;this.n13=c*x+d*r+e*$;this.n14=c*B+d*u+e*Z+g;this.n21=f*G+h*o+j*y;this.n22=f*K+h*M+j*Q;this.n23=f*x+h*r+j*$;this.n24=f*B+h*u+j*Z+k;this.n31=m*G+p*o+l*y;this.n32=m*K+p*M+l*Q;this.n33=m*x+p*r+l*$;this.n34=m*B+p*u+l*Z+n;this.n41=i*G+q*o+v*y;this.n42=i*K+q*M+v*Q;this.n43=i*x+q*r+v*$;this.n44=i*B+q*u+v*Z+t;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,j=this.n31,k=this.n32,m=this.n33,p=this.n34,l=this.n41,n=this.n42,i=this.n43,q=this.n44;return d*f*k*l-c*h*k*l-d*g*m*l+b*h*m*l+c*g*p*l-b*f*p*l-d*f*j*n+c*h*j*n+d*e*m*n-a*h*m*n-c*e*p*n+a*f*p*n+d*g*j*i-b*h*j*i-d*e*k*i+a*h*k*i+b*e*p*i-a*g*p*i-c*g*j*q+b*f*j*q+c*e*k*q-a*f*k*q-b*e*m*q+a*g*m*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,j=e*g,k=e*f;this.set(j*
-g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,k*f+c,k*h-d*g,0,j*h-d*f,k*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,j=b*f;b*=h;var k=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(k+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},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,j=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,n=a.n34,i=a.n41,q=a.n42,v=a.n43,t=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-k*l*q+k*p*v-h*n*v-j*p*t+h*l*t;b.n12=g*l*q-e*n*q-g*p*v+d*n*v+e*p*t-d*l*t;b.n13=e*k*q-g*j*q+g*h*v-d*k*v-e*h*t+d*j*t;b.n14=g*j*p-e*k*p-g*h*l+d*k*l+e*h*n-d*j*n;b.n21=k*l*i-j*n*i-k*m*v+f*n*v+j*m*t-f*l*t;b.n22=e*n*i-g*l*i+g*m*v-c*n*v-e*m*t+c*l*t;b.n23=g*j*i-e*k*i-g*f*v+c*k*v+e*f*t-c*j*t;b.n24=
-e*k*m-g*j*m+g*f*l-c*k*l-e*f*n+c*j*n;b.n31=h*n*i-k*p*i+k*m*q-f*n*q-h*m*t+f*p*t;b.n32=g*p*i-d*n*i-g*m*q+c*n*q+d*m*t-c*p*t;b.n33=e*k*i-g*h*i+g*f*q-c*k*q-d*f*t+c*h*t;b.n34=g*h*m-d*k*m-g*f*p+c*k*p+d*f*n-c*h*n;b.n41=j*p*i-h*l*i-j*m*q+f*l*q+h*m*v-f*p*v;b.n42=d*l*i-e*p*i+e*m*q-c*l*q-d*m*v+c*p*v;b.n43=e*h*i-d*j*i-e*f*q+c*j*q+d*f*v-c*h*v;b.n44=d*j*m-e*h*m+e*f*p-c*j*p-d*f*l+c*h*l;b.multiplyScalar(1/a.determinant());return b};
+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,j=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,n=a.n34,i=a.n41,q=a.n42,v=a.n43,s=a.n44,J=b.n11,N=b.n12,x=b.n13,B=b.n14,o=b.n21,O=b.n22,
+r=b.n23,u=b.n24,y=b.n31,R=b.n32,$=b.n33,Z=b.n34,C=b.n41,F=b.n42,L=b.n43,D=b.n44;this.n11=c*J+d*o+e*y+g*C;this.n12=c*N+d*O+e*R+g*F;this.n13=c*x+d*r+e*$+g*L;this.n14=c*B+d*u+e*Z+g*D;this.n21=f*J+h*o+j*y+k*C;this.n22=f*N+h*O+j*R+k*F;this.n23=f*x+h*r+j*$+k*L;this.n24=f*B+h*u+j*Z+k*D;this.n31=m*J+p*o+l*y+n*C;this.n32=m*N+p*O+l*R+n*F;this.n33=m*x+p*r+l*$+n*L;this.n34=m*B+p*u+l*Z+n*D;this.n41=i*J+q*o+v*y+s*C;this.n42=i*N+q*O+v*R+s*F;this.n43=i*x+q*r+v*$+s*L;this.n44=i*B+q*u+v*Z+s*D;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,j=this.n31,k=this.n32,m=this.n33,p=this.n34,l=this.n41,n=this.n42,i=this.n43,q=this.n44;return d*f*k*l-c*h*k*l-d*g*m*l+b*h*m*l+c*g*p*l-b*f*p*l-d*f*j*n+c*h*j*n+d*e*m*n-a*h*m*n-c*e*p*n+a*f*p*n+d*g*j*i-b*h*j*i-d*e*k*i+a*h*k*i+b*e*p*i-a*g*p*i-c*g*j*q+b*f*j*q+c*e*k*q-a*f*k*q-b*e*m*q+a*g*m*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,j=e*g,k=e*f;this.set(j*g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,k*f+c,k*h-d*g,0,j*h-d*f,k*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=
+-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,j=b*f;b*=h;var k=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(k+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},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,j=a.n23,k=a.n24,m=a.n31,p=a.n32,l=a.n33,n=a.n34,i=a.n41,q=a.n42,v=a.n43,s=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-k*l*q+k*p*v-h*n*v-j*p*s+h*l*s;b.n12=g*l*q-e*n*q-g*p*v+d*n*v+e*p*s-d*l*s;b.n13=e*k*q-g*j*q+g*h*v-d*k*v-e*h*s+d*j*s;b.n14=g*j*p-e*k*p-g*h*l+d*k*l+e*h*n-d*j*n;b.n21=k*l*i-j*n*i-k*m*v+f*n*v+j*m*s-f*l*s;b.n22=e*n*i-g*l*i+g*m*v-c*n*v-e*m*s+c*l*s;b.n23=g*j*i-e*k*i-g*f*v+c*k*v+e*f*s-c*j*s;b.n24=
+e*k*m-g*j*m+g*f*l-c*k*l-e*f*n+c*j*n;b.n31=h*n*i-k*p*i+k*m*q-f*n*q-h*m*s+f*p*s;b.n32=g*p*i-d*n*i-g*m*q+c*n*q+d*m*s-c*p*s;b.n33=e*k*i-g*h*i+g*f*q-c*k*q-d*f*s+c*h*s;b.n34=g*h*m-d*k*m-g*f*p+c*k*p+d*f*n-c*h*n;b.n41=j*p*i-h*l*i-j*m*q+f*l*q+h*m*v-f*p*v;b.n42=d*l*i-e*p*i+e*m*q-c*l*q-d*m*v+c*p*v;b.n43=e*h*i-d*j*i-e*f*q+c*j*q+d*f*v-c*h*v;b.n44=d*j*m-e*h*m+e*f*p-c*j*p-d*f*l+c*h*l;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,j=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;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*j;c[6]=a*k;c[7]=a*m;c[8]=a*p;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,j,k;f=new THREE.Matrix4;h=b-a;j=c-d;k=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((g+e)/k);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;
@@ -59,9 +59,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,e,g,f,h=new THREE.Vector3,j=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],f=this.vertices[g.c],h.sub(f.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()||
 h.normalize();g.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,g,r){h=a.vertices[b].position;j=a.vertices[c].position;k=a.vertices[d].position;m=f[e];p=f[g];l=f[r];n=j.x-h.x;i=k.x-h.x;q=j.y-h.y;v=k.y-h.y;t=j.z-h.z;G=k.z-h.z;K=p.u-m.u;x=l.u-m.u;B=p.v-m.v;o=l.v-m.v;M=1/(K*o-x*B);Q.set((o*n-B*i)*
-M,(o*q-B*v)*M,(o*t-B*G)*M);$.set((K*i-x*n)*M,(K*v-x*q)*M,(K*G-x*t)*M);u[b].addSelf(Q);u[c].addSelf(Q);u[d].addSelf(Q);y[b].addSelf($);y[c].addSelf($);y[d].addSelf($)}var b,c,d,e,g,f,h,j,k,m,p,l,n,i,q,v,t,G,K,x,B,o,M,r,u=[],y=[],Q=new THREE.Vector3,$=new THREE.Vector3,Z=new THREE.Vector3,I=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof
-THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var R=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)O.copy(g.vertexNormals[d]),e=g[R[d]],r=u[e],Z.copy(r),Z.subSelf(O.multiplyScalar(O.dot(r))).normalize(),I.cross(g.vertexNormals[d],r),e=I.dot(y[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var 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,g,r){h=a.vertices[b].position;j=a.vertices[c].position;k=a.vertices[d].position;m=f[e];p=f[g];l=f[r];n=j.x-h.x;i=k.x-h.x;q=j.y-h.y;v=k.y-h.y;s=j.z-h.z;J=k.z-h.z;N=p.u-m.u;x=l.u-m.u;B=p.v-m.v;o=l.v-m.v;O=1/(N*o-x*B);R.set((o*n-B*i)*
+O,(o*q-B*v)*O,(o*s-B*J)*O);$.set((N*i-x*n)*O,(N*v-x*q)*O,(N*J-x*s)*O);u[b].addSelf(R);u[c].addSelf(R);u[d].addSelf(R);y[b].addSelf($);y[c].addSelf($);y[d].addSelf($)}var b,c,d,e,g,f,h,j,k,m,p,l,n,i,q,v,s,J,N,x,B,o,O,r,u=[],y=[],R=new THREE.Vector3,$=new THREE.Vector3,Z=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof
+THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)F.copy(g.vertexNormals[d]),e=g[L[d]],r=u[e],Z.copy(r),Z.subSelf(F.multiplyScalar(F.dot(r))).normalize(),C.cross(g.vertexNormals[d],r),e=C.dot(y[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}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}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===
 void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h={};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];
@@ -108,42 +108,42 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.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);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.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.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=j[h]=j[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,j=[],k,m,p=[],l,n=[],i,q,v=[],t,G,K=[],x=new THREE.Vector4,B=new THREE.Vector4,
-o=new THREE.Matrix4,M=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,y=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.projectObjects=function(a,c,f){var c=[],h,i,l;e=0;i=
-a.objects;a=0;for(h=i.length;a<h;a++){l=i[a];var k;if(!(k=!l.visible))if(k=l instanceof THREE.Mesh){a:{k=void 0;for(var j=l.matrixWorld,n=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++)if(k=r[m].x*j.n14+r[m].y*j.n24+r[m].z*j.n34+r[m].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=g[e]=g[e]||new THREE.RenderableObject,e++,d=k,x.copy(l.position),o.multiplyVector3(x),d.object=l,d.z=x.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var I=[],
-O=e.near,R=e.far,L,D,z,N,w,J,H,S,x,s,E,C,F,T,W,ca,X;G=q=l=m=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);r[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);r[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);r[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);r[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);r[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);r[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
-o.n33,o.n44+o.n34);for(L=0;L<6;L++)x=r[L],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(L=x.length;d<L;d++)if(s=x[d].object,s.visible)if(E=s.matrixWorld,C=s.matrixRotationWorld,F=s.materials,T=s.overdraw,h=0,s instanceof THREE.Mesh){W=s.geometry;N=W.vertices;ca=W.faces;W=W.faceVertexUvs;D=0;for(z=N.length;D<z;D++)f=a(),f.positionWorld.copy(N[D].position),E.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>O&&f.positionScreen.z<R;N=0;for(D=ca.length;N<D;N++){z=ca[N];if(z instanceof THREE.Face3)if(w=j[z.a],J=j[z.b],H=j[z.c],w.visible&&J.visible&&H.visible&&(s.doubleSided||s.flipSided!=(H.positionScreen.x-w.positionScreen.x)*(J.positionScreen.y-w.positionScreen.y)-(H.positionScreen.y-w.positionScreen.y)*(J.positionScreen.x-w.positionScreen.x)<0))S=p[m]=p[m]||new THREE.RenderableFace3,m++,k=S,k.v1.copy(w),
-k.v2.copy(J),k.v3.copy(H);else continue;else if(z instanceof THREE.Face4)if(w=j[z.a],J=j[z.b],H=j[z.c],S=j[z.d],w.visible&&J.visible&&H.visible&&S.visible&&(s.doubleSided||s.flipSided!=((S.positionScreen.x-w.positionScreen.x)*(J.positionScreen.y-w.positionScreen.y)-(S.positionScreen.y-w.positionScreen.y)*(J.positionScreen.x-w.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)))X=n[l]=n[l]||new THREE.RenderableFace4,l++,k=X,k.v1.copy(w),k.v2.copy(J),k.v3.copy(H),k.v4.copy(S);else continue;k.normalWorld.copy(z.normal);C.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);E.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);H=z.vertexNormals;w=0;for(J=H.length;w<J;w++)S=k.vertexNormalsWorld[w],S.copy(H[w]),C.multiplyVector3(S);w=0;for(J=W.length;w<J;w++)if(X=W[w][N]){H=0;for(S=X.length;H<S;H++)k.uvs[w][H]=
-X[H]}k.meshMaterials=F;k.faceMaterials=z.materials;k.overdraw=T;k.z=k.centroidScreen.z;I.push(k)}}else if(s instanceof THREE.Line){M.multiply(o,E);N=s.geometry.vertices;w=a();w.positionScreen.copy(N[0].position);M.multiplyVector4(w.positionScreen);D=1;for(z=N.length;D<z;D++)if(w=a(),w.positionScreen.copy(N[D].position),M.multiplyVector4(w.positionScreen),J=j[h-2],u.copy(w.positionScreen),y.copy(J.positionScreen),c(u,y))u.multiplyScalar(1/u.w),y.multiplyScalar(1/y.w),E=v[q]=v[q]||new THREE.RenderableLine,
-q++,i=E,i.v1.positionScreen.copy(u),i.v2.positionScreen.copy(y),i.z=Math.max(u.z,y.z),i.materials=s.materials,I.push(i)}else if(s instanceof THREE.Particle&&(B.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),o.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))E=K[G]=K[G]||new THREE.RenderableParticle,G++,t=E,t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=s.rotation.z,t.scale.x=s.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),t.scale.y=s.scale.y*Math.abs(t.y-(B.y+
-e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),t.materials=s.materials,I.push(t);g&&I.sort(b);return I}};
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)i.globalAlpha=t=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}G=a}}function d(a){if(K!=a.hex)K=a.hex,i.strokeStyle="#"+g(K.toString(16))}function e(a){if(x!=a.hex)x=a.hex,i.fillStyle="#"+g(x.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a}
-var f=this,h=null,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,p,l,n,i=k.getContext("2d"),q=new THREE.Color(0),v=0,t=1,G=0,K=null,x=null,B=null,o=null,M=null,r,u,y,Q,$=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,I,O,R,L,D,z,N,w,J,H,S,oa,s=new THREE.Color(0),E=new THREE.Color(0),C=new THREE.Color(0),F=new THREE.Color(0),T=new THREE.Color(0),W,ca,X,aa,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,da=new THREE.Rectangle,V=new THREE.Rectangle,ya=
-!1,ba=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,P=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(a,b){m=a;p=b;l=m/2;n=p/2;k.width=m;k.height=p;ka.set(-l,-n,l,n);t=1;G=0;M=o=B=x=K=null};this.setClearColor=function(a,b){q=a;v=b};this.setClearColorHex=function(a,b){q.setHex(a);v=b};this.clear=function(){i.setTransform(1,0,0,-1,l,n);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&v==0?i.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),i.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
+THREE.Projector=function(){function a(){var a=j[h]=j[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,j=[],k,m,p=[],l,n=[],i,q,v=[],s,J,N=[],x=new THREE.Vector4,B=new THREE.Vector4,
+o=new THREE.Matrix4,O=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,y=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.projectObjects=function(a,c,f){var c=[],h,i,k;e=0;i=
+a.objects;a=0;for(h=i.length;a<h;a++){k=i[a];var l;if(!(l=!k.visible))if(l=k instanceof THREE.Mesh){a:{l=void 0;for(var j=k.matrixWorld,n=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),m=0;m<6;m++)if(l=r[m].x*j.n14+r[m].y*j.n24+r[m].z*j.n34+r[m].w,l<=n){l=!1;break a}l=!0}l=!l}if(!l)l=g[e]=g[e]||new THREE.RenderableObject,e++,d=l,x.copy(k.position),o.multiplyVector3(x),d.object=k,d.z=x.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var C=[],
+F=e.near,L=e.far,D,G,z,P,w,M,K,S,x,t,H,E,I,T,W,ca,X;J=q=l=m=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);r[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);r[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);r[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);r[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);r[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);r[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
+o.n33,o.n44+o.n34);for(D=0;D<6;D++)x=r[D],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(D=x.length;d<D;d++)if(t=x[d].object,t.visible)if(H=t.matrixWorld,E=t.matrixRotationWorld,I=t.materials,T=t.overdraw,h=0,t instanceof THREE.Mesh){W=t.geometry;P=W.vertices;ca=W.faces;W=W.faceVertexUvs;G=0;for(z=P.length;G<z;G++)f=a(),f.positionWorld.copy(P[G].position),H.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>F&&f.positionScreen.z<L;P=0;for(G=ca.length;P<G;P++){z=ca[P];if(z instanceof THREE.Face3)if(w=j[z.a],M=j[z.b],K=j[z.c],w.visible&&M.visible&&K.visible&&(t.doubleSided||t.flipSided!=(K.positionScreen.x-w.positionScreen.x)*(M.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(M.positionScreen.x-w.positionScreen.x)<0))S=p[m]=p[m]||new THREE.RenderableFace3,m++,k=S,k.v1.copy(w),
+k.v2.copy(M),k.v3.copy(K);else continue;else if(z instanceof THREE.Face4)if(w=j[z.a],M=j[z.b],K=j[z.c],S=j[z.d],w.visible&&M.visible&&K.visible&&S.visible&&(t.doubleSided||t.flipSided!=((S.positionScreen.x-w.positionScreen.x)*(M.positionScreen.y-w.positionScreen.y)-(S.positionScreen.y-w.positionScreen.y)*(M.positionScreen.x-w.positionScreen.x)<0||(M.positionScreen.x-K.positionScreen.x)*(S.positionScreen.y-K.positionScreen.y)-(M.positionScreen.y-K.positionScreen.y)*(S.positionScreen.x-K.positionScreen.x)<
+0)))X=n[l]=n[l]||new THREE.RenderableFace4,l++,k=X,k.v1.copy(w),k.v2.copy(M),k.v3.copy(K),k.v4.copy(S);else continue;k.normalWorld.copy(z.normal);E.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);H.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);K=z.vertexNormals;w=0;for(M=K.length;w<M;w++)S=k.vertexNormalsWorld[w],S.copy(K[w]),E.multiplyVector3(S);w=0;for(M=W.length;w<M;w++)if(X=W[w][P]){K=0;for(S=X.length;K<S;K++)k.uvs[w][K]=
+X[K]}k.meshMaterials=I;k.faceMaterials=z.materials;k.overdraw=T;k.z=k.centroidScreen.z;C.push(k)}}else if(t instanceof THREE.Line){O.multiply(o,H);P=t.geometry.vertices;w=a();w.positionScreen.copy(P[0].position);O.multiplyVector4(w.positionScreen);G=1;for(z=P.length;G<z;G++)if(w=a(),w.positionScreen.copy(P[G].position),O.multiplyVector4(w.positionScreen),M=j[h-2],u.copy(w.positionScreen),y.copy(M.positionScreen),c(u,y))u.multiplyScalar(1/u.w),y.multiplyScalar(1/y.w),H=v[q]=v[q]||new THREE.RenderableLine,
+q++,i=H,i.v1.positionScreen.copy(u),i.v2.positionScreen.copy(y),i.z=Math.max(u.z,y.z),i.materials=t.materials,C.push(i)}else if(t instanceof THREE.Particle&&(B.set(t.matrixWorld.n14,t.matrixWorld.n24,t.matrixWorld.n34,1),o.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))H=N[J]=N[J]||new THREE.RenderableParticle,J++,s=H,s.x=B.x/B.w,s.y=B.y/B.w,s.z=B.z,s.rotation=t.rotation.z,s.scale.x=t.scale.x*Math.abs(s.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),s.scale.y=t.scale.y*Math.abs(s.y-(B.y+
+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),s.materials=t.materials,C.push(s);g&&C.sort(b);return C}};
+THREE.CanvasRenderer=function(a){function b(a){if(s!=a)i.globalAlpha=s=a}function c(a){if(J!=a){switch(a){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}J=a}}function d(a){if(N!=a.hex)N=a.hex,i.strokeStyle="#"+g(N.toString(16))}function e(a){if(x!=a.hex)x=a.hex,i.fillStyle="#"+g(x.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a}
+var f=this,h=null,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,p,l,n,i=k.getContext("2d"),q=new THREE.Color(0),v=0,s=1,J=0,N=null,x=null,B=null,o=null,O=null,r,u,y,R,$=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,C,F,L,D,G,z,P,w,M,K,S,oa,t=new THREE.Color(0),H=new THREE.Color(0),E=new THREE.Color(0),I=new THREE.Color(0),T=new THREE.Color(0),W,ca,X,aa,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,da=new THREE.Rectangle,V=new THREE.Rectangle,ya=
+!1,ba=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,Q=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(a,b){m=a;p=b;l=m/2;n=p/2;k.width=m;k.height=p;ka.set(-l,-n,l,n);s=1;J=0;O=o=B=x=N=null};this.setClearColor=function(a,b){q=a;v=b};this.setClearColorHex=function(a,b){q.setHex(a);v=b};this.clear=function(){i.setTransform(1,0,0,-1,l,n);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&v==0?i.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),i.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
 255)+","+v+")",i.fillRect(da.getX(),da.getY(),da.getWidth(),da.getHeight())),da.empty()};this.render=function(a,g){function k(a){var b,c,d,e=a.lights;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(Y.r+=d.r,Y.g+=d.g,Y.b+=d.b):c instanceof THREE.DirectionalLight?(sa.r+=d.r,sa.g+=d.g,sa.b+=d.b):c instanceof THREE.PointLight&&(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b)}function m(a,b,c,d){var e,f,g,h,i=a.lights,a=0;for(e=i.length;a<e;a++)f=
-i[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(P.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function p(a,f,g){b(g.opacity);c(g.blending);var h,k,m,j,Aa,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,Aa=j.width>>1,o=j.height>>1,g=f.scale.x*
+i[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(Q.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function p(a,f,g){b(g.opacity);c(g.blending);var h,k,m,j,Aa,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,Aa=j.width>>1,o=j.height>>1,g=f.scale.x*
 l,m=f.scale.y*n,h=g*Aa,k=m*o,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(g,-m),i.translate(-Aa,-o),i.drawImage(j,0,0),i.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*l,k=f.scale.y*n,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(d(g.color),e(g.color),i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(h,k),g.program(i),i.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);i.beginPath();
-i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)i.lineWidth=B=a;a=g.linecap;if(o!=a)i.lineCap=o=a;a=g.linejoin;if(M!=a)i.lineJoin=M=a;d(g.color);i.stroke();V.inflate(g.linewidth*2)}}function t(a,d,e,h,k,i,l,j,n){f.data.vertices+=3;f.data.faces++;b(j.opacity);c(j.blending);I=a.positionScreen.x;O=a.positionScreen.y;R=d.positionScreen.x;L=d.positionScreen.y;D=e.positionScreen.x;
-z=e.positionScreen.y;x(I,O,R,L,D,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,aa[k].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,P.copy(l.vertexNormalsWorld[0]),Ba=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ca=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[1]),Da=(P.x*a.n11+P.y*a.n12+P.z*
-a.n13)*0.5+0.5,Ea=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[2]),Fa=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ga=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,ga(I,O,R,L,D,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,
-aa[k].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(E.r=C.r=F.r=Y.r,E.g=C.g=F.g=Y.g,E.b=C.b=F.b=Y.b,m(n,l.v1.positionWorld,l.vertexNormalsWorld[0],E),m(n,l.v2.positionWorld,l.vertexNormalsWorld[1],C),m(n,l.v3.positionWorld,l.vertexNormalsWorld[2],F),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,l.centroidWorld,l.normalWorld,ba),s.r=
-Math.max(0,Math.min(j.color.r*ba.r,1)),s.g=Math.max(0,Math.min(j.color.g*ba.g,1)),s.b=Math.max(0,Math.min(j.color.b*ba.b,1)),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)):j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(e.positionScreen.z,
-W,ca),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)s.r=ma(l.normalWorld.x),s.g=ma(l.normalWorld.y),s.b=ma(l.normalWorld.z),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)}function v(a,d,e,h,j,l,k,i,n){f.data.vertices+=4;f.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)t(a,d,h,0,1,3,k,i,n),t(j,e,l,1,2,3,k,i,n);else if(I=a.positionScreen.x,O=
-a.positionScreen.y,R=d.positionScreen.x,L=d.positionScreen.y,D=e.positionScreen.x,z=e.positionScreen.y,N=h.positionScreen.x,w=h.positionScreen.y,J=j.positionScreen.x,H=j.positionScreen.y,S=l.positionScreen.x,oa=l.positionScreen.y,i instanceof THREE.MeshBasicMaterial)K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)ya?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==
-4?(E.r=C.r=F.r=T.r=Y.r,E.g=C.g=F.g=T.g=Y.g,E.b=C.b=F.b=T.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],E),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],C),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],F),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),s.r=Math.max(0,Math.min(i.color.r*ba.r,1)),s.g=Math.max(0,Math.min(i.color.g*
-ba.g,1)),s.b=Math.max(0,Math.min(i.color.b*ba.b,1)),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(s)):(K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)s.r=ma(k.normalWorld.x),s.g=ma(k.normalWorld.y),s.b=ma(k.normalWorld.z),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):
-ha(s);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(h.positionScreen.z,W,ca),T.r=T.g=T.b=1-la(e.positionScreen.z,W,ca),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)}function x(a,b,c,d,e,f){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(a,b);i.closePath()}function K(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,
-b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b);i.closePath()}function G(a,b,c,e){if(B!=b)i.lineWidth=B=b;if(o!=c)i.lineCap=o=c;if(M!=e)i.lineJoin=M=e;d(a);i.stroke();V.inflate(b*2)}function ha(a){e(a);i.fill()}function ga(a,b,c,d,e,f,g,h,j,k,l,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;j*=p;k*=o;l*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;k-=h;l-=j;m-=h;n-=j;o=k*n-m*l;o!=0&&(p=1/o,o=(n*c-l*e)*p,l=(n*d-l*f)*p,c=(k*e-m*c)*p,d=(k*f-m*d)*p,a=a-o*h-c*j,b=b-l*h-d*j,i.save(),i.transform(o,l,c,d,a,b),
+i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)i.lineWidth=B=a;a=g.linecap;if(o!=a)i.lineCap=o=a;a=g.linejoin;if(O!=a)i.lineJoin=O=a;d(g.color);i.stroke();V.inflate(g.linewidth*2)}}function s(a,d,e,h,k,i,l,j,n){f.data.vertices+=3;f.data.faces++;b(j.opacity);c(j.blending);C=a.positionScreen.x;F=a.positionScreen.y;L=d.positionScreen.x;D=d.positionScreen.y;G=e.positionScreen.x;
+z=e.positionScreen.y;x(C,F,L,D,G,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(C,F,L,D,G,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,aa[k].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,Q.copy(l.vertexNormalsWorld[0]),Ba=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ca=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(l.vertexNormalsWorld[1]),Da=(Q.x*a.n11+Q.y*a.n12+Q.z*
+a.n13)*0.5+0.5,Ea=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(l.vertexNormalsWorld[2]),Fa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ga=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,ga(C,F,L,D,G,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(C,F,L,D,G,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,
+aa[k].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(H.r=E.r=I.r=Y.r,H.g=E.g=I.g=Y.g,H.b=E.b=I.b=Y.b,m(n,l.v1.positionWorld,l.vertexNormalsWorld[0],H),m(n,l.v2.positionWorld,l.vertexNormalsWorld[1],E),m(n,l.v3.positionWorld,l.vertexNormalsWorld[2],I),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,l.centroidWorld,l.normalWorld,ba),t.r=
+Math.max(0,Math.min(j.color.r*ba.r,1)),t.g=Math.max(0,Math.min(j.color.g*ba.g,1)),t.b=Math.max(0,Math.min(j.color.b*ba.b,1)),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)):j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,ca),E.r=E.g=E.b=1-la(d.positionScreen.z,W,ca),I.r=I.g=I.b=1-la(e.positionScreen.z,
+W,ca),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)t.r=ma(l.normalWorld.x),t.g=ma(l.normalWorld.y),t.b=ma(l.normalWorld.z),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)}function v(a,d,e,h,j,l,k,i,n){f.data.vertices+=4;f.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)s(a,d,h,0,1,3,k,i,n),s(j,e,l,1,2,3,k,i,n);else if(C=a.positionScreen.x,F=
+a.positionScreen.y,L=d.positionScreen.x,D=d.positionScreen.y,G=e.positionScreen.x,z=e.positionScreen.y,P=h.positionScreen.x,w=h.positionScreen.y,M=j.positionScreen.x,K=j.positionScreen.y,S=l.positionScreen.x,oa=l.positionScreen.y,i instanceof THREE.MeshBasicMaterial)N(C,F,L,D,G,z,P,w),i.wireframe?J(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)ya?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==
+4?(H.r=E.r=I.r=T.r=Y.r,H.g=E.g=I.g=T.g=Y.g,H.b=E.b=I.b=T.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],H),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],E),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],I),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),t.r=Math.max(0,Math.min(i.color.r*ba.r,1)),t.g=Math.max(0,Math.min(i.color.g*
+ba.g,1)),t.b=Math.max(0,Math.min(i.color.b*ba.b,1)),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(t)):(N(C,F,L,D,G,z,P,w),i.wireframe?J(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)t.r=ma(k.normalWorld.x),t.g=ma(k.normalWorld.y),t.b=ma(k.normalWorld.z),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):
+ha(t);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,ca),E.r=E.g=E.b=1-la(d.positionScreen.z,W,ca),I.r=I.g=I.b=1-la(h.positionScreen.z,W,ca),T.r=T.g=T.b=1-la(e.positionScreen.z,W,ca),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)}function x(a,b,c,d,e,f){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(a,b);i.closePath()}function N(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,
+b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b);i.closePath()}function J(a,b,c,e){if(B!=b)i.lineWidth=B=b;if(o!=c)i.lineCap=o=c;if(O!=e)i.lineJoin=O=e;d(a);i.stroke();V.inflate(b*2)}function ha(a){e(a);i.fill()}function ga(a,b,c,d,e,f,g,h,j,k,l,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;j*=p;k*=o;l*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;k-=h;l-=j;m-=h;n-=j;o=k*n-m*l;o!=0&&(p=1/o,o=(n*c-l*e)*p,l=(n*d-l*f)*p,c=(k*e-m*c)*p,d=(k*f-m*d)*p,a=a-o*h-c*j,b=b-l*h-d*j,i.save(),i.transform(o,l,c,d,a,b),
 i.clip(),i.drawImage(g,0,0),i.restore())}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ea[0]=e<0?0:e>255?255:e;ea[1]=f<0?0:f>255?255:f;ea[2]=a<0?0:a>255?255:a;ea[4]=g<0?0:g>255?255:g;ea[5]=h<0?0:h>255?255:h;ea[6]=b<0?0:b>255?255:b;ea[8]=i<0?0:i>255?255:i;ea[9]=j<0?0:j>255?255:j;ea[10]=c<0?0:c>255?255:c;ea[12]=k<0?0:k>255?255:k;ea[13]=l<0?0:l>255?255:l;
 ea[14]=d<0?0:d>255?255:d;qa.putImageData(za,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ma(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=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var wa,Ha,A,fa,ja,na,xa,U;this.autoClear?this.clear():i.setTransform(1,0,0,-1,l,n);f.data.vertices=0;f.data.faces=0;h=j.projectScene(a,g,this.sortElements);(ya=a.lights.length>0)&&k(a);wa=0;for(Ha=h.length;wa<Ha;wa++){A=
 h[wa];V.empty();if(A instanceof THREE.RenderableParticle){r=A;r.x*=l;r.y*=n;fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&p(r,A,U,a)}else if(A instanceof THREE.RenderableLine){if(r=A.v1,u=A.v2,r.positionScreen.x*=l,r.positionScreen.y*=n,u.positionScreen.x*=l,u.positionScreen.y*=n,V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(u.positionScreen.x,u.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&q(r,
 u,A,U,a)}}else if(A instanceof THREE.RenderableFace3){if(r=A.v1,u=A.v2,y=A.v3,r.positionScreen.x*=l,r.positionScreen.y*=n,u.positionScreen.x*=l,u.positionScreen.y*=n,y.positionScreen.x*=l,y.positionScreen.y*=n,A.overdraw&&(ia(r.positionScreen,u.positionScreen),ia(u.positionScreen,y.positionScreen),ia(y.positionScreen,r.positionScreen)),V.add3Points(r.positionScreen.x,r.positionScreen.y,u.positionScreen.x,u.positionScreen.y,y.positionScreen.x,y.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.meshMaterials.length;fa<
-ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&t(r,u,y,0,1,2,A,U,a)}else U.opacity!=0&&t(r,u,y,0,1,2,A,U,a)}}else if(A instanceof THREE.RenderableFace4&&(r=A.v1,u=A.v2,y=A.v3,Q=A.v4,r.positionScreen.x*=l,r.positionScreen.y*=n,u.positionScreen.x*=l,u.positionScreen.y*=n,y.positionScreen.x*=l,y.positionScreen.y*=n,Q.positionScreen.x*=l,Q.positionScreen.y*=n,$.positionScreen.copy(u.positionScreen),
-Z.positionScreen.copy(Q.positionScreen),A.overdraw&&(ia(r.positionScreen,u.positionScreen),ia(u.positionScreen,Q.positionScreen),ia(Q.positionScreen,r.positionScreen),ia(y.positionScreen,$.positionScreen),ia(y.positionScreen,Z.positionScreen)),V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(u.positionScreen.x,u.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(Q.positionScreen.x,Q.positionScreen.y),ka.instersects(V))){fa=0;for(ja=A.meshMaterials.length;fa<
-ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&v(r,u,y,Q,$,Z,A,U,a)}else U.opacity!=0&&v(r,u,y,Q,$,Z,A,U,a)}da.addRectangle(V)}i.setTransform(1,0,0,1,0,0)}};
+ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&s(r,u,y,0,1,2,A,U,a)}else U.opacity!=0&&s(r,u,y,0,1,2,A,U,a)}}else if(A instanceof THREE.RenderableFace4&&(r=A.v1,u=A.v2,y=A.v3,R=A.v4,r.positionScreen.x*=l,r.positionScreen.y*=n,u.positionScreen.x*=l,u.positionScreen.y*=n,y.positionScreen.x*=l,y.positionScreen.y*=n,R.positionScreen.x*=l,R.positionScreen.y*=n,$.positionScreen.copy(u.positionScreen),
+Z.positionScreen.copy(R.positionScreen),A.overdraw&&(ia(r.positionScreen,u.positionScreen),ia(u.positionScreen,R.positionScreen),ia(R.positionScreen,r.positionScreen),ia(y.positionScreen,$.positionScreen),ia(y.positionScreen,Z.positionScreen)),V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(u.positionScreen.x,u.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(R.positionScreen.x,R.positionScreen.y),ka.instersects(V))){fa=0;for(ja=A.meshMaterials.length;fa<
+ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&v(r,u,y,R,$,Z,A,U,a)}else U.opacity!=0&&v(r,u,y,R,$,Z,A,U,a)}da.addRectangle(V)}i.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}};
 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};

+ 38 - 38
build/custom/ThreeDOM.js

@@ -1,6 +1,6 @@
 // ThreeDOM.js r41/ROME - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,i;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),i=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=i;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=i;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=i;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
+THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
 e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={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,33 +14,33 @@ THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w
 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.set(0,0,0,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={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(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,c=c.matrixWorld.getPosition();d=c.clone().subSelf(a).dot(b);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}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,i,k,l,n,j,m,p=a.geometry,
-q=p.vertices,t=[],d=0;for(e=p.faces.length;d<e;d++)if(g=p.faces[d],j=this.origin.clone(),m=this.direction.clone(),k=a.matrixWorld,f=k.multiplyVector3(q[g.a].position.clone()),h=k.multiplyVector3(q[g.b].position.clone()),i=k.multiplyVector3(q[g.c].position.clone()),k=g instanceof THREE.Face4?k.multiplyVector3(q[g.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),n=m.dot(l),a.doubleSided||(a.flipSided?n>0:n<0))if(l=l.dot((new THREE.Vector3).sub(f,j))/n,j=j.addSelf(m.multiplyScalar(l)),
-g instanceof THREE.Face3)c(j,f,h,i)&&(g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g));else if(g instanceof THREE.Face4&&(c(j,f,h,k)||c(j,h,i,k)))g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g);return t}else return[]}};
-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,l,n){h=!1;b=f;c=g;d=l;e=n;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,l,n,j,m){h?(h=!1,b=f<l?f<j?f:j:l<j?l:j,c=g<n?g<m?g:m:n<m?n:m,d=f>l?f>j?f:j:l>j?l:j,e=g>n?g>m?g:m:n>m?n:m):(b=f<l?f<j?f<b?f:b:j<b?j:b:l<j?l<b?l:b:j<b?j:b,c=g<n?g<m?g<c?g:c:m<c?m:c:n<m?n<c?n:c:m<c?m:c,d=f>l?f>j?f>d?f:d:j>d?j:d:l>j?l>d?l:d:j>d?j:d,e=g>n?g>m?g>e?g:e:m>e?m:e:n>m?n>e?n: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>
+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}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,j,i,l,m,k,n,p=a.geometry,
+q=p.vertices,t=[],d=0;for(e=p.faces.length;d<e;d++)if(g=p.faces[d],k=this.origin.clone(),n=this.direction.clone(),i=a.matrixWorld,f=i.multiplyVector3(q[g.a].position.clone()),h=i.multiplyVector3(q[g.b].position.clone()),j=i.multiplyVector3(q[g.c].position.clone()),i=g instanceof THREE.Face4?i.multiplyVector3(q[g.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),m=n.dot(l),a.doubleSided||(a.flipSided?m>0:m<0))if(l=l.dot((new THREE.Vector3).sub(f,k))/m,k=k.addSelf(n.multiplyScalar(l)),
+g instanceof THREE.Face3)c(k,f,h,j)&&(g={distance:this.origin.distanceTo(k),point:k,face:g,object:a},t.push(g));else if(g instanceof THREE.Face4&&(c(k,f,h,i)||c(k,h,j,i)))g={distance:this.origin.distanceTo(k),point:k,face:g,object:a},t.push(g);return t}else return[]}};
+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,l,m){h=!1;b=f;c=g;d=l;e=m;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,l,m,k,n){h?(h=!1,b=f<l?f<k?f:k:l<k?l:k,c=g<m?g<n?g:n:m<n?m:n,d=f>l?f>k?f:k:l>k?l:k,e=g>m?g>n?g:n:m>n?m:n):(b=f<l?f<k?f<b?f:b:k<b?k:b:l<k?l<b?l:b:k<b?k:b,c=g<m?g<n?g<c?g:c:n<c?n:c:m<n?m<c?m:c:n<c?n:c,d=f>l?f>k?f>d?f:d:k>d?k:d:l>k?l>d?l:d:k>d?k:d,e=g>m?g>n?g>e?g:e:n>e?n:e:m>n?m>e?m:e:n>e?n: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.instersects=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={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,i,k,l,n,j,m,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,k||0,l||1,n||0,j||0,m||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,i,k,l,n,j,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=i;this.n32=k;this.n33=l;this.n34=n;this.n41=j;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,
+THREE.Matrix3.prototype={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,j,i,l,m,k,n,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,i||0,l||1,m||0,k||0,n||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,i,l,m,k,n,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=j;this.n32=i;this.n33=l;this.n34=m;this.n41=k;this.n42=n;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,i=a.n23,k=a.n24,l=a.n31,n=a.n32,j=a.n33,m=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44,H=b.n11,K=b.n12,A=b.n13,v=b.n14,o=b.n21,I=b.n22,
-z=b.n23,D=b.n24,E=b.n31,O=b.n32,P=b.n33,Q=b.n34;this.n11=c*H+d*o+e*E;this.n12=c*K+d*I+e*O;this.n13=c*A+d*z+e*P;this.n14=c*v+d*D+e*Q+g;this.n21=f*H+h*o+i*E;this.n22=f*K+h*I+i*O;this.n23=f*A+h*z+i*P;this.n24=f*v+h*D+i*Q+k;this.n31=l*H+n*o+j*E;this.n32=l*K+n*I+j*O;this.n33=l*A+n*z+j*P;this.n34=l*v+n*D+j*Q+m;this.n41=p*H+q*o+t*E;this.n42=p*K+q*I+t*O;this.n43=p*A+q*z+t*P;this.n44=p*v+q*D+t*Q+r;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,i=this.n31,k=this.n32,l=this.n33,n=this.n34,j=this.n41,m=this.n42,p=this.n43,q=this.n44;return d*f*k*j-c*h*k*j-d*g*l*j+b*h*l*j+c*g*n*j-b*f*n*j-d*f*i*m+c*h*i*m+d*e*l*m-a*h*l*m-c*e*n*m+a*f*n*m+d*g*i*p-b*h*i*p-d*e*k*p+a*h*k*p+b*e*n*p-a*g*n*p-c*g*i*q+b*f*i*q+c*e*k*q-a*f*k*q-b*e*l*q+a*g*l*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,i=e*g,k=e*f;this.set(i*
-g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+c,k*h-d*g,0,i*h-d*f,k*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,i=b*f;b*=h;var k=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},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,i=a.n23,k=a.n24,l=a.n31,n=a.n32,j=a.n33,m=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*m*q-k*j*q+k*n*t-h*m*t-i*n*r+h*j*r;b.n12=g*j*q-e*m*q-g*n*t+d*m*t+e*n*r-d*j*r;b.n13=e*k*q-g*i*q+g*h*t-d*k*t-e*h*r+d*i*r;b.n14=g*i*n-e*k*n-g*h*j+d*k*j+e*h*m-d*i*m;b.n21=k*j*p-i*m*p-k*l*t+f*m*t+i*l*r-f*j*r;b.n22=e*m*p-g*j*p+g*l*t-c*m*t-e*l*r+c*j*r;b.n23=g*i*p-e*k*p-g*f*t+c*k*t+e*f*r-c*i*r;b.n24=
-e*k*l-g*i*l+g*f*j-c*k*j-e*f*m+c*i*m;b.n31=h*m*p-k*n*p+k*l*q-f*m*q-h*l*r+f*n*r;b.n32=g*n*p-d*m*p-g*l*q+c*m*q+d*l*r-c*n*r;b.n33=e*k*p-g*h*p+g*f*q-c*k*q-d*f*r+c*h*r;b.n34=g*h*l-d*k*l-g*f*n+c*k*n+d*f*m-c*h*m;b.n41=i*n*p-h*j*p-i*l*q+f*j*q+h*l*t-f*n*t;b.n42=d*j*p-e*n*p+e*l*q-c*j*q-d*l*t+c*n*t;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*t-c*h*t;b.n44=d*i*l-e*h*l+e*f*n-c*i*n-d*f*j+c*h*j;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,i=-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,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;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*i;c[6]=a*k;c[7]=a*l;c[8]=a*n;return b};
+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,j=a.n23,i=a.n24,l=a.n31,m=a.n32,k=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44,J=b.n11,M=b.n12,G=b.n13,v=b.n14,o=b.n21,K=b.n22,
+z=b.n23,C=b.n24,D=b.n31,Q=b.n32,R=b.n33,S=b.n34,H=b.n41,T=b.n42,O=b.n43,E=b.n44;this.n11=c*J+d*o+e*D+g*H;this.n12=c*M+d*K+e*Q+g*T;this.n13=c*G+d*z+e*R+g*O;this.n14=c*v+d*C+e*S+g*E;this.n21=f*J+h*o+j*D+i*H;this.n22=f*M+h*K+j*Q+i*T;this.n23=f*G+h*z+j*R+i*O;this.n24=f*v+h*C+j*S+i*E;this.n31=l*J+m*o+k*D+n*H;this.n32=l*M+m*K+k*Q+n*T;this.n33=l*G+m*z+k*R+n*O;this.n34=l*v+m*C+k*S+n*E;this.n41=p*J+q*o+t*D+r*H;this.n42=p*M+q*K+t*Q+r*T;this.n43=p*G+q*z+t*R+r*O;this.n44=p*v+q*C+t*S+r*E;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,j=this.n31,i=this.n32,l=this.n33,m=this.n34,k=this.n41,n=this.n42,p=this.n43,q=this.n44;return d*f*i*k-c*h*i*k-d*g*l*k+b*h*l*k+c*g*m*k-b*f*m*k-d*f*j*n+c*h*j*n+d*e*l*n-a*h*l*n-c*e*m*n+a*f*m*n+d*g*j*p-b*h*j*p-d*e*i*p+a*h*i*p+b*e*m*p-a*g*m*p-c*g*j*q+b*f*j*q+c*e*i*q-a*f*i*q-b*e*l*q+a*g*l*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,j=e*g,i=e*f;this.set(j*g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,i*f+c,i*h-d*g,0,j*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=
+-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,j=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=j-e;this.n13=b+f;this.n21=j+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},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,j=a.n23,i=a.n24,l=a.n31,m=a.n32,k=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-i*k*q+i*m*t-h*n*t-j*m*r+h*k*r;b.n12=g*k*q-e*n*q-g*m*t+d*n*t+e*m*r-d*k*r;b.n13=e*i*q-g*j*q+g*h*t-d*i*t-e*h*r+d*j*r;b.n14=g*j*m-e*i*m-g*h*k+d*i*k+e*h*n-d*j*n;b.n21=i*k*p-j*n*p-i*l*t+f*n*t+j*l*r-f*k*r;b.n22=e*n*p-g*k*p+g*l*t-c*n*t-e*l*r+c*k*r;b.n23=g*j*p-e*i*p-g*f*t+c*i*t+e*f*r-c*j*r;b.n24=
+e*i*l-g*j*l+g*f*k-c*i*k-e*f*n+c*j*n;b.n31=h*n*p-i*m*p+i*l*q-f*n*q-h*l*r+f*m*r;b.n32=g*m*p-d*n*p-g*l*q+c*n*q+d*l*r-c*m*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*l-d*i*l-g*f*m+c*i*m+d*f*n-c*h*n;b.n41=j*m*p-h*k*p-j*l*q+f*k*q+h*l*t-f*m*t;b.n42=d*k*p-e*m*p+e*l*q-c*k*q-d*l*t+c*m*t;b.n43=e*h*p-d*j*p-e*f*q+c*j*q+d*f*t-c*h*t;b.n44=d*j*l-e*h*l+e*f*m-c*j*m-d*f*k+c*h*k;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,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,m=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*j;c[6]=a*i;c[7]=a*l;c[8]=a*m;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,i,k;f=new THREE.Matrix4;h=b-a;i=c-d;k=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((g+e)/k);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.makeOrtho=function(a,b,c,d,e,g){var f,h,j,i;f=new THREE.Matrix4;h=b-a;j=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/j;f.n23=0;f.n24=-((c+d)/j);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.Object3D=function(){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.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._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={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)},addChild:function(a){if(this.children.indexOf(a)===
@@ -49,8 +49,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 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)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={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=0.5*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},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,i=this.w,k=i*c+f*e-h*d,l=
-i*d+h*c-g*e,n=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=k*i+c*-g+l*-h-n*-f;b.y=l*i+c*-f+n*-g-k*-h;b.z=n*i+c*-h+k*-f-l*-g;return b}};
+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,j=this.w,i=j*c+f*e-h*d,l=
+j*d+h*c-g*e,m=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*j+c*-g+l*-h-m*-f;b.y=l*j+c*-f+m*-g-i*-h;b.z=m*j+c*-h+i*-f-l*-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.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;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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
@@ -72,17 +72,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.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);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.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.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=i[h]=i[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,i=[],k,l,n=[],j,m=[],p,q,t=[],r,H,K=[],A=new THREE.Vector4,v=new THREE.Vector4,
-o=new THREE.Matrix4,I=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=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.projectObjects=function(a,c,f){var c=[],h,k,i;e=0;k=
-a.objects;a=0;for(h=k.length;a<h;a++){i=k[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh){a:{j=void 0;for(var l=i.matrixWorld,n=-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*l.n14+z[m].y*l.n24+z[m].z*l.n34+z[m].w,j<=n){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,A.copy(i.position),o.multiplyVector3(A),d.object=i,d.z=A.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var A=[],
-V=e.near,W=e.far,M,G,x,C,s,y,w,B,F,u,J,R,T,U,L,S,N;H=q=j=l=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(M=0;M<6;M++)F=z[M],F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z));F=this.projectObjects(d,e,!0);d=0;for(M=F.length;d<M;d++)if(u=F[d].object,u.visible)if(J=u.matrixWorld,R=u.matrixRotationWorld,T=u.materials,U=u.overdraw,h=0,u instanceof THREE.Mesh){L=u.geometry;C=L.vertices;S=L.faces;L=L.faceVertexUvs;G=0;for(x=C.length;G<x;G++)f=a(),f.positionWorld.copy(C[G].position),J.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>V&&f.positionScreen.z<W;C=0;for(G=S.length;C<G;C++){x=S[C];if(x instanceof THREE.Face3)if(s=i[x.a],y=i[x.b],w=i[x.c],s.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(w.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.positionScreen.x)<0))B=n[l]=n[l]||new THREE.RenderableFace3,l++,k=B,k.v1.copy(s),
-k.v2.copy(y),k.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(s=i[x.a],y=i[x.b],w=i[x.c],B=i[x.d],s.visible&&y.visible&&w.visible&&B.visible&&(u.doubleSided||u.flipSided!=((B.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(B.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<
-0)))N=m[j]=m[j]||new THREE.RenderableFace4,j++,k=N,k.v1.copy(s),k.v2.copy(y),k.v3.copy(w),k.v4.copy(B);else continue;k.normalWorld.copy(x.normal);R.multiplyVector3(k.normalWorld);k.centroidWorld.copy(x.centroid);J.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);w=x.vertexNormals;s=0;for(y=w.length;s<y;s++)B=k.vertexNormalsWorld[s],B.copy(w[s]),R.multiplyVector3(B);s=0;for(y=L.length;s<y;s++)if(N=L[s][C]){w=0;for(B=N.length;w<B;w++)k.uvs[s][w]=
-N[w]}k.meshMaterials=T;k.faceMaterials=x.materials;k.overdraw=U;k.z=k.centroidScreen.z;A.push(k)}}else if(u instanceof THREE.Line){I.multiply(o,J);C=u.geometry.vertices;s=a();s.positionScreen.copy(C[0].position);I.multiplyVector4(s.positionScreen);G=1;for(x=C.length;G<x;G++)if(s=a(),s.positionScreen.copy(C[G].position),I.multiplyVector4(s.positionScreen),y=i[h-2],D.copy(s.positionScreen),E.copy(y.positionScreen),c(D,E))D.multiplyScalar(1/D.w),E.multiplyScalar(1/E.w),J=t[q]=t[q]||new THREE.RenderableLine,
-q++,p=J,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(E),p.z=Math.max(D.z,E.z),p.materials=u.materials,A.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))J=K[H]=K[H]||new THREE.RenderableParticle,H++,r=J,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,A.push(r);g&&A.sort(b);return 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 i,k,l,n,j,m,p,q;a=b.projectScene(c,d);i=0;for(k=a.length;i<k;i++)if(j=a[i],j instanceof THREE.RenderableParticle){p=j.x*e+e;q=j.y*g+g;l=0;for(n=j.material.length;l<n;l++)if(m=j.material[l],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=q+"px"}}};
+THREE.Projector=function(){function a(){var a=j[h]=j[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,j=[],i,l,m=[],k,n=[],p,q,t=[],r,J,M=[],G=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],C=new THREE.Vector4,D=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.projectObjects=function(a,c,f){var c=[],h,i,j;e=0;i=
+a.objects;a=0;for(h=i.length;a<h;a++){j=i[a];var k;if(!(k=!j.visible))if(k=j instanceof THREE.Mesh){a:{k=void 0;for(var l=j.matrixWorld,n=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),m=0;m<6;m++)if(k=z[m].x*l.n14+z[m].y*l.n24+z[m].z*l.n34+z[m].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=g[e]=g[e]||new THREE.RenderableObject,e++,d=k,G.copy(j.position),o.multiplyVector3(G),d.object=j,d.z=G.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var H=[],
+G=e.near,O=e.far,E,I,x,B,s,y,w,A,F,u,L,U,W,X,N,V,P;J=q=k=l=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(E=0;E<6;E++)F=z[E],F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z));F=this.projectObjects(d,e,!0);d=0;for(E=F.length;d<E;d++)if(u=F[d].object,u.visible)if(L=u.matrixWorld,U=u.matrixRotationWorld,W=u.materials,X=u.overdraw,h=0,u instanceof THREE.Mesh){N=u.geometry;B=N.vertices;V=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>G&&f.positionScreen.z<O;B=0;for(I=V.length;B<I;B++){x=V[B];if(x instanceof THREE.Face3)if(s=j[x.a],y=j[x.b],w=j[x.c],s.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(w.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.positionScreen.x)<0))A=m[l]=m[l]||new THREE.RenderableFace3,l++,i=A,i.v1.copy(s),
+i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(s=j[x.a],y=j[x.b],w=j[x.c],A=j[x.d],s.visible&&y.visible&&w.visible&&A.visible&&(u.doubleSided||u.flipSided!=((A.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(A.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.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=n[k]=n[k]||new THREE.RenderableFace4,k++,i=P,i.v1.copy(s),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);U.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);w=x.vertexNormals;s=0;for(y=w.length;s<y;s++)A=i.vertexNormalsWorld[s],A.copy(w[s]),U.multiplyVector3(A);s=0;for(y=N.length;s<y;s++)if(P=N[s][B]){w=0;for(A=P.length;w<A;w++)i.uvs[s][w]=
+P[w]}i.meshMaterials=W;i.faceMaterials=x.materials;i.overdraw=X;i.z=i.centroidScreen.z;H.push(i)}}else if(u instanceof THREE.Line){K.multiply(o,L);B=u.geometry.vertices;s=a();s.positionScreen.copy(B[0].position);K.multiplyVector4(s.positionScreen);I=1;for(x=B.length;I<x;I++)if(s=a(),s.positionScreen.copy(B[I].position),K.multiplyVector4(s.positionScreen),y=j[h-2],C.copy(s.positionScreen),D.copy(y.positionScreen),c(C,D))C.multiplyScalar(1/C.w),D.multiplyScalar(1/D.w),L=t[q]=t[q]||new THREE.RenderableLine,
+q++,p=L,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(D),p.z=Math.max(C.z,D.z),p.materials=u.materials,H.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,H.push(r);g&&H.sort(b);return H}};
+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 j,i,l,m,k,n,p,q;a=b.projectScene(c,d);j=0;for(i=a.length;j<i;j++)if(k=a[j],k instanceof THREE.RenderableParticle){p=k.x*e+e;q=k.y*g+g;l=0;for(m=k.material.length;l<m;l++)if(n=k.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=p+"px",n.style.top=q+"px"}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 52 - 52
build/custom/ThreeSVG.js

@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w
 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.set(0,0,0,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={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(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,c=c.matrixWorld.getPosition();d=c.clone().subSelf(a).dot(b);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}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,i,l,k,n,j,o,p=a.geometry,
-q=p.vertices,t=[],d=0;for(e=p.faces.length;d<e;d++)if(g=p.faces[d],j=this.origin.clone(),o=this.direction.clone(),l=a.matrixWorld,f=l.multiplyVector3(q[g.a].position.clone()),h=l.multiplyVector3(q[g.b].position.clone()),i=l.multiplyVector3(q[g.c].position.clone()),l=g instanceof THREE.Face4?l.multiplyVector3(q[g.d].position.clone()):null,k=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),n=o.dot(k),a.doubleSided||(a.flipSided?n>0:n<0))if(k=k.dot((new THREE.Vector3).sub(f,j))/n,j=j.addSelf(o.multiplyScalar(k)),
-g instanceof THREE.Face3)c(j,f,h,i)&&(g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g));else if(g instanceof THREE.Face4&&(c(j,f,h,l)||c(j,h,i,l)))g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g);return t}else return[]}};
-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,k,n){h=!1;b=f;c=g;d=k;e=n;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,k,n,j,o){h?(h=!1,b=f<k?f<j?f:j:k<j?k:j,c=g<n?g<o?g:o:n<o?n:o,d=f>k?f>j?f:j:k>j?k:j,e=g>n?g>o?g:o:n>o?n:o):(b=f<k?f<j?f<b?f:b:j<b?j:b:k<j?k<b?k:b:j<b?j:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=f>k?f>j?f>d?f:d:j>d?j:d:k>j?k>d?k:d:j>d?j:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o: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>
+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}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,i,k,m,n,j,l,p=a.geometry,
+q=p.vertices,t=[],d=0;for(e=p.faces.length;d<e;d++)if(g=p.faces[d],j=this.origin.clone(),l=this.direction.clone(),k=a.matrixWorld,f=k.multiplyVector3(q[g.a].position.clone()),h=k.multiplyVector3(q[g.b].position.clone()),i=k.multiplyVector3(q[g.c].position.clone()),k=g instanceof THREE.Face4?k.multiplyVector3(q[g.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),n=l.dot(m),a.doubleSided||(a.flipSided?n>0:n<0))if(m=m.dot((new THREE.Vector3).sub(f,j))/n,j=j.addSelf(l.multiplyScalar(m)),
+g instanceof THREE.Face3)c(j,f,h,i)&&(g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g));else if(g instanceof THREE.Face4&&(c(j,f,h,k)||c(j,h,i,k)))g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},t.push(g);return t}else return[]}};
+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,m,n){h=!1;b=f;c=g;d=m;e=n;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,m,n,j,l){h?(h=!1,b=f<m?f<j?f:j:m<j?m:j,c=g<n?g<l?g:l:n<l?n:l,d=f>m?f>j?f:j:m>j?m:j,e=g>n?g>l?g:l:n>l?n:l):(b=f<m?f<j?f<b?f:b:j<b?j:b:m<j?m<b?m:b:j<b?j:b,c=g<n?g<l?g<c?g:c:l<c?l:c:n<l?n<c?n:c:l<c?l:c,d=f>m?f>j?f>d?f:d:j>d?j:d:m>j?m>d?m:d:j>d?j:d,e=g>n?g>l?g>e?g:e:l>e?l:e:n>l?n>e?n:e:l>e?l: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.instersects=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={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,i,l,k,n,j,o,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,l||0,k||1,n||0,j||0,o||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,i,l,k,n,j,o,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=i;this.n32=l;this.n33=k;this.n34=n;this.n41=j;this.n42=o;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,
+THREE.Matrix3.prototype={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,i,k,m,n,j,l,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,k||0,m||1,n||0,j||0,l||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,i,k,m,n,j,l,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=i;this.n32=k;this.n33=m;this.n34=n;this.n41=j;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,
 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,i=a.n23,l=a.n24,k=a.n31,n=a.n32,j=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,y=b.n12,E=b.n13,r=b.n14,m=b.n21,z=b.n22,
-A=b.n23,C=b.n24,v=b.n31,L=b.n32,F=b.n33,J=b.n34;this.n11=c*G+d*m+e*v;this.n12=c*y+d*z+e*L;this.n13=c*E+d*A+e*F;this.n14=c*r+d*C+e*J+g;this.n21=f*G+h*m+i*v;this.n22=f*y+h*z+i*L;this.n23=f*E+h*A+i*F;this.n24=f*r+h*C+i*J+l;this.n31=k*G+n*m+j*v;this.n32=k*y+n*z+j*L;this.n33=k*E+n*A+j*F;this.n34=k*r+n*C+j*J+o;this.n41=p*G+q*m+t*v;this.n42=p*y+q*z+t*L;this.n43=p*E+q*A+t*F;this.n44=p*r+q*C+t*J+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,i=this.n31,l=this.n32,k=this.n33,n=this.n34,j=this.n41,o=this.n42,p=this.n43,q=this.n44;return d*f*l*j-c*h*l*j-d*g*k*j+b*h*k*j+c*g*n*j-b*f*n*j-d*f*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*n*o+a*f*n*o+d*g*i*p-b*h*i*p-d*e*l*p+a*h*l*p+b*e*n*p-a*g*n*p-c*g*i*q+b*f*i*q+c*e*l*q-a*f*l*q-b*e*k*q+a*g*k*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,i=e*g,l=e*f;this.set(i*
-g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*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(){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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,i=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=i-e;this.n13=b+f;this.n21=i+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},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,i=a.n23,l=a.n24,k=a.n31,n=a.n32,j=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*o*q-l*j*q+l*n*t-h*o*t-i*n*u+h*j*u;b.n12=g*j*q-e*o*q-g*n*t+d*o*t+e*n*u-d*j*u;b.n13=e*l*q-g*i*q+g*h*t-d*l*t-e*h*u+d*i*u;b.n14=g*i*n-e*l*n-g*h*j+d*l*j+e*h*o-d*i*o;b.n21=l*j*p-i*o*p-l*k*t+f*o*t+i*k*u-f*j*u;b.n22=e*o*p-g*j*p+g*k*t-c*o*t-e*k*u+c*j*u;b.n23=g*i*p-e*l*p-g*f*t+c*l*t+e*f*u-c*i*u;b.n24=
-e*l*k-g*i*k+g*f*j-c*l*j-e*f*o+c*i*o;b.n31=h*o*p-l*n*p+l*k*q-f*o*q-h*k*u+f*n*u;b.n32=g*n*p-d*o*p-g*k*q+c*o*q+d*k*u-c*n*u;b.n33=e*l*p-g*h*p+g*f*q-c*l*q-d*f*u+c*h*u;b.n34=g*h*k-d*l*k-g*f*n+c*l*n+d*f*o-c*h*o;b.n41=i*n*p-h*j*p-i*k*q+f*j*q+h*k*t-f*n*t;b.n42=d*j*p-e*n*p+e*k*q-c*j*q-d*k*t+c*n*t;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*t-c*h*t;b.n44=d*i*k-e*h*k+e*f*n-c*i*n-d*f*j+c*h*j;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,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=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*i;c[6]=a*l;c[7]=a*k;c[8]=a*n;return b};
+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,i=a.n23,k=a.n24,m=a.n31,n=a.n32,j=a.n33,l=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,z=b.n12,E=b.n13,r=b.n14,o=b.n21,A=b.n22,
+B=b.n23,C=b.n24,v=b.n31,M=b.n32,F=b.n33,K=b.n34,x=b.n41,N=b.n42,P=b.n43,J=b.n44;this.n11=c*G+d*o+e*v+g*x;this.n12=c*z+d*A+e*M+g*N;this.n13=c*E+d*B+e*F+g*P;this.n14=c*r+d*C+e*K+g*J;this.n21=f*G+h*o+i*v+k*x;this.n22=f*z+h*A+i*M+k*N;this.n23=f*E+h*B+i*F+k*P;this.n24=f*r+h*C+i*K+k*J;this.n31=m*G+n*o+j*v+l*x;this.n32=m*z+n*A+j*M+l*N;this.n33=m*E+n*B+j*F+l*P;this.n34=m*r+n*C+j*K+l*J;this.n41=p*G+q*o+t*v+u*x;this.n42=p*z+q*A+t*M+u*N;this.n43=p*E+q*B+t*F+u*P;this.n44=p*r+q*C+t*K+u*J;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,i=this.n31,k=this.n32,m=this.n33,n=this.n34,j=this.n41,l=this.n42,p=this.n43,q=this.n44;return d*f*k*j-c*h*k*j-d*g*m*j+b*h*m*j+c*g*n*j-b*f*n*j-d*f*i*l+c*h*i*l+d*e*m*l-a*h*m*l-c*e*n*l+a*f*n*l+d*g*i*p-b*h*i*p-d*e*k*p+a*h*k*p+b*e*n*p-a*g*n*p-c*g*i*q+b*f*i*q+c*e*k*q-a*f*k*q-b*e*m*q+a*g*m*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,i=e*g,k=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+c,k*h-d*g,0,i*h-d*f,k*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=
+-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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,i=b*f;b*=h;var k=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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},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,i=a.n23,k=a.n24,m=a.n31,n=a.n32,j=a.n33,l=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*l*q-k*j*q+k*n*t-h*l*t-i*n*u+h*j*u;b.n12=g*j*q-e*l*q-g*n*t+d*l*t+e*n*u-d*j*u;b.n13=e*k*q-g*i*q+g*h*t-d*k*t-e*h*u+d*i*u;b.n14=g*i*n-e*k*n-g*h*j+d*k*j+e*h*l-d*i*l;b.n21=k*j*p-i*l*p-k*m*t+f*l*t+i*m*u-f*j*u;b.n22=e*l*p-g*j*p+g*m*t-c*l*t-e*m*u+c*j*u;b.n23=g*i*p-e*k*p-g*f*t+c*k*t+e*f*u-c*i*u;b.n24=
+e*k*m-g*i*m+g*f*j-c*k*j-e*f*l+c*i*l;b.n31=h*l*p-k*n*p+k*m*q-f*l*q-h*m*u+f*n*u;b.n32=g*n*p-d*l*p-g*m*q+c*l*q+d*m*u-c*n*u;b.n33=e*k*p-g*h*p+g*f*q-c*k*q-d*f*u+c*h*u;b.n34=g*h*m-d*k*m-g*f*n+c*k*n+d*f*l-c*h*l;b.n41=i*n*p-h*j*p-i*m*q+f*j*q+h*m*t-f*n*t;b.n42=d*j*p-e*n*p+e*m*q-c*j*q-d*m*t+c*n*t;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*t-c*h*t;b.n44=d*i*m-e*h*m+e*f*n-c*i*n-d*f*j+c*h*j;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,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;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*i;c[6]=a*k;c[7]=a*m;c[8]=a*n;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,i,l;f=new THREE.Matrix4;h=b-a;i=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/i;f.n23=0;f.n24=-((c+d)/i);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.makeOrtho=function(a,b,c,d,e,g){var f,h,i,k;f=new THREE.Matrix4;h=b-a;i=c-d;k=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((g+e)/k);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.Object3D=function(){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.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._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={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)},addChild:function(a){if(this.children.indexOf(a)===
@@ -49,8 +49,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 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)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={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=0.5*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},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,i=this.w,l=i*c+f*e-h*d,k=
-i*d+h*c-g*e,n=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=l*i+c*-g+k*-h-n*-f;b.y=k*i+c*-f+n*-g-l*-h;b.z=n*i+c*-h+l*-f-k*-g;return b}};
+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,i=this.w,k=i*c+f*e-h*d,m=
+i*d+h*c-g*e,n=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=k*i+c*-g+m*-h-n*-f;b.y=m*i+c*-f+n*-g-k*-h;b.z=n*i+c*-h+k*-f-m*-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.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;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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
@@ -59,9 +59,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,e,g,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],f=this.vertices[g.c],h.sub(f.position,c.position),i.sub(b.position,c.position),h.crossSelf(i);h.isZero()||
 h.normalize();g.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,g,D){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];n=f[g];j=f[D];o=i.x-h.x;p=l.x-h.x;q=i.y-h.y;t=l.y-h.y;u=i.z-h.z;G=l.z-h.z;y=n.u-k.u;E=j.u-k.u;r=n.v-k.v;m=j.v-k.v;z=1/(y*m-E*r);L.set((m*o-r*p)*
-z,(m*q-r*t)*z,(m*u-r*G)*z);F.set((y*p-E*o)*z,(y*t-E*q)*z,(y*G-E*u)*z);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L);v[b].addSelf(F);v[c].addSelf(F);v[d].addSelf(F)}var b,c,d,e,g,f,h,i,l,k,n,j,o,p,q,t,u,G,y,E,r,m,z,A,C=[],v=[],L=new THREE.Vector3,F=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,v[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof
-THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[S[d]],A=C[e],J.copy(A),J.subSelf(Q.multiplyScalar(Q.dot(A))).normalize(),B.cross(g.vertexNormals[d],A),e=B.dot(v[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var 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,g,D){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;m=f[e];n=f[g];j=f[D];l=i.x-h.x;p=k.x-h.x;q=i.y-h.y;t=k.y-h.y;u=i.z-h.z;G=k.z-h.z;z=n.u-m.u;E=j.u-m.u;r=n.v-m.v;o=j.v-m.v;A=1/(z*o-E*r);M.set((o*l-r*p)*
+A,(o*q-r*t)*A,(o*u-r*G)*A);F.set((z*p-E*l)*A,(z*t-E*q)*A,(z*G-E*u)*A);C[b].addSelf(M);C[c].addSelf(M);C[d].addSelf(M);v[b].addSelf(F);v[c].addSelf(F);v[d].addSelf(F)}var b,c,d,e,g,f,h,i,k,m,n,j,l,p,q,t,u,G,z,E,r,o,A,B,C=[],v=[],M=new THREE.Vector3,F=new THREE.Vector3,K=new THREE.Vector3,x=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,v[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof
+THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var P=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)N.copy(g.vertexNormals[d]),e=g[P[d]],B=C[e],K.copy(B),K.subSelf(N.multiplyScalar(N.dot(B))).normalize(),x.cross(g.vertexNormals[d],B),e=x.dot(v[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}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}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===
 void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h={};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];
@@ -103,30 +103,30 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.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);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.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.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=i[h]=i[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,i=[],l,k,n=[],j,o=[],p,q,t=[],u,G,y=[],E=new THREE.Vector4,r=new THREE.Vector4,
-m=new THREE.Matrix4,z=new THREE.Matrix4,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,v=new THREE.Vector4;this.projectVector=function(a,b){m.multiply(b.projectionMatrix,b.matrixWorldInverse);m.multiplyVector3(a);return a};this.unprojectVector=function(a,b){m.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));m.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,l,j;e=0;l=
-a.objects;a=0;for(h=l.length;a<h;a++){j=l[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh){a:{i=void 0;for(var k=j.matrixWorld,o=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),n=0;n<6;n++)if(i=A[n].x*k.n14+A[n].y*k.n24+A[n].z*k.n34+A[n].w,i<=o){i=!1;break a}i=!0}i=!i}if(!i)i=g[e]=g[e]||new THREE.RenderableObject,e++,d=i,E.copy(j.position),m.multiplyVector3(E),d.object=j,d.z=E.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var B=[],
-E=e.near,S=e.far,N,P,H,M,x,I,D,K,O,s,w,U,W,X,R,V,T;G=q=j=k=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);m.multiply(e.projectionMatrix,e.matrixWorldInverse);A[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);A[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);A[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);A[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);A[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);A[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+
-m.n33,m.n44+m.n34);for(N=0;N<6;N++)O=A[N],O.divideScalar(Math.sqrt(O.x*O.x+O.y*O.y+O.z*O.z));O=this.projectObjects(d,e,!0);d=0;for(N=O.length;d<N;d++)if(s=O[d].object,s.visible)if(w=s.matrixWorld,U=s.matrixRotationWorld,W=s.materials,X=s.overdraw,h=0,s instanceof THREE.Mesh){R=s.geometry;M=R.vertices;V=R.faces;R=R.faceVertexUvs;P=0;for(H=M.length;P<H;P++)f=a(),f.positionWorld.copy(M[P].position),w.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),m.multiplyVector4(f.positionScreen),
-f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>E&&f.positionScreen.z<S;M=0;for(P=V.length;M<P;M++){H=V[M];if(H instanceof THREE.Face3)if(x=i[H.a],I=i[H.b],D=i[H.c],x.visible&&I.visible&&D.visible&&(s.doubleSided||s.flipSided!=(D.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(D.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0))K=n[k]=n[k]||new THREE.RenderableFace3,k++,l=K,l.v1.copy(x),
-l.v2.copy(I),l.v3.copy(D);else continue;else if(H instanceof THREE.Face4)if(x=i[H.a],I=i[H.b],D=i[H.c],K=i[H.d],x.visible&&I.visible&&D.visible&&K.visible&&(s.doubleSided||s.flipSided!=((K.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(K.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0||(I.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-(I.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<
-0)))T=o[j]=o[j]||new THREE.RenderableFace4,j++,l=T,l.v1.copy(x),l.v2.copy(I),l.v3.copy(D),l.v4.copy(K);else continue;l.normalWorld.copy(H.normal);U.multiplyVector3(l.normalWorld);l.centroidWorld.copy(H.centroid);w.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);m.multiplyVector3(l.centroidScreen);D=H.vertexNormals;x=0;for(I=D.length;x<I;x++)K=l.vertexNormalsWorld[x],K.copy(D[x]),U.multiplyVector3(K);x=0;for(I=R.length;x<I;x++)if(T=R[x][M]){D=0;for(K=T.length;D<K;D++)l.uvs[x][D]=
-T[D]}l.meshMaterials=W;l.faceMaterials=H.materials;l.overdraw=X;l.z=l.centroidScreen.z;B.push(l)}}else if(s instanceof THREE.Line){z.multiply(m,w);M=s.geometry.vertices;x=a();x.positionScreen.copy(M[0].position);z.multiplyVector4(x.positionScreen);P=1;for(H=M.length;P<H;P++)if(x=a(),x.positionScreen.copy(M[P].position),z.multiplyVector4(x.positionScreen),I=i[h-2],C.copy(x.positionScreen),v.copy(I.positionScreen),c(C,v))C.multiplyScalar(1/C.w),v.multiplyScalar(1/v.w),w=t[q]=t[q]||new THREE.RenderableLine,
-q++,p=w,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(v),p.z=Math.max(C.z,v.z),p.materials=s.materials,B.push(p)}else if(s instanceof THREE.Particle&&(r.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),m.multiplyVector4(r),r.z/=r.w,r.z>0&&r.z<1))w=y[G]=y[G]||new THREE.RenderableParticle,G++,u=w,u.x=r.x/r.w,u.y=r.y/r.w,u.z=r.z,u.rotation=s.rotation.z,u.scale.x=s.scale.x*Math.abs(u.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),u.scale.y=s.scale.y*Math.abs(u.y-(r.y+
-e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),u.materials=s.materials,B.push(u);g&&B.sort(b);return B}};
-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&&(L.sub(f.position,b.centroidWorld),L.normalize(),g=b.normalWorld.dot(L)*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,h,j,i,k){f.data.vertices+=3;f.data.faces++;B=d(Q++);B.setAttribute("d",
-"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.hex=i.color.hex:i instanceof THREE.MeshLambertMaterial?E?(m.r=z.r,m.g=z.g,m.b=z.b,a(k,j,m),r.r=Math.max(0,Math.min(i.color.r*m.r,1)),r.g=Math.max(0,Math.min(i.color.g*m.g,1)),r.b=Math.max(0,Math.min(i.color.b*m.b,1)),r.updateHex()):r.hex=i.color.hex:i instanceof THREE.MeshDepthMaterial?(v=1-i.__2near/(i.__farPlusNear-
-j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):B.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);l.appendChild(B)}function c(b,c,h,i,
-j,k,n){f.data.vertices+=4;f.data.faces++;B=d(Q++);B.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");k instanceof THREE.MeshBasicMaterial?r.hex=k.color.hex:k instanceof THREE.MeshLambertMaterial?E?(m.r=z.r,m.g=z.g,m.b=z.b,a(n,j,m),r.r=Math.max(0,Math.min(k.color.r*m.r,1)),r.g=Math.max(0,Math.min(k.color.g*m.g,1)),r.b=Math.max(0,Math.min(k.color.b*
-m.b,1)),r.updateHex()):r.hex=k.color.hex:k instanceof THREE.MeshDepthMaterial?(v=1-k.__2near/(k.__farPlusNear-j.z*k.__farMinusNear),r.setRGB(v,v,v)):k instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));k.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+k.wireframeLinewidth+"; stroke-opacity: "+k.opacity+"; stroke-linecap: "+k.wireframeLinecap+"; stroke-linejoin: "+k.wireframeLinejoin):B.setAttribute("style",
-"fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+k.opacity);l.appendChild(B)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),N==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,i=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,j,o,p,q,t,u,G=new THREE.Rectangle,y=new THREE.Rectangle,E=
-!1,r=new THREE.Color(16777215),m=new THREE.Color(16777215),z=new THREE.Color(0),A=new THREE.Color(0),C=new THREE.Color(0),v,L=new THREE.Vector3,F=[],J=[],B,Q,S,N=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":N=1;break;case "low":N=0}};this.setSize=function(a,b){k=a;n=b;j=k/2;o=n/2;l.setAttribute("viewBox",-j+" "+-o+" "+k+" "+n);l.setAttribute("width",k);l.setAttribute("height",n);G.set(-j,-o,
-j,o)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(a,d){var e,k,m,n,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=i.projectScene(a,d,this.sortElements);S=Q=0;if(E=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);A.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(k=s.length;e<k;e++)m=s[e],n=m.color,m instanceof THREE.AmbientLight?(z.r+=n.r,z.g+=n.g,z.b+=n.b):m instanceof THREE.DirectionalLight?(A.r+=n.r,A.g+=n.g,A.b+=n.b):m instanceof
-THREE.PointLight&&(C.r+=n.r,C.g+=n.g,C.b+=n.b)}e=0;for(k=h.length;e<k;e++)if(s=h[e],y.empty(),s instanceof THREE.RenderableParticle){p=s;p.x*=j;p.y*=-o;m=0;for(n=s.materials.length;m<n;)m++}else if(s instanceof THREE.RenderableLine){if(p=s.v1,q=s.v2,p.positionScreen.x*=j,p.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),G.instersects(y)){m=0;for(n=s.materials.length;m<n;)if((w=s.materials[m++])&&
-w.opacity!=0){r=p;v=q;var F=S++;J[F]==null&&(J[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),N==0&&J[F].setAttribute("shape-rendering","crispEdges"));B=J[F];B.setAttribute("x1",r.positionScreen.x);B.setAttribute("y1",r.positionScreen.y);B.setAttribute("x2",v.positionScreen.x);B.setAttribute("y2",v.positionScreen.y);w instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: ##"+g(w.color.hex.toString(16))+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+
-w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin),l.appendChild(B))}}}else if(s instanceof THREE.RenderableFace3){if(p=s.v1,q=s.v2,t=s.v3,p.positionScreen.x*=j,p.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,t.positionScreen.x*=j,t.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),G.instersects(y)){m=0;for(n=s.meshMaterials.length;m<
-n;)if(w=s.meshMaterials[m++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&b(p,q,t,s,w,a)}else w&&w.opacity!=0&&b(p,q,t,s,w,a)}}else if(s instanceof THREE.RenderableFace4&&(p=s.v1,q=s.v2,t=s.v3,u=s.v4,p.positionScreen.x*=j,p.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,t.positionScreen.x*=j,t.positionScreen.y*=-o,u.positionScreen.x*=j,u.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,
-q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),y.addPoint(u.positionScreen.x,u.positionScreen.y),G.instersects(y))){m=0;for(n=s.meshMaterials.length;m<n;)if(w=s.meshMaterials[m++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&c(p,q,t,u,s,w,a)}else w&&w.opacity!=0&&c(p,q,t,u,s,w,a)}}};
+THREE.Projector=function(){function a(){var a=i[h]=i[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,i=[],k,m,n=[],j,l=[],p,q,t=[],u,G,z=[],E=new THREE.Vector4,r=new THREE.Vector4,
+o=new THREE.Matrix4,A=new THREE.Matrix4,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,v=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.projectObjects=function(a,c,f){var c=[],h,k,j;e=0;k=
+a.objects;a=0;for(h=k.length;a<h;a++){j=k[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh){a:{i=void 0;for(var l=j.matrixWorld,m=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),n=0;n<6;n++)if(i=B[n].x*l.n14+B[n].y*l.n24+B[n].z*l.n34+B[n].w,i<=m){i=!1;break a}i=!0}i=!i}if(!i)i=g[e]=g[e]||new THREE.RenderableObject,e++,d=i,E.copy(j.position),o.multiplyVector3(E),d.object=j,d.z=E.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var x=[],
+E=e.near,P=e.far,J,R,H,O,y,I,D,L,Q,s,w,U,W,X,S,V,T;G=q=j=m=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);B[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);B[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);B[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);B[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);B[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);B[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
+o.n33,o.n44+o.n34);for(J=0;J<6;J++)Q=B[J],Q.divideScalar(Math.sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z));Q=this.projectObjects(d,e,!0);d=0;for(J=Q.length;d<J;d++)if(s=Q[d].object,s.visible)if(w=s.matrixWorld,U=s.matrixRotationWorld,W=s.materials,X=s.overdraw,h=0,s instanceof THREE.Mesh){S=s.geometry;O=S.vertices;V=S.faces;S=S.faceVertexUvs;R=0;for(H=O.length;R<H;R++)f=a(),f.positionWorld.copy(O[R].position),w.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>E&&f.positionScreen.z<P;O=0;for(R=V.length;O<R;O++){H=V[O];if(H instanceof THREE.Face3)if(y=i[H.a],I=i[H.b],D=i[H.c],y.visible&&I.visible&&D.visible&&(s.doubleSided||s.flipSided!=(D.positionScreen.x-y.positionScreen.x)*(I.positionScreen.y-y.positionScreen.y)-(D.positionScreen.y-y.positionScreen.y)*(I.positionScreen.x-y.positionScreen.x)<0))L=n[m]=n[m]||new THREE.RenderableFace3,m++,k=L,k.v1.copy(y),
+k.v2.copy(I),k.v3.copy(D);else continue;else if(H instanceof THREE.Face4)if(y=i[H.a],I=i[H.b],D=i[H.c],L=i[H.d],y.visible&&I.visible&&D.visible&&L.visible&&(s.doubleSided||s.flipSided!=((L.positionScreen.x-y.positionScreen.x)*(I.positionScreen.y-y.positionScreen.y)-(L.positionScreen.y-y.positionScreen.y)*(I.positionScreen.x-y.positionScreen.x)<0||(I.positionScreen.x-D.positionScreen.x)*(L.positionScreen.y-D.positionScreen.y)-(I.positionScreen.y-D.positionScreen.y)*(L.positionScreen.x-D.positionScreen.x)<
+0)))T=l[j]=l[j]||new THREE.RenderableFace4,j++,k=T,k.v1.copy(y),k.v2.copy(I),k.v3.copy(D),k.v4.copy(L);else continue;k.normalWorld.copy(H.normal);U.multiplyVector3(k.normalWorld);k.centroidWorld.copy(H.centroid);w.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);o.multiplyVector3(k.centroidScreen);D=H.vertexNormals;y=0;for(I=D.length;y<I;y++)L=k.vertexNormalsWorld[y],L.copy(D[y]),U.multiplyVector3(L);y=0;for(I=S.length;y<I;y++)if(T=S[y][O]){D=0;for(L=T.length;D<L;D++)k.uvs[y][D]=
+T[D]}k.meshMaterials=W;k.faceMaterials=H.materials;k.overdraw=X;k.z=k.centroidScreen.z;x.push(k)}}else if(s instanceof THREE.Line){A.multiply(o,w);O=s.geometry.vertices;y=a();y.positionScreen.copy(O[0].position);A.multiplyVector4(y.positionScreen);R=1;for(H=O.length;R<H;R++)if(y=a(),y.positionScreen.copy(O[R].position),A.multiplyVector4(y.positionScreen),I=i[h-2],C.copy(y.positionScreen),v.copy(I.positionScreen),c(C,v))C.multiplyScalar(1/C.w),v.multiplyScalar(1/v.w),w=t[q]=t[q]||new THREE.RenderableLine,
+q++,p=w,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(v),p.z=Math.max(C.z,v.z),p.materials=s.materials,x.push(p)}else if(s instanceof THREE.Particle&&(r.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),o.multiplyVector4(r),r.z/=r.w,r.z>0&&r.z<1))w=z[G]=z[G]||new THREE.RenderableParticle,G++,u=w,u.x=r.x/r.w,u.y=r.y/r.w,u.z=r.z,u.rotation=s.rotation.z,u.scale.x=s.scale.x*Math.abs(u.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),u.scale.y=s.scale.y*Math.abs(u.y-(r.y+
+e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),u.materials=s.materials,x.push(u);g&&x.sort(b);return x}};
+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&&(M.sub(f.position,b.centroidWorld),M.normalize(),g=b.normalWorld.dot(M)*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,h,j,i,l){f.data.vertices+=3;f.data.faces++;x=d(N++);x.setAttribute("d",
+"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.hex=i.color.hex:i instanceof THREE.MeshLambertMaterial?E?(o.r=A.r,o.g=A.g,o.b=A.b,a(l,j,o),r.r=Math.max(0,Math.min(i.color.r*o.r,1)),r.g=Math.max(0,Math.min(i.color.g*o.g,1)),r.b=Math.max(0,Math.min(i.color.b*o.b,1)),r.updateHex()):r.hex=i.color.hex:i instanceof THREE.MeshDepthMaterial?(v=1-i.__2near/(i.__farPlusNear-
+j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?x.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):x.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);k.appendChild(x)}function c(b,c,h,i,
+j,l,m){f.data.vertices+=4;f.data.faces++;x=d(N++);x.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?r.hex=l.color.hex:l instanceof THREE.MeshLambertMaterial?E?(o.r=A.r,o.g=A.g,o.b=A.b,a(m,j,o),r.r=Math.max(0,Math.min(l.color.r*o.r,1)),r.g=Math.max(0,Math.min(l.color.g*o.g,1)),r.b=Math.max(0,Math.min(l.color.b*
+o.b,1)),r.updateHex()):r.hex=l.color.hex:l instanceof THREE.MeshDepthMaterial?(v=1-l.__2near/(l.__farPlusNear-j.z*l.__farMinusNear),r.setRGB(v,v,v)):l instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));l.wireframe?x.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):x.setAttribute("style",
+"fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+l.opacity);k.appendChild(x)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),J==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,j,l,p,q,t,u,G=new THREE.Rectangle,z=new THREE.Rectangle,E=
+!1,r=new THREE.Color(16777215),o=new THREE.Color(16777215),A=new THREE.Color(0),B=new THREE.Color(0),C=new THREE.Color(0),v,M=new THREE.Vector3,F=[],K=[],x,N,P,J=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":J=1;break;case "low":J=0}};this.setSize=function(a,b){m=a;n=b;j=m/2;l=n/2;k.setAttribute("viewBox",-j+" "+-l+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);G.set(-j,-l,
+j,l)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(a,d){var e,o,m,n,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=i.projectScene(a,d,this.sortElements);P=N=0;if(E=a.lights.length>0){s=a.lights;A.setRGB(0,0,0);B.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(o=s.length;e<o;e++)m=s[e],n=m.color,m instanceof THREE.AmbientLight?(A.r+=n.r,A.g+=n.g,A.b+=n.b):m instanceof THREE.DirectionalLight?(B.r+=n.r,B.g+=n.g,B.b+=n.b):m instanceof
+THREE.PointLight&&(C.r+=n.r,C.g+=n.g,C.b+=n.b)}e=0;for(o=h.length;e<o;e++)if(s=h[e],z.empty(),s instanceof THREE.RenderableParticle){p=s;p.x*=j;p.y*=-l;m=0;for(n=s.materials.length;m<n;)m++}else if(s instanceof THREE.RenderableLine){if(p=s.v1,q=s.v2,p.positionScreen.x*=j,p.positionScreen.y*=-l,q.positionScreen.x*=j,q.positionScreen.y*=-l,z.addPoint(p.positionScreen.x,p.positionScreen.y),z.addPoint(q.positionScreen.x,q.positionScreen.y),G.instersects(z)){m=0;for(n=s.materials.length;m<n;)if((w=s.materials[m++])&&
+w.opacity!=0){r=p;v=q;var F=P++;K[F]==null&&(K[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),J==0&&K[F].setAttribute("shape-rendering","crispEdges"));x=K[F];x.setAttribute("x1",r.positionScreen.x);x.setAttribute("y1",r.positionScreen.y);x.setAttribute("x2",v.positionScreen.x);x.setAttribute("y2",v.positionScreen.y);w instanceof THREE.LineBasicMaterial&&(x.setAttribute("style","fill: none; stroke: ##"+g(w.color.hex.toString(16))+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+
+w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin),k.appendChild(x))}}}else if(s instanceof THREE.RenderableFace3){if(p=s.v1,q=s.v2,t=s.v3,p.positionScreen.x*=j,p.positionScreen.y*=-l,q.positionScreen.x*=j,q.positionScreen.y*=-l,t.positionScreen.x*=j,t.positionScreen.y*=-l,z.addPoint(p.positionScreen.x,p.positionScreen.y),z.addPoint(q.positionScreen.x,q.positionScreen.y),z.addPoint(t.positionScreen.x,t.positionScreen.y),G.instersects(z)){m=0;for(n=s.meshMaterials.length;m<
+n;)if(w=s.meshMaterials[m++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&b(p,q,t,s,w,a)}else w&&w.opacity!=0&&b(p,q,t,s,w,a)}}else if(s instanceof THREE.RenderableFace4&&(p=s.v1,q=s.v2,t=s.v3,u=s.v4,p.positionScreen.x*=j,p.positionScreen.y*=-l,q.positionScreen.x*=j,q.positionScreen.y*=-l,t.positionScreen.x*=j,t.positionScreen.y*=-l,u.positionScreen.x*=j,u.positionScreen.y*=-l,z.addPoint(p.positionScreen.x,p.positionScreen.y),z.addPoint(q.positionScreen.x,
+q.positionScreen.y),z.addPoint(t.positionScreen.x,t.positionScreen.y),z.addPoint(u.positionScreen.x,u.positionScreen.y),G.instersects(z))){m=0;for(n=s.meshMaterials.length;m<n;)if(w=s.meshMaterials[m++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&c(p,q,t,u,s,w,a)}else w&&w.opacity!=0&&c(p,q,t,u,s,w,a)}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}};
 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};

+ 138 - 138
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r41/ROME - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,o;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),o=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=o;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=o;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=o;break;case 6:case 0:f=e,g=d,i=b}this.setRGB(f,
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,m;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),m=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=m;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=m;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=m;break;case 6:case 0:f=e,g=d,i=b}this.setRGB(f,
 g,i)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
 THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,d){this.x+=(b.x-this.x)*d;this.y+=(b.y-this.y)*d;this.z+=(b.z-this.z)*d;this.w+=(b.w-this.w)*d;return this}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d<e;d++)f=f.concat(this.intersectObject(b[d]));f.sort(function(b,d){return b.distance-d.distance});return f},intersectObject:function(b){function d(b,d,e){var f,e=e.matrixWorld.getPosition();f=e.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),
-g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,i,h,j,o,m,n,q,t,r,D=b.geometry,
-x=D.vertices,z=[],f=0;for(g=D.faces.length;f<g;f++)if(i=D.faces[f],t=this.origin.clone(),r=this.direction.clone(),m=b.matrixWorld,h=m.multiplyVector3(x[i.a].position.clone()),j=m.multiplyVector3(x[i.b].position.clone()),o=m.multiplyVector3(x[i.c].position.clone()),m=i instanceof THREE.Face4?m.multiplyVector3(x[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),q=r.dot(n),b.doubleSided||(b.flipSided?q>0:q<0))if(n=n.dot((new THREE.Vector3).sub(h,t))/q,t=t.addSelf(r.multiplyScalar(n)),
-i instanceof THREE.Face3)e(t,h,j,o)&&(i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},z.push(i));else if(i instanceof THREE.Face4&&(e(t,h,j,m)||e(t,j,o,m)))i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},z.push(i);return z}else return[]}};
+g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,i,h,j,m,o,n,q,t,r,B=b.geometry,
+x=B.vertices,z=[],f=0;for(g=B.faces.length;f<g;f++)if(i=B.faces[f],t=this.origin.clone(),r=this.direction.clone(),o=b.matrixWorld,h=o.multiplyVector3(x[i.a].position.clone()),j=o.multiplyVector3(x[i.b].position.clone()),m=o.multiplyVector3(x[i.c].position.clone()),o=i instanceof THREE.Face4?o.multiplyVector3(x[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),q=r.dot(n),b.doubleSided||(b.flipSided?q>0:q<0))if(n=n.dot((new THREE.Vector3).sub(h,t))/q,t=t.addSelf(r.multiplyScalar(n)),
+i instanceof THREE.Face3)e(t,h,j,m)&&(i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},z.push(i));else if(i instanceof THREE.Face4&&(e(t,h,j,o)||e(t,j,m,o)))i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},z.push(i);return z}else return[]}};
 THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,q){j=!1;d=h;e=i;f=n;g=q;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
 function(h,i,n,q,t,r){j?(j=!1,d=h<n?h<t?h:t:n<t?n:t,e=i<q?i<r?i:r:q<r?q:r,f=h>n?h>t?h:t:n>t?n:t,g=i>q?i>r?i:r:q>r?q:r):(d=h<n?h<t?h<d?h:d:t<d?t:d:n<t?n<d?n:d:t<d?t:d,e=i<q?i<r?i<e?i:e:r<e?r:e:q<r?q<e?q:e:r<e?r:e,f=h>n?h>t?h>f?h:f:t>f?t:f:n>t?n>f?n:f:t>f?t:f,g=i>q?i>r?i>g?i:g:r>g?r:g:q>r?q>g?q:g:r>g?r:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,o,m,n,q,t,r,D,x){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,o||0,m||0,n||1,q||0,t||0,r||0,D||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,o,m,n,q,t,r,D,x){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=o;this.n32=m;this.n33=n;this.n34=q;this.n41=t;this.n42=r;this.n43=D;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
+THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,m,o,n,q,t,r,B,x){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,m||0,o||0,n||1,q||0,t||0,r||0,B||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,m,o,n,q,t,r,B,x){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=m;this.n32=o;this.n33=n;this.n34=q;this.n41=t;this.n42=r;this.n43=B;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,m=b.n24,n=b.n31,q=b.n32,t=b.n33,r=b.n34,D=b.n41,x=b.n42,z=b.n43,B=b.n44,ea=d.n11,M=d.n12,N=d.n13,F=d.n14,y=d.n21,Y=d.n22,
-C=d.n23,Z=d.n24,K=d.n31,ka=d.n32,S=d.n33,P=d.n34;this.n11=e*ea+f*y+g*K;this.n12=e*M+f*Y+g*ka;this.n13=e*N+f*C+g*S;this.n14=e*F+f*Z+g*P+i;this.n21=h*ea+j*y+o*K;this.n22=h*M+j*Y+o*ka;this.n23=h*N+j*C+o*S;this.n24=h*F+j*Z+o*P+m;this.n31=n*ea+q*y+t*K;this.n32=n*M+q*Y+t*ka;this.n33=n*N+q*C+t*S;this.n34=n*F+q*Z+t*P+r;this.n41=D*ea+x*y+z*K;this.n42=D*M+x*Y+z*ka;this.n43=D*N+x*C+z*S;this.n44=D*F+x*Z+z*P+B;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;
-e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
-this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,o=this.n31,m=this.n32,n=this.n33,q=this.n34,t=this.n41,r=this.n42,D=this.n43,x=this.n44;return f*h*m*t-e*j*m*t-f*i*n*t+d*j*n*t+e*i*q*t-d*h*q*t-f*h*o*r+e*j*o*r+f*g*n*r-b*j*n*r-e*g*q*r+b*h*q*r+f*i*o*D-d*j*o*D-f*g*m*D+b*j*m*D+d*g*q*D-b*i*q*D-e*i*o*x+d*h*o*x+e*g*m*x-b*h*m*x-d*g*n*x+b*i*n*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
-this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
-this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
-this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,
-d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j=b.z,o=g*i,m=g*h;this.set(o*
-i+e,o*h-f*j,o*j+f*h,0,o*h+f*j,m*h+e,m*j-f*i,0,o*j-f*h,m*j+f*i,g*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this},
-setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,o=d*h;d*=j;var m=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(m+f);this.n12=o-g;this.n13=d+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+m);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,m=b.n24,n=b.n31,q=b.n32,t=b.n33,r=b.n34,D=b.n41,x=b.n42,z=b.n43,B=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=o*r*x-m*t*x+m*q*z-j*r*z-o*q*B+j*t*B;d.n12=i*t*x-g*r*x-i*q*z+f*r*z+g*q*B-f*t*B;d.n13=g*m*x-i*o*x+i*j*z-f*m*z-g*j*B+f*o*B;d.n14=i*o*q-g*m*q-i*j*t+f*m*t+g*j*r-f*o*r;d.n21=m*t*D-o*r*D-m*n*z+h*r*z+o*n*B-h*t*B;d.n22=g*r*D-i*t*D+i*n*z-e*r*z-g*n*B+e*t*B;d.n23=i*o*D-g*m*D-i*h*z+e*m*z+g*h*B-e*o*B;d.n24=
-g*m*n-i*o*n+i*h*t-e*m*t-g*h*r+e*o*r;d.n31=j*r*D-m*q*D+m*n*x-h*r*x-j*n*B+h*q*B;d.n32=i*q*D-f*r*D-i*n*x+e*r*x+f*n*B-e*q*B;d.n33=g*m*D-i*j*D+i*h*x-e*m*x-f*h*B+e*j*B;d.n34=i*j*n-f*m*n-i*h*q+e*m*q+f*h*r-e*j*r;d.n41=o*q*D-j*t*D-o*n*x+h*t*x+j*n*z-h*q*z;d.n42=f*t*D-g*q*D+g*n*x-e*t*x-f*n*z+e*q*z;d.n43=g*j*D-f*o*D-g*h*x+e*o*x+f*h*z-e*j*z;d.n44=f*o*n-g*j*n+g*h*q-e*o*q-f*h*t+e*j*t;d.multiplyScalar(1/b.determinant());return d};
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*o;e[6]=b*m;e[7]=b*n;e[8]=b*q;return d};
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,m=b.n23,o=b.n24,n=b.n31,q=b.n32,t=b.n33,r=b.n34,B=b.n41,x=b.n42,z=b.n43,D=b.n44,fa=d.n11,M=d.n12,O=d.n13,F=d.n14,y=d.n21,Z=d.n22,
+C=d.n23,$=d.n24,K=d.n31,ma=d.n32,T=d.n33,Q=d.n34,c=d.n41,ga=d.n42,R=d.n43,ja=d.n44;this.n11=e*fa+f*y+g*K+i*c;this.n12=e*M+f*Z+g*ma+i*ga;this.n13=e*O+f*C+g*T+i*R;this.n14=e*F+f*$+g*Q+i*ja;this.n21=h*fa+j*y+m*K+o*c;this.n22=h*M+j*Z+m*ma+o*ga;this.n23=h*O+j*C+m*T+o*R;this.n24=h*F+j*$+m*Q+o*ja;this.n31=n*fa+q*y+t*K+r*c;this.n32=n*M+q*Z+t*ma+r*ga;this.n33=n*O+q*C+t*T+r*R;this.n34=n*F+q*$+t*Q+r*ja;this.n41=B*fa+x*y+z*K+D*c;this.n42=B*M+x*Z+z*ma+D*ga;this.n43=B*O+x*C+z*T+D*R;this.n44=B*F+x*$+z*Q+D*ja;return this},
+multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;
+this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,m=this.n31,o=this.n32,n=this.n33,q=this.n34,t=this.n41,r=this.n42,B=this.n43,x=this.n44;return f*h*o*t-e*j*o*t-f*i*n*t+d*j*n*t+e*i*q*t-d*h*q*t-f*h*m*r+e*j*m*r+f*g*n*r-b*j*n*r-e*g*q*r+b*h*q*r+f*i*m*B-d*j*m*B-f*g*o*B+b*j*o*B+d*g*q*B-b*i*q*B-e*i*m*x+d*h*m*x+e*g*o*x-b*h*o*x-d*g*n*x+b*i*n*x},transpose:function(){var b;
+b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;
+b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
+b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},
+setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},
+setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j=b.z,m=g*i,o=g*h;this.set(m*i+e,m*h-f*j,m*j+f*h,0,m*h+f*j,o*h+e,o*j-f*i,0,m*j-f*h,o*j+f*i,g*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,
+this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;
+this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,m=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=m-g;this.n13=d+h;this.n21=m+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=
+d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,m=b.n23,o=b.n24,n=b.n31,q=b.n32,t=b.n33,r=b.n34,B=b.n41,x=b.n42,z=b.n43,D=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=m*r*x-o*t*x+o*q*z-j*r*z-m*q*D+j*t*D;d.n12=i*t*x-g*r*x-i*q*z+f*r*z+g*q*D-f*t*D;d.n13=g*o*x-i*m*x+i*j*z-f*o*z-g*j*D+f*m*D;d.n14=i*m*q-g*o*q-i*j*t+f*o*t+g*j*r-f*m*r;d.n21=o*t*B-m*r*B-o*n*z+h*r*z+m*n*D-h*t*D;d.n22=g*r*B-i*t*B+i*n*z-e*r*z-g*n*D+e*t*D;d.n23=i*m*B-g*o*B-i*h*z+e*o*z+g*h*D-e*m*D;d.n24=
+g*o*n-i*m*n+i*h*t-e*o*t-g*h*r+e*m*r;d.n31=j*r*B-o*q*B+o*n*x-h*r*x-j*n*D+h*q*D;d.n32=i*q*B-f*r*B-i*n*x+e*r*x+f*n*D-e*q*D;d.n33=g*o*B-i*j*B+i*h*x-e*o*x-f*h*D+e*j*D;d.n34=i*j*n-f*o*n-i*h*q+e*o*q+f*h*r-e*j*r;d.n41=m*q*B-j*t*B-m*n*x+h*t*x+j*n*z-h*q*z;d.n42=f*t*B-g*q*B+g*n*x-e*t*x-f*n*z+e*q*z;d.n43=g*j*B-f*m*B-g*h*x+e*m*x+f*h*z-e*j*z;d.n44=f*m*n-g*j*n+g*h*q-e*m*q-f*h*t+e*j*t;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*m;e[6]=b*o;e[7]=b*n;e[8]=b*q;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,o,m;h=new THREE.Matrix4;j=d-b;o=e-f;m=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((i+g)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,m,o;h=new THREE.Matrix4;j=d-b;m=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((e+f)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){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.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._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
@@ -49,25 +49,25 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,o=this.w,m=o*e+h*g-j*f,n=
-o*f+j*e-i*g,q=o*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=m*o+e*-i+n*-j-q*-h;d.y=n*o+e*-h+q*-i-m*-j;d.z=q*o+e*-j+m*-h-n*-i;return d}};
+multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,m=this.w,o=m*e+h*g-j*f,n=
+m*f+j*e-i*g,q=m*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*m+e*-i+n*-j-q*-h;d.y=n*m+e*-h+q*-i-o*-j;d.z=q*m+e*-j+o*-h-n*-i;return d}};
 THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),o.sub(d.position,e.position),j.crossSelf(o);j.isZero()||
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),m.sub(d.position,e.position),j.crossSelf(m);j.isZero()||
 j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,d,e,f,g,i){j=b.vertices[c].position;o=b.vertices[d].position;m=b.vertices[e].position;n=h[f];q=h[g];t=h[i];r=o.x-j.x;D=m.x-j.x;x=o.y-j.y;z=m.y-j.y;B=o.z-j.z;ea=m.z-j.z;M=q.u-n.u;N=t.u-n.u;F=q.v-n.v;y=t.v-n.v;Y=1/(M*y-N*F);ka.set((y*r-F*D)*
-Y,(y*x-F*z)*Y,(y*B-F*ea)*Y);S.set((M*D-N*r)*Y,(M*z-N*x)*Y,(M*ea-N*B)*Y);Z[c].addSelf(ka);Z[d].addSelf(ka);Z[e].addSelf(ka);K[c].addSelf(S);K[d].addSelf(S);K[e].addSelf(S)}var d,e,f,g,i,h,j,o,m,n,q,t,r,D,x,z,B,ea,M,N,F,y,Y,C,Z=[],K=[],ka=new THREE.Vector3,S=new THREE.Vector3,P=new THREE.Vector3,c=new THREE.Vector3,na=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)Z[d]=new THREE.Vector3,K[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof
-THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ia=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)na.copy(i.vertexNormals[f]),g=i[ia[f]],C=Z[g],P.copy(C),P.subSelf(na.multiplyScalar(na.dot(C))).normalize(),c.cross(i.vertexNormals[f],C),g=c.dot(K[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(P.x,P.y,P.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,d,e,f,g,i){j=b.vertices[c].position;m=b.vertices[d].position;o=b.vertices[e].position;n=h[f];q=h[g];t=h[i];r=m.x-j.x;B=o.x-j.x;x=m.y-j.y;z=o.y-j.y;D=m.z-j.z;fa=o.z-j.z;M=q.u-n.u;O=t.u-n.u;F=q.v-n.v;y=t.v-n.v;Z=1/(M*y-O*F);ma.set((y*r-F*B)*
+Z,(y*x-F*z)*Z,(y*D-F*fa)*Z);T.set((M*B-O*r)*Z,(M*z-O*x)*Z,(M*fa-O*D)*Z);$[c].addSelf(ma);$[d].addSelf(ma);$[e].addSelf(ma);K[c].addSelf(T);K[d].addSelf(T);K[e].addSelf(T)}var d,e,f,g,i,h,j,m,o,n,q,t,r,B,x,z,D,fa,M,O,F,y,Z,C,$=[],K=[],ma=new THREE.Vector3,T=new THREE.Vector3,Q=new THREE.Vector3,c=new THREE.Vector3,ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)$[d]=new THREE.Vector3,K[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof
+THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var R=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)ga.copy(i.vertexNormals[f]),g=i[R[f]],C=$[g],Q.copy(C),Q.subSelf(ga.multiplyScalar(ga.dot(C))).normalize(),c.cross(i.vertexNormals[f],C),g=c.dot(K[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===
 void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];
 h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,o,m,n,q,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;m=this.points[e[0]];n=this.points[e[1]];
-q=this.points[e[2]];t=this.points[e[3]];j=h*h;o=h*j;f.x=d(m.x,n.x,q.x,t.x,h,j,o);f.y=d(m.y,n.y,q.y,t.y,h,j,o);f.z=d(m.z,n.z,q.z,t.z,h,j,o);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
+THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,m,o,n,q,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];n=this.points[e[1]];
+q=this.points[e[2]];t=this.points[e[3]];j=h*h;m=h*j;f.x=d(o.x,n.x,q.x,t.x,h,j,m);f.y=d(o.y,n.y,q.y,t.y,h,j,m);f.z=d(o.z,n.z,q.z,t.z,h,j,m);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
 j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],o=new THREE.Vector3,m=this.getLength();j.push(o.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=m.chunks[d]-m.chunks[d-1];i=Math.ceil(b*e/m.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(o.copy(position).clone());
 j.push(o.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);d.multiplyScalar(b);this.position.addSelf(d);this.target.position.addSelf(d)};
@@ -126,13 +126,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,o,m,n,q,t,r,D=new THREE.Geometry;D.vertices=this.geometry.vertices;f=D.faces=this.geometry.faces;var x=D.egdes=this.geometry.edges,z=D.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],B.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
-e.normal;b=0;for(d=x.length;b<d;b++)j=x[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(o="a",n=B[g]+0):e.b===h?(o="b",n=B[g]+1):e.c===h?(o="c",n=B[g]+2):e.d===h&&(o="d",n=B[g]+3),e.a===j?(o+="a",q=B[g]+0):e.b===j?(o+="b",q=B[g]+1):e.c===j?(o+="c",q=B[g]+2):e.d===j&&(o+="d",q=B[g]+3),f.a===h?(m="a",t=B[i]+0):f.b===h?(m="b",t=B[i]+1):f.c===h?(m="c",t=B[i]+2):f.d===h&&(m="d",t=B[i]+3),f.a===j?(m+="a",r=B[i]+0):f.b===j?(m+="b",r=B[i]+
-1):f.c===j?(m+="c",r=B[i]+2):f.d===j&&(m+="d",r=B[i]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>q&&(e=n,n=q,q=e):n<q&&(e=n,n=q,q=e),m==="ac"||m==="ad"||m==="ca"||m==="da"?t>r&&(e=t,t=r,r=e):t<r&&(e=t,t=r,r=e),e=new THREE.Face4(n,q,t,r),e.normal.set(1,0,0),z.push(e);this.geometry=D}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,o,m,n,q=["a","b","c","d"];for(o=0;o<i;o++){j=d.length;h=g[o];h instanceof THREE.Face4?(m=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(m=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
-for(j=0;j<m;j++)n=b[h[q[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,o,m,n,q,t,r,D,x,z=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(D=0;D<f;D++){i=d[B[D]];j=b[i];for(x=0;x<g;x++)if(h=e[B[x]],o=b[h],Math.abs(j.position.x-o.position.x)<1.0E-4&&Math.abs(j.position.y-o.position.y)<1.0E-4&&Math.abs(j.position.z-o.position.z)<1.0E-4&&(z++,z===1&&(m=j,n=o,q=i,t=h,r=B[D]),z===2))return r+=B[D],r==="ad"||r==="ac"?{faces:[d,e],vertices:[m,n,o,j],indices:[q,t,
-h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[m,j,o,n],indices:[q,i,h,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,m,o,n,q,t,r,B=new THREE.Geometry;B.vertices=this.geometry.vertices;f=B.faces=this.geometry.faces;var x=B.egdes=this.geometry.edges,z=B.edgeFaces=[];g=0;var D=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],D.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
+e.normal;b=0;for(d=x.length;b<d;b++)j=x[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(m="a",n=D[g]+0):e.b===h?(m="b",n=D[g]+1):e.c===h?(m="c",n=D[g]+2):e.d===h&&(m="d",n=D[g]+3),e.a===j?(m+="a",q=D[g]+0):e.b===j?(m+="b",q=D[g]+1):e.c===j?(m+="c",q=D[g]+2):e.d===j&&(m+="d",q=D[g]+3),f.a===h?(o="a",t=D[i]+0):f.b===h?(o="b",t=D[i]+1):f.c===h?(o="c",t=D[i]+2):f.d===h&&(o="d",t=D[i]+3),f.a===j?(o+="a",r=D[i]+0):f.b===j?(o+="b",r=D[i]+
+1):f.c===j?(o+="c",r=D[i]+2):f.d===j&&(o+="d",r=D[i]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?n>q&&(e=n,n=q,q=e):n<q&&(e=n,n=q,q=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?t>r&&(e=t,t=r,r=e):t<r&&(e=t,t=r,r=e),e=new THREE.Face4(n,q,t,r),e.normal.set(1,0,0),z.push(e);this.geometry=B}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,m,o,n,q=["a","b","c","d"];for(m=0;m<i;m++){j=d.length;h=g[m];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
+for(j=0;j<o;j++)n=b[h[q[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,m,o,n,q,t,r,B,x,z=0,D=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(B=0;B<f;B++){i=d[D[B]];j=b[i];for(x=0;x<g;x++)if(h=e[D[x]],m=b[h],Math.abs(j.position.x-m.position.x)<1.0E-4&&Math.abs(j.position.y-m.position.y)<1.0E-4&&Math.abs(j.position.z-m.position.z)<1.0E-4&&(z++,z===1&&(o=j,n=m,q=i,t=h,r=D[B]),z===2))return r+=D[B],r==="ad"||r==="ac"?{faces:[d,e],vertices:[o,n,m,j],indices:[q,t,
+h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,m,n],indices:[q,i,h,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -141,17 +141,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
-THREE.Projector=function(){function b(){var b=o[j]=o[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,c=1,f=b.z+b.w,g=d.z+d.w,h=-b.z+b.w,i=-d.z+d.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?e=Math.max(e,f/(f-g)):g<0&&(c=Math.min(c,f/(f-g))),h<0?e=Math.max(e,h/(h-i)):i<0&&(c=Math.min(c,h/(h-i))),c<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-c),!0))}var f,g,i=[],h,j,o=[],m,n,q=[],t,r=[],D,x,z=[],B,ea,M=[],N=new THREE.Vector4,F=new THREE.Vector4,
-y=new THREE.Matrix4,Y=new THREE.Matrix4,C=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,d){y.multiply(d.projectionMatrix,d.matrixWorldInverse);y.multiplyVector3(b);return b};this.unprojectVector=function(b,d){y.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));y.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],c,j,o;g=0;j=
-b.objects;b=0;for(c=j.length;b<c;b++){o=j[b];var m;if(!(m=!o.visible))if(m=o instanceof THREE.Mesh){a:{m=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),q=0;q<6;q++)if(m=C[q].x*n.n14+C[q].y*n.n24+C[q].z*n.n34+C[q].w,m<=t){m=!1;break a}m=!0}m=!m}if(!m)m=i[g]=i[g]||new THREE.RenderableObject,g++,f=m,N.copy(o.position),y.multiplyVector3(N),f.object=o,f.z=N.z,e.push(f)}h&&e.sort(d);return e};this.projectScene=function(f,g,i){var c=[],
-N=g.near,ia=g.far,ma,O,J,ha,E,L,G,Q,ja,v,u,pa,ra,Ca,ua,Ba,za;ea=x=t=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);y.multiply(g.projectionMatrix,g.matrixWorldInverse);C[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);C[1].set(y.n41+y.n11,y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);C[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);C[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);C[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);C[5].set(y.n41+y.n31,y.n42+
-y.n32,y.n43+y.n33,y.n44+y.n34);for(ma=0;ma<6;ma++)ja=C[ma],ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z));ja=this.projectObjects(f,g,!0);f=0;for(ma=ja.length;f<ma;f++)if(v=ja[f].object,v.visible)if(u=v.matrixWorld,pa=v.matrixRotationWorld,ra=v.materials,Ca=v.overdraw,j=0,v instanceof THREE.Mesh){ua=v.geometry;ha=ua.vertices;Ba=ua.faces;ua=ua.faceVertexUvs;O=0;for(J=ha.length;O<J;O++)h=b(),h.positionWorld.copy(ha[O].position),u.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>N&&h.positionScreen.z<ia;ha=0;for(O=Ba.length;ha<O;ha++){J=Ba[ha];if(J instanceof THREE.Face3)if(E=o[J.a],L=o[J.b],G=o[J.c],E.visible&&L.visible&&G.visible&&(v.doubleSided||v.flipSided!=(G.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(G.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0))Q=q[n]=q[n]||
-new THREE.RenderableFace3,n++,m=Q,m.v1.copy(E),m.v2.copy(L),m.v3.copy(G);else continue;else if(J instanceof THREE.Face4)if(E=o[J.a],L=o[J.b],G=o[J.c],Q=o[J.d],E.visible&&L.visible&&G.visible&&Q.visible&&(v.doubleSided||v.flipSided!=((Q.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(Q.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(Q.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*
-(Q.positionScreen.x-G.positionScreen.x)<0)))za=r[t]=r[t]||new THREE.RenderableFace4,t++,m=za,m.v1.copy(E),m.v2.copy(L),m.v3.copy(G),m.v4.copy(Q);else continue;m.normalWorld.copy(J.normal);pa.multiplyVector3(m.normalWorld);m.centroidWorld.copy(J.centroid);u.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);y.multiplyVector3(m.centroidScreen);G=J.vertexNormals;E=0;for(L=G.length;E<L;E++)Q=m.vertexNormalsWorld[E],Q.copy(G[E]),pa.multiplyVector3(Q);E=0;for(L=ua.length;E<L;E++)if(za=
-ua[E][ha]){G=0;for(Q=za.length;G<Q;G++)m.uvs[E][G]=za[G]}m.meshMaterials=ra;m.faceMaterials=J.materials;m.overdraw=Ca;m.z=m.centroidScreen.z;c.push(m)}}else if(v instanceof THREE.Line){Y.multiply(y,u);ha=v.geometry.vertices;E=b();E.positionScreen.copy(ha[0].position);Y.multiplyVector4(E.positionScreen);O=1;for(J=ha.length;O<J;O++)if(E=b(),E.positionScreen.copy(ha[O].position),Y.multiplyVector4(E.positionScreen),L=o[j-2],Z.copy(E.positionScreen),K.copy(L.positionScreen),e(Z,K))Z.multiplyScalar(1/Z.w),
-K.multiplyScalar(1/K.w),u=z[x]=z[x]||new THREE.RenderableLine,x++,D=u,D.v1.positionScreen.copy(Z),D.v2.positionScreen.copy(K),D.z=Math.max(Z.z,K.z),D.materials=v.materials,c.push(D)}else if(v instanceof THREE.Particle&&(F.set(v.matrixWorld.n14,v.matrixWorld.n24,v.matrixWorld.n34,1),y.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))u=M[ea]=M[ea]||new THREE.RenderableParticle,ea++,B=u,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=v.rotation.z,B.scale.x=v.scale.x*Math.abs(B.x-(F.x+g.projectionMatrix.n11)/(F.w+
-g.projectionMatrix.n14)),B.scale.y=v.scale.y*Math.abs(B.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),B.materials=v.materials,c.push(B);i&&c.sort(d);return c}};
+THREE.Projector=function(){function b(){var b=m[j]=m[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,c=1,f=b.z+b.w,g=d.z+d.w,h=-b.z+b.w,i=-d.z+d.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?e=Math.max(e,f/(f-g)):g<0&&(c=Math.min(c,f/(f-g))),h<0?e=Math.max(e,h/(h-i)):i<0&&(c=Math.min(c,h/(h-i))),c<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-c),!0))}var f,g,i=[],h,j,m=[],o,n,q=[],t,r=[],B,x,z=[],D,fa,M=[],O=new THREE.Vector4,F=new THREE.Vector4,
+y=new THREE.Matrix4,Z=new THREE.Matrix4,C=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],$=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,d){y.multiply(d.projectionMatrix,d.matrixWorldInverse);y.multiplyVector3(b);return b};this.unprojectVector=function(b,d){y.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));y.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],c,j,o;g=0;j=
+b.objects;b=0;for(c=j.length;b<c;b++){o=j[b];var m;if(!(m=!o.visible))if(m=o instanceof THREE.Mesh){a:{m=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),q=0;q<6;q++)if(m=C[q].x*n.n14+C[q].y*n.n24+C[q].z*n.n34+C[q].w,m<=t){m=!1;break a}m=!0}m=!m}if(!m)m=i[g]=i[g]||new THREE.RenderableObject,g++,f=m,O.copy(o.position),y.multiplyVector3(O),f.object=o,f.z=O.z,e.push(f)}h&&e.sort(d);return e};this.projectScene=function(f,g,i){var c=[],
+O=g.near,R=g.far,ja,P,J,ka,E,L,G,N,la,u,v,oa,qa,Ca,ta,Aa,ya;fa=x=t=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);y.multiply(g.projectionMatrix,g.matrixWorldInverse);C[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);C[1].set(y.n41+y.n11,y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);C[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);C[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);C[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);C[5].set(y.n41+y.n31,y.n42+
+y.n32,y.n43+y.n33,y.n44+y.n34);for(ja=0;ja<6;ja++)la=C[ja],la.divideScalar(Math.sqrt(la.x*la.x+la.y*la.y+la.z*la.z));la=this.projectObjects(f,g,!0);f=0;for(ja=la.length;f<ja;f++)if(u=la[f].object,u.visible)if(v=u.matrixWorld,oa=u.matrixRotationWorld,qa=u.materials,Ca=u.overdraw,j=0,u instanceof THREE.Mesh){ta=u.geometry;ka=ta.vertices;Aa=ta.faces;ta=ta.faceVertexUvs;P=0;for(J=ka.length;P<J;P++)h=b(),h.positionWorld.copy(ka[P].position),v.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
+y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>O&&h.positionScreen.z<R;ka=0;for(P=Aa.length;ka<P;ka++){J=Aa[ka];if(J instanceof THREE.Face3)if(E=m[J.a],L=m[J.b],G=m[J.c],E.visible&&L.visible&&G.visible&&(u.doubleSided||u.flipSided!=(G.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(G.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0))N=q[n]=q[n]||
+new THREE.RenderableFace3,n++,o=N,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G);else continue;else if(J instanceof THREE.Face4)if(E=m[J.a],L=m[J.b],G=m[J.c],N=m[J.d],E.visible&&L.visible&&G.visible&&N.visible&&(u.doubleSided||u.flipSided!=((N.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(N.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(N.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*
+(N.positionScreen.x-G.positionScreen.x)<0)))ya=r[t]=r[t]||new THREE.RenderableFace4,t++,o=ya,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G),o.v4.copy(N);else continue;o.normalWorld.copy(J.normal);oa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(J.centroid);v.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);y.multiplyVector3(o.centroidScreen);G=J.vertexNormals;E=0;for(L=G.length;E<L;E++)N=o.vertexNormalsWorld[E],N.copy(G[E]),oa.multiplyVector3(N);E=0;for(L=ta.length;E<L;E++)if(ya=
+ta[E][ka]){G=0;for(N=ya.length;G<N;G++)o.uvs[E][G]=ya[G]}o.meshMaterials=qa;o.faceMaterials=J.materials;o.overdraw=Ca;o.z=o.centroidScreen.z;c.push(o)}}else if(u instanceof THREE.Line){Z.multiply(y,v);ka=u.geometry.vertices;E=b();E.positionScreen.copy(ka[0].position);Z.multiplyVector4(E.positionScreen);P=1;for(J=ka.length;P<J;P++)if(E=b(),E.positionScreen.copy(ka[P].position),Z.multiplyVector4(E.positionScreen),L=m[j-2],$.copy(E.positionScreen),K.copy(L.positionScreen),e($,K))$.multiplyScalar(1/$.w),
+K.multiplyScalar(1/K.w),v=z[x]=z[x]||new THREE.RenderableLine,x++,B=v,B.v1.positionScreen.copy($),B.v2.positionScreen.copy(K),B.z=Math.max($.z,K.z),B.materials=u.materials,c.push(B)}else if(u instanceof THREE.Particle&&(F.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),y.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))v=M[fa]=M[fa]||new THREE.RenderableParticle,fa++,D=v,D.x=F.x/F.w,D.y=F.y/F.w,D.z=F.z,D.rotation=u.rotation.z,D.scale.x=u.scale.x*Math.abs(D.x-(F.x+g.projectionMatrix.n11)/(F.w+
+g.projectionMatrix.n14)),D.scale.y=u.scale.y*Math.abs(D.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),D.materials=u.materials,c.push(D);i&&c.sort(d);return c}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(void 0,!1,d);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(d.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
@@ -184,16 +184,16 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_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;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,m=b.colors,o=m.length,p=b.__vertexArray,H=b.__colorArray,Aa=b.__sortArray,n=b.__dirtyVertices,q=b.__dirtyColors;if(e.sortParticles){_projScreenMatrix.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,_vector3.copy(g),_projScreenMatrix.multiplyVector3(_vector3),Aa[f]=[_vector3.z,f];Aa.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[Aa[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<
-o;f++)h=f*3,color=m[Aa[f][1]],H[h]=color.r,H[h+1]=color.g,H[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(q)for(f=0;f<o;f++)color=m[f],h=f*3,H[h]=color.r,H[h+1]=color.g,H[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(q||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,H,d)}function e(b,d,e,f,g){f.program||P.initMaterial(f,d,e,g);
-var h=f.program,i=h.uniforms,j=f.uniforms;h!=ia&&(c.useProgram(h),ia=h);c.uniformMatrix4fv(i.projectionMatrix,!1,_projectionMatrixArray);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;
-if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,p=0,H=0,n=0,q,t,u,r,y=_lights,v=y.directional.colors,D=y.directional.positions,B=y.point.colors,x=y.point.positions,I=y.point.distances,z=0,s=0,e=o=r=0;for(m=d.length;e<m;e++)if(o=d[e],q=o.color,t=o.position,u=o.intensity,r=o.distance,o instanceof THREE.AmbientLight)p+=q.r,H+=q.g,n+=q.b;else if(o instanceof THREE.DirectionalLight)r=z*3,v[r]=q.r*u,v[r+1]=q.g*u,v[r+2]=q.b*u,D[r]=t.x,D[r+1]=t.y,D[r+2]=
-t.z,z+=1;else if(o instanceof THREE.PointLight)o=s*3,B[o]=q.r*u,B[o+1]=q.g*u,B[o+2]=q.b*u,x[o]=t.x,x[o+1]=t.y,x[o+2]=t.z,I[s]=r,s+=1;for(e=z*3;e<v.length;e++)v[e]=0;for(e=s*3;e<B.length;e++)B[e]=0;y.point.length=s;y.directional.length=z;y.ambient[0]=p;y.ambient[1]=H;y.ambient[2]=n;e=_lights;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,m=b.colors,o=m.length,p=b.__vertexArray,H=b.__colorArray,za=b.__sortArray,n=b.__dirtyVertices,q=b.__dirtyColors;if(e.sortParticles){_projScreenMatrix.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,_vector3.copy(g),_projScreenMatrix.multiplyVector3(_vector3),za[f]=[_vector3.z,f];za.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[za[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<
+o;f++)h=f*3,color=m[za[f][1]],H[h]=color.r,H[h+1]=color.g,H[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(q)for(f=0;f<o;f++)color=m[f],h=f*3,H[h]=color.r,H[h+1]=color.g,H[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(q||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,H,d)}function e(b,d,e,f,g){f.program||Q.initMaterial(f,d,e,g);
+var h=f.program,i=h.uniforms,j=f.uniforms;h!=R&&(c.useProgram(h),R=h);c.uniformMatrix4fv(i.projectionMatrix,!1,_projectionMatrixArray);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;
+if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,p=0,H=0,n=0,q,t,r,v,y=_lights,u=y.directional.colors,D=y.directional.positions,B=y.point.colors,x=y.point.positions,I=y.point.distances,z=0,s=0,e=o=v=0;for(m=d.length;e<m;e++)if(o=d[e],q=o.color,t=o.position,r=o.intensity,v=o.distance,o instanceof THREE.AmbientLight)p+=q.r,H+=q.g,n+=q.b;else if(o instanceof THREE.DirectionalLight)v=z*3,u[v]=q.r*r,u[v+1]=q.g*r,u[v+2]=q.b*r,D[v]=t.x,D[v+1]=t.y,D[v+2]=
+t.z,z+=1;else if(o instanceof THREE.PointLight)o=s*3,B[o]=q.r*r,B[o+1]=q.g*r,B[o+2]=q.b*r,x[o]=t.x,x[o+1]=t.y,x[o+2]=t.z,I[s]=v,s+=1;for(e=z*3;e<u.length;e++)u[e]=0;for(e=s*3;e<B.length;e++)B[e]=0;y.point.length=s;y.directional.length=z;y.ambient[0]=p;y.ambient[1]=H;y.ambient[2]=n;e=_lights;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=
 e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,
 j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=_canvas.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof
 THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var A in j)if(H=h.uniforms[A])if(m=j[A],p=m.type,e=m.value,p=="i")c.uniform1i(H,e);else if(p=="f")c.uniform1f(H,e);else if(p=="fv1")c.uniform1fv(H,e);else if(p=="fv")c.uniform3fv(H,e);else if(p=="v2")c.uniform2f(H,e.x,e.y);else if(p=="v3")c.uniform3f(H,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(H,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(H,
 e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(H,e),m=m.texture))if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
-p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}Y(c.TEXTURE_CUBE_MAP,m,m.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else C(m,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,
+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}Z(c.TEXTURE_CUBE_MAP,m,m.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else C(m,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,
 b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=
 -d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,_viewMatrixArray),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,
 3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,m=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<m.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m[f]]),
@@ -201,94 +201,94 @@ c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetI
 null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(j in h.__webglCustomAttributes)b[j]>=0&&(d=h.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,
 !1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));
 g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,
-4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),P.data.vertices+=h.__webglFaceCount,P.data.faces+=h.__webglFaceCount/3,P.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),
-c.drawArrays(i,0,h.__webglLineCount),P.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),P.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),P.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,
+4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),Q.data.vertices+=h.__webglFaceCount,Q.data.faces+=h.__webglFaceCount/3,Q.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),
+c.drawArrays(i,0,h.__webglLineCount),Q.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),Q.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),Q.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,
 b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,i,j,m,o,p,H,n,q=b.count*3;for(n=0;n<q;n+=9)e=b.normalArray,f=e[n],h=e[n+1],g=e[n+2],i=e[n+3],m=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],H=e[n+8],f=(f+i+j)/3,h=(h+m+o)/3,g=(g+p+H)/3,e[n]=f,e[n+1]=h,e[n+2]=g,e[n+3]=f,e[n+4]=h,e[n+5]=g,e[n+6]=f,e[n+7]=h,e[n+8]=g}c.bufferData(c.ARRAY_BUFFER,
-b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(J!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),J=b.doubleSided;if(ha!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ha=b.flipSided}function h(b){L!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),L=b)}function j(b,d,e){G!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):
-c.disable(c.POLYGON_OFFSET_FILL),G=b);if(b&&(_oldPolygonOffsetFactor!=d||_oldPolygonOffsetUnits!=e))c.polygonOffset(d,e),_oldPolygonOffsetFactor=d,_oldPolygonOffsetUnits=e}function o(b){_frustum[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);_frustum[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);_frustum[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);_frustum[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);_frustum[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-
-b.n34);_frustum[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=_frustum[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=_frustum[e].x*c.n14+_frustum[e].y*c.n24+_frustum[e].z*c.n34+_frustum[e].w,b<=d)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function q(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;
-h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?n(h,d):n(f,d)}function t(b){var c,d,e,f,h=b.object,g=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=g.materials.length;c<d;c++)(f=g.materials[c])&&(f.transparent?n(j,f):n(i,f))}else(f=c)&&(f.transparent?n(j,f):n(i,f))}function r(b,c){return c.z-b.z}function D(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,
+b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(J!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),J=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function h(b){L!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),L=b)}function j(b,d,e){G!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):
+c.disable(c.POLYGON_OFFSET_FILL),G=b);if(b&&(_oldPolygonOffsetFactor!=d||_oldPolygonOffsetUnits!=e))c.polygonOffset(d,e),_oldPolygonOffsetFactor=d,_oldPolygonOffsetUnits=e}function m(b){_frustum[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);_frustum[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);_frustum[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);_frustum[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);_frustum[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-
+b.n34);_frustum[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=_frustum[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=_frustum[e].x*c.n14+_frustum[e].y*c.n24+_frustum[e].z*c.n34+_frustum[e].w,b<=d)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function q(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;
+h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?n(h,d):n(f,d)}function t(b){var c,d,e,f,h=b.object,g=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=g.materials.length;c<d;c++)(f=g.materials[c])&&(f.transparent?n(j,f):n(i,f))}else(f=c)&&(f.transparent?n(j,f):n(i,f))}function r(b,c){return c.z-b.z}function B(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,
 1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,h=b.lights,g=[],i,j,m,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer,
-j=f.materials[0],j.program||P.initMaterial(j,h,void 0,f),j=j.program,m=j.uniforms,o=j.attributes,ia!==j&&(c.useProgram(j),ia=j,c.uniformMatrix4fv(m.projectionMatrix,!1,_projectionMatrixArray),c.uniformMatrix4fv(m.viewMatrix,!1,_viewMatrixArray),c.uniform3fv(m.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(m.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),
-c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);E=-1;ia=v.program;c.useProgram(v.program);
-c.uniformMatrix4fv(v.projectionLocation,!1,_projectionMatrixArray);c.uniform1f(v.darknessLocation,v.darkness);c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.vertexAttribPointer(v.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(v.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(O)}function x(b,
-d){var e,f,h;e=_sprite.attributes;var g=_sprite.uniforms,i=_viewportHeight/_viewportWidth,j,m=[],o=_viewportWidth*0.5,p=_viewportHeight*0.5,n=!0;c.useProgram(_sprite.program);ia=_sprite.program;E=-1;ra||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),ra=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,
-2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,_projectionMatrixArray);c.activeTexture(c.TEXTURE0);c.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],
-h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(c.uniform1i(g.useScreenCoordinates,1),c.uniform3f(g.screenPosition,(h.position.x-o)/o,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(c.uniform1i(g.useScreenCoordinates,0),c.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),c.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),j=h.map.image.width/(h.scaleByViewport?_viewportHeight:1),m[0]=j*i*h.scale.x,m[1]=j*h.scale.y,c.uniform2f(g.uvScale,
-h.uvScale.x,h.uvScale.y),c.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),c.uniform2f(g.alignment,h.alignment.x,h.alignment.y),c.uniform1f(g.opacity,h.opacity),c.uniform1f(g.rotation,h.rotation),c.uniform2fv(g.scale,m),h.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),y(h.blending),C(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(O)}function z(b,d){var e,f,h=b.__webglLensFlares.length,
-g,i,j,m=new THREE.Vector3,o=_viewportHeight/_viewportWidth,p=_viewportWidth*0.5,n=_viewportHeight*0.5,q=16/_viewportHeight,t=[q*o,q],r=[1,1,0],v=[1,1],B=u.uniforms;e=u.attributes;c.useProgram(u.program);ia=u.program;E=-1;pa||(c.enableVertexAttribArray(u.attributes.vertex),c.enableVertexAttribArray(u.attributes.uv),pa=!0);c.uniform1i(B.occlusionMap,0);c.uniform1i(B.map,1);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,
-!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,u.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;f++)if(e=b.__webglLensFlares[f].object,m.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),r[0]=m.x,r[1]=m.y,r[2]=m.z,v[0]=r[0]*p+p,v[1]=r[1]*n+n,u.hasVertexTexture||v[0]>0&&v[0]<_viewportWidth&&v[1]>
-0&&v[1]<_viewportHeight){c.bindTexture(c.TEXTURE_2D,u.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,v[0]-8,v[1]-8,16,16,0);c.uniform1i(B.renderType,0);c.uniform2fv(B.scale,t);c.uniform3fv(B.screenPosition,r);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,u.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,v[0]-8,v[1]-8,16,16,0);c.uniform1i(B.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,u.tempTexture);
-c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=r[0];e.positionScreen.y=r[1];e.positionScreen.z=r[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(B.renderType,2);c.enable(c.BLEND);g=0;for(i=e.lensFlares.length;g<i;g++)if(j=e.lensFlares[g],j.opacity>0.001&&j.scale>0.001)r[0]=j.x,r[1]=j.y,r[2]=j.z,q=j.size*j.scale/_viewportHeight,t[0]=q*o,t[1]=q,c.uniform3fv(B.screenPosition,r),c.uniform2fv(B.scale,t),c.uniform1f(B.rotation,j.rotation),c.uniform1f(B.opacity,
-j.opacity),y(j.blending),C(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(O)}function B(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ea(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var i=g=void 0,j=void 0,m=void 0,
-o=void 0,o=h.__materials,i=0,j=o.length;i<j;i++)if(m=o[i],m.attributes)for(g in m.attributes)if(m.attributes[g].needsUpdate){g=!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,i=b,j=c.DYNAMIC_DRAW,g.__inittedArrays){var n=o=m=void 0,p=void 0,H=n=void 0,q=void 0,t=void 0,r=void 0,u=void 0,v=void 0,y=void 0,B=void 0,D=void 0,x=void 0,z=void 0,I=void 0,E=void 0,s=p=r=p=t=q=void 0,A=void 0,k=A=
-s=q=void 0,F=void 0,K=k=A=s=n=n=H=r=p=k=A=s=F=k=A=s=F=k=A=s=void 0,C=0,G=0,P=0,S=0,J=0,L=0,R=0,M=0,$=0,w=0,aa=0,A=s=0,ca=g.__vertexArray,Y=g.__uvArray,Z=g.__uv2Array,N=g.__normalArray,T=g.__tangentArray,da=g.__colorArray,U=g.__skinVertexAArray,V=g.__skinVertexBArray,W=g.__skinIndexArray,X=g.__skinWeightArray,ea=g.__morphTargetsArrays,Q=g.__webglCustomAttributes,k=void 0,la=g.__faceArray,O=g.__lineArray,ha=g.__needsSmoothNormals,v=g.__vertexColorType,u=g.__uvType,y=g.__normalType,fa=i.geometry,ja=
-fa.__dirtyVertices,ka=fa.__dirtyElements,ia=fa.__dirtyUvs,ma=fa.__dirtyNormals,na=fa.__dirtyTangents,pa=fa.__dirtyColors,ra=fa.__dirtyMorphTargets,va=fa.vertices,Da=g.faces,Ga=fa.faces,Ea=fa.faceVertexUvs[0],Fa=fa.faceVertexUvs[1],wa=fa.skinVerticesA,xa=fa.skinVerticesB,ya=fa.skinIndices,sa=fa.skinWeights,ta=i instanceof THREE.ShadowVolume?fa.edgeFaces:void 0,qa=fa.morphTargets;if(Q)for(K in Q)Q[K].offset=0,Q[K].offsetSrc=0;m=0;for(o=Da.length;m<o;m++)if(n=Da[m],p=Ga[n],Ea&&(B=Ea[n]),Fa&&(D=Fa[n]),
-n=p.vertexNormals,H=p.normal,q=p.vertexColors,t=p.color,r=p.vertexTangents,p instanceof THREE.Face3){if(ja)x=va[p.a].position,z=va[p.b].position,I=va[p.c].position,ca[G]=x.x,ca[G+1]=x.y,ca[G+2]=x.z,ca[G+3]=z.x,ca[G+4]=z.y,ca[G+5]=z.z,ca[G+6]=I.x,ca[G+7]=I.y,ca[G+8]=I.z,G+=9;if(Q)for(K in Q)if(k=Q[K],k.__original.needsUpdate)s=k.offset,A=k.offsetSrc,k.size===1?(k.boundTo===void 0||k.boundTo==="vertices"?(k.array[s+0]=k.value[p.a],k.array[s+1]=k.value[p.b],k.array[s+2]=k.value[p.c]):k.boundTo==="faces"?
-(k.array[s+0]=k.value[A],k.array[s+1]=k.value[A],k.array[s+2]=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(k.array[s+0]=k.value[A+0],k.array[s+1]=k.value[A+1],k.array[s+2]=k.value[A+2],k.offsetSrc+=3),k.offset+=3):(k.boundTo===void 0||k.boundTo==="vertices"?(x=k.value[p.a],z=k.value[p.b],I=k.value[p.c]):k.boundTo==="faces"?(x=k.value[A],z=k.value[A],I=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(x=k.value[A+0],z=k.value[A+1],I=k.value[A+2],k.offsetSrc+=3),k.size===2?(k.array[s+
-0]=x.x,k.array[s+1]=x.y,k.array[s+2]=z.x,k.array[s+3]=z.y,k.array[s+4]=I.x,k.array[s+5]=I.y,k.offset+=6):k.size===3?(k.type==="c"?(k.array[s+0]=x.r,k.array[s+1]=x.g,k.array[s+2]=x.b,k.array[s+3]=z.r,k.array[s+4]=z.g,k.array[s+5]=z.b,k.array[s+6]=I.r,k.array[s+7]=I.g,k.array[s+8]=I.b):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=z.x,k.array[s+4]=z.y,k.array[s+5]=z.z,k.array[s+6]=I.x,k.array[s+7]=I.y,k.array[s+8]=I.z),k.offset+=9):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=
-x.z,k.array[s+3]=x.w,k.array[s+4]=z.x,k.array[s+5]=z.y,k.array[s+6]=z.z,k.array[s+7]=z.w,k.array[s+8]=I.x,k.array[s+9]=I.y,k.array[s+10]=I.z,k.array[s+11]=I.w,k.offset+=12));if(ra){s=0;for(A=qa.length;s<A;s++)x=qa[s].vertices[p.a].position,z=qa[s].vertices[p.b].position,I=qa[s].vertices[p.c].position,k=ea[s],k[aa+0]=x.x,k[aa+1]=x.y,k[aa+2]=x.z,k[aa+3]=z.x,k[aa+4]=z.y,k[aa+5]=z.z,k[aa+6]=I.x,k[aa+7]=I.y,k[aa+8]=I.z;aa+=9}if(sa.length)s=sa[p.a],A=sa[p.b],k=sa[p.c],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+
-3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=k.x,X[w+9]=k.y,X[w+10]=k.z,X[w+11]=k.w,s=ya[p.a],A=ya[p.b],k=ya[p.c],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=s.w,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=A.w,W[w+8]=k.x,W[w+9]=k.y,W[w+10]=k.z,W[w+11]=k.w,s=wa[p.a],A=wa[p.b],k=wa[p.c],U[w]=s.x,U[w+1]=s.y,U[w+2]=s.z,U[w+3]=1,U[w+4]=A.x,U[w+5]=A.y,U[w+6]=A.z,U[w+7]=1,U[w+8]=k.x,U[w+9]=k.y,U[w+10]=k.z,U[w+11]=1,s=xa[p.a],A=xa[p.b],k=xa[p.c],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=
-A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=k.x,V[w+9]=k.y,V[w+10]=k.z,V[w+11]=1,w+=12;if(pa&&v)q.length==3&&v==THREE.VertexColors?(p=q[0],s=q[1],A=q[2]):A=s=p=t,da[$]=p.r,da[$+1]=p.g,da[$+2]=p.b,da[$+3]=s.r,da[$+4]=s.g,da[$+5]=s.b,da[$+6]=A.r,da[$+7]=A.g,da[$+8]=A.b,$+=9;if(na&&fa.hasTangents)q=r[0],t=r[1],p=r[2],T[R]=q.x,T[R+1]=q.y,T[R+2]=q.z,T[R+3]=q.w,T[R+4]=t.x,T[R+5]=t.y,T[R+6]=t.z,T[R+7]=t.w,T[R+8]=p.x,T[R+9]=p.y,T[R+10]=p.z,T[R+11]=p.w,R+=12;if(ma&&y)if(n.length==3&&ha)for(r=0;r<3;r++)H=n[r],N[L]=H.x,
-N[L+1]=H.y,N[L+2]=H.z,L+=3;else for(r=0;r<3;r++)N[L]=H.x,N[L+1]=H.y,N[L+2]=H.z,L+=3;if(ia&&B!==void 0&&u)for(r=0;r<3;r++)n=B[r],Y[P]=n.u,Y[P+1]=n.v,P+=2;if(ia&&D!==void 0&&u)for(r=0;r<3;r++)n=D[r],Z[S]=n.u,Z[S+1]=n.v,S+=2;ka&&(la[J]=C,la[J+1]=C+1,la[J+2]=C+2,J+=3,O[M]=C,O[M+1]=C+1,O[M+2]=C,O[M+3]=C+2,O[M+4]=C+1,O[M+5]=C+2,M+=6,C+=3)}else if(p instanceof THREE.Face4){if(ja)x=va[p.a].position,z=va[p.b].position,I=va[p.c].position,E=va[p.d].position,ca[G]=x.x,ca[G+1]=x.y,ca[G+2]=x.z,ca[G+3]=z.x,ca[G+
-4]=z.y,ca[G+5]=z.z,ca[G+6]=I.x,ca[G+7]=I.y,ca[G+8]=I.z,ca[G+9]=E.x,ca[G+10]=E.y,ca[G+11]=E.z,G+=12;if(Q)for(K in Q)if(k=Q[K],k.__original.needsUpdate)s=k.offset,A=k.offsetSrc,k.size===1?(k.boundTo===void 0||k.boundTo==="vertices"?(k.array[s+0]=k.value[p.a],k.array[s+1]=k.value[p.b],k.array[s+2]=k.value[p.c],k.array[s+3]=k.value[p.d]):k.boundTo==="faces"?(k.array[s+0]=k.value[A],k.array[s+1]=k.value[A],k.array[s+2]=k.value[A],k.array[s+3]=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(k.array[s+
-0]=k.value[A+0],k.array[s+1]=k.value[A+1],k.array[s+2]=k.value[A+2],k.array[s+3]=k.value[A+3],k.offsetSrc+=4),k.offset+=4):(k.boundTo===void 0||k.boundTo==="vertices"?(x=k.value[p.a],z=k.value[p.b],I=k.value[p.c],E=k.value[p.d]):k.boundTo==="faces"?(x=k.value[A],z=k.value[A],I=k.value[A],E=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(x=k.value[A+0],z=k.value[A+1],I=k.value[A+2],E=k.value[A+3],k.offsetSrc+=4),k.size===2?(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=z.x,k.array[s+3]=z.y,
-k.array[s+4]=I.x,k.array[s+5]=I.y,k.array[s+6]=E.x,k.array[s+7]=E.y,k.offset+=8):k.size===3?(k.type==="c"?(k.array[s+0]=x.r,k.array[s+1]=x.g,k.array[s+2]=x.b,k.array[s+3]=z.r,k.array[s+4]=z.g,k.array[s+5]=z.b,k.array[s+6]=I.r,k.array[s+7]=I.g,k.array[s+8]=I.b,k.array[s+9]=E.r,k.array[s+10]=E.g,k.array[s+11]=E.b):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=z.x,k.array[s+4]=z.y,k.array[s+5]=z.z,k.array[s+6]=I.x,k.array[s+7]=I.y,k.array[s+8]=I.z,k.array[s+9]=E.x,k.array[s+10]=E.y,
-k.array[s+11]=E.z),k.offset+=12):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=x.w,k.array[s+4]=z.x,k.array[s+5]=z.y,k.array[s+6]=z.z,k.array[s+7]=z.w,k.array[s+8]=I.x,k.array[s+9]=I.y,k.array[s+10]=I.z,k.array[s+11]=I.w,k.array[s+12]=E.x,k.array[s+13]=E.y,k.array[s+14]=E.z,k.array[s+15]=E.w,k.offset+=16));if(ra){s=0;for(A=qa.length;s<A;s++)x=qa[s].vertices[p.a].position,z=qa[s].vertices[p.b].position,I=qa[s].vertices[p.c].position,E=qa[s].vertices[p.d].position,k=ea[s],k[aa+0]=
-x.x,k[aa+1]=x.y,k[aa+2]=x.z,k[aa+3]=z.x,k[aa+4]=z.y,k[aa+5]=z.z,k[aa+6]=I.x,k[aa+7]=I.y,k[aa+8]=I.z,k[aa+9]=E.x,k[aa+10]=E.y,k[aa+11]=E.z;aa+=12}if(sa.length)s=sa[p.a],A=sa[p.b],k=sa[p.c],F=sa[p.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=k.x,X[w+9]=k.y,X[w+10]=k.z,X[w+11]=k.w,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=F.w,s=ya[p.a],A=ya[p.b],k=ya[p.c],F=ya[p.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=s.w,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=A.w,
-W[w+8]=k.x,W[w+9]=k.y,W[w+10]=k.z,W[w+11]=k.w,W[w+12]=F.x,W[w+13]=F.y,W[w+14]=F.z,W[w+15]=F.w,s=wa[p.a],A=wa[p.b],k=wa[p.c],F=wa[p.d],U[w]=s.x,U[w+1]=s.y,U[w+2]=s.z,U[w+3]=1,U[w+4]=A.x,U[w+5]=A.y,U[w+6]=A.z,U[w+7]=1,U[w+8]=k.x,U[w+9]=k.y,U[w+10]=k.z,U[w+11]=1,U[w+12]=F.x,U[w+13]=F.y,U[w+14]=F.z,U[w+15]=1,s=xa[p.a],A=xa[p.b],k=xa[p.c],p=xa[p.d],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=k.x,V[w+9]=k.y,V[w+10]=k.z,V[w+11]=1,V[w+12]=p.x,V[w+13]=p.y,V[w+14]=
-p.z,V[w+15]=1,w+=16;if(pa&&v)q.length==4&&v==THREE.VertexColors?(p=q[0],s=q[1],A=q[2],q=q[3]):q=A=s=p=t,da[$]=p.r,da[$+1]=p.g,da[$+2]=p.b,da[$+3]=s.r,da[$+4]=s.g,da[$+5]=s.b,da[$+6]=A.r,da[$+7]=A.g,da[$+8]=A.b,da[$+9]=q.r,da[$+10]=q.g,da[$+11]=q.b,$+=12;if(na&&fa.hasTangents)q=r[0],t=r[1],p=r[2],r=r[3],T[R]=q.x,T[R+1]=q.y,T[R+2]=q.z,T[R+3]=q.w,T[R+4]=t.x,T[R+5]=t.y,T[R+6]=t.z,T[R+7]=t.w,T[R+8]=p.x,T[R+9]=p.y,T[R+10]=p.z,T[R+11]=p.w,T[R+12]=r.x,T[R+13]=r.y,T[R+14]=r.z,T[R+15]=r.w,R+=16;if(ma&&y)if(n.length==
-4&&ha)for(r=0;r<4;r++)H=n[r],N[L]=H.x,N[L+1]=H.y,N[L+2]=H.z,L+=3;else for(r=0;r<4;r++)N[L]=H.x,N[L+1]=H.y,N[L+2]=H.z,L+=3;if(ia&&B!==void 0&&u)for(r=0;r<4;r++)n=B[r],Y[P]=n.u,Y[P+1]=n.v,P+=2;if(ia&&D!==void 0&&u)for(r=0;r<4;r++)n=D[r],Z[S]=n.u,Z[S+1]=n.v,S+=2;ka&&(la[J]=C,la[J+1]=C+1,la[J+2]=C+3,la[J+3]=C+1,la[J+4]=C+2,la[J+5]=C+3,J+=6,O[M]=C,O[M+1]=C+1,O[M+2]=C,O[M+3]=C+3,O[M+4]=C+1,O[M+5]=C+2,O[M+6]=C+2,O[M+7]=C+3,M+=8,C+=4)}if(ta){m=0;for(o=ta.length;m<o;m++)la[J]=ta[m].a,la[J+1]=ta[m].b,la[J+
-2]=ta[m].c,la[J+3]=ta[m].a,la[J+4]=ta[m].c,la[J+5]=ta[m].d,J+=6}ja&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,ca,j));if(Q)for(K in Q)k=Q[K],k.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,k.buffer),c.bufferData(c.ARRAY_BUFFER,k.array,j));if(ra){s=0;for(A=qa.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,ea[s],j)}pa&&$>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,
-da,j));ma&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,N,j));na&&fa.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,T,j));ia&&P>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j));ia&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,Z,j));ka&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,la,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,O,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,U,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,V,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,X,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,
-delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ga;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(ga in e.attributes)e.attributes[ga].needsUpdate=
-!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ga=f;b=c.DYNAMIC_DRAW;o=ga.vertices;h=ga.colors;u=o.length;g=h.length;v=ga.__vertexArray;i=ga.__colorArray;y=ga.__dirtyColors;if(ga.__dirtyVertices){for(j=0;j<u;j++)m=o[j].position,e=j*3,v[e]=m.x,v[e+1]=m.y,v[e+2]=m.z;c.bindBuffer(c.ARRAY_BUFFER,ga.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,
-ga.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ga=f;b=c.DYNAMIC_DRAW;o=ga.vertices;h=ga.colors;u=o.length;g=h.length;v=ga.__vertexArray;i=ga.__colorArray;y=ga.__dirtyColors;if(ga.__dirtyVertices){for(j=0;j<u;j++)m=o[j].position,e=j*3,v[e]=m.x,v[e+1]=m.y,v[e+2]=m.z;c.bindBuffer(c.ARRAY_BUFFER,ga.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<
-g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ga.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function M(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function N(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==
-void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,g,h,i,j,m,p={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,counter:0}),m=p[j].hash+"_"+p[j].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+h>65535&&(p[j].counter+=1,m=p[j].hash+"_"+p[j].counter,
-b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=h}function F(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(b){if(b!=E){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;
-case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}E=b}}function Y(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,S(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,S(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,S(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,S(e.minFilter)),
-c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,ka(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,ka(e.minFilter)))}function C(b,e){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,
-0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),Y(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function Z(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);
-c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,S(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,S(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,S(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,S(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,
-c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,
-b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,d=_viewportWidth,b=_viewportHeight);e!=ma&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(_viewportX,_viewportY,d,b),ma=e)}function K(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)),
-console.error(e),null;return d}function ka(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
-case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
-case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var P=this,c,na=[],ia=null,ma=null,O=!0,J=null,ha=null,E=null,L=null,G=null;_oldPolygonOffsetUnits=_oldPolygonOffsetFactor=null;_cullEnabled=!0;_viewportHeight=_viewportWidth=_viewportY=_viewportX=0;_frustum=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];_projScreenMatrix=
-new THREE.Matrix4;_projectionMatrixArray=new Float32Array(16);_viewMatrixArray=new Float32Array(16);_vector3=new THREE.Vector4;_lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};_canvas=b.canvas!==void 0?b.canvas:document.createElement("canvas");_stencil=b.stencil!==void 0?b.stencil:!0;_antialias=b.antialias!==void 0?b.antialias:!1;_clearColor=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0);_clearAlpha=
-b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=_canvas;this.sortObjects=this.autoClear=!0;try{if(!(c=_canvas.getContext("experimental-webgl",{antialias:_antialias,stencil:_stencil})))throw"Error creating WebGL context.";}catch(Q){console.error(Q)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,
-0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha);_cullEnabled=!0;this.context=c;var ja=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(_stencil){var v={};v.vertices=new Float32Array(12);v.faces=new Uint16Array(6);v.darkness=0.5;v.vertices[0]=-20;v.vertices[1]=
--20;v.vertices[2]=-1;v.vertices[3]=20;v.vertices[4]=-20;v.vertices[5]=-1;v.vertices[6]=20;v.vertices[7]=20;v.vertices[8]=-1;v.vertices[9]=-20;v.vertices[10]=20;v.vertices[11]=-1;v.faces[0]=0;v.faces[1]=1;v.faces[2]=2;v.faces[3]=0;v.faces[4]=2;v.faces[5]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,
-v.faces,c.STATIC_DRAW);v.program=c.createProgram();c.attachShader(v.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(v.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(v.program);v.vertexLocation=c.getAttribLocation(v.program,"position");v.projectionLocation=c.getUniformLocation(v.program,"projectionMatrix");v.darknessLocation=c.getUniformLocation(v.program,"darkness")}var u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);b=0;
-u.vertices[b++]=-1;u.vertices[b++]=-1;u.vertices[b++]=0;u.vertices[b++]=0;u.vertices[b++]=1;u.vertices[b++]=-1;u.vertices[b++]=1;u.vertices[b++]=0;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=-1;u.vertices[b++]=1;u.vertices[b++]=0;u.vertices[b++]=1;b=0;u.faces[b++]=0;u.faces[b++]=1;u.faces[b++]=2;u.faces[b++]=0;u.faces[b++]=2;u.faces[b++]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();u.tempTexture=c.createTexture();u.occlusionTexture=
-c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,u.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,
-c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,u.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(u.hasVertexTexture=
-!1,u.program=c.createProgram(),c.attachShader(u.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(u.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(u.hasVertexTexture=!0,u.program=c.createProgram(),c.attachShader(u.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(u.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.vertex=
-c.getAttribLocation(u.program,"position");u.attributes.uv=c.getAttribLocation(u.program,"UV");u.uniforms.renderType=c.getUniformLocation(u.program,"renderType");u.uniforms.map=c.getUniformLocation(u.program,"map");u.uniforms.occlusionMap=c.getUniformLocation(u.program,"occlusionMap");u.uniforms.opacity=c.getUniformLocation(u.program,"opacity");u.uniforms.scale=c.getUniformLocation(u.program,"scale");u.uniforms.rotation=c.getUniformLocation(u.program,"rotation");u.uniforms.screenPosition=c.getUniformLocation(u.program,
-"screenPosition");var pa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;
-b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,
-K("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=
-c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,
-"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var ra=!1;this.setSize=function(b,c){_canvas.width=b;_canvas.height=c;this.setViewport(0,0,_canvas.width,_canvas.height)};this.setViewport=function(b,e,d,f){_viewportX=b;_viewportY=e;_viewportWidth=d;_viewportHeight=
-f;c.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight)};this.setScissor=function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){O=b;c.depthMask(b)};this.setClearColorHex=function(b,e){_clearColor.setHex(b);_clearAlpha=e;c.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.setClearColor=function(b,e){_clearColor.copy(b);_clearAlpha=e;c.clearColor(_clearColor.r,
-_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){v.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,e,d,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?
-i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var m,o,p;m=p=j=0;for(o=e.length;m<o;m++)h=e[m],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&j++;j+p<=4?e=p:(e=Math.ceil(4*p/(j+p)),j=4-e);h={directional:e,point:j};
-p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var n;a:{m=b.fragmentShader;o=b.vertexShader;var j=b.uniforms,e=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},r;h=[];i?h.push(i):(h.push(m),h.push(o));for(r in d)h.push(r),h.push(d[r]);i=h.join();
-r=0;for(h=na.length;r<h;r++)if(na[r].code==i){n=na[r].program;break a}r=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-p=[ja?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.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");
+j=f.materials[0],j.program||Q.initMaterial(j,h,void 0,f),j=j.program,m=j.uniforms,o=j.attributes,R!==j&&(c.useProgram(j),R=j,c.uniformMatrix4fv(m.projectionMatrix,!1,_projectionMatrixArray),c.uniformMatrix4fv(m.viewMatrix,!1,_viewMatrixArray),c.uniform3fv(m.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(m.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,
+i.__webglNormalBuffer),c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);E=-1;R=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,
+!1,_projectionMatrixArray);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(P)}function x(b,d){var e,f,h;e=_sprite.attributes;var g=
+_sprite.uniforms,i=_viewportHeight/_viewportWidth,j,m=[],o=_viewportWidth*0.5,p=_viewportHeight*0.5,n=!0;c.useProgram(_sprite.program);R=_sprite.program;E=-1;qa||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),qa=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+_sprite.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,_projectionMatrixArray);c.activeTexture(c.TEXTURE0);c.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&
+(h.useScreenCoordinates?(c.uniform1i(g.useScreenCoordinates,1),c.uniform3f(g.screenPosition,(h.position.x-o)/o,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(c.uniform1i(g.useScreenCoordinates,0),c.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),c.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),j=h.map.image.width/(h.scaleByViewport?_viewportHeight:1),m[0]=j*i*h.scale.x,m[1]=j*h.scale.y,c.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),c.uniform2f(g.uvOffset,h.uvOffset.x,
+h.uvOffset.y),c.uniform2f(g.alignment,h.alignment.x,h.alignment.y),c.uniform1f(g.opacity,h.opacity),c.uniform1f(g.rotation,h.rotation),c.uniform2fv(g.scale,m),h.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),y(h.blending),C(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(P)}function z(b,d){var e,f,h=b.__webglLensFlares.length,g,i,j,m=new THREE.Vector3,o=_viewportHeight/_viewportWidth,
+p=_viewportWidth*0.5,n=_viewportHeight*0.5,q=16/_viewportHeight,t=[q*o,q],r=[1,1,0],u=[1,1],B=v.uniforms;e=v.attributes;c.useProgram(v.program);R=v.program;E=-1;oa||(c.enableVertexAttribArray(v.attributes.vertex),c.enableVertexAttribArray(v.attributes.uv),oa=!0);c.uniform1i(B.occlusionMap,0);c.uniform1i(B.map,1);c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);
+c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,v.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;f++)if(e=b.__webglLensFlares[f].object,m.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),r[0]=m.x,r[1]=m.y,r[2]=m.z,u[0]=r[0]*p+p,u[1]=r[1]*n+n,v.hasVertexTexture||u[0]>0&&u[0]<_viewportWidth&&u[1]>0&&u[1]<_viewportHeight){c.bindTexture(c.TEXTURE_2D,v.tempTexture);
+c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,u[0]-8,u[1]-8,16,16,0);c.uniform1i(B.renderType,0);c.uniform2fv(B.scale,t);c.uniform3fv(B.screenPosition,r);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,v.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,u[0]-8,u[1]-8,16,16,0);c.uniform1i(B.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,v.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=
+r[0];e.positionScreen.y=r[1];e.positionScreen.z=r[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(B.renderType,2);c.enable(c.BLEND);g=0;for(i=e.lensFlares.length;g<i;g++)if(j=e.lensFlares[g],j.opacity>0.001&&j.scale>0.001)r[0]=j.x,r[1]=j.y,r[2]=j.z,q=j.size*j.scale/_viewportHeight,t[0]=q*o,t[1]=q,c.uniform3fv(B.screenPosition,r),c.uniform2fv(B.scale,t),c.uniform1f(B.rotation,j.rotation),c.uniform1f(B.opacity,j.opacity),y(j.blending),C(j.texture,1),c.drawElements(c.TRIANGLES,
+6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(P)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function fa(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var i=g=void 0,j=void 0,m=void 0,o=void 0,o=h.__materials,i=0,j=o.length;i<j;i++)if(m=o[i],m.attributes)for(g in m.attributes)if(m.attributes[g].needsUpdate){g=
+!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,i=b,j=c.DYNAMIC_DRAW,g.__inittedArrays){var n=o=m=void 0,p=void 0,H=n=void 0,q=void 0,t=void 0,r=void 0,v=void 0,u=void 0,y=void 0,B=void 0,D=void 0,x=void 0,z=void 0,I=void 0,E=void 0,s=p=r=p=t=q=void 0,A=void 0,k=A=s=q=void 0,F=void 0,K=k=A=s=n=n=H=r=p=k=A=s=F=k=A=s=F=k=A=s=void 0,C=0,G=0,Q=0,T=0,J=0,L=0,S=0,M=0,aa=0,w=0,ca=0,A=s=0,da=g.__vertexArray,
+Z=g.__uvArray,$=g.__uv2Array,O=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,fa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,k=void 0,N=g.__faceArray,P=g.__lineArray,ka=g.__needsSmoothNormals,u=g.__vertexColorType,v=g.__uvType,y=g.__normalType,ha=i.geometry,ja=ha.__dirtyVertices,la=ha.__dirtyElements,ga=ha.__dirtyUvs,ma=ha.__dirtyNormals,oa=ha.__dirtyTangents,qa=ha.__dirtyColors,Ba=ha.__dirtyMorphTargets,
+ua=ha.vertices,Da=g.faces,Ga=ha.faces,Ea=ha.faceVertexUvs[0],Fa=ha.faceVertexUvs[1],va=ha.skinVerticesA,wa=ha.skinVerticesB,xa=ha.skinIndices,ra=ha.skinWeights,sa=i instanceof THREE.ShadowVolume?ha.edgeFaces:void 0,pa=ha.morphTargets;if(R)for(K in R)R[K].offset=0,R[K].offsetSrc=0;m=0;for(o=Da.length;m<o;m++)if(n=Da[m],p=Ga[n],Ea&&(B=Ea[n]),Fa&&(D=Fa[n]),n=p.vertexNormals,H=p.normal,q=p.vertexColors,t=p.color,r=p.vertexTangents,p instanceof THREE.Face3){if(ja)x=ua[p.a].position,z=ua[p.b].position,
+I=ua[p.c].position,da[G]=x.x,da[G+1]=x.y,da[G+2]=x.z,da[G+3]=z.x,da[G+4]=z.y,da[G+5]=z.z,da[G+6]=I.x,da[G+7]=I.y,da[G+8]=I.z,G+=9;if(R)for(K in R)if(k=R[K],k.__original.needsUpdate)s=k.offset,A=k.offsetSrc,k.size===1?(k.boundTo===void 0||k.boundTo==="vertices"?(k.array[s+0]=k.value[p.a],k.array[s+1]=k.value[p.b],k.array[s+2]=k.value[p.c]):k.boundTo==="faces"?(k.array[s+0]=k.value[A],k.array[s+1]=k.value[A],k.array[s+2]=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(k.array[s+0]=k.value[A+
+0],k.array[s+1]=k.value[A+1],k.array[s+2]=k.value[A+2],k.offsetSrc+=3),k.offset+=3):(k.boundTo===void 0||k.boundTo==="vertices"?(x=k.value[p.a],z=k.value[p.b],I=k.value[p.c]):k.boundTo==="faces"?(x=k.value[A],z=k.value[A],I=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(x=k.value[A+0],z=k.value[A+1],I=k.value[A+2],k.offsetSrc+=3),k.size===2?(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=z.x,k.array[s+3]=z.y,k.array[s+4]=I.x,k.array[s+5]=I.y,k.offset+=6):k.size===3?(k.type==="c"?(k.array[s+
+0]=x.r,k.array[s+1]=x.g,k.array[s+2]=x.b,k.array[s+3]=z.r,k.array[s+4]=z.g,k.array[s+5]=z.b,k.array[s+6]=I.r,k.array[s+7]=I.g,k.array[s+8]=I.b):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=z.x,k.array[s+4]=z.y,k.array[s+5]=z.z,k.array[s+6]=I.x,k.array[s+7]=I.y,k.array[s+8]=I.z),k.offset+=9):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=x.w,k.array[s+4]=z.x,k.array[s+5]=z.y,k.array[s+6]=z.z,k.array[s+7]=z.w,k.array[s+8]=I.x,k.array[s+9]=I.y,k.array[s+10]=I.z,
+k.array[s+11]=I.w,k.offset+=12));if(Ba){s=0;for(A=pa.length;s<A;s++)x=pa[s].vertices[p.a].position,z=pa[s].vertices[p.b].position,I=pa[s].vertices[p.c].position,k=fa[s],k[ca+0]=x.x,k[ca+1]=x.y,k[ca+2]=x.z,k[ca+3]=z.x,k[ca+4]=z.y,k[ca+5]=z.z,k[ca+6]=I.x,k[ca+7]=I.y,k[ca+8]=I.z;ca+=9}if(ra.length)s=ra[p.a],A=ra[p.b],k=ra[p.c],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=k.x,Y[w+9]=k.y,Y[w+10]=k.z,Y[w+11]=k.w,s=xa[p.a],A=xa[p.b],k=xa[p.c],X[w]=s.x,X[w+
+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=k.x,X[w+9]=k.y,X[w+10]=k.z,X[w+11]=k.w,s=va[p.a],A=va[p.b],k=va[p.c],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=k.x,V[w+9]=k.y,V[w+10]=k.z,V[w+11]=1,s=wa[p.a],A=wa[p.b],k=wa[p.c],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=1,W[w+8]=k.x,W[w+9]=k.y,W[w+10]=k.z,W[w+11]=1,w+=12;if(qa&&u)q.length==3&&u==THREE.VertexColors?(p=q[0],s=q[1],A=q[2]):
+A=s=p=t,ea[aa]=p.r,ea[aa+1]=p.g,ea[aa+2]=p.b,ea[aa+3]=s.r,ea[aa+4]=s.g,ea[aa+5]=s.b,ea[aa+6]=A.r,ea[aa+7]=A.g,ea[aa+8]=A.b,aa+=9;if(oa&&ha.hasTangents)q=r[0],t=r[1],p=r[2],U[S]=q.x,U[S+1]=q.y,U[S+2]=q.z,U[S+3]=q.w,U[S+4]=t.x,U[S+5]=t.y,U[S+6]=t.z,U[S+7]=t.w,U[S+8]=p.x,U[S+9]=p.y,U[S+10]=p.z,U[S+11]=p.w,S+=12;if(ma&&y)if(n.length==3&&ka)for(r=0;r<3;r++)H=n[r],O[L]=H.x,O[L+1]=H.y,O[L+2]=H.z,L+=3;else for(r=0;r<3;r++)O[L]=H.x,O[L+1]=H.y,O[L+2]=H.z,L+=3;if(ga&&B!==void 0&&v)for(r=0;r<3;r++)n=B[r],Z[Q]=
+n.u,Z[Q+1]=n.v,Q+=2;if(ga&&D!==void 0&&v)for(r=0;r<3;r++)n=D[r],$[T]=n.u,$[T+1]=n.v,T+=2;la&&(N[J]=C,N[J+1]=C+1,N[J+2]=C+2,J+=3,P[M]=C,P[M+1]=C+1,P[M+2]=C,P[M+3]=C+2,P[M+4]=C+1,P[M+5]=C+2,M+=6,C+=3)}else if(p instanceof THREE.Face4){if(ja)x=ua[p.a].position,z=ua[p.b].position,I=ua[p.c].position,E=ua[p.d].position,da[G]=x.x,da[G+1]=x.y,da[G+2]=x.z,da[G+3]=z.x,da[G+4]=z.y,da[G+5]=z.z,da[G+6]=I.x,da[G+7]=I.y,da[G+8]=I.z,da[G+9]=E.x,da[G+10]=E.y,da[G+11]=E.z,G+=12;if(R)for(K in R)if(k=R[K],k.__original.needsUpdate)s=
+k.offset,A=k.offsetSrc,k.size===1?(k.boundTo===void 0||k.boundTo==="vertices"?(k.array[s+0]=k.value[p.a],k.array[s+1]=k.value[p.b],k.array[s+2]=k.value[p.c],k.array[s+3]=k.value[p.d]):k.boundTo==="faces"?(k.array[s+0]=k.value[A],k.array[s+1]=k.value[A],k.array[s+2]=k.value[A],k.array[s+3]=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(k.array[s+0]=k.value[A+0],k.array[s+1]=k.value[A+1],k.array[s+2]=k.value[A+2],k.array[s+3]=k.value[A+3],k.offsetSrc+=4),k.offset+=4):(k.boundTo===void 0||k.boundTo===
+"vertices"?(x=k.value[p.a],z=k.value[p.b],I=k.value[p.c],E=k.value[p.d]):k.boundTo==="faces"?(x=k.value[A],z=k.value[A],I=k.value[A],E=k.value[A],k.offsetSrc++):k.boundTo==="faceVertices"&&(x=k.value[A+0],z=k.value[A+1],I=k.value[A+2],E=k.value[A+3],k.offsetSrc+=4),k.size===2?(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=z.x,k.array[s+3]=z.y,k.array[s+4]=I.x,k.array[s+5]=I.y,k.array[s+6]=E.x,k.array[s+7]=E.y,k.offset+=8):k.size===3?(k.type==="c"?(k.array[s+0]=x.r,k.array[s+1]=x.g,k.array[s+2]=x.b,
+k.array[s+3]=z.r,k.array[s+4]=z.g,k.array[s+5]=z.b,k.array[s+6]=I.r,k.array[s+7]=I.g,k.array[s+8]=I.b,k.array[s+9]=E.r,k.array[s+10]=E.g,k.array[s+11]=E.b):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=z.x,k.array[s+4]=z.y,k.array[s+5]=z.z,k.array[s+6]=I.x,k.array[s+7]=I.y,k.array[s+8]=I.z,k.array[s+9]=E.x,k.array[s+10]=E.y,k.array[s+11]=E.z),k.offset+=12):(k.array[s+0]=x.x,k.array[s+1]=x.y,k.array[s+2]=x.z,k.array[s+3]=x.w,k.array[s+4]=z.x,k.array[s+5]=z.y,k.array[s+6]=z.z,k.array[s+
+7]=z.w,k.array[s+8]=I.x,k.array[s+9]=I.y,k.array[s+10]=I.z,k.array[s+11]=I.w,k.array[s+12]=E.x,k.array[s+13]=E.y,k.array[s+14]=E.z,k.array[s+15]=E.w,k.offset+=16));if(Ba){s=0;for(A=pa.length;s<A;s++)x=pa[s].vertices[p.a].position,z=pa[s].vertices[p.b].position,I=pa[s].vertices[p.c].position,E=pa[s].vertices[p.d].position,k=fa[s],k[ca+0]=x.x,k[ca+1]=x.y,k[ca+2]=x.z,k[ca+3]=z.x,k[ca+4]=z.y,k[ca+5]=z.z,k[ca+6]=I.x,k[ca+7]=I.y,k[ca+8]=I.z,k[ca+9]=E.x,k[ca+10]=E.y,k[ca+11]=E.z;ca+=12}if(ra.length)s=ra[p.a],
+A=ra[p.b],k=ra[p.c],F=ra[p.d],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=k.x,Y[w+9]=k.y,Y[w+10]=k.z,Y[w+11]=k.w,Y[w+12]=F.x,Y[w+13]=F.y,Y[w+14]=F.z,Y[w+15]=F.w,s=xa[p.a],A=xa[p.b],k=xa[p.c],F=xa[p.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=k.x,X[w+9]=k.y,X[w+10]=k.z,X[w+11]=k.w,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=F.w,s=va[p.a],A=va[p.b],k=va[p.c],F=va[p.d],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,
+V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=k.x,V[w+9]=k.y,V[w+10]=k.z,V[w+11]=1,V[w+12]=F.x,V[w+13]=F.y,V[w+14]=F.z,V[w+15]=1,s=wa[p.a],A=wa[p.b],k=wa[p.c],p=wa[p.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=1,W[w+8]=k.x,W[w+9]=k.y,W[w+10]=k.z,W[w+11]=1,W[w+12]=p.x,W[w+13]=p.y,W[w+14]=p.z,W[w+15]=1,w+=16;if(qa&&u)q.length==4&&u==THREE.VertexColors?(p=q[0],s=q[1],A=q[2],q=q[3]):q=A=s=p=t,ea[aa]=p.r,ea[aa+1]=p.g,ea[aa+2]=p.b,ea[aa+3]=s.r,ea[aa+4]=
+s.g,ea[aa+5]=s.b,ea[aa+6]=A.r,ea[aa+7]=A.g,ea[aa+8]=A.b,ea[aa+9]=q.r,ea[aa+10]=q.g,ea[aa+11]=q.b,aa+=12;if(oa&&ha.hasTangents)q=r[0],t=r[1],p=r[2],r=r[3],U[S]=q.x,U[S+1]=q.y,U[S+2]=q.z,U[S+3]=q.w,U[S+4]=t.x,U[S+5]=t.y,U[S+6]=t.z,U[S+7]=t.w,U[S+8]=p.x,U[S+9]=p.y,U[S+10]=p.z,U[S+11]=p.w,U[S+12]=r.x,U[S+13]=r.y,U[S+14]=r.z,U[S+15]=r.w,S+=16;if(ma&&y)if(n.length==4&&ka)for(r=0;r<4;r++)H=n[r],O[L]=H.x,O[L+1]=H.y,O[L+2]=H.z,L+=3;else for(r=0;r<4;r++)O[L]=H.x,O[L+1]=H.y,O[L+2]=H.z,L+=3;if(ga&&B!==void 0&&
+v)for(r=0;r<4;r++)n=B[r],Z[Q]=n.u,Z[Q+1]=n.v,Q+=2;if(ga&&D!==void 0&&v)for(r=0;r<4;r++)n=D[r],$[T]=n.u,$[T+1]=n.v,T+=2;la&&(N[J]=C,N[J+1]=C+1,N[J+2]=C+3,N[J+3]=C+1,N[J+4]=C+2,N[J+5]=C+3,J+=6,P[M]=C,P[M+1]=C+1,P[M+2]=C,P[M+3]=C+3,P[M+4]=C+1,P[M+5]=C+2,P[M+6]=C+2,P[M+7]=C+3,M+=8,C+=4)}if(sa){m=0;for(o=sa.length;m<o;m++)N[J]=sa[m].a,N[J+1]=sa[m].b,N[J+2]=sa[m].c,N[J+3]=sa[m].a,N[J+4]=sa[m].c,N[J+5]=sa[m].d,J+=6}ja&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,da,j));
+if(R)for(K in R)k=R[K],k.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,k.buffer),c.bufferData(c.ARRAY_BUFFER,k.array,j));if(Ba){s=0;for(A=pa.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,fa[s],j)}qa&&aa>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ea,j));ma&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,O,j));oa&&ha.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),
+c.bufferData(c.ARRAY_BUFFER,U,j));ga&&Q>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));ga&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,$,j));la&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,N,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,
+V,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,
+delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ia;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(ia in e.attributes)e.attributes[ia].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ia=f;b=c.DYNAMIC_DRAW;o=ia.vertices;h=ia.colors;v=o.length;g=
+h.length;u=ia.__vertexArray;i=ia.__colorArray;y=ia.__dirtyColors;if(ia.__dirtyVertices){for(j=0;j<v;j++)m=o[j].position,e=j*3,u[e]=m.x,u[e+1]=m.y,u[e+2]=m.z;c.bindBuffer(c.ARRAY_BUFFER,ia.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,u,b)}if(y){for(j=0;j<g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ia.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||
+f.__dirtyColors){ia=f;b=c.DYNAMIC_DRAW;o=ia.vertices;h=ia.colors;v=o.length;g=h.length;u=ia.__vertexArray;i=ia.__colorArray;y=ia.__dirtyColors;if(ia.__dirtyVertices){for(j=0;j<v;j++)m=o[j].position,e=j*3,u[e]=m.x,u[e+1]=m.y,u[e+2]=m.z;c.bindBuffer(c.ARRAY_BUFFER,ia.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,u,b)}if(y){for(j=0;j<g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ia.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=
+!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function M(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function O(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,g,h,i,j,m,p={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=
+0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,counter:0}),m=p[j].hash+"_"+p[j].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+h>65535&&(p[j].counter+=1,m=p[j].hash+"_"+p[j].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=
+h}function F(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(b){if(b!=E){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,
+c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}E=b}}function Z(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,T(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,T(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,T(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,T(e.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,ma(e.magFilter)),
+c.texParameteri(b,c.TEXTURE_MIN_FILTER,ma(e.minFilter)))}function C(b,e){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),Z(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_2D,
+b.__webglTexture)}function $(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,T(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,T(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,T(b.magFilter));
+c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,T(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
+c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,
+d=_viewportWidth,b=_viewportHeight);e!=ja&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(_viewportX,_viewportY,d,b),ja=e)}function K(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)),console.error(e),null;return d}function ma(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;
+default:return c.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}
+var Q=this,c,ga=[],R=null,ja=null,P=!0,J=null,ka=null,E=null,L=null,G=null;_oldPolygonOffsetUnits=_oldPolygonOffsetFactor=null;_cullEnabled=!0;_viewportHeight=_viewportWidth=_viewportY=_viewportX=0;_frustum=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];_projScreenMatrix=new THREE.Matrix4;_projectionMatrixArray=new Float32Array(16);_viewMatrixArray=new Float32Array(16);_vector3=new THREE.Vector4;_lights={ambient:[0,0,0],directional:{length:0,
+colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};_canvas=b.canvas!==void 0?b.canvas:document.createElement("canvas");_stencil=b.stencil!==void 0?b.stencil:!0;_antialias=b.antialias!==void 0?b.antialias:!1;_clearColor=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0);_clearAlpha=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=_canvas;this.sortObjects=this.autoClear=!0;try{if(!(c=
+_canvas.getContext("experimental-webgl",{antialias:_antialias,stencil:_stencil})))throw"Error creating WebGL context.";}catch(N){console.error(N)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);
+c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha);_cullEnabled=!0;this.context=c;var la=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(_stencil){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=
+-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,K("vertex",
+THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var v={};v.vertices=new Float32Array(16);v.faces=new Uint16Array(6);b=0;v.vertices[b++]=-1;v.vertices[b++]=-1;v.vertices[b++]=0;v.vertices[b++]=0;v.vertices[b++]=1;v.vertices[b++]=-1;v.vertices[b++]=1;v.vertices[b++]=0;v.vertices[b++]=1;v.vertices[b++]=
+1;v.vertices[b++]=1;v.vertices[b++]=1;v.vertices[b++]=-1;v.vertices[b++]=1;v.vertices[b++]=0;v.vertices[b++]=1;b=0;v.faces[b++]=0;v.faces[b++]=1;v.faces[b++]=2;v.faces[b++]=0;v.faces[b++]=2;v.faces[b++]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();v.tempTexture=c.createTexture();v.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,
+v.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,v.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,v.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);
+c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(v.hasVertexTexture=!1,v.program=c.createProgram(),c.attachShader(v.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(v.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):
+(v.hasVertexTexture=!0,v.program=c.createProgram(),c.attachShader(v.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(v.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.vertex=c.getAttribLocation(v.program,"position");v.attributes.uv=c.getAttribLocation(v.program,"UV");v.uniforms.renderType=c.getUniformLocation(v.program,"renderType");v.uniforms.map=c.getUniformLocation(v.program,
+"map");v.uniforms.occlusionMap=c.getUniformLocation(v.program,"occlusionMap");v.uniforms.opacity=c.getUniformLocation(v.program,"opacity");v.uniforms.scale=c.getUniformLocation(v.program,"scale");v.uniforms.rotation=c.getUniformLocation(v.program,"rotation");v.uniforms.screenPosition=c.getUniformLocation(v.program,"screenPosition");var oa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=
+0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=
+c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};
+_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,
+"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,
+"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var qa=!1;this.setSize=function(b,c){_canvas.width=b;_canvas.height=c;this.setViewport(0,0,_canvas.width,_canvas.height)};this.setViewport=function(b,e,d,f){_viewportX=b;_viewportY=e;_viewportWidth=d;_viewportHeight=f;c.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight)};this.setScissor=function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):
+c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){P=b;c.depthMask(b)};this.setClearColorHex=function(b,e){_clearColor.setHex(b);_clearAlpha=e;c.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.setClearColor=function(b,e){_clearColor.copy(b);_clearAlpha=e;c.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=
+b};this.getContext=function(){return c};this.initMaterial=function(b,e,d,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
+if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var m,o,p;m=p=j=0;for(o=e.length;m<o;m++)h=e[m],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&j++;j+p<=4?e=p:(e=Math.ceil(4*p/(j+p)),j=4-e);h={directional:e,point:j};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var n;a:{m=b.fragmentShader;o=b.vertexShader;var j=b.uniforms,e=b.attributes,d={map:!!b.map,envMap:!!b.envMap,
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},r;h=[];i?h.push(i):(h.push(m),h.push(o));for(r in d)h.push(r),h.push(d[r]);i=h.join();r=0;for(h=ga.length;r<h;r++)if(ga[r].code==i){n=ga[r].program;break a}r=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,
+"#define MAX_POINT_LIGHTS "+d.maxPointLights,d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[la?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":
+"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.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");
 c.attachShader(r,K("fragment",h+m));c.attachShader(r,K("vertex",p+o));c.linkProgram(r);c.getProgramParameter(r,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(r,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");r.uniforms={};r.attributes={};var q;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in j)m.push(q);q=m;j=0;for(m=
-q.length;j<m;j++)o=q[j],r.uniforms[o]=c.getUniformLocation(r,o);m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<d.maxMorphTargets;q++)m.push("morphTarget"+q);for(n in e)m.push(n);n=m;q=0;for(e=n.length;q<e;q++)d=n[q],r.attributes[d]=c.getAttribLocation(r,d);na.push({program:r,code:i});n=r}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>=
+q.length;j<m;j++)o=q[j],r.uniforms[o]=c.getUniformLocation(r,o);m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<d.maxMorphTargets;q++)m.push("morphTarget"+q);for(n in e)m.push(n);n=m;q=0;for(e=n.length;q<e;q++)d=n[q],r.attributes[d]=c.getAttribLocation(r,d);ga.push({program:r,code:i});n=r}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>=
 0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),
 b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=
-0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,n,v){var u,E,oa,C,F,G,p,H,J=b.lights,K=b.fog;P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(_viewMatrixArray);
-d.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(d.projectionMatrix,d.matrixWorldInverse);o(_projScreenMatrix);this.initWebGLObjects(b);Z(n);(this.autoClear||v)&&this.clear();F=b.__webglObjects.length;for(v=0;v<F;v++)if(u=b.__webglObjects[v],p=u.object,p.visible)if(!(p instanceof THREE.Mesh)||m(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),B(p,d),t(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(_vector3.copy(p.position),
-_projScreenMatrix.multiplyVector3(_vector3),u.z=_vector3.z)}else u.render=!1;else u.render=!1;this.sortObjects&&b.__webglObjects.sort(r);G=b.__webglObjectsImmediate.length;for(v=0;v<G;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),B(p,d),q(u));y(THREE.NormalBlending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;H=u.buffer;oa=u.opaque;i(p);for(u=0;u<oa.count;u++)C=oa.list[u],h(C.depthTest),j(C.polygonOffset,
-C.polygonOffsetFactor,C.polygonOffsetUnits),f(d,J,K,C,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){oa=u.opaque;i(p);for(u=0;u<oa.count;u++)C=oa.list[u],h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(d,J,K,C,p),p.render(function(b){g(b,E,C.shading)})}for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;H=u.buffer;oa=u.transparent;i(p);for(u=0;u<oa.count;u++)C=oa.list[u],y(C.blending),h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,
-C.polygonOffsetUnits),f(d,J,K,C,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){oa=u.transparent;i(p);for(u=0;u<oa.count;u++)C=oa.list[u],y(C.blending),h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(d,J,K,C,p),p.render(function(b){g(b,E,C.shading)})}b.__webglSprites.length&&x(b,d);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&D(b);b.__webglLensFlares.length&&z(b,d);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&
+0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,n,v){var u,E,na,C,F,G,p,H,J=b.lights,K=b.fog;Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(_viewMatrixArray);
+d.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(d.projectionMatrix,d.matrixWorldInverse);m(_projScreenMatrix);this.initWebGLObjects(b);$(n);(this.autoClear||v)&&this.clear();F=b.__webglObjects.length;for(v=0;v<F;v++)if(u=b.__webglObjects[v],p=u.object,p.visible)if(!(p instanceof THREE.Mesh)||o(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),t(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(_vector3.copy(p.position),
+_projScreenMatrix.multiplyVector3(_vector3),u.z=_vector3.z)}else u.render=!1;else u.render=!1;this.sortObjects&&b.__webglObjects.sort(r);G=b.__webglObjectsImmediate.length;for(v=0;v<G;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),q(u));y(THREE.NormalBlending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;H=u.buffer;na=u.opaque;i(p);for(u=0;u<na.count;u++)C=na.list[u],h(C.depthTest),j(C.polygonOffset,
+C.polygonOffsetFactor,C.polygonOffsetUnits),f(d,J,K,C,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){na=u.opaque;i(p);for(u=0;u<na.count;u++)C=na.list[u],h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(d,J,K,C,p),p.render(function(b){g(b,E,C.shading)})}for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;H=u.buffer;na=u.transparent;i(p);for(u=0;u<na.count;u++)C=na.list[u],y(C.blending),h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,
+C.polygonOffsetUnits),f(d,J,K,C,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){na=u.transparent;i(p);for(u=0;u<na.count;u++)C=na.list[u],y(C.blending),h(C.depthTest),j(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(d,J,K,C,p),p.render(function(b){g(b,E,C.shading)})}b.__webglSprites.length&&x(b,d);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&B(b);b.__webglLensFlares.length&&z(b,d);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&
 (c.bindTexture(c.TEXTURE_2D,n.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=
-new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&N(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=
+new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&O(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=
 c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,m=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(m=i.numMorphTargets;j<m;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,p=void 0,o=void 0,r=o=void 0,q=void 0,u=void 0,v=u=m=0,t=o=p=void 0,x=t=p=n=void 0,o=void 0,
 r=j.geometry,q=r.faces,t=i.faces,n=0,p=t.length;n<p;n++)o=t[n],o=q[o],o instanceof THREE.Face3?(m+=3,u+=1,v+=3):o instanceof THREE.Face4&&(m+=4,u+=2,v+=4);for(var n=i,p=j,y=t=q=void 0,z=void 0,y=void 0,o=[],q=0,t=p.materials.length;q<t;q++)if(y=p.materials[q],y instanceof THREE.MeshFaceMaterial){y=0;for(l=n.materials.length;y<l;y++)(z=n.materials[y])&&o.push(z)}else(z=y)&&o.push(z);n=o;i.__materials=n;a:{q=p=void 0;t=n.length;for(p=0;p<t;p++)if(q=n[p],q.map||q.lightMap||q instanceof THREE.MeshShaderMaterial){p=
 !0;break a}p=!1}a:{t=q=void 0;o=n.length;for(q=0;q<o;q++)if(t=n[q],!(t instanceof THREE.MeshBasicMaterial&&!t.envMap||t instanceof THREE.MeshDepthMaterial)){t=t&&t.shading!=void 0&&t.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}t=!1}a:{o=q=void 0;y=n.length;for(q=0;q<y;q++)if(o=n[q],o.vertexColors){o=o.vertexColors;break a}o=!1}i.__vertexArray=new Float32Array(m*3);if(t)i.__normalArray=new Float32Array(m*3);if(r.hasTangents)i.__tangentArray=new Float32Array(m*4);if(o)i.__colorArray=
@@ -298,7 +298,7 @@ o[x];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,u=1
 F(e.__webglShadowVolumes,h,d):F(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)F(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;
 if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*
 3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)d=b.__objectsRemoved[0],e=b,d instanceof THREE.ShadowVolume?M(e.__webglShadowVolumes,
-d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?M(e.__webglObjects,d):d instanceof THREE.Sprite?M(e.__webglSprites,d):d instanceof THREE.LensFlare?M(e.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&M(e.__webglObjectsImmediate,d),b.__objectsRemoved.splice(0,1);d=0;for(e=b.__webglObjects.length;d<e;d++)ea(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)ea(b.__webglShadowVolumes[d].object,b);d=0;for(e=
-b.__webglLensFlares.length;d<e;d++)ea(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return ja}};
+d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?M(e.__webglObjects,d):d instanceof THREE.Sprite?M(e.__webglSprites,d):d instanceof THREE.LensFlare?M(e.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&M(e.__webglObjectsImmediate,d),b.__objectsRemoved.splice(0,1);d=0;for(e=b.__webglObjects.length;d<e;d++)fa(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)fa(b.__webglShadowVolumes[d].object,b);d=0;for(e=
+b.__webglLensFlares.length;d<e;d++)fa(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return la}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};

+ 0 - 22
src/core/Matrix4.js

@@ -165,27 +165,6 @@ THREE.Matrix4.prototype = {
 		b31 = b.n31, b32 = b.n32, b33 = b.n33, b34 = b.n34,
 		b41 = b.n41, b42 = b.n42, b43 = b.n43, b44 = b.n44;
 
-		this.n11 = a11 * b11 + a12 * b21 + a13 * b31;
-		this.n12 = a11 * b12 + a12 * b22 + a13 * b32;
-		this.n13 = a11 * b13 + a12 * b23 + a13 * b33;
-		this.n14 = a11 * b14 + a12 * b24 + a13 * b34 + a14;
-
-		this.n21 = a21 * b11 + a22 * b21 + a23 * b31;
-		this.n22 = a21 * b12 + a22 * b22 + a23 * b32;
-		this.n23 = a21 * b13 + a22 * b23 + a23 * b33;
-		this.n24 = a21 * b14 + a22 * b24 + a23 * b34 + a24;
-
-		this.n31 = a31 * b11 + a32 * b21 + a33 * b31;
-		this.n32 = a31 * b12 + a32 * b22 + a33 * b32;
-		this.n33 = a31 * b13 + a32 * b23 + a33 * b33;
-		this.n34 = a31 * b14 + a32 * b24 + a33 * b34 + a34;
-
-		this.n41 = a41 * b11 + a42 * b21 + a43 * b31;
-		this.n42 = a41 * b12 + a42 * b22 + a43 * b32;
-		this.n43 = a41 * b13 + a42 * b23 + a43 * b33;
-		this.n44 = a41 * b14 + a42 * b24 + a43 * b34 + a44;
-
-		/*
 		this.n11 = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
 		this.n12 = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
 		this.n13 = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
@@ -205,7 +184,6 @@ THREE.Matrix4.prototype = {
 		this.n42 = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
 		this.n43 = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
 		this.n44 = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-		*/
 
 		return this;