Browse Source

Changed canvas_geometry_shape => webgl_geometry_shapes.

Also cleaned up ExtrudeGeometry.
alteredq 14 years ago
parent
commit
c35cca9ecf
4 changed files with 480 additions and 454 deletions
  1. 283 283
      build/Three.js
  2. 18 12
      examples/webgl_geometry_shapes.html
  3. 177 157
      src/extras/geometries/ExtrudeGeometry.js
  4. 2 2
      src/extras/geometries/Path.js

+ 283 - 283
build/Three.js

@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;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,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,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(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=c(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,h,j,m,n,p,o,u,v,w,x=b.geometry,
-y=x.vertices,D=[],f=0;for(g=x.faces.length;f<g;f++)if(h=x.faces[f],v=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),n=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),u=w.dot(o),b.doubleSided||(b.flipSided?u>0:u<0))if(o=o.dot((new THREE.Vector3).sub(j,v))/u,v=v.addSelf(w.multiplyScalar(o)),
-h instanceof THREE.Face3)e(v,j,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(e(v,j,m,p)||e(v,m,n,p)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h);return D}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;j=g-e}var c,e,f,g,h,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,u){m=!1;c=h;e=j;f=o;g=u;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
-function(h,j,o,u,v,w){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<u?j<w?j:w:u<w?u:w,f=h>o?h>v?h:v:o>v?o:v,g=j>u?j>w?j:w:u>w?u:w):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<u?j<w?j<e?j:e:w<e?w:e:u<w?u<e?u:e:w<e?w:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>u?j>w?j>g?j:g:w>g?w:g:u>w?u>g?u:g:w>g?w:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(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=c(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,h,j,m,n,p,o,t,u,v,w=b.geometry,
+z=w.vertices,x=[],f=0;for(g=w.faces.length;f<g;f++)if(h=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(z[h.a].position.clone()),m=p.multiplyVector3(z[h.b].position.clone()),n=p.multiplyVector3(z[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(z[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),t=v.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(j,u))/t,u=u.addSelf(v.multiplyScalar(o)),
+h instanceof THREE.Face3)e(u,j,m,n)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},x.push(h));else if(h instanceof THREE.Face4&&(e(u,j,m,p)||e(u,m,n,p)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},x.push(h);return x}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;j=g-e}var c,e,f,g,h,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,t){m=!1;c=h;e=j;f=o;g=t;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
+function(h,j,o,t,u,v){m?(m=!1,c=h<o?h<u?h:u:o<u?o:u,e=j<t?j<v?j:v:t<v?t:v,f=h>o?h>u?h:u:o>u?o:u,g=j>t?j>v?j:v:t>v?t:v):(c=h<o?h<u?h<c?h:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=j<t?j<v?j<e?j:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>o?h>u?h>f?h:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f,g=j>t?j>v?j>g?j:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c: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){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c: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(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};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,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.set(b||1,c||0,e||0,f||0,g||0,h||1,j||0,m||0,n||0,p||0,o||1,u||0,v||0,w||0,x||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=u;this.n41=v;this.n42=w;this.n43=x;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=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,e,f,g,h,j,m,n,p,o,t,u,v,w,z){this.set(b||1,c||0,e||0,f||0,g||0,h||1,j||0,m||0,n||0,p||0,o||1,t||0,u||0,v||0,w||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,j,m,n,p,o,t,u,v,w,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=u;this.n42=v;this.n43=w;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44,H=c.n11,C=c.n12,E=c.n13,I=c.n14,J=c.n21,S=c.n22,
-R=c.n23,N=c.n24,F=c.n31,W=c.n32,K=c.n33,X=c.n34,Q=c.n41,U=c.n42,k=c.n43,ia=c.n44;this.n11=e*H+f*J+g*F+h*Q;this.n12=e*C+f*S+g*W+h*U;this.n13=e*E+f*R+g*K+h*k;this.n14=e*I+f*N+g*X+h*ia;this.n21=j*H+m*J+n*F+p*Q;this.n22=j*C+m*S+n*W+p*U;this.n23=j*E+m*R+n*K+p*k;this.n24=j*I+m*N+n*X+p*ia;this.n31=o*H+u*J+v*F+w*Q;this.n32=o*C+u*S+v*W+w*U;this.n33=o*E+u*R+v*K+w*k;this.n34=o*I+u*N+v*X+w*ia;this.n41=x*H+y*J+D*F+A*Q;this.n42=x*C+y*S+D*W+A*U;this.n43=x*E+y*R+D*K+A*k;this.n44=x*I+y*N+D*X+A*ia;return this},multiplyToArray:function(b,
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,z=b.n42,x=b.n43,y=b.n44,F=c.n11,C=c.n12,E=c.n13,G=c.n14,B=c.n21,P=c.n22,
+I=c.n23,H=c.n24,T=c.n31,U=c.n32,J=c.n33,Y=c.n34,K=c.n41,S=c.n42,k=c.n43,V=c.n44;this.n11=e*F+f*B+g*T+h*K;this.n12=e*C+f*P+g*U+h*S;this.n13=e*E+f*I+g*J+h*k;this.n14=e*G+f*H+g*Y+h*V;this.n21=j*F+m*B+n*T+p*K;this.n22=j*C+m*P+n*U+p*S;this.n23=j*E+m*I+n*J+p*k;this.n24=j*G+m*H+n*Y+p*V;this.n31=o*F+t*B+u*T+v*K;this.n32=o*C+t*P+u*U+v*S;this.n33=o*E+t*I+u*J+v*k;this.n34=o*G+t*H+u*Y+v*V;this.n41=w*F+z*B+x*T+y*K;this.n42=w*C+z*P+x*U+y*S;this.n43=w*E+z*I+x*J+y*k;this.n44=w*G+z*H+x*Y+y*V;return this},multiplyToArray:function(b,
 c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
-b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,v=this.n41,w=this.n42,x=this.n43,y=this.n44;return f*j*p*v-e*m*p*v-f*h*o*v+c*m*o*v+e*h*u*v-c*j*u*v-f*j*n*w+e*m*n*w+f*g*o*w-b*m*o*w-e*g*u*w+b*j*u*w+f*h*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*u*x-b*h*u*x-e*h*n*y+c*j*n*y+e*g*p*y-b*j*p*y-c*g*o*y+b*h*o*y},transpose:function(){var b;b=this.n21;this.n21=
+b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,z=this.n44;return f*j*p*u-e*m*p*u-f*h*o*u+c*m*o*u+e*h*t*u-c*j*t*u-f*j*n*v+e*m*n*v+f*g*o*v-b*m*o*v-e*g*t*v+b*j*t*v+f*h*n*w-c*m*n*w-f*g*p*w+b*m*p*w+c*g*t*w-b*h*t*w-e*h*n*z+c*j*n*z+e*g*p*z-b*j*p*z-c*g*o*z+b*h*o*z},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,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
 c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,j=b.y,m=b.z,n=g*h,p=g*j;this.set(n*h+e,n*j-f*m,n*m+f*j,0,n*j+f*m,p*j+e,p*m-f*h,0,n*m-f*j,p*m+f*h,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
-return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=j*m,p=j*g,o=f*m,u=f*g;this.n11=n+u*e;this.n12=
-o*e-p;this.n13=h*f;this.n21=h*g;this.n22=h*m;this.n23=-e;this.n31=p*e-o;this.n32=u+n*e;this.n33=h*j;break;case "ZXY":n=j*m;p=j*g;o=f*m;u=f*g;this.n11=n-u*e;this.n12=-h*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=h*m;this.n23=u-n*e;this.n31=-h*f;this.n32=e;this.n33=h*j;break;case "ZYX":n=h*m;p=h*g;o=e*m;u=e*g;this.n11=j*m;this.n12=o*f-p;this.n13=n*f+u;this.n21=j*g;this.n22=u*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*j;this.n33=h*j;break;case "YZX":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=u-n*g;this.n13=
-o*g+p;this.n21=g;this.n22=h*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-u*g;break;case "XZY":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=-g;this.n13=f*m;this.n21=n*g+u;this.n22=h*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=u*g+n;break;default:n=h*m,p=h*g,o=e*m,u=e*g,this.n11=j*m,this.n12=-j*g,this.n13=f,this.n21=p+o*f,this.n22=n-u*f,this.n23=-e*j,this.n31=u-n*f,this.n32=o+p*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,
+return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=j*m,p=j*g,o=f*m,t=f*g;this.n11=n+t*e;this.n12=
+o*e-p;this.n13=h*f;this.n21=h*g;this.n22=h*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=h*j;break;case "ZXY":n=j*m;p=j*g;o=f*m;t=f*g;this.n11=n-t*e;this.n12=-h*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=h*m;this.n23=t-n*e;this.n31=-h*f;this.n32=e;this.n33=h*j;break;case "ZYX":n=h*m;p=h*g;o=e*m;t=e*g;this.n11=j*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=j*g;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*j;this.n33=h*j;break;case "YZX":n=h*j;p=h*f;o=e*j;t=e*f;this.n11=j*m;this.n12=t-n*g;this.n13=
+o*g+p;this.n21=g;this.n22=h*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-t*g;break;case "XZY":n=h*j;p=h*f;o=e*j;t=e*f;this.n11=j*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=h*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=t*g+n;break;default:n=h*m,p=h*g,o=e*m,t=e*g,this.n11=j*m,this.n12=-j*g,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*j,this.n31=t-n*f,this.n32=o+p*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,
 j=e+e,m=f+f,b=c*h,n=c*j;c*=m;var p=e*j;e*=m;f*=m;h*=g;j*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-j;this.n32=e+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
 c){var e=1/c.x,f=1/c.y,g=1/c.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,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*w*y-p*v*y+p*u*D-m*w*D-n*u*A+m*v*A;c.n12=h*v*y-g*w*y-h*u*D+f*w*D+g*u*A-f*v*A;c.n13=g*p*y-h*n*y+h*m*D-f*p*D-g*m*A+f*n*A;c.n14=h*n*u-g*p*u-h*m*v+f*p*v+g*m*w-f*n*w;c.n21=p*v*x-n*w*x-p*o*D+j*w*D+n*o*A-j*v*A;c.n22=g*w*x-h*v*x+h*o*D-e*w*D-g*o*A+e*v*A;c.n23=h*n*x-g*p*x-h*j*D+e*p*D+g*j*A-e*n*A;c.n24=
-g*p*o-h*n*o+h*j*v-e*p*v-g*j*w+e*n*w;c.n31=m*w*x-p*u*x+p*o*y-j*w*y-m*o*A+j*u*A;c.n32=h*u*x-f*w*x-h*o*y+e*w*y+f*o*A-e*u*A;c.n33=g*p*x-h*m*x+h*j*y-e*p*y-f*j*A+e*m*A;c.n34=h*m*o-f*p*o-h*j*u+e*p*u+f*j*w-e*m*w;c.n41=n*u*x-m*v*x-n*o*y+j*v*y+m*o*D-j*u*D;c.n42=f*v*x-g*u*x+g*o*y-e*v*y-f*o*D+e*u*D;c.n43=g*m*x-f*n*x-g*j*y+e*n*y+f*j*D-e*m*D;c.n44=f*n*o-g*m*o+g*j*u-e*n*u-f*j*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*j;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*u;return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,z=b.n42,x=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*z-p*u*z+p*t*x-m*v*x-n*t*y+m*u*y;c.n12=h*u*z-g*v*z-h*t*x+f*v*x+g*t*y-f*u*y;c.n13=g*p*z-h*n*z+h*m*x-f*p*x-g*m*y+f*n*y;c.n14=h*n*t-g*p*t-h*m*u+f*p*u+g*m*v-f*n*v;c.n21=p*u*w-n*v*w-p*o*x+j*v*x+n*o*y-j*u*y;c.n22=g*v*w-h*u*w+h*o*x-e*v*x-g*o*y+e*u*y;c.n23=h*n*w-g*p*w-h*j*x+e*p*x+g*j*y-e*n*y;c.n24=
+g*p*o-h*n*o+h*j*u-e*p*u-g*j*v+e*n*v;c.n31=m*v*w-p*t*w+p*o*z-j*v*z-m*o*y+j*t*y;c.n32=h*t*w-f*v*w-h*o*z+e*v*z+f*o*y-e*t*y;c.n33=g*p*w-h*m*w+h*j*z-e*p*z-f*j*y+e*m*y;c.n34=h*m*o-f*p*o-h*j*t+e*p*t+f*j*v-e*m*v;c.n41=n*t*w-m*u*w-n*o*z+j*u*z+m*o*x-j*t*x;c.n42=f*u*w-g*t*w+g*o*z-e*u*z-f*o*x+e*t*x;c.n43=g*m*w-f*n*w-g*j*z+e*n*z+f*j*x-e*m*x;c.n44=f*n*o-g*m*o+g*j*t-e*n*t-f*j*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*j;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var j,m,n,p;j=new THREE.Matrix4;m=c-b;n=e-f;p=h-g;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((e+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/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.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
@@ -52,7 +52,7 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
 THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),j=b*c,m=f*g;this.w=j*h-m*e;this.x=j*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},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,e=this.y,f=this.z,g=this.w,h=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*j;this.y=e*b+g*j+f*h-c*m;this.z=f*b+g*m+c*j-e*h;this.w=g*b-c*h-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,j=this.y,m=this.z,n=this.w,p=n*e+j*g-m*f,o=
-n*f+m*e-h*g,u=n*g+h*f-j*e,e=-h*e-j*f-m*g;c.x=p*n+e*-h+o*-m-u*-j;c.y=o*n+e*-j+u*-h-p*-m;c.z=u*n+e*-m+p*-j-o*-h;return c}};
+n*f+m*e-h*g,t=n*g+h*f-j*e,e=-h*e-j*f-m*g;c.x=p*n+e*-h+o*-m-t*-j;c.y=o*n+e*-j+t*-h-p*-m;c.z=t*n+e*-m+p*-j-o*-h;return c}};
 THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.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 h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,h,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];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)};
@@ -61,15 +61,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.f
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,j,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],j=this.vertices[h.c],m.sub(j.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;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(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;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,e,c,f,g,h,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=j[g];u=j[h];v=j[k];w=n.x-m.x;x=p.x-m.x;y=n.y-m.y;D=p.y-m.y;A=n.z-m.z;H=p.z-m.z;C=u.u-o.u;E=v.u-o.u;I=u.v-o.v;J=v.v-o.v;S=1/(C*J-E*I);W.set((J*w-I*x)*
-S,(J*y-I*D)*S,(J*A-I*H)*S);K.set((C*x-E*w)*S,(C*D-E*y)*S,(C*H-E*A)*S);N[e].addSelf(W);N[c].addSelf(W);N[f].addSelf(W);F[e].addSelf(K);F[c].addSelf(K);F[f].addSelf(K)}var c,e,f,g,h,j,m,n,p,o,u,v,w,x,y,D,A,H,C,E,I,J,S,R,N=[],F=[],W=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,U=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
-THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)U.copy(h.vertexNormals[f]),g=h[k[f]],R=N[g],X.copy(R),X.subSelf(U.multiplyScalar(U.dot(R))).normalize(),Q.cross(h.vertexNormals[f],R),g=Q.dot(F[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.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,e,c,f,g,h,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=j[g];t=j[h];u=j[k];v=n.x-m.x;w=p.x-m.x;z=n.y-m.y;x=p.y-m.y;y=n.z-m.z;F=p.z-m.z;C=t.u-o.u;E=u.u-o.u;G=t.v-o.v;B=u.v-o.v;P=1/(C*B-E*G);U.set((B*v-G*w)*
+P,(B*z-G*x)*P,(B*y-G*F)*P);J.set((C*w-E*v)*P,(C*x-E*z)*P,(C*F-E*y)*P);H[e].addSelf(U);H[c].addSelf(U);H[f].addSelf(U);T[e].addSelf(J);T[c].addSelf(J);T[f].addSelf(J)}var c,e,f,g,h,j,m,n,p,o,t,u,v,w,z,x,y,F,C,E,G,B,P,I,H=[],T=[],U=new THREE.Vector3,J=new THREE.Vector3,Y=new THREE.Vector3,K=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)H[c]=new THREE.Vector3,T[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
+THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)S.copy(h.vertexNormals[f]),g=h[k[f]],I=H[g],Y.copy(I),Y.subSelf(S.multiplyScalar(S.dot(I))).normalize(),K.cross(h.vertexNormals[f],I),g=K.dot(T[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(Y.x,Y.y,Y.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 c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
 void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,j,m={};e=0;for(f=this.faces.length;e<f;e++)j=this.faces[e],j instanceof THREE.Face3?(g=b(j.a,j.b),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.a,j.c),c(m,g,e)):j instanceof THREE.Face4&&(g=b(j.b,j.d),c(m,g,e),g=b(j.a,j.b),c(m,g,e),g=b(j.a,j.d),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.c,j.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){j=this.edges[e];g=j.vertexIndices[0];h=j.vertexIndices[1];
 j.faceIndices=m[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++)h=j.faceIndices[g],j.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,g,h,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,j,m,n,p,o,u,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);j=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
-u=this.points[e[2]];v=this.points[e[3]];m=j*j;n=j*m;f.x=c(p.x,o.x,u.x,v.x,j,m,n);f.y=c(p.y,o.y,u.y,v.y,j,m,n);f.z=c(p.z,o.z,u.z,v.z,j,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
+THREE.Spline=function(b){function c(b,e,c,f,g,h,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,j,m,n,p,o,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);j=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
+t=this.points[e[2]];u=this.points[e[3]];m=j*j;n=j*m;f.x=c(p.x,o.x,t.x,u.x,j,m,n);f.y=c(p.y,o.y,t.y,u.y,j,m,n);f.z=c(p.z,o.z,t.z,u.z,j,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
 m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(j[e]=m,f=e);j[j.length]=m;return{chunks:j,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,j,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];j=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<j-1;c++)f=g+c*(1/j)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||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,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
@@ -123,13 +123,13 @@ THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THR
 THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var 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,c,e)};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,e,f,g,h,j,m,n,p,o,u,v,w,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var y=x.egdes=this.geometry.edges,D=x.edgeFaces=[];g=0;var A=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],A.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(c=y.length;b<c;b++)m=y[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],j=m.vertexIndices[0],m=m.vertexIndices[1],e.a===j?(n="a",o=A[g]+0):e.b===j?(n="b",o=A[g]+1):e.c===j?(n="c",o=A[g]+2):e.d===j&&(n="d",o=A[g]+3),e.a===m?(n+="a",u=A[g]+0):e.b===m?(n+="b",u=A[g]+1):e.c===m?(n+="c",u=A[g]+2):e.d===m&&(n+="d",u=A[g]+3),f.a===j?(p="a",v=A[h]+0):f.b===j?(p="b",v=A[h]+1):f.c===j?(p="c",v=A[h]+2):f.d===j&&(p="d",v=A[h]+3),f.a===m?(p+="a",w=A[h]+0):f.b===m?(p+="b",w=A[h]+
-1):f.c===m?(p+="c",w=A[h]+2):f.d===m&&(p+="d",w=A[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>u&&(e=o,o=u,u=e):o<u&&(e=o,o=u,u=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>w&&(e=v,v=w,w=e):v<w&&(e=v,v=w,w=e),e=new THREE.Face4(o,u,v,w),e.normal.set(1,0,0),D.push(e);this.geometry=x}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,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,j,m,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;j=g[n];j instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(j.normal);e.push(m);
-for(m=0;m<p;m++)o=b[j[u[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(j=h+1;j<g.length;j++)m=e[j],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,j,m,n,p,o,u,v,w,x,y,D=0,A=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){h=c[A[x]];m=b[h];for(y=0;y<g;y++)if(j=e[A[y]],n=b[j],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(D++,D===1&&(p=m,o=n,u=h,v=j,w=A[x]),D===2))return w+=A[x],w==="ad"||w==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[u,v,
-j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[u,h,j,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,j,m,n,p,o,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var z=w.egdes=this.geometry.edges,x=w.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.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(c=z.length;b<c;b++)m=z[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],j=m.vertexIndices[0],m=m.vertexIndices[1],e.a===j?(n="a",o=y[g]+0):e.b===j?(n="b",o=y[g]+1):e.c===j?(n="c",o=y[g]+2):e.d===j&&(n="d",o=y[g]+3),e.a===m?(n+="a",t=y[g]+0):e.b===m?(n+="b",t=y[g]+1):e.c===m?(n+="c",t=y[g]+2):e.d===m&&(n+="d",t=y[g]+3),f.a===j?(p="a",u=y[h]+0):f.b===j?(p="b",u=y[h]+1):f.c===j?(p="c",u=y[h]+2):f.d===j&&(p="d",u=y[h]+3),f.a===m?(p+="a",v=y[h]+0):f.b===m?(p+="b",v=y[h]+
+1):f.c===m?(p+="c",v=y[h]+2):f.d===m&&(p+="d",v=y[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(o,t,u,v),e.normal.set(1,0,0),x.push(e);this.geometry=w}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,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,j,m,n,p,o,t=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;j=g[n];j instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(j.normal);e.push(m);
+for(m=0;m<p;m++)o=b[j[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(j=h+1;j<g.length;j++)m=e[j],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,j,m,n,p,o,t,u,v,w,z,x=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){h=c[y[w]];m=b[h];for(z=0;z<g;z++)if(j=e[y[z]],n=b[j],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(x++,x===1&&(p=m,o=n,t=h,u=j,v=y[w]),x===2))return v+=y[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,u,
+j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,h,j,u],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);
@@ -138,56 +138,56 @@ 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.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.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,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||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=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,j=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&j>=0&&m>=0?!0:g<0&&h<0||j<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),j<0?c=Math.max(c,j/(j-m)):m<0&&(f=Math.min(f,j/(j-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],j,m,n=[],p,o,u=[],v,w=[],x,y,D=[],A,H,C=[],E=new THREE.Vector4,I=new THREE.Vector4,
-J=new THREE.Matrix4,S=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,e){J.multiply(e.projectionMatrix,e.matrixWorldInverse);J.multiplyVector3(b);return b};this.unprojectVector=function(b,e){J.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));J.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],m,n,k;g=0;n=
-b.objects;b=0;for(m=n.length;b<m;b++){k=n[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var o=k.matrixWorld,u=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(p=R[v].x*o.n14+R[v].y*o.n24+R[v].z*o.n34+R[v].w,p<=u){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,E.copy(k.position),J.multiplyVector3(E),f.object=k,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,h){var E=[],
-U=g.near,k=g.far,ia,L,ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da,Y,Z,pa;H=y=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);J.multiply(g.projectionMatrix,g.matrixWorldInverse);R[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);R[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);R[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+J.n23,J.n44+J.n24);R[3].set(J.n41-J.n21,J.n42-J.n22,J.n43-J.n23,J.n44-J.n24);R[4].set(J.n41-J.n31,J.n42-J.n32,J.n43-J.n33,J.n44-J.n34);R[5].set(J.n41+J.n31,J.n42+
-J.n32,J.n43+J.n33,J.n44+J.n34);for(ia=0;ia<6;ia++)ra=R[ia],ra.divideScalar(Math.sqrt(ra.x*ra.x+ra.y*ra.y+ra.z*ra.z));ra=this.projectObjects(f,g,!0);f=0;for(ia=ra.length;f<ia;f++)if(T=ra[f].object,T.visible)if(ka=T.matrixWorld,ca=T.matrixRotationWorld,oa=T.materials,da=T.overdraw,m=0,T instanceof THREE.Mesh){Y=T.geometry;fa=Y.vertices;Z=Y.faces;Y=Y.faceVertexUvs;L=0;for(ga=fa.length;L<ga;L++)j=b(),j.positionWorld.copy(fa[L].position),ka.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
-J.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>U&&j.positionScreen.z<k;fa=0;for(L=Z.length;fa<L;fa++){ga=Z[fa];if(ga instanceof THREE.Face3)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],$.visible&&ha.visible&&ja.visible&&(T.doubleSided||T.flipSided!=(ja.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ja.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0))ma=
-u[o]=u[o]||new THREE.RenderableFace3,o++,p=ma,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja);else continue;else if(ga instanceof THREE.Face4)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],ma=n[ga.d],$.visible&&ha.visible&&ja.visible&&ma.visible&&(T.doubleSided||T.flipSided!=((ma.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ma.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0||(ha.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-
-(ha.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<0)))pa=w[v]=w[v]||new THREE.RenderableFace4,v++,p=pa,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja),p.v4.copy(ma);else continue;p.normalWorld.copy(ga.normal);ca.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ga.centroid);ka.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);J.multiplyVector3(p.centroidScreen);ja=ga.vertexNormals;$=0;for(ha=ja.length;$<ha;$++)ma=p.vertexNormalsWorld[$],ma.copy(ja[$]),
-ca.multiplyVector3(ma);$=0;for(ha=Y.length;$<ha;$++)if(pa=Y[$][fa]){ja=0;for(ma=pa.length;ja<ma;ja++)p.uvs[$][ja]=pa[ja]}p.meshMaterials=oa;p.faceMaterials=ga.materials;p.overdraw=da;p.z=p.centroidScreen.z;E.push(p)}}else if(T instanceof THREE.Line){S.multiply(J,ka);fa=T.geometry.vertices;$=b();$.positionScreen.copy(fa[0].position);S.multiplyVector4($.positionScreen);L=1;for(ga=fa.length;L<ga;L++)if($=b(),$.positionScreen.copy(fa[L].position),S.multiplyVector4($.positionScreen),ha=n[m-2],N.copy($.positionScreen),
-F.copy(ha.positionScreen),e(N,F))N.multiplyScalar(1/N.w),F.multiplyScalar(1/F.w),ka=D[y]=D[y]||new THREE.RenderableLine,y++,x=ka,x.v1.positionScreen.copy(N),x.v2.positionScreen.copy(F),x.z=Math.max(N.z,F.z),x.materials=T.materials,E.push(x)}else if(T instanceof THREE.Particle&&(I.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),J.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ka=C[H]=C[H]||new THREE.RenderableParticle,H++,A=ka,A.x=I.x/I.w,A.y=I.y/I.w,A.z=I.z,A.rotation=T.rotation.z,A.scale.x=
-T.scale.x*Math.abs(A.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),A.scale.y=T.scale.y*Math.abs(A.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),A.materials=T.materials,E.push(A);h&&E.sort(c);return E}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,u,v,w,x,y;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){x=v.x*g+g;y=v.y*h+h;o=0;for(u=v.material.length;o<u;o++)if(w=v.material[o],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=x+"px",w.style.top=y+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)x.globalAlpha=A=b}function e(b){if(H!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}H=b}}function f(b){if(C!=b.hex)C=b.hex,x.strokeStyle="#"+h(C.toString(16))}function g(b){if(E!=b.hex)E=b.hex,x.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
-var j=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,u,v,w,x=p.getContext("2d"),y=new THREE.Color(0),D=0,A=1,H=0,C=null,E=null,I=null,J=null,S=null,R,N,F,W,K=new THREE.RenderableVertex,X=new THREE.RenderableVertex,Q,U,k,ia,L,ga,fa,$,ha,ja,ma,ra,T=new THREE.Color(0),ka=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),da=new THREE.Color(0),Y,Z,pa,na,qa,ya,Ca,xa,Aa,Oa,ua=new THREE.Rectangle,ta=new THREE.Rectangle,sa=new THREE.Rectangle,
-Da=!1,ea=new THREE.Color,O=new THREE.Color,wa=new THREE.Color,V=new THREE.Color,la=new THREE.Vector3,aa,Ra,Xa,za,Sa,Ta,b=16;aa=document.createElement("canvas");aa.width=aa.height=2;Ra=aa.getContext("2d");Ra.fillStyle="rgba(0,0,0,1)";Ra.fillRect(0,0,2,2);Xa=Ra.getImageData(0,0,2,2);za=Xa.data;Sa=document.createElement("canvas");Sa.width=Sa.height=b;Ta=Sa.getContext("2d");Ta.translate(-b/2,-b/2);Ta.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.width=o;p.height=u;ua.set(-v,-w,v,w);ta.set(-v,-w,v,w);A=1;H=0;S=J=I=E=C=null};this.setClearColor=function(b,e){y=b;D=e;ta.set(-v,-w,v,w)};this.setClearColorHex=function(b,e){y.setHex(b);D=e;ta.set(-v,-w,v,w)};this.clear=function(){x.setTransform(1,0,0,-1,v,w);if(!ta.isEmpty())ta.inflate(1),ta.minSelf(ua),y.hex==0&&D==0?x.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(y.r*
-255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+D+")",x.fillRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight())),ta.empty()};this.render=function(b,h){function p(b){var e,c,f,g=b.lights;O.setRGB(0,0,0);wa.setRGB(0,0,0);V.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(V.r+=f.r,V.g+=f.g,V.b+=f.b)}function o(b,e,c,f){var g,
-h,k,j,m=b.lights,b=0;for(g=m.length;b<g;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)):h instanceof THREE.PointLight&&(j=c.dot(la.sub(h.position,e).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)))}function u(b,h,k){c(k.opacity);e(k.blending);var j,m,p,n,o,aa;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)n=
-k.map.image,o=n.width>>1,aa=n.height>>1,k=h.scale.x*v,p=h.scale.y*w,j=k*o,m=p*aa,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,-p),x.translate(-o,-aa),x.drawImage(n,0,0),x.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*v,m=h.scale.y*w,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(f(k.color),g(k.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,m),k.program(x),x.restore()))}function A(b,
-g,h,k){c(k.opacity);e(k.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(I!=b)x.lineWidth=I=b;b=k.linecap;if(J!=b)x.lineCap=J=b;b=k.linejoin;if(S!=b)x.lineJoin=S=b;f(k.color);x.stroke();sa.inflate(k.linewidth*2)}}function D(b,f,g,m,p,n,aa,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);Q=b.positionScreen.x;U=b.positionScreen.y;k=f.positionScreen.x;
-ia=f.positionScreen.y;L=g.positionScreen.x;ga=g.positionScreen.y;C(Q,U,k,ia,L,ga);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,la.copy(aa.vertexNormalsWorld[0]),qa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,ya=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[1]),
-Ca=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,xa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[2]),Aa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,Oa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,Ea(Q,U,k,ia,L,ga,u.envMap.image,qa,ya,Ca,xa,Aa,Oa)}else u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,
-U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v)),e(THREE.SubtractiveBlending)),Da?!u.wireframe&&u.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(ka.r=ca.r=oa.r=O.r,ka.g=ca.g=oa.g=O.g,ka.b=ca.b=oa.b=O.b,o(v,aa.v1.positionWorld,aa.vertexNormalsWorld[0],ka),o(v,aa.v2.positionWorld,aa.vertexNormalsWorld[1],ca),o(v,aa.v3.positionWorld,aa.vertexNormalsWorld[2],oa),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,
-pa,0,0,1,0,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,aa.centroidWorld,aa.normalWorld,ea),T.r=Math.max(0,Math.min(u.color.r*ea.r,1)),T.g=Math.max(0,Math.min(u.color.g*ea.g,1)),T.b=Math.max(0,Math.min(u.color.b*ea.b,1)),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)):u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,
-Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(g.positionScreen.z,Y,Z),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,pa,0,0,1,0,0,1);else if(u instanceof THREE.MeshNormalMaterial)T.r=Pa(aa.normalWorld.x),T.g=Pa(aa.normalWorld.y),T.b=Pa(aa.normalWorld.z),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)}function y(b,f,g,m,p,n,u,aa,v){j.data.vertices+=4;j.data.faces++;c(aa.opacity);
-e(aa.blending);if(aa.map||aa.envMap)D(b,f,m,0,1,3,u,aa,v),D(p,g,n,1,2,3,u,aa,v);else if(Q=b.positionScreen.x,U=b.positionScreen.y,k=f.positionScreen.x,ia=f.positionScreen.y,L=g.positionScreen.x,ga=g.positionScreen.y,fa=m.positionScreen.x,$=m.positionScreen.y,ha=p.positionScreen.x,ja=p.positionScreen.y,ma=n.positionScreen.x,ra=n.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color);
-else if(aa instanceof THREE.MeshLambertMaterial)Da?!aa.wireframe&&aa.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(ka.r=ca.r=oa.r=da.r=O.r,ka.g=ca.g=oa.g=da.g=O.g,ka.b=ca.b=oa.b=da.b=O.b,o(v,u.v1.positionWorld,u.vertexNormalsWorld[0],ka),o(v,u.v2.positionWorld,u.vertexNormalsWorld[1],ca),o(v,u.v4.positionWorld,u.vertexNormalsWorld[3],oa),o(v,u.v3.positionWorld,u.vertexNormalsWorld[2],da),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,ja,L,ga,ma,ra),Ea(ha,
-ja,L,ga,ma,ra,pa,1,0,1,1,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,u.centroidWorld,u.normalWorld,ea),T.r=Math.max(0,Math.min(aa.color.r*ea.r,1)),T.g=Math.max(0,Math.min(aa.color.g*ea.g,1)),T.b=Math.max(0,Math.min(aa.color.b*ea.b,1)),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T)):(H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)T.r=
-Pa(u.normalWorld.x),T.g=Pa(u.normalWorld.y),T.b=Pa(u.normalWorld.z),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T);else if(aa instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(m.positionScreen.z,Y,Z),da.r=da.g=da.b=1-Ka(g.positionScreen.z,Y,Z),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,
-ja,L,ga,ma,ra),Ea(ha,ja,L,ga,ma,ra,pa,1,0,1,1,0,1)}function C(b,e,c,f,g,h){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,g,h,k,j){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(k,j);x.lineTo(b,e);x.closePath()}function E(b,e,c,g){if(I!=e)x.lineWidth=I=e;if(J!=c)x.lineCap=J=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();sa.inflate(e*2)}function Ga(b){g(b);x.fill()}function Ea(b,e,c,f,g,h,k,j,m,p,n,aa,u){var o,v;o=k.width-1;v=k.height-
-1;j*=o;m*=v;p*=o;n*=v;aa*=o;u*=v;c-=b;f-=e;g-=b;h-=e;p-=j;n-=m;aa-=j;u-=m;o=p*u-aa*n;if(!((o<0?-o:o)<1))v=1/o,o=(u*c-n*g)*v,n=(u*f-n*h)*v,c=(p*g-aa*c)*v,f=(p*h-aa*f)*v,b=b-o*j-c*m,e=e-n*j-f*m,x.save(),x.transform(o,n,c,f,b,e),x.clip(),x.drawImage(k,0,0),x.restore()}function Ua(b,e,c,f){var g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);za[0]=g<0?0:g>255?255:g;za[1]=h<0?0:h>255?
-255:h;za[2]=b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=j<0?0:j>255?255:j;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=p<0?0:p>255?255:p;za[10]=c<0?0:c>255?255:c;za[12]=n<0?0:n>255?255:n;za[13]=u<0?0:u>255?255:u;za[14]=f<0?0:f>255?255:f;Ra.putImageData(Xa,0,0);Ta.drawImage(aa,0,0);return Sa}function Ka(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Pa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ha(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=
-f,b.x-=c,b.y-=f)}var Va,G,M,B,Ia,Qa,Wa,va;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,w);j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Da=b.lights.length>0)&&p(b);Va=0;for(G=m.length;Va<G;Va++){M=m[Va];sa.empty();if(M instanceof THREE.RenderableParticle){R=M;R.x*=v;R.y*=w;B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&u(R,M,va,b)}else if(M instanceof THREE.RenderableLine){if(R=M.v1,N=M.v2,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=
-v,N.positionScreen.y*=w,sa.addPoint(R.positionScreen.x,R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&A(R,N,M,va,b)}}else if(M instanceof THREE.RenderableFace3){if(R=M.v1,N=M.v2,F=M.v3,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,
-F.positionScreen),Ha(F.positionScreen,R.positionScreen)),sa.add3Points(R.positionScreen.x,R.positionScreen.y,N.positionScreen.x,N.positionScreen.y,F.positionScreen.x,F.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}else va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}}else if(M instanceof THREE.RenderableFace4&&
-(R=M.v1,N=M.v2,F=M.v3,W=M.v4,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,W.positionScreen.x*=v,W.positionScreen.y*=w,K.positionScreen.copy(N.positionScreen),X.positionScreen.copy(W.positionScreen),M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,W.positionScreen),Ha(W.positionScreen,R.positionScreen),Ha(F.positionScreen,K.positionScreen),Ha(F.positionScreen,X.positionScreen)),sa.addPoint(R.positionScreen.x,
-R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(F.positionScreen.x,F.positionScreen.y),sa.addPoint(W.positionScreen.x,W.positionScreen.y),ua.instersects(sa))){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}else va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}ta.addRectangle(sa)}x.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,h,k;f=0;for(g=b.lights.length;f<g;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),k=e.normalWorld.dot(W)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,k,m,n,u){j.data.vertices+=3;j.data.faces++;Q=f(U++);Q.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(u,m,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1)),I.updateHex()):I.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(F=1-n.__2near/(n.__farPlusNear-
-m.z*n.__farMinusNear),I.setRGB(F,F,F)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(e,c,k,m,
-n,u,o){j.data.vertices+=4;j.data.faces++;Q=f(U++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.hex=u.color.hex:u instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(o,n,J),I.r=Math.max(0,Math.min(u.color.r*J.r,1)),I.g=Math.max(0,Math.min(u.color.g*J.g,1)),I.b=Math.max(0,Math.min(u.color.b*
-J.b,1)),I.updateHex()):I.hex=u.color.hex:u instanceof THREE.MeshDepthMaterial?(F=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),I.setRGB(F,F,F)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));u.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):Q.setAttribute("style",
-"fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+u.opacity);p.appendChild(Q)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ia==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,u,v,w,x,y,D,A,H=new THREE.Rectangle,C=new THREE.Rectangle,
-E=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),S=new THREE.Color(0),R=new THREE.Color(0),N=new THREE.Color(0),F,W=new THREE.Vector3,K=[],X=[],Q,U,k,ia=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":ia=1;break;case "low":ia=0}};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+u);p.setAttribute("width",o);p.setAttribute("height",u);H.set(-v,
--w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,u,o,I,J,F,T,K;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,f,this.sortElements);k=U=0;if(E=b.lights.length>0){T=b.lights;S.setRGB(0,0,0);R.setRGB(0,0,0);N.setRGB(0,0,0);g=0;for(u=T.length;g<u;g++)o=T[g],I=o.color,o instanceof THREE.AmbientLight?(S.r+=I.r,S.g+=I.g,S.b+=I.b):o instanceof THREE.DirectionalLight?(R.r+=I.r,R.g+=I.g,R.b+=I.b):o instanceof
-THREE.PointLight&&(N.r+=I.r,N.g+=I.g,N.b+=I.b)}g=0;for(u=m.length;g<u;g++)if(T=m[g],C.empty(),T instanceof THREE.RenderableParticle){x=T;x.x*=v;x.y*=-w;o=0;for(I=T.materials.length;o<I;)o++}else if(T instanceof THREE.RenderableLine){if(x=T.v1,y=T.v2,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),H.instersects(C)){o=0;for(I=T.materials.length;o<I;)if((K=T.materials[o++])&&
-K.opacity!=0){J=x;F=y;var W=k++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),ia==0&&X[W].setAttribute("shape-rendering","crispEdges"));Q=X[W];Q.setAttribute("x1",J.positionScreen.x);Q.setAttribute("y1",J.positionScreen.y);Q.setAttribute("x2",F.positionScreen.x);Q.setAttribute("y2",F.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+h(K.color.hex.toString(16))+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+
-K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),p.appendChild(Q))}}}else if(T instanceof THREE.RenderableFace3){if(x=T.v1,y=T.v2,D=T.v3,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),H.instersects(C)){o=0;for(I=T.meshMaterials.length;o<
-I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&c(x,y,D,T,K,b)}else K&&K.opacity!=0&&c(x,y,D,T,K,b)}}else if(T instanceof THREE.RenderableFace4&&(x=T.v1,y=T.v2,D=T.v3,A=T.v4,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,A.positionScreen.x*=v,A.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,
-y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),C.addPoint(A.positionScreen.x,A.positionScreen.y),H.instersects(C))){o=0;for(I=T.meshMaterials.length;o<I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&e(x,y,D,A,T,K,b)}else K&&K.opacity!=0&&e(x,y,D,A,T,K,b)}}};
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,j=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&j>=0&&m>=0?!0:g<0&&h<0||j<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),j<0?c=Math.max(c,j/(j-m)):m<0&&(f=Math.min(f,j/(j-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],j,m,n=[],p,o,t=[],u,v=[],w,z,x=[],y,F,C=[],E=new THREE.Vector4,G=new THREE.Vector4,
+B=new THREE.Matrix4,P=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,T=new THREE.Vector4;this.projectVector=function(b,e){B.multiply(e.projectionMatrix,e.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,e){B.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],m,n,k;g=0;n=
+b.objects;b=0;for(m=n.length;b<m;b++){k=n[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var o=k.matrixWorld,t=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),u=0;u<6;u++)if(p=I[u].x*o.n14+I[u].y*o.n24+I[u].z*o.n34+I[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,E.copy(k.position),B.multiplyVector3(E),f.object=k,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,h){var E=[],
+S=g.near,k=g.far,V,O,fa,ea,W,da,ga,ka,pa,R,ha,$,ma,aa,ia,X,na;F=z=u=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);B.multiply(g.projectionMatrix,g.matrixWorldInverse);I[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);I[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);I[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);I[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);I[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);I[5].set(B.n41+B.n31,B.n42+
+B.n32,B.n43+B.n33,B.n44+B.n34);for(V=0;V<6;V++)pa=I[V],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(V=pa.length;f<V;f++)if(R=pa[f].object,R.visible)if(ha=R.matrixWorld,$=R.matrixRotationWorld,ma=R.materials,aa=R.overdraw,m=0,R instanceof THREE.Mesh){ia=R.geometry;ea=ia.vertices;X=ia.faces;ia=ia.faceVertexUvs;O=0;for(fa=ea.length;O<fa;O++)j=b(),j.positionWorld.copy(ea[O].position),ha.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
+B.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>S&&j.positionScreen.z<k;ea=0;for(O=X.length;ea<O;ea++){fa=X[ea];if(fa instanceof THREE.Face3)if(W=n[fa.a],da=n[fa.b],ga=n[fa.c],W.visible&&da.visible&&ga.visible&&(R.doubleSided||R.flipSided!=(ga.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ga.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0))ka=
+t[o]=t[o]||new THREE.RenderableFace3,o++,p=ka,p.v1.copy(W),p.v2.copy(da),p.v3.copy(ga);else continue;else if(fa instanceof THREE.Face4)if(W=n[fa.a],da=n[fa.b],ga=n[fa.c],ka=n[fa.d],W.visible&&da.visible&&ga.visible&&ka.visible&&(R.doubleSided||R.flipSided!=((ka.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ka.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0||(da.positionScreen.x-ga.positionScreen.x)*(ka.positionScreen.y-ga.positionScreen.y)-
+(da.positionScreen.y-ga.positionScreen.y)*(ka.positionScreen.x-ga.positionScreen.x)<0)))na=v[u]=v[u]||new THREE.RenderableFace4,u++,p=na,p.v1.copy(W),p.v2.copy(da),p.v3.copy(ga),p.v4.copy(ka);else continue;p.normalWorld.copy(fa.normal);$.multiplyVector3(p.normalWorld);p.centroidWorld.copy(fa.centroid);ha.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);B.multiplyVector3(p.centroidScreen);ga=fa.vertexNormals;W=0;for(da=ga.length;W<da;W++)ka=p.vertexNormalsWorld[W],ka.copy(ga[W]),
+$.multiplyVector3(ka);W=0;for(da=ia.length;W<da;W++)if(na=ia[W][ea]){ga=0;for(ka=na.length;ga<ka;ga++)p.uvs[W][ga]=na[ga]}p.meshMaterials=ma;p.faceMaterials=fa.materials;p.overdraw=aa;p.z=p.centroidScreen.z;E.push(p)}}else if(R instanceof THREE.Line){P.multiply(B,ha);ea=R.geometry.vertices;W=b();W.positionScreen.copy(ea[0].position);P.multiplyVector4(W.positionScreen);O=1;for(fa=ea.length;O<fa;O++)if(W=b(),W.positionScreen.copy(ea[O].position),P.multiplyVector4(W.positionScreen),da=n[m-2],H.copy(W.positionScreen),
+T.copy(da.positionScreen),e(H,T))H.multiplyScalar(1/H.w),T.multiplyScalar(1/T.w),ha=x[z]=x[z]||new THREE.RenderableLine,z++,w=ha,w.v1.positionScreen.copy(H),w.v2.positionScreen.copy(T),w.z=Math.max(H.z,T.z),w.materials=R.materials,E.push(w)}else if(R instanceof THREE.Particle&&(G.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),B.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))ha=C[F]=C[F]||new THREE.RenderableParticle,F++,y=ha,y.x=G.x/G.w,y.y=G.y/G.w,y.z=G.z,y.rotation=R.rotation.z,y.scale.x=
+R.scale.x*Math.abs(y.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),y.materials=R.materials,E.push(y);h&&E.sort(c);return E}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,t,u,v,w,z;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){w=u.x*g+g;z=u.y*h+h;o=0;for(t=u.material.length;o<t;o++)if(v=u.material[o],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)w.globalAlpha=y=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}F=b}}function f(b){if(C!=b.hex)C=b.hex,w.strokeStyle="#"+h(C.toString(16))}function g(b){if(E!=b.hex)E=b.hex,w.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
+var j=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,w=p.getContext("2d"),z=new THREE.Color(0),x=0,y=1,F=0,C=null,E=null,G=null,B=null,P=null,I,H,T,U,J=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,K,S,k,V,O,fa,ea,W,da,ga,ka,pa,R=new THREE.Color(0),ha=new THREE.Color(0),$=new THREE.Color(0),ma=new THREE.Color(0),aa=new THREE.Color(0),ia,X,na,la,oa,wa,Aa,va,ya,Ma,sa=new THREE.Rectangle,ra=new THREE.Rectangle,qa=new THREE.Rectangle,
+Ba=!1,ca=new THREE.Color,M=new THREE.Color,ua=new THREE.Color,Q=new THREE.Color,ja=new THREE.Vector3,Z,Pa,Va,xa,Qa,Ra,b=16;Z=document.createElement("canvas");Z.width=Z.height=2;Pa=Z.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;sa.set(-u,-v,u,v);ra.set(-u,-v,u,v);y=1;F=0;P=B=G=E=C=null};this.setClearColor=function(b,e){z=b;x=e;ra.set(-u,-v,u,v)};this.setClearColorHex=function(b,e){z.setHex(b);x=e;ra.set(-u,-v,u,v)};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!ra.isEmpty())ra.inflate(1),ra.minSelf(sa),z.hex==0&&x==0?w.clearRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(z.r*
+255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+x+")",w.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())),ra.empty()};this.render=function(b,h){function p(b){var e,c,f,g=b.lights;M.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(M.r+=f.r,M.g+=f.g,M.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var g,
+h,k,j,m=b.lights,b=0;for(g=m.length;b<g;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)):h instanceof THREE.PointLight&&(j=c.dot(ja.sub(h.position,e).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)))}function t(b,h,k){c(k.opacity);e(k.blending);var j,m,p,n,o,Z;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)n=k.map.image,
+o=n.width>>1,Z=n.height>>1,k=h.scale.x*u,p=h.scale.y*v,j=k*o,m=p*Z,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),sa.instersects(qa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(k,-p),w.translate(-o,-Z),w.drawImage(n,0,0),w.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*u,m=h.scale.y*v,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),sa.instersects(qa)&&(f(k.color),g(k.color),w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(j,m),k.program(w),w.restore()))}function y(b,g,h,k){c(k.opacity);
+e(k.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(g.positionScreen.x,g.positionScreen.y);w.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(G!=b)w.lineWidth=G=b;b=k.linecap;if(B!=b)w.lineCap=B=b;b=k.linejoin;if(P!=b)w.lineJoin=P=b;f(k.color);w.stroke();qa.inflate(k.linewidth*2)}}function z(b,f,g,m,p,n,Z,t,u){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);K=b.positionScreen.x;S=b.positionScreen.y;k=f.positionScreen.x;V=f.positionScreen.y;
+O=g.positionScreen.x;fa=g.positionScreen.y;C(K,S,k,V,O,fa);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=Z.uvs[0],Ca(K,S,k,V,O,fa,t.map.image,la[m].u,la[m].v,la[p].u,la[p].v,la[n].u,la[n].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,ja.copy(Z.vertexNormalsWorld[0]),oa=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,wa=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(Z.vertexNormalsWorld[1]),
+Aa=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,va=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(Z.vertexNormalsWorld[2]),ya=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,Ma=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,Ca(K,S,k,V,O,fa,t.envMap.image,oa,wa,Aa,va,ya,Ma)}else t.wireframe?E(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(la=Z.uvs[0],Ca(K,S,k,
+V,O,fa,t.map.image,la[m].u,la[m].v,la[p].u,la[p].v,la[n].u,la[n].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&Z.vertexNormalsWorld.length==3?(ha.r=$.r=ma.r=M.r,ha.g=$.g=ma.g=M.g,ha.b=$.b=ma.b=M.b,o(u,Z.v1.positionWorld,Z.vertexNormalsWorld[0],ha),o(u,Z.v2.positionWorld,Z.vertexNormalsWorld[1],$),o(u,Z.v3.positionWorld,Z.vertexNormalsWorld[2],ma),aa.r=($.r+ma.r)*0.5,aa.g=($.g+ma.g)*0.5,aa.b=($.b+ma.b)*0.5,na=Sa(ha,$,ma,aa),Ca(K,S,k,V,O,fa,na,0,0,1,0,0,1)):(ca.r=
+M.r,ca.g=M.g,ca.b=M.b,o(u,Z.centroidWorld,Z.normalWorld,ca),R.r=Math.max(0,Math.min(t.color.r*ca.r,1)),R.g=Math.max(0,Math.min(t.color.g*ca.g,1)),R.b=Math.max(0,Math.min(t.color.b*ca.b,1)),R.updateHex(),t.wireframe?E(R,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(R)):t.wireframe?E(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)ia=h.near,X=h.far,ha.r=ha.g=ha.b=1-Ia(b.positionScreen.z,ia,X),$.r=$.g=$.b=
+1-Ia(f.positionScreen.z,ia,X),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,ia,X),aa.r=($.r+ma.r)*0.5,aa.g=($.g+ma.g)*0.5,aa.b=($.b+ma.b)*0.5,na=Sa(ha,$,ma,aa),Ca(K,S,k,V,O,fa,na,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)R.r=Na(Z.normalWorld.x),R.g=Na(Z.normalWorld.y),R.b=Na(Z.normalWorld.z),R.updateHex(),t.wireframe?E(R,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(R)}function x(b,f,g,m,p,n,t,Z,u){j.data.vertices+=4;j.data.faces++;c(Z.opacity);e(Z.blending);if(Z.map||
+Z.envMap)z(b,f,m,0,1,3,t,Z,u),z(p,g,n,1,2,3,t,Z,u);else if(K=b.positionScreen.x,S=b.positionScreen.y,k=f.positionScreen.x,V=f.positionScreen.y,O=g.positionScreen.x,fa=g.positionScreen.y,ea=m.positionScreen.x,W=m.positionScreen.y,da=p.positionScreen.x,ga=p.positionScreen.y,ka=n.positionScreen.x,pa=n.positionScreen.y,Z instanceof THREE.MeshBasicMaterial)F(K,S,k,V,O,fa,ea,W),Z.wireframe?E(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(Z.color);else if(Z instanceof THREE.MeshLambertMaterial)Ba?
+!Z.wireframe&&Z.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ha.r=$.r=ma.r=aa.r=M.r,ha.g=$.g=ma.g=aa.g=M.g,ha.b=$.b=ma.b=aa.b=M.b,o(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ha),o(u,t.v2.positionWorld,t.vertexNormalsWorld[1],$),o(u,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),o(u,t.v3.positionWorld,t.vertexNormalsWorld[2],aa),na=Sa(ha,$,ma,aa),C(K,S,k,V,ea,W),Ca(K,S,k,V,ea,W,na,0,0,1,0,0,1),C(da,ga,O,fa,ka,pa),Ca(da,ga,O,fa,ka,pa,na,1,0,1,1,0,1)):(ca.r=M.r,ca.g=M.g,ca.b=M.b,
+o(u,t.centroidWorld,t.normalWorld,ca),R.r=Math.max(0,Math.min(Z.color.r*ca.r,1)),R.g=Math.max(0,Math.min(Z.color.g*ca.g,1)),R.b=Math.max(0,Math.min(Z.color.b*ca.b,1)),R.updateHex(),F(K,S,k,V,O,fa,ea,W),Z.wireframe?E(R,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(R)):(F(K,S,k,V,O,fa,ea,W),Z.wireframe?E(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(Z.color));else if(Z instanceof THREE.MeshNormalMaterial)R.r=Na(t.normalWorld.x),R.g=Na(t.normalWorld.y),R.b=
+Na(t.normalWorld.z),R.updateHex(),F(K,S,k,V,O,fa,ea,W),Z.wireframe?E(R,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(R);else if(Z instanceof THREE.MeshDepthMaterial)ia=h.near,X=h.far,ha.r=ha.g=ha.b=1-Ia(b.positionScreen.z,ia,X),$.r=$.g=$.b=1-Ia(f.positionScreen.z,ia,X),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,ia,X),aa.r=aa.g=aa.b=1-Ia(g.positionScreen.z,ia,X),na=Sa(ha,$,ma,aa),C(K,S,k,V,ea,W),Ca(K,S,k,V,ea,W,na,0,0,1,0,0,1),C(da,ga,O,fa,ka,pa),Ca(da,ga,O,fa,ka,pa,na,1,0,1,1,0,1)}function C(b,
+e,c,f,g,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,h);w.lineTo(b,e);w.closePath()}function F(b,e,c,f,g,h,k,j){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,h);w.lineTo(k,j);w.lineTo(b,e);w.closePath()}function E(b,e,c,g){if(G!=e)w.lineWidth=G=e;if(B!=c)w.lineCap=B=c;if(P!=g)w.lineJoin=P=g;f(b);w.stroke();qa.inflate(e*2)}function Ea(b){g(b);w.fill()}function Ca(b,e,c,f,g,h,k,j,m,p,n,Z,t){var o,u;o=k.width-1;u=k.height-1;j*=o;m*=u;p*=o;n*=u;Z*=o;t*=u;c-=b;f-=e;g-=b;h-=e;p-=j;n-=
+m;Z-=j;t-=m;o=p*t-Z*n;if(!((o<0?-o:o)<1))u=1/o,o=(t*c-n*g)*u,n=(t*f-n*h)*u,c=(p*g-Z*c)*u,f=(p*h-Z*f)*u,b=b-o*j-c*m,e=e-n*j-f*m,w.save(),w.transform(o,n,c,f,b,e),w.clip(),w.drawImage(k,0,0),w.restore()}function Sa(b,e,c,f){var g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=h<0?0:h>255?255:h;xa[2]=b<0?0:b>255?255:b;xa[4]=k<0?0:k>255?255:k;xa[5]=j<0?0:
+j>255?255:j;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=p<0?0:p>255?255:p;xa[10]=c<0?0:c>255?255:c;xa[12]=n<0?0:n>255?255:n;xa[13]=t<0?0:t>255?255:t;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(Z,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ta,D,L,A,Ga,Oa,Ua,ta;this.autoClear?this.clear():
+w.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(D=m.length;Ta<D;Ta++){L=m[Ta];qa.empty();if(L instanceof THREE.RenderableParticle){I=L;I.x*=u;I.y*=v;A=0;for(Ga=L.materials.length;A<Ga;)ta=L.materials[A++],ta.opacity!=0&&t(I,L,ta,b)}else if(L instanceof THREE.RenderableLine){if(I=L.v1,H=L.v2,I.positionScreen.x*=u,I.positionScreen.y*=v,H.positionScreen.x*=u,H.positionScreen.y*=v,qa.addPoint(I.positionScreen.x,
+I.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),sa.instersects(qa)){A=0;for(Ga=L.materials.length;A<Ga;)ta=L.materials[A++],ta.opacity!=0&&y(I,H,L,ta,b)}}else if(L instanceof THREE.RenderableFace3){if(I=L.v1,H=L.v2,T=L.v3,I.positionScreen.x*=u,I.positionScreen.y*=v,H.positionScreen.x*=u,H.positionScreen.y*=v,T.positionScreen.x*=u,T.positionScreen.y*=v,L.overdraw&&(Fa(I.positionScreen,H.positionScreen),Fa(H.positionScreen,T.positionScreen),Fa(T.positionScreen,I.positionScreen)),
+qa.add3Points(I.positionScreen.x,I.positionScreen.y,H.positionScreen.x,H.positionScreen.y,T.positionScreen.x,T.positionScreen.y),sa.instersects(qa)){A=0;for(Ga=L.meshMaterials.length;A<Ga;)if(ta=L.meshMaterials[A++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=L.faceMaterials.length;Oa<Ua;)(ta=L.faceMaterials[Oa++])&&ta.opacity!=0&&z(I,H,T,0,1,2,L,ta,b)}else ta.opacity!=0&&z(I,H,T,0,1,2,L,ta,b)}}else if(L instanceof THREE.RenderableFace4&&(I=L.v1,H=L.v2,T=L.v3,U=L.v4,I.positionScreen.x*=u,I.positionScreen.y*=
+v,H.positionScreen.x*=u,H.positionScreen.y*=v,T.positionScreen.x*=u,T.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,J.positionScreen.copy(H.positionScreen),Y.positionScreen.copy(U.positionScreen),L.overdraw&&(Fa(I.positionScreen,H.positionScreen),Fa(H.positionScreen,U.positionScreen),Fa(U.positionScreen,I.positionScreen),Fa(T.positionScreen,J.positionScreen),Fa(T.positionScreen,Y.positionScreen)),qa.addPoint(I.positionScreen.x,I.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),
+qa.addPoint(T.positionScreen.x,T.positionScreen.y),qa.addPoint(U.positionScreen.x,U.positionScreen.y),sa.instersects(qa))){A=0;for(Ga=L.meshMaterials.length;A<Ga;)if(ta=L.meshMaterials[A++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=L.faceMaterials.length;Oa<Ua;)(ta=L.faceMaterials[Oa++])&&ta.opacity!=0&&x(I,H,T,U,J,Y,L,ta,b)}else ta.opacity!=0&&x(I,H,T,U,J,Y,L,ta,b)}ra.addRectangle(qa)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,h,k;f=0;for(g=b.lights.length;f<g;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(U.sub(h.position,e.centroidWorld),U.normalize(),k=e.normalWorld.dot(U)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,k,m,n,t){j.data.vertices+=3;j.data.faces++;K=f(S++);K.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(B.r=P.r,B.g=P.g,B.b=P.b,b(t,m,B),G.r=Math.max(0,Math.min(n.color.r*B.r,1)),G.g=Math.max(0,Math.min(n.color.g*B.g,1)),G.b=Math.max(0,Math.min(n.color.b*B.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(T=1-n.__2near/(n.__farPlusNear-
+m.z*n.__farMinusNear),G.setRGB(T,T,T)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?K.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):K.setAttribute("style","fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(K)}function e(e,c,k,m,
+n,t,o){j.data.vertices+=4;j.data.faces++;K=f(S++);K.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?E?(B.r=P.r,B.g=P.g,B.b=P.b,b(o,n,B),G.r=Math.max(0,Math.min(t.color.r*B.r,1)),G.g=Math.max(0,Math.min(t.color.g*B.g,1)),G.b=Math.max(0,Math.min(t.color.b*
+B.b,1)),G.updateHex()):G.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(T=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(T,T,T)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?K.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):K.setAttribute("style",
+"fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(K)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,v,w,z,x,y,F=new THREE.Rectangle,C=new THREE.Rectangle,E=
+!1,G=new THREE.Color(16777215),B=new THREE.Color(16777215),P=new THREE.Color(0),I=new THREE.Color(0),H=new THREE.Color(0),T,U=new THREE.Vector3,J=[],Y=[],K,S,k,V=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":V=1;break;case "low":V=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);F.set(-u,-v,
+u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,o,B,G,T,R,J;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,f,this.sortElements);k=S=0;if(E=b.lights.length>0){R=b.lights;P.setRGB(0,0,0);I.setRGB(0,0,0);H.setRGB(0,0,0);g=0;for(t=R.length;g<t;g++)o=R[g],B=o.color,o instanceof THREE.AmbientLight?(P.r+=B.r,P.g+=B.g,P.b+=B.b):o instanceof THREE.DirectionalLight?(I.r+=B.r,I.g+=B.g,I.b+=B.b):o instanceof
+THREE.PointLight&&(H.r+=B.r,H.g+=B.g,H.b+=B.b)}g=0;for(t=m.length;g<t;g++)if(R=m[g],C.empty(),R instanceof THREE.RenderableParticle){w=R;w.x*=u;w.y*=-v;o=0;for(B=R.materials.length;o<B;)o++}else if(R instanceof THREE.RenderableLine){if(w=R.v1,z=R.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),F.instersects(C)){o=0;for(B=R.materials.length;o<B;)if((J=R.materials[o++])&&
+J.opacity!=0){G=w;T=z;var U=k++;Y[U]==null&&(Y[U]=document.createElementNS("http://www.w3.org/2000/svg","line"),V==0&&Y[U].setAttribute("shape-rendering","crispEdges"));K=Y[U];K.setAttribute("x1",G.positionScreen.x);K.setAttribute("y1",G.positionScreen.y);K.setAttribute("x2",T.positionScreen.x);K.setAttribute("y2",T.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: ##"+h(J.color.hex.toString(16))+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+
+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),p.appendChild(K))}}}else if(R instanceof THREE.RenderableFace3){if(w=R.v1,z=R.v2,x=R.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),F.instersects(C)){o=0;for(B=R.meshMaterials.length;o<
+B;)if(J=R.meshMaterials[o++],J instanceof THREE.MeshFaceMaterial){G=0;for(T=R.faceMaterials.length;G<T;)(J=R.faceMaterials[G++])&&J.opacity!=0&&c(w,z,x,R,J,b)}else J&&J.opacity!=0&&c(w,z,x,R,J,b)}}else if(R instanceof THREE.RenderableFace4&&(w=R.v1,z=R.v2,x=R.v3,y=R.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(z.positionScreen.x,
+z.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),F.instersects(C))){o=0;for(B=R.meshMaterials.length;o<B;)if(J=R.meshMaterials[o++],J instanceof THREE.MeshFaceMaterial){G=0;for(T=R.faceMaterials.length;G<T;)(J=R.faceMaterials[G++])&&J.opacity!=0&&e(w,z,x,y,R,J,b)}else J&&J.opacity!=0&&e(w,z,x,y,R,J,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",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -218,124 +218,124 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
 THREE.ShaderChunk.morphtarget_pars_vertex,"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,e,c){var f,g,h,j=b.vertices,m=j.length,n=b.colors,u=n.length,p=b.__vertexArray,o=b.__colorArray,v=b.__sortArray,w=b.__dirtyVertices,x=b.__dirtyColors,A=b.__webglCustomAttributes,D,y;if(A)for(D in A)A[D].offset=0;if(c.sortParticles){pa.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=j[f].position,ya.copy(g),pa.multiplyVector3(ya),v[f]=[ya.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=j[v[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
-for(f=0;f<u;f++)h=f*3,color=n[v[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A){f=A[D];n=f.value.length;for(h=0;h<n;h++){index=v[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[u]=y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=
-y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}else{if(w)for(f=0;f<m;f++)g=j[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<u;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A)if(f=A[D],f.__original.needsUpdate){n=f.value.length;for(h=0;h<n;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[u]=
-y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(x||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(A)for(D in A)if(f=A[D],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
-f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||U.initMaterial(f,e,c,g);var h=f.program,j=h.uniforms,m=f.uniforms;h!=L&&(k.useProgram(h),L=h);k.uniformMatrix4fv(j.projectionMatrix,!1,na);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
-m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var u,n,p=0,o=0,v=0,w,x,A,y,D=Ca,C=D.directional.colors,I=D.directional.positions,H=D.point.colors,J=D.point.positions,E=D.point.distances,Y=0,G=0,c=n=y=0;for(u=e.length;c<u;c++)if(n=e[c],w=n.color,x=n.position,A=n.intensity,y=n.distance,n instanceof THREE.AmbientLight)p+=w.r,o+=w.g,v+=w.b;else if(n instanceof THREE.DirectionalLight)y=
-Y*3,C[y]=w.r*A,C[y+1]=w.g*A,C[y+2]=w.b*A,I[y]=x.x,I[y+1]=x.y,I[y+2]=x.z,Y+=1;else if(n instanceof THREE.PointLight)n=G*3,H[n]=w.r*A,H[n+1]=w.g*A,H[n+2]=w.b*A,J[n]=x.x,J[n+1]=x.y,J[n+2]=x.z,E[G]=y,G+=1;for(c=Y*3;c<C.length;c++)C[c]=0;for(c=G*3;c<H.length;c++)H[c]=0;D.point.length=G;D.directional.length=Y;D.ambient[0]=p;D.ambient[1]=o;D.ambient[2]=v;c=Ca;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,j=b.vertices,m=j.length,n=b.colors,t=n.length,p=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,y=b.__webglCustomAttributes,z,x;if(y)for(z in y)y[z].offset=0;if(c.sortParticles){na.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=j[f].position,wa.copy(g),na.multiplyVector3(wa),u[f]=[wa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=j[u[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
+for(f=0;f<t;f++)h=f*3,color=n[u[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(z in y){f=y[z];n=f.value.length;for(h=0;h<n;h++){index=u[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[index];f.size===2?(f.array[t]=x.x,f.array[t+1]=x.y):f.size===3?f.type==="c"?(f.array[t]=x.r,f.array[t+1]=x.g,f.array[t+2]=x.b):(f.array[t]=x.x,f.array[t+1]=x.y,f.array[t+2]=x.z):(f.array[t]=
+x.x,f.array[t+1]=x.y,f.array[t+2]=x.z,f.array[t+3]=x.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=j[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(w)for(f=0;f<t;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(z in y)if(f=y[z],f.__original.needsUpdate){n=f.value.length;for(h=0;h<n;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[h];f.size===2?(f.array[t]=
+x.x,f.array[t+1]=x.y):f.size===3?f.type==="c"?(f.array[t]=x.r,f.array[t+1]=x.g,f.array[t+2]=x.b):(f.array[t]=x.x,f.array[t+1]=x.y,f.array[t+2]=x.z):(f.array[t]=x.x,f.array[t+1]=x.y,f.array[t+2]=x.z,f.array[t+3]=x.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(y)for(z in y)if(f=y[z],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
+f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||S.initMaterial(f,e,c,g);var h=f.program,j=h.uniforms,m=f.uniforms;h!=O&&(k.useProgram(h),O=h);k.uniformMatrix4fv(j.projectionMatrix,!1,la);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
+m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,n,p=0,o=0,u=0,v,w,y,x,z=Aa,C=z.directional.colors,B=z.directional.positions,F=z.point.colors,G=z.point.positions,E=z.point.distances,ia=0,D=0,c=n=x=0;for(t=e.length;c<t;c++)if(n=e[c],v=n.color,w=n.position,y=n.intensity,x=n.distance,n instanceof THREE.AmbientLight)p+=v.r,o+=v.g,u+=v.b;else if(n instanceof THREE.DirectionalLight)x=
+ia*3,C[x]=v.r*y,C[x+1]=v.g*y,C[x+2]=v.b*y,B[x]=w.x,B[x+1]=w.y,B[x+2]=w.z,ia+=1;else if(n instanceof THREE.PointLight)n=D*3,F[n]=v.r*y,F[n+1]=v.g*y,F[n+2]=v.b*y,G[n]=w.x,G[n+1]=w.y,G[n+2]=w.z,E[D]=x,D+=1;for(c=ia*3;c<C.length;c++)C[c]=0;for(c=D*3;c<F.length;c++)F[c]=0;z.point.length=D;z.directional.length=ia;z.ambient[0]=p;z.ambient[1]=o;z.ambient[2]=u;c=Aa;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
 m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=
-f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=xa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
-f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var M in m)if(o=h.uniforms[M])if(u=m[M],p=u.type,c=u.value,p=="i")k.uniform1i(o,c);else if(p=="f")k.uniform1f(o,c);else if(p=="fv1")k.uniform1fv(o,c);else if(p=="fv")k.uniform3fv(o,c);else if(p=="v2")k.uniform2f(o,c.x,c.y);else if(p=="v3")k.uniform3f(o,
-c.x,c.y,c.z);else if(p=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")k.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(o,c),u=u.texture))if(u.image instanceof Array&&u.image.length==6){if(u.image.length==6){if(u.needsUpdate){if(u.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,k.RGBA,k.UNSIGNED_BYTE,u.image[p])}else{u.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,
-u.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,u.image[p]);u.__webglInit=!0}N(k.TEXTURE_CUBE_MAP,u,u.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);u.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}}else F(u,c);k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,qa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=
-m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,qa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,qa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,
-h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else{c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,u=j.morphTargetForcedOrder,n=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&
-f<u.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=n[u[f]],f++;else{var u=[],p=-1,o=0,n=j.morphTargetInfluences,v,w=n.length,f=0;for(j.morphTargetBase!==-1&&(u[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(v=0;v<w;v++)!u[v]&&n[v]>p&&(o=v,p=n[o]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=
-p;u[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
+f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=va.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
+f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var L in m)if(o=h.uniforms[L])if(t=m[L],p=t.type,c=t.value,p=="i")k.uniform1i(o,c);else if(p=="f")k.uniform1f(o,c);else if(p=="fv1")k.uniform1fv(o,c);else if(p=="fv")k.uniform3fv(o,c);else if(p=="v2")k.uniform2f(o,c.x,c.y);else if(p=="v3")k.uniform3f(o,
+c.x,c.y,c.z);else if(p=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")k.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(o,c),t=t.texture))if(t.image instanceof Array&&t.image.length==6){if(t.image.length==6){if(t.needsUpdate){if(t.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,k.RGBA,k.UNSIGNED_BYTE,t.image[p])}else{t.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,
+t.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,t.image[p]);t.__webglInit=!0}H(k.TEXTURE_CUBE_MAP,t,t.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);t.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}}else T(t,c);k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,oa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=
+m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,oa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,oa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else{c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,t=j.morphTargetForcedOrder,n=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&
+f<t.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=n[t[f]],f++;else{var t=[],p=-1,o=0,n=j.morphTargetInfluences,u,v=n.length,f=0;for(j.morphTargetBase!==-1&&(t[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!t[u]&&n[u]>p&&(o=u,p=n[o]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=
+p;t[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
 h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,
 0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,
-h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)),U.data.vertices+=h.__webglFaceCount,U.data.faces+=h.__webglFaceCount/3,U.data.drawCalls++):j instanceof
-THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),U.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),U.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),U.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&
-(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,u,n,p,o,v,w=b.count*3;for(v=0;v<w;v+=9)c=b.normalArray,f=c[v],h=c[v+1],g=c[v+2],j=c[v+3],u=c[v+4],p=c[v+5],m=c[v+6],n=c[v+7],o=c[v+8],f=(f+j+m)/3,h=(h+u+n)/3,g=(g+p+o)/3,c[v]=
-f,c[v+1]=h,c[v+2]=g,c[v+3]=f,c[v+4]=h,c[v+5]=g,c[v+6]=f,c[v+7]=h,c[v+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),$=b.doubleSided;if(ha!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ha=b.flipSided}function j(b){ma!=b&&(b?
-k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),ma=b)}function m(b,e,c){ra!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ra=b);if(b&&(T!=e||ka!=c))k.polygonOffset(e,c),T=e,ka=c}function n(b){Z[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Z[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Z[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Z[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Z[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
-Z[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=Z[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Z[f].x*e.n14+Z[f].y*e.n24+Z[f].z*e.n34+Z[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function u(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<
-e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function w(b,e){return e.z-b.z}function x(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);
-k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,u,n,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],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<o;p++)f=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
-U.initMaterial(m,h,void 0,f),m=m.program,u=m.uniforms,n=m.attributes,L!==m&&(k.useProgram(m),L=m,k.uniformMatrix4fv(u.projectionMatrix,!1,na),k.uniformMatrix4fv(u.viewMatrix,!1,qa),k.uniform3fv(u.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(u.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(n.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(n.normal,
-3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);ma=ja=-1;L=ea.program;k.useProgram(ea.program);k.uniformMatrix4fv(ea.projectionLocation,!1,na);k.uniform1f(ea.darknessLocation,
-ea.darkness);k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.vertexAttribPointer(ea.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(ea.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function y(b,e){var c,f,h;c=V.attributes;var g=V.uniforms,j=Y/da,m,u=[],n=da*0.5,p=Y*0.5,o=!0;k.useProgram(V.program);
-L=V.program;ma=ja=-1;la||(k.enableVertexAttribArray(V.attributes.position),k.enableVertexAttribArray(V.attributes.uv),la=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,na);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<
-f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-n)/n,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):
-(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Y:1),u[0]=m*j*h.scale.x,u[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,u),h.mergeWith3D&&
-!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),R(h.blending),F(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function D(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,u=new THREE.Vector3,n=Y/da,p=da*0.5,o=Y*0.5,v=16/Y,w=[v*n,v],x=[1,1,0],A=[1,1],y=O.uniforms;c=O.attributes;k.useProgram(O.program);L=O.program;ma=ja=-1;wa||(k.enableVertexAttribArray(O.attributes.vertex),k.enableVertexAttribArray(O.attributes.uv),
-wa=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,u.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),
-e.matrixWorldInverse.multiplyVector3(u),e.projectionMatrix.multiplyVector3(u),x[0]=u.x,x[1]=u.y,x[2]=u.z,A[0]=x[0]*p+p,A[1]=x[1]*o+o,O.hasVertexTexture||A[0]>0&&A[0]<da&&A[1]>0&&A[1]<Y){k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,w);k.uniform3fv(y.screenPosition,x);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);
-k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(y.renderType,2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,
-x[2]=m.z,v=m.size*m.scale/Y,w[0]=v*n,w[1]=v,k.uniform3fv(y.screenPosition,x),k.uniform2fv(y.scale,w),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),R(m.blending),F(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function A(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function H(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function C(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=H(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
-f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var u=void 0,n=void 0,p=void 0,o=void 0,v=p=void 0,w=void 0,x=void 0,A=void 0,y=void 0,D=void 0,I=void 0,J=void 0,Y=void 0,E=void 0,F=void 0,Z=void 0,N=void 0,G=o=A=o=x=w=void 0,M=void 0,B=M=G=w=void 0,K=void 0,R=B=M=G=p=p=v=A=o=B=M=G=K=B=M=G=K=B=M=G=void 0,L=0,O=0,T=0,W=0,pa=0,S=0,Q=0,V=0,na=0,P=0,U=0,M=G=0,$=g.__vertexArray,ea=g.__uvArray,ia=g.__uv2Array,ga=g.__normalArray,X=g.__tangentArray,
-fa=g.__colorArray,qa=g.__skinVertexAArray,ha=g.__skinVertexBArray,ca=g.__skinIndexArray,da=g.__skinWeightArray,oa=g.__morphTargetsArrays,ka=g.__webglCustomAttributes,B=void 0,ja=g.__faceArray,ma=g.__lineArray,ra=g.__needsSmoothNormals,D=g.__vertexColorType,y=g.__uvType,I=g.__normalType,la=j.geometry,ya=la.__dirtyVertices,ta=la.__dirtyElements,sa=la.__dirtyUvs,ua=la.__dirtyNormals,Ca=la.__dirtyTangents,xa=la.__dirtyColors,Aa=la.__dirtyMorphTargets,wa=la.vertices,Da=g.faces,Oa=la.faces,Ya=la.faceVertexUvs[0],
-Za=la.faceVertexUvs[1],La=la.skinVerticesA,Ma=la.skinVerticesB,Na=la.skinIndices,Fa=la.skinWeights,Ja=j instanceof THREE.ShadowVolume?la.edgeFaces:void 0,Ba=la.morphTargets;if(ka)for(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;u=0;for(n=Da.length;u<n;u++)if(p=Da[u],o=Oa[p],Ya&&(J=Ya[p]),Za&&(Y=Za[p]),p=o.vertexNormals,v=o.normal,w=o.vertexColors,x=o.color,A=o.vertexTangents,o instanceof THREE.Face3){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=
-F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,O+=9;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.offsetSrc+=
-3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],B.offsetSrc+=3),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,B.array[G+3]=F.r,B.array[G+
-4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z),B.offset+=9):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.offset+=12));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=
-Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z;U+=9}if(Fa.length)G=Fa[o.a],M=Fa[o.b],B=Fa[o.c],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,
-ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,G=La[o.a],M=La[o.b],B=La[o.c],qa[P]=G.x,qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,P+=12;if(xa&&D)w.length==3&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2]):M=G=o=x,fa[na]=o.r,fa[na+1]=o.g,
-fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,na+=9;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,Q+=12;if(ua&&I)if(p.length==3&&ra)for(A=0;A<3;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<3;A++)ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<3;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&
-Y!==void 0&&y)for(A=0;A<3;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+2,pa+=3,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+2,ma[V+4]=L+1,ma[V+5]=L+2,V+=6,L+=3)}else if(o instanceof THREE.Face4){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,N=wa[o.d].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,$[O+9]=N.x,$[O+10]=N.y,$[O+11]=N.z,O+=12;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,
-M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c],B.array[G+3]=B.value[o.d]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.array[G+3]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.array[G+3]=B.value[M+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo===
-"vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c],N=B.value[o.d]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],N=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],N=B.value[M+3],B.offsetSrc+=4),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.array[G+6]=N.x,B.array[G+7]=N.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,
-B.array[G+3]=F.r,B.array[G+4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b,B.array[G+9]=N.r,B.array[G+10]=N.g,B.array[G+11]=N.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z,B.array[G+9]=N.x,B.array[G+10]=N.y,B.array[G+11]=N.z),B.offset+=12):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+
-7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.array[G+12]=N.x,B.array[G+13]=N.y,B.array[G+14]=N.z,B.array[G+15]=N.w,B.offset+=16));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,N=Ba[G].vertices[o.d].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z,B[U+9]=N.x,B[U+10]=N.y,B[U+11]=N.z;U+=12}if(Fa.length)G=Fa[o.a],M=Fa[o.b],
-B=Fa[o.c],K=Fa[o.d],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,da[P+12]=K.x,da[P+13]=K.y,da[P+14]=K.z,da[P+15]=K.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],K=Na[o.d],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,ca[P+12]=K.x,ca[P+13]=K.y,ca[P+14]=K.z,ca[P+15]=K.w,G=La[o.a],M=La[o.b],B=La[o.c],K=La[o.d],qa[P]=G.x,
-qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,qa[P+12]=K.x,qa[P+13]=K.y,qa[P+14]=K.z,qa[P+15]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],o=Ma[o.d],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,ha[P+12]=o.x,ha[P+13]=o.y,ha[P+14]=o.z,ha[P+15]=1,P+=16;if(xa&&D)w.length==4&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2],w=w[3]):w=M=G=o=x,fa[na]=
-o.r,fa[na+1]=o.g,fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,fa[na+9]=w.r,fa[na+10]=w.g,fa[na+11]=w.b,na+=12;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],A=A[3],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,X[Q+12]=A.x,X[Q+13]=A.y,X[Q+14]=A.z,X[Q+15]=A.w,Q+=16;if(ua&&I)if(p.length==4&&ra)for(A=0;A<4;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<4;A++)ga[S]=
-v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<4;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&Y!==void 0&&y)for(A=0;A<4;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+3,ja[pa+3]=L+1,ja[pa+4]=L+2,ja[pa+5]=L+3,pa+=6,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+3,ma[V+4]=L+1,ma[V+5]=L+2,ma[V+6]=L+2,ma[V+7]=L+3,V+=8,L+=4)}if(Ja){u=0;for(n=Ja.length;u<n;u++)ja[pa]=Ja[u].a,ja[pa+1]=Ja[u].b,ja[pa+2]=Ja[u].c,ja[pa+3]=Ja[u].a,ja[pa+4]=Ja[u].c,ja[pa+5]=Ja[u].d,pa+=6}ya&&
-(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));if(ka)for(R in ka)B=ka[R],B.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,B.buffer),k.bufferData(k.ARRAY_BUFFER,B.array,m));if(Aa){G=0;for(M=Ba.length;G<M;G++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[G]),k.bufferData(k.ARRAY_BUFFER,oa[G],m)}xa&&na>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));ua&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),
-k.bufferData(k.ARRAY_BUFFER,ga,m));Ca&&la.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,X,m));sa&&T>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m));sa&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ia,m));ta&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ja,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
-ma,m));P>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,qa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ha,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));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)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;C(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;
-J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
-y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
-b.geometry,g=H(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,C(f)}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function J(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,u,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
-m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[u].vertices+j>65535&&(o[m].counter+=1,u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=j}function S(b,e,c){b.push({buffer:e,object:c,
-opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ja=
-b}}function N(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,Q(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,Q(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,X(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,X(e.minFilter)))}
-function F(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),N(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function W(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===
-void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,Q(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,Q(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,Q(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,Q(b.minFilter));k.texImage2D(k.TEXTURE_2D,
-0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
-k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=da,b=Y);e!=ga&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,oa,c,b),ga=e)}function K(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):
-b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
+h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)),S.data.vertices+=h.__webglFaceCount,S.data.faces+=h.__webglFaceCount/3,S.data.drawCalls++):j instanceof
+THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),S.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),S.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),S.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&
+(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,t,n,p,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],j=c[u+3],t=c[u+4],p=c[u+5],m=c[u+6],n=c[u+7],o=c[u+8],f=(f+j+m)/3,h=(h+t+n)/3,g=(g+p+o)/3,c[u]=
+f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),W=b.doubleSided;if(da!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),da=b.flipSided}function j(b){ka!=b&&(b?
+k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),ka=b)}function m(b,e,c){pa!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),pa=b);if(b&&(R!=e||ha!=c))k.polygonOffset(e,c),R=e,ha=c}function n(b){X[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);X[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);X[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);X[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);X[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
+X[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=X[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=X[f].x*e.n14+X[f].y*e.n24+X[f].z*e.n34+X[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<
+e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function u(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function v(b,e){return e.z-b.z}function w(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);
+k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,t,n,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],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<o;p++)f=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
+S.initMaterial(m,h,void 0,f),m=m.program,t=m.uniforms,n=m.attributes,O!==m&&(k.useProgram(m),O=m,k.uniformMatrix4fv(t.projectionMatrix,!1,la),k.uniformMatrix4fv(t.viewMatrix,!1,oa),k.uniform3fv(t.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(t.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(n.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(n.normal,
+3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);ka=ga=-1;O=ca.program;k.useProgram(ca.program);k.uniformMatrix4fv(ca.projectionLocation,!1,la);k.uniform1f(ca.darknessLocation,
+ca.darkness);k.bindBuffer(k.ARRAY_BUFFER,ca.vertexBuffer);k.vertexAttribPointer(ca.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(ca.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(ea)}function z(b,e){var c,f,h;c=Q.attributes;var g=Q.uniforms,j=ia/aa,m,t=[],n=aa*0.5,p=ia*0.5,o=!0;k.useProgram(Q.program);
+O=Q.program;ka=ga=-1;ja||(k.enableVertexAttribArray(Q.attributes.position),k.enableVertexAttribArray(Q.attributes.uv),ja=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,la);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<
+f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-n)/n,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):
+(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?ia:1),t[0]=m*j*h.scale.x,t[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,t),h.mergeWith3D&&
+!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),I(h.blending),T(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(ea)}function x(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,t=new THREE.Vector3,n=ia/aa,p=aa*0.5,o=ia*0.5,u=16/ia,v=[u*n,u],w=[1,1,0],y=[1,1],x=M.uniforms;c=M.attributes;k.useProgram(M.program);O=M.program;ka=ga=-1;ua||(k.enableVertexAttribArray(M.attributes.vertex),k.enableVertexAttribArray(M.attributes.uv),
+ua=!0);k.uniform1i(x.occlusionMap,0);k.uniform1i(x.map,1);k.bindBuffer(k.ARRAY_BUFFER,M.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,M.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,M.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,t.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),
+e.matrixWorldInverse.multiplyVector3(t),e.projectionMatrix.multiplyVector3(t),w[0]=t.x,w[1]=t.y,w[2]=t.z,y[0]=w[0]*p+p,y[1]=w[1]*o+o,M.hasVertexTexture||y[0]>0&&y[0]<aa&&y[1]>0&&y[1]<ia){k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,y[0]-8,y[1]-8,16,16,0);k.uniform1i(x.renderType,0);k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,w);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,M.occlusionTexture);
+k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,y[0]-8,y[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,
+w[2]=m.z,u=m.size*m.scale/ia,v[0]=u*n,v[1]=u,k.uniform3fv(x.screenPosition,w),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),T(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(ea)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function F(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function C(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=F(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
+f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var t=void 0,n=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,w=void 0,y=void 0,x=void 0,z=void 0,B=void 0,G=void 0,ia=void 0,E=void 0,X=void 0,I=void 0,H=void 0,D=o=y=o=w=v=void 0,L=void 0,A=L=D=v=void 0,J=void 0,O=A=L=D=p=p=u=y=o=A=L=D=J=A=L=D=J=A=L=D=void 0,K=0,M=0,T=0,R=0,P=0,na=0,W=0,S=0,Q=0,N=0,la=0,L=D=0,U=g.__vertexArray,fa=g.__uvArray,ca=g.__uv2Array,ea=g.__normalArray,V=g.__tangentArray,
+Y=g.__colorArray,da=g.__skinVertexAArray,oa=g.__skinVertexBArray,$=g.__skinIndexArray,aa=g.__skinWeightArray,ma=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,A=void 0,ga=g.__faceArray,ka=g.__lineArray,pa=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,B=g.__normalType,ja=j.geometry,wa=ja.__dirtyVertices,ra=ja.__dirtyElements,qa=ja.__dirtyUvs,sa=ja.__dirtyNormals,Aa=ja.__dirtyTangents,va=ja.__dirtyColors,ya=ja.__dirtyMorphTargets,ua=ja.vertices,Ba=g.faces,Ma=ja.faces,Wa=ja.faceVertexUvs[0],
+Xa=ja.faceVertexUvs[1],Ja=ja.skinVerticesA,Ka=ja.skinVerticesB,La=ja.skinIndices,Da=ja.skinWeights,Ha=j instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,za=ja.morphTargets;if(ha)for(O in ha)ha[O].offset=0,ha[O].offsetSrc=0;t=0;for(n=Ba.length;t<n;t++)if(p=Ba[t],o=Ma[p],Wa&&(G=Wa[p]),Xa&&(ia=Xa[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,w=o.color,y=o.vertexTangents,o instanceof THREE.Face3){if(wa)E=ua[o.a].position,X=ua[o.b].position,I=ua[o.c].position,U[M]=E.x,U[M+1]=E.y,U[M+2]=E.z,U[M+3]=
+X.x,U[M+4]=X.y,U[M+5]=X.z,U[M+6]=I.x,U[M+7]=I.y,U[M+8]=I.z,M+=9;if(ha)for(O in ha)if(A=ha[O],A.__original.needsUpdate)D=A.offset,L=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[D+0]=A.value[o.a],A.array[D+1]=A.value[o.b],A.array[D+2]=A.value[o.c]):A.boundTo==="faces"?(A.array[D+0]=A.value[L],A.array[D+1]=A.value[L],A.array[D+2]=A.value[L],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[D+0]=A.value[L+0],A.array[D+1]=A.value[L+1],A.array[D+2]=A.value[L+2],A.offsetSrc+=
+3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(E=A.value[o.a],X=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(E=A.value[L],X=A.value[L],I=A.value[L],A.offsetSrc++):A.boundTo==="faceVertices"&&(E=A.value[L+0],X=A.value[L+1],I=A.value[L+2],A.offsetSrc+=3),A.size===2?(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=X.x,A.array[D+3]=X.y,A.array[D+4]=I.x,A.array[D+5]=I.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[D+0]=E.r,A.array[D+1]=E.g,A.array[D+2]=E.b,A.array[D+3]=X.r,A.array[D+
+4]=X.g,A.array[D+5]=X.b,A.array[D+6]=I.r,A.array[D+7]=I.g,A.array[D+8]=I.b):(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=E.z,A.array[D+3]=X.x,A.array[D+4]=X.y,A.array[D+5]=X.z,A.array[D+6]=I.x,A.array[D+7]=I.y,A.array[D+8]=I.z),A.offset+=9):(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=E.z,A.array[D+3]=E.w,A.array[D+4]=X.x,A.array[D+5]=X.y,A.array[D+6]=X.z,A.array[D+7]=X.w,A.array[D+8]=I.x,A.array[D+9]=I.y,A.array[D+10]=I.z,A.array[D+11]=I.w,A.offset+=12));if(ya){D=0;for(L=za.length;D<L;D++)E=
+za[D].vertices[o.a].position,X=za[D].vertices[o.b].position,I=za[D].vertices[o.c].position,A=ma[D],A[la+0]=E.x,A[la+1]=E.y,A[la+2]=E.z,A[la+3]=X.x,A[la+4]=X.y,A[la+5]=X.z,A[la+6]=I.x,A[la+7]=I.y,A[la+8]=I.z;la+=9}if(Da.length)D=Da[o.a],L=Da[o.b],A=Da[o.c],aa[N]=D.x,aa[N+1]=D.y,aa[N+2]=D.z,aa[N+3]=D.w,aa[N+4]=L.x,aa[N+5]=L.y,aa[N+6]=L.z,aa[N+7]=L.w,aa[N+8]=A.x,aa[N+9]=A.y,aa[N+10]=A.z,aa[N+11]=A.w,D=La[o.a],L=La[o.b],A=La[o.c],$[N]=D.x,$[N+1]=D.y,$[N+2]=D.z,$[N+3]=D.w,$[N+4]=L.x,$[N+5]=L.y,$[N+6]=
+L.z,$[N+7]=L.w,$[N+8]=A.x,$[N+9]=A.y,$[N+10]=A.z,$[N+11]=A.w,D=Ja[o.a],L=Ja[o.b],A=Ja[o.c],da[N]=D.x,da[N+1]=D.y,da[N+2]=D.z,da[N+3]=1,da[N+4]=L.x,da[N+5]=L.y,da[N+6]=L.z,da[N+7]=1,da[N+8]=A.x,da[N+9]=A.y,da[N+10]=A.z,da[N+11]=1,D=Ka[o.a],L=Ka[o.b],A=Ka[o.c],oa[N]=D.x,oa[N+1]=D.y,oa[N+2]=D.z,oa[N+3]=1,oa[N+4]=L.x,oa[N+5]=L.y,oa[N+6]=L.z,oa[N+7]=1,oa[N+8]=A.x,oa[N+9]=A.y,oa[N+10]=A.z,oa[N+11]=1,N+=12;if(va&&z)v.length==3&&z==THREE.VertexColors?(o=v[0],D=v[1],L=v[2]):L=D=o=w,Y[Q]=o.r,Y[Q+1]=o.g,Y[Q+
+2]=o.b,Y[Q+3]=D.r,Y[Q+4]=D.g,Y[Q+5]=D.b,Y[Q+6]=L.r,Y[Q+7]=L.g,Y[Q+8]=L.b,Q+=9;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],V[W]=v.x,V[W+1]=v.y,V[W+2]=v.z,V[W+3]=v.w,V[W+4]=w.x,V[W+5]=w.y,V[W+6]=w.z,V[W+7]=w.w,V[W+8]=o.x,V[W+9]=o.y,V[W+10]=o.z,V[W+11]=o.w,W+=12;if(sa&&B)if(p.length==3&&pa)for(y=0;y<3;y++)u=p[y],ea[na]=u.x,ea[na+1]=u.y,ea[na+2]=u.z,na+=3;else for(y=0;y<3;y++)ea[na]=u.x,ea[na+1]=u.y,ea[na+2]=u.z,na+=3;if(qa&&G!==void 0&&x)for(y=0;y<3;y++)p=G[y],fa[T]=p.u,fa[T+1]=p.v,T+=2;if(qa&&ia!==void 0&&
+x)for(y=0;y<3;y++)p=ia[y],ca[R]=p.u,ca[R+1]=p.v,R+=2;ra&&(ga[P]=K,ga[P+1]=K+1,ga[P+2]=K+2,P+=3,ka[S]=K,ka[S+1]=K+1,ka[S+2]=K,ka[S+3]=K+2,ka[S+4]=K+1,ka[S+5]=K+2,S+=6,K+=3)}else if(o instanceof THREE.Face4){if(wa)E=ua[o.a].position,X=ua[o.b].position,I=ua[o.c].position,H=ua[o.d].position,U[M]=E.x,U[M+1]=E.y,U[M+2]=E.z,U[M+3]=X.x,U[M+4]=X.y,U[M+5]=X.z,U[M+6]=I.x,U[M+7]=I.y,U[M+8]=I.z,U[M+9]=H.x,U[M+10]=H.y,U[M+11]=H.z,M+=12;if(ha)for(O in ha)if(A=ha[O],A.__original.needsUpdate)D=A.offset,L=A.offsetSrc,
+A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[D+0]=A.value[o.a],A.array[D+1]=A.value[o.b],A.array[D+2]=A.value[o.c],A.array[D+3]=A.value[o.d]):A.boundTo==="faces"?(A.array[D+0]=A.value[L],A.array[D+1]=A.value[L],A.array[D+2]=A.value[L],A.array[D+3]=A.value[L],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[D+0]=A.value[L+0],A.array[D+1]=A.value[L+1],A.array[D+2]=A.value[L+2],A.array[D+3]=A.value[L+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(E=
+A.value[o.a],X=A.value[o.b],I=A.value[o.c],H=A.value[o.d]):A.boundTo==="faces"?(E=A.value[L],X=A.value[L],I=A.value[L],H=A.value[L],A.offsetSrc++):A.boundTo==="faceVertices"&&(E=A.value[L+0],X=A.value[L+1],I=A.value[L+2],H=A.value[L+3],A.offsetSrc+=4),A.size===2?(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=X.x,A.array[D+3]=X.y,A.array[D+4]=I.x,A.array[D+5]=I.y,A.array[D+6]=H.x,A.array[D+7]=H.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[D+0]=E.r,A.array[D+1]=E.g,A.array[D+2]=E.b,A.array[D+3]=
+X.r,A.array[D+4]=X.g,A.array[D+5]=X.b,A.array[D+6]=I.r,A.array[D+7]=I.g,A.array[D+8]=I.b,A.array[D+9]=H.r,A.array[D+10]=H.g,A.array[D+11]=H.b):(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=E.z,A.array[D+3]=X.x,A.array[D+4]=X.y,A.array[D+5]=X.z,A.array[D+6]=I.x,A.array[D+7]=I.y,A.array[D+8]=I.z,A.array[D+9]=H.x,A.array[D+10]=H.y,A.array[D+11]=H.z),A.offset+=12):(A.array[D+0]=E.x,A.array[D+1]=E.y,A.array[D+2]=E.z,A.array[D+3]=E.w,A.array[D+4]=X.x,A.array[D+5]=X.y,A.array[D+6]=X.z,A.array[D+7]=X.w,
+A.array[D+8]=I.x,A.array[D+9]=I.y,A.array[D+10]=I.z,A.array[D+11]=I.w,A.array[D+12]=H.x,A.array[D+13]=H.y,A.array[D+14]=H.z,A.array[D+15]=H.w,A.offset+=16));if(ya){D=0;for(L=za.length;D<L;D++)E=za[D].vertices[o.a].position,X=za[D].vertices[o.b].position,I=za[D].vertices[o.c].position,H=za[D].vertices[o.d].position,A=ma[D],A[la+0]=E.x,A[la+1]=E.y,A[la+2]=E.z,A[la+3]=X.x,A[la+4]=X.y,A[la+5]=X.z,A[la+6]=I.x,A[la+7]=I.y,A[la+8]=I.z,A[la+9]=H.x,A[la+10]=H.y,A[la+11]=H.z;la+=12}if(Da.length)D=Da[o.a],L=
+Da[o.b],A=Da[o.c],J=Da[o.d],aa[N]=D.x,aa[N+1]=D.y,aa[N+2]=D.z,aa[N+3]=D.w,aa[N+4]=L.x,aa[N+5]=L.y,aa[N+6]=L.z,aa[N+7]=L.w,aa[N+8]=A.x,aa[N+9]=A.y,aa[N+10]=A.z,aa[N+11]=A.w,aa[N+12]=J.x,aa[N+13]=J.y,aa[N+14]=J.z,aa[N+15]=J.w,D=La[o.a],L=La[o.b],A=La[o.c],J=La[o.d],$[N]=D.x,$[N+1]=D.y,$[N+2]=D.z,$[N+3]=D.w,$[N+4]=L.x,$[N+5]=L.y,$[N+6]=L.z,$[N+7]=L.w,$[N+8]=A.x,$[N+9]=A.y,$[N+10]=A.z,$[N+11]=A.w,$[N+12]=J.x,$[N+13]=J.y,$[N+14]=J.z,$[N+15]=J.w,D=Ja[o.a],L=Ja[o.b],A=Ja[o.c],J=Ja[o.d],da[N]=D.x,da[N+1]=
+D.y,da[N+2]=D.z,da[N+3]=1,da[N+4]=L.x,da[N+5]=L.y,da[N+6]=L.z,da[N+7]=1,da[N+8]=A.x,da[N+9]=A.y,da[N+10]=A.z,da[N+11]=1,da[N+12]=J.x,da[N+13]=J.y,da[N+14]=J.z,da[N+15]=1,D=Ka[o.a],L=Ka[o.b],A=Ka[o.c],o=Ka[o.d],oa[N]=D.x,oa[N+1]=D.y,oa[N+2]=D.z,oa[N+3]=1,oa[N+4]=L.x,oa[N+5]=L.y,oa[N+6]=L.z,oa[N+7]=1,oa[N+8]=A.x,oa[N+9]=A.y,oa[N+10]=A.z,oa[N+11]=1,oa[N+12]=o.x,oa[N+13]=o.y,oa[N+14]=o.z,oa[N+15]=1,N+=16;if(va&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],D=v[1],L=v[2],v=v[3]):v=L=D=o=w,Y[Q]=o.r,Y[Q+
+1]=o.g,Y[Q+2]=o.b,Y[Q+3]=D.r,Y[Q+4]=D.g,Y[Q+5]=D.b,Y[Q+6]=L.r,Y[Q+7]=L.g,Y[Q+8]=L.b,Y[Q+9]=v.r,Y[Q+10]=v.g,Y[Q+11]=v.b,Q+=12;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],y=y[3],V[W]=v.x,V[W+1]=v.y,V[W+2]=v.z,V[W+3]=v.w,V[W+4]=w.x,V[W+5]=w.y,V[W+6]=w.z,V[W+7]=w.w,V[W+8]=o.x,V[W+9]=o.y,V[W+10]=o.z,V[W+11]=o.w,V[W+12]=y.x,V[W+13]=y.y,V[W+14]=y.z,V[W+15]=y.w,W+=16;if(sa&&B)if(p.length==4&&pa)for(y=0;y<4;y++)u=p[y],ea[na]=u.x,ea[na+1]=u.y,ea[na+2]=u.z,na+=3;else for(y=0;y<4;y++)ea[na]=u.x,ea[na+1]=u.y,ea[na+
+2]=u.z,na+=3;if(qa&&G!==void 0&&x)for(y=0;y<4;y++)p=G[y],fa[T]=p.u,fa[T+1]=p.v,T+=2;if(qa&&ia!==void 0&&x)for(y=0;y<4;y++)p=ia[y],ca[R]=p.u,ca[R+1]=p.v,R+=2;ra&&(ga[P]=K,ga[P+1]=K+1,ga[P+2]=K+3,ga[P+3]=K+1,ga[P+4]=K+2,ga[P+5]=K+3,P+=6,ka[S]=K,ka[S+1]=K+1,ka[S+2]=K,ka[S+3]=K+3,ka[S+4]=K+1,ka[S+5]=K+2,ka[S+6]=K+2,ka[S+7]=K+3,S+=8,K+=4)}if(Ha){t=0;for(n=Ha.length;t<n;t++)ga[P]=Ha[t].a,ga[P+1]=Ha[t].b,ga[P+2]=Ha[t].c,ga[P+3]=Ha[t].a,ga[P+4]=Ha[t].c,ga[P+5]=Ha[t].d,P+=6}wa&&(k.bindBuffer(k.ARRAY_BUFFER,
+g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,U,m));if(ha)for(O in ha)A=ha[O],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(ya){D=0;for(L=za.length;D<L;D++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),k.bufferData(k.ARRAY_BUFFER,ma[D],m)}va&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Y,m));sa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ea,
+m));Aa&&ja.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,V,m));qa&&T>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));qa&&R>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ca,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ga,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ka,m));N>
+0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,da,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,oa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,$,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m));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)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;C(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;B=b.__vertexArray;m=b.__colorArray;
+G=b.__dirtyColors;if(b.__dirtyVertices){for(t=0;t<z;t++)n=x[t].position,h=t*3,B[h]=n.x,B[h+1]=n.y,B[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,B,e)}if(G){for(t=0;t<j;t++)color=g[t],h=t*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
+x=b.vertices;g=b.colors;z=x.length;j=g.length;B=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(t=0;t<z;t++)n=x[t].position,h=t*3,B[h]=n.x,B[h+1]=n.y,B[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,B,e)}if(G){for(t=0;t<j;t++)color=g[t],h=t*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
+b.geometry,g=F(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,C(f)}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function B(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,t,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
+m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),t=o[m].hash+"_"+o[m].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+j>65535&&(o[m].counter+=1,t=o[m].hash+"_"+o[m].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=j}function P(b,e,c){b.push({buffer:e,object:c,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=ga){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ga=
+b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,K(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,K(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,K(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,K(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Y(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Y(e.minFilter)))}
+function T(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),H(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function U(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===
+void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,K(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,K(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,K(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,K(b.minFilter));k.texImage2D(k.TEXTURE_2D,
+0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
+k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=aa,b=ia);e!=fa&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport($,ma,c,b),fa=e)}function J(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):
+b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function Y(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function K(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
 case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;
-case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var U=this,k,ia=[],L=null,ga=null,fa=!0,$=null,ha=null,ja=null,ma=null,ra=null,T=null,ka=null,ca=0,oa=0,da=0,Y=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,na=new Float32Array(16),qa=new Float32Array(16),ya=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Oa=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ta=b.clearAlpha!==
-void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;try{if(!(k=xa.getContext("experimental-webgl",{antialias:Oa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);
-k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ua.r,ua.g,ua.b,ta);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var ea={};ea.vertices=new Float32Array(12);ea.faces=new Uint16Array(6);ea.darkness=0.5;ea.vertices[0]=-20;ea.vertices[1]=-20;ea.vertices[2]=-1;ea.vertices[3]=20;ea.vertices[4]=-20;ea.vertices[5]=-1;ea.vertices[6]=20;
-ea.vertices[7]=20;ea.vertices[8]=-1;ea.vertices[9]=-20;ea.vertices[10]=20;ea.vertices[11]=-1;ea.faces[0]=0;ea.faces[1]=1;ea.faces[2]=2;ea.faces[3]=0;ea.faces[4]=2;ea.faces[5]=3;ea.vertexBuffer=k.createBuffer();ea.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,ea.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ea.faces,k.STATIC_DRAW);ea.program=k.createProgram();k.attachShader(ea.program,
-K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(ea.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(ea.program);ea.vertexLocation=k.getAttribLocation(ea.program,"position");ea.projectionLocation=k.getUniformLocation(ea.program,"projectionMatrix");ea.darknessLocation=k.getUniformLocation(ea.program,"darkness")}var O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=
-0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();O.tempTexture=k.createTexture();O.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
-O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,
-O.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(O.hasVertexTexture=!1,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
-k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.vertex=k.getAttribLocation(O.program,"position");O.attributes.uv=k.getAttribLocation(O.program,"UV");O.uniforms.renderType=
-k.getUniformLocation(O.program,"renderType");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=k.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");var wa=!1,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++]=1;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++]=1;V.vertices[b++]=0;V.vertices[b++]=-1;V.vertices[b++]=1;V.vertices[b++]=0;b=V.vertices[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=k.createBuffer();V.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
-V.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,V.faces,k.STATIC_DRAW);V.program=k.createProgram();k.attachShader(V.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(V.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=k.getAttribLocation(V.program,"position");V.attributes.uv=k.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=
-k.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=k.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=k.getUniformLocation(V.program,"rotation");V.uniforms.scale=k.getUniformLocation(V.program,"scale");V.uniforms.alignment=k.getUniformLocation(V.program,"alignment");V.uniforms.map=k.getUniformLocation(V.program,"map");V.uniforms.opacity=k.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=k.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=
-k.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=k.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=k.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=k.getUniformLocation(V.program,"projectionMatrix");var la=!1;this.setSize=function(b,e){xa.width=b;xa.height=e;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;da=c;Y=f;k.viewport(ca,oa,da,Y)};this.setScissor=function(b,e,c,f){k.scissor(b,
-e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){fa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ua.setHex(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.setClearColor=function(b,e){ua.copy(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ea.darkness=b};this.getContext=function(){return k};
+case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var S=this,k,V=[],O=null,fa=null,ea=!0,W=null,da=null,ga=null,ka=null,pa=null,R=null,ha=null,$=0,ma=0,aa=0,ia=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],na=new THREE.Matrix4,la=new Float32Array(16),oa=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(k=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(qa){console.error(qa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);
+k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(sa.r,sa.g,sa.b,ra);this.context=k;var Ba=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-20;ca.vertices[1]=-20;ca.vertices[2]=-1;ca.vertices[3]=20;ca.vertices[4]=-20;ca.vertices[5]=-1;ca.vertices[6]=20;
+ca.vertices[7]=20;ca.vertices[8]=-1;ca.vertices[9]=-20;ca.vertices[10]=20;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=k.createBuffer();ca.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,ca.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,ca.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ca.faces,k.STATIC_DRAW);ca.program=k.createProgram();k.attachShader(ca.program,
+J("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(ca.program,J("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(ca.program);ca.vertexLocation=k.getAttribLocation(ca.program,"position");ca.projectionLocation=k.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=k.getUniformLocation(ca.program,"darkness")}var M={};M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);b=0;M.vertices[b++]=-1;M.vertices[b++]=-1;M.vertices[b++]=0;M.vertices[b++]=
+0;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=0;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=0;M.vertices[b++]=1;b=0;M.faces[b++]=0;M.faces[b++]=1;M.faces[b++]=2;M.faces[b++]=0;M.faces[b++]=2;M.faces[b++]=3;M.vertexBuffer=k.createBuffer();M.elementBuffer=k.createBuffer();M.tempTexture=k.createTexture();M.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,M.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+M.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,M.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,M.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,M.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,
+M.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(M.hasVertexTexture=!1,M.program=k.createProgram(),k.attachShader(M.program,J("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
+k.attachShader(M.program,J("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(M.hasVertexTexture=!0,M.program=k.createProgram(),k.attachShader(M.program,J("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(M.program,J("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.vertex=k.getAttribLocation(M.program,"position");M.attributes.uv=k.getAttribLocation(M.program,"UV");M.uniforms.renderType=
+k.getUniformLocation(M.program,"renderType");M.uniforms.map=k.getUniformLocation(M.program,"map");M.uniforms.occlusionMap=k.getUniformLocation(M.program,"occlusionMap");M.uniforms.opacity=k.getUniformLocation(M.program,"opacity");M.uniforms.scale=k.getUniformLocation(M.program,"scale");M.uniforms.rotation=k.getUniformLocation(M.program,"rotation");M.uniforms.screenPosition=k.getUniformLocation(M.program,"screenPosition");var ua=!1,Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);b=
+0;Q.vertices[b++]=-1;Q.vertices[b++]=-1;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;b=Q.vertices[b++]=0;Q.faces[b++]=0;Q.faces[b++]=1;Q.faces[b++]=2;Q.faces[b++]=0;Q.faces[b++]=2;Q.faces[b++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+Q.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Q.faces,k.STATIC_DRAW);Q.program=k.createProgram();k.attachShader(Q.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(Q.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.position=k.getAttribLocation(Q.program,"position");Q.attributes.uv=k.getAttribLocation(Q.program,"uv");Q.uniforms.uvOffset=
+k.getUniformLocation(Q.program,"uvOffset");Q.uniforms.uvScale=k.getUniformLocation(Q.program,"uvScale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.alignment=k.getUniformLocation(Q.program,"alignment");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.useScreenCoordinates=k.getUniformLocation(Q.program,"useScreenCoordinates");Q.uniforms.affectedByDistance=
+k.getUniformLocation(Q.program,"affectedByDistance");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");Q.uniforms.modelViewMatrix=k.getUniformLocation(Q.program,"modelViewMatrix");Q.uniforms.projectionMatrix=k.getUniformLocation(Q.program,"projectionMatrix");var ja=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){$=b;ma=e;aa=c;ia=f;k.viewport($,ma,aa,ia)};this.setScissor=function(b,e,c,f){k.scissor(b,
+e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ea=b;k.depthMask(b)};this.setClearColorHex=function(b,e){sa.setHex(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.setClearColor=function(b,e){sa.copy(b);ra=e;k.clearColor(sa.r,sa.g,sa.b,ra)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ca.darkness=b};this.getContext=function(){return k};
 this.initMaterial=function(b,e,c,f){var h,g,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 m=THREE.ShaderLib[j];b.uniforms=
-THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var u,o,n;u=n=m=0;for(o=e.length;u<o;u++)g=e[u],g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?e=n:(e=Math.ceil(4*n/(m+n)),m=4-e);g={directional:e,point:m};n=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)n=f.bones.length;var p;a:{u=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=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:g.directional,maxPointLights:g.point,maxBones:n},v;g=[];j?g.push(j):(g.push(u),g.push(o));for(v in c)g.push(v),g.push(c[v]);j=g.join();v=0;for(g=ia.length;v<g;v++)if(ia[v].code==j){p=ia[v].program;break a}v=k.createProgram();g=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+
+THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var t,o,n;t=n=m=0;for(o=e.length;t<o;t++)g=e[t],g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?e=n:(e=Math.ceil(4*n/(m+n)),m=4-e);g={directional:e,point:m};n=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)n=f.bones.length;var p;a:{t=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=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:g.directional,maxPointLights:g.point,maxBones:n},u;g=[];j?g.push(j):(g.push(t),g.push(o));for(u in c)g.push(u),g.push(c[u]);j=g.join();u=0;for(g=V.length;u<g;u++)if(V[u].code==j){p=V[u].program;break a}u=k.createProgram();g=[Ba?"#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");
-n=["#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");k.attachShader(v,K("fragment",n+u));k.attachShader(v,K("vertex",g+o));k.linkProgram(v);
-k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms={};v.attributes={};var w;u=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)u.push(w);w=u;m=0;for(u=w.length;m<u;m++)o=w[m],v.uniforms[o]=k.getUniformLocation(v,o);u=["position","normal",
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)u.push("morphTarget"+w);for(p in e)u.push(p);p=u;w=0;for(e=p.length;w<e;w++)c=p[w],v.attributes[c]=k.getAttribLocation(v,c);ia.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
+n=["#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");k.attachShader(u,J("fragment",n+t));k.attachShader(u,J("vertex",g+o));k.linkProgram(u);
+k.getProgramParameter(u,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(u,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");u.uniforms={};u.attributes={};var v;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)t.push(v);v=t;m=0;for(t=v.length;m<t;m++)o=v[m],u.uniforms[o]=k.getUniformLocation(u,o);t=["position","normal",
+"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)t.push("morphTarget"+v);for(p in e)t.push(p);p=t;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=k.getAttribLocation(u,c);V.push({program:u,code:j});p=u}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
 b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&k.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),
 b.numSupportedMorphTargets++);p.morphTarget2>=0&&(k.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(k.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(k.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(k.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(k.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
-0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,C){var E,I,F,H,J,Z,Y,N,L=b.lights,K=b.fog;U.data.vertices=0;U.data.faces=0;U.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(qa);c.projectionMatrix.flattenToArray(na);pa.multiply(c.projectionMatrix,
-c.matrixWorldInverse);n(pa);this.initWebGLObjects(b);W(o);(this.autoClear||C)&&this.clear();J=b.__webglObjects.length;for(C=0;C<J;C++)if(E=b.__webglObjects[C],Y=E.object,Y.visible)if(!(Y instanceof THREE.Mesh)||p(Y)){if(Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),v(E),E.render=!0,this.sortObjects)E.object.renderDepth?E.z=E.object.renderDepth:(ya.copy(Y.position),pa.multiplyVector3(ya),E.z=ya.z)}else E.render=!1;else E.render=!1;this.sortObjects&&b.__webglObjects.sort(w);Z=b.__webglObjectsImmediate.length;
-for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(Y.matrixAutoUpdate&&Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),u(E));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render)Y=E.object,N=E.buffer,h(Y),f(c,L,K,b.overrideMaterial,N,Y);for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(h(Y),I=e(c,L,K,b.overrideMaterial,Y),Y.render(function(e){g(e,I,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);
-for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render){Y=E.object;N=E.buffer;F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}for(C=0;C<J;C++)if(E=b.__webglObjects[C],
-E.render){Y=E.object;N=E.buffer;F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}}b.__webglSprites.length&&y(b,c);Aa&&
-b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&D(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.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 e=b.__objectsAdded[0],
-c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&J(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();
-j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,u=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(u=j.numMorphTargets;m<
-u;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=h,m=e,o=void 0,p=void 0,n=void 0,v=n=void 0,w=void 0,x=void 0,A=x=u=0,y=n=p=void 0,D=y=p=o=void 0,n=void 0,v=m.geometry,w=v.faces,y=j.faces,o=0,p=y.length;o<p;o++)n=y[o],n=w[n],n instanceof THREE.Face3?(u+=3,x+=1,A+=3):n instanceof THREE.Face4&&(u+=4,x+=2,A+=4);for(var o=j,p=m,C=y=w=void 0,H=void 0,C=void 0,n=[],w=0,y=p.materials.length;w<y;w++)if(C=p.materials[w],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<
-l;C++)(H=o.materials[C])&&n.push(H)}else(H=C)&&n.push(H);o=n;j.__materials=o;a:{w=p=void 0;y=o.length;for(p=0;p<y;p++)if(w=o[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{y=w=void 0;n=o.length;for(w=0;w<n;w++)if(y=o[w],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{n=w=void 0;C=o.length;for(w=0;w<C;w++)if(n=o[w],
-n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(u*3);if(y)j.__normalArray=new Float32Array(u*3);if(v.hasTangents)j.__tangentArray=new Float32Array(u*4);if(n)j.__colorArray=new Float32Array(u*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(u*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(u*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(u*4),
-j.__skinVertexBArray=new Float32Array(u*4),j.__skinIndexArray=new Float32Array(u*4),j.__skinWeightArray=new Float32Array(u*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(w=j.numMorphTargets;v<w;v++)j.__morphTargetsArrays.push(new Float32Array(u*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=y;j.__webglFaceCount=
-x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;v=0;for(w=o.length;v<w;v++)if(p=o[v],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];y={};for(D in n)y[D]=n[D];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,x=1,y.type==="v2"?x=2:y.type==="v3"?x=3:y.type==="v4"?x=4:y.type==="c"&&(x=3),y.size=x,y.array=new Float32Array(u*x),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=
-a,n.needsUpdate=!0,y.__original=n;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?S(c.__webglShadowVolumes,h,e):S(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)S(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),
-f.__webglColorBuffer=k.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;S(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.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;S(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;h=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=h.materials;D=u=m=void 0;m=0;for(u=h.materials.length;m<u;m++)if(D=h.materials[m],D.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
-{};for(a in D.attributes){originalAttribute=D.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
-a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}S(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
-THREE.ShadowVolume)I(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)I(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?I(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&I(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)E(b.__webglObjects[e].object,
-b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)E(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)E(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
+0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,C){var B,E,G,F,X,ia,H,J,K=b.lights,M=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(oa);c.projectionMatrix.flattenToArray(la);na.multiply(c.projectionMatrix,
+c.matrixWorldInverse);n(na);this.initWebGLObjects(b);U(o);(this.autoClear||C)&&this.clear();X=b.__webglObjects.length;for(C=0;C<X;C++)if(B=b.__webglObjects[C],H=B.object,H.visible)if(!(H instanceof THREE.Mesh)||p(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),u(B),B.render=!0,this.sortObjects)B.object.renderDepth?B.z=B.object.renderDepth:(wa.copy(H.position),na.multiplyVector3(wa),B.z=wa.z)}else B.render=!1;else B.render=!1;this.sortObjects&&b.__webglObjects.sort(v);ia=b.__webglObjectsImmediate.length;
+for(C=0;C<ia;C++)B=b.__webglObjectsImmediate[C],H=B.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),t(B));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(C=0;C<X;C++)if(B=b.__webglObjects[C],B.render)H=B.object,J=B.buffer,h(H),f(c,K,M,b.overrideMaterial,J,H);for(C=0;C<ia;C++)B=b.__webglObjectsImmediate[C],H=B.object,H.visible&&(h(H),E=e(c,K,M,b.overrideMaterial,H),H.render(function(e){g(e,E,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);
+for(C=0;C<X;C++)if(B=b.__webglObjects[C],B.render){H=B.object;J=B.buffer;G=B.opaque;h(H);for(B=0;B<G.count;B++)F=G.list[B],j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,M,F,J,H)}for(C=0;C<ia;C++)if(B=b.__webglObjectsImmediate[C],H=B.object,H.visible){G=B.opaque;h(H);for(B=0;B<G.count;B++)F=G.list[B],j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),E=e(c,K,M,F,H),H.render(function(b){g(b,E,F.shading)})}for(C=0;C<X;C++)if(B=b.__webglObjects[C],
+B.render){H=B.object;J=B.buffer;G=B.transparent;h(H);for(B=0;B<G.count;B++)F=G.list[B],I(F.blending),j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,M,F,J,H)}for(C=0;C<ia;C++)if(B=b.__webglObjectsImmediate[C],H=B.object,H.visible){G=B.transparent;h(H);for(B=0;B<G.count;B++)F=G.list[B],I(F.blending),j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),E=e(c,K,M,F,H),H.render(function(b){g(b,E,F.shading)})}}b.__webglSprites.length&&z(b,c);ya&&
+b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.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 e=b.__objectsAdded[0],
+c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&B(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();
+j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,t=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(t=j.numMorphTargets;m<
+t;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=h,m=e,o=void 0,p=void 0,n=void 0,u=n=void 0,v=void 0,w=void 0,y=w=t=0,x=n=p=void 0,z=x=p=o=void 0,n=void 0,u=m.geometry,v=u.faces,x=j.faces,o=0,p=x.length;o<p;o++)n=x[o],n=v[n],n instanceof THREE.Face3?(t+=3,w+=1,y+=3):n instanceof THREE.Face4&&(t+=4,w+=2,y+=4);for(var o=j,p=m,C=x=v=void 0,F=void 0,C=void 0,n=[],v=0,x=p.materials.length;v<x;v++)if(C=p.materials[v],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<
+l;C++)(F=o.materials[C])&&n.push(F)}else(F=C)&&n.push(F);o=n;j.__materials=o;a:{v=p=void 0;x=o.length;for(p=0;p<x;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{x=v=void 0;n=o.length;for(v=0;v<n;v++)if(x=o[v],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{n=v=void 0;C=o.length;for(v=0;v<C;v++)if(n=o[v],
+n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(t*3);if(x)j.__normalArray=new Float32Array(t*3);if(u.hasTangents)j.__tangentArray=new Float32Array(t*4);if(n)j.__colorArray=new Float32Array(t*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(t*4),
+j.__skinVertexBArray=new Float32Array(t*4),j.__skinIndexArray=new Float32Array(t*4),j.__skinWeightArray=new Float32Array(t*4);j.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u<v;u++)j.__morphTargetsArrays.push(new Float32Array(t*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=x;j.__webglFaceCount=
+w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];x={};for(z in n)x[z]=n[z];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,w=1,x.type==="v2"?w=2:x.type==="v3"?w=3:x.type==="v4"?w=4:x.type==="c"&&(w=3),x.size=w,x.array=new Float32Array(t*w),x.buffer=k.createBuffer(),x.buffer.belongsToAttribute=
+a,n.needsUpdate=!0,x.__original=n;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?P(c.__webglShadowVolumes,h,e):P(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)P(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),
+f.__webglColorBuffer=k.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;P(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.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;P(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;h=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=h.materials;z=t=m=void 0;m=0;for(t=h.materials.length;m<t;m++)if(z=h.materials[m],z.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
+{};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}P(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
+THREE.ShadowVolume)G(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)G(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?G(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&G(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)E(b.__webglObjects[e].object,
+b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)E(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)E(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ba}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.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};
@@ -343,8 +343,8 @@ 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,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),j=Math.min(Math.min(e,f),g);if(j==h)j=e=0;else{var m=h-j,j=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=h;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,j=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=j.length;o<u;o++){var v=new THREE.Vertex(j[o].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}o=0;for(u=n.length;o<u;o++){var j=n[o],w,x,y=j.vertexNormals,v=j.vertexColors;j instanceof THREE.Face3?w=new THREE.Face3(j.a+f,j.b+f,j.c+
-f):j instanceof THREE.Face4&&(w=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));w.normal.copy(j.normal);e=0;for(h=y.length;e<h;e++)x=y[e],w.vertexNormals.push(x.clone());w.color.copy(j.color);e=0;for(h=v.length;e<h;e++)x=v[e],w.vertexColors.push(x.clone());w.materials=j.materials.slice();w.centroid.copy(j.centroid);m.push(w)}o=0;for(u=g.length;o<u;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,j=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=j.length;o<t;o++){var u=new THREE.Vertex(j[o].position.clone());e&&c.matrix.multiplyVector3(u.position);h.push(u)}o=0;for(t=n.length;o<t;o++){var j=n[o],v,w,z=j.vertexNormals,u=j.vertexColors;j instanceof THREE.Face3?v=new THREE.Face3(j.a+f,j.b+f,j.c+
+f):j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);e=0;for(h=z.length;e<h;e++)w=z[e],v.vertexNormals.push(w.clone());v.color.copy(j.color);e=0;for(h=u.length;e<h;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=j.materials.slice();v.centroid.copy(j.centroid);m.push(v)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return h}};
 THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -366,11 +366,11 @@ THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,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"],e,f,g,h,j,m,n,p,o=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,x=this.hierarchy.length;w<x;w++)if(b=this.hierarchy[w],n=b.animationCache,this.JITCompile&&o[w][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=o[w][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++){e=c[y];j=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(u<v)if(this.loop){j=this.data.hierarchy[w].keys[0];for(m=this.getNextKeyWith(e,w,1);m.time<u;)j=m,m=this.getNextKeyWith(e,w,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,w,m.index+1);while(m.time<
-u)}n.prevKey[e]=j;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(m.time-j.time);g=j[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",w,j.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)o[w][p]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,j,m,n,p,o=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=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 v=0,w=this.hierarchy.length;v<w;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&o[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=o[v][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 z=0;z<3;z++){e=c[z];j=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){j=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)j=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
+t)}n.prevKey[e]=j;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-j.time)/(m.time-j.time);g=j[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",v,j.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,j,m,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;j=g*e;f[0]=this.interpolate(h[0],m[0],n[0],p[0],g,e,j);f[1]=this.interpolate(h[1],m[1],n[1],p[1],g,e,j);f[2]=this.interpolate(h[2],m[2],n[2],p[2],g,e,j);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
@@ -384,7 +384,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
 !1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
 THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,j=e.getControlPointsArray(),m=e.getLength(),n=j.length,H=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)H=f*m.chunks[h]/m.total,e.keys[h]={time:H,pos:j[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,j=e.getControlPointsArray(),m=e.getLength(),n=j.length,F=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)F=f*m.chunks[h]/m.total,e.keys[h]={time:F,pos:j[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
 f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
 16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
@@ -404,13 +404,13 @@ 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,e,f){THREE.Camera.call(this,b,c,e,f);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 g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,u=0,v=0,w=0,x=0,y=window.innerWidth/2,D=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*w),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*u);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);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 g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,u=0,v=0,w=0,z=window.innerWidth/2,x=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*v),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*u);n&&(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);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 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){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){w=(b.clientX-y)/window.innerWidth;x=(b.clientY-D)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:u=-1;break;
-case 40:case 83:o=-1;break;case 39:case 68:u=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:u=0;break;case 40:case 83:o=0;break;case 39:case 68:u=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(b){v=(b.clientX-z)/window.innerWidth;w=(b.clientY-x)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=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,e){return function(){e.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 e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
@@ -436,32 +436,32 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,g,h);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:j,curve:m})};
 THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
 THREE.Path.prototype.arc=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:j})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
-THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,h,j,m,n,p,o,u,v,w,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],h=g.action,g=g.args,h){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=g[2];m=g[3];o=g[0];u=g[1];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b2(x,v,o,j),x=THREE.FontUtils.b2(x,w,u,m),c.push(new THREE.Vector2(g,
-x));break;case THREE.PathActions.BEZIER_CURVE_TO:j=g[4];m=g[5];o=g[0];u=g[1];n=g[2];p=g[3];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b3(x,v,o,n,j),x=THREE.FontUtils.b3(x,w,u,p,m),c.push(new THREE.Vector2(g,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*g[0].length;h=h.concat(g[0]);g=new THREE.SplineCurve(h);for(h=1;h<=x;h++)c.push(g.getPointAt(h/
-x));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;j=g[0];m=g[1];n=g[2];o=g[3];x=g[4];u=!!g[5];p=h[h.length-2];v=h[h.length-1];h.length==0&&(p=v=0);w=x-o;var y=b*2;for(h=1;h<=y;h++)x=h/y,u||(x=1-x),x=o+x*w,g=p+j+n*Math.cos(x),x=v+m+n*Math.sin(x),c.push(new THREE.Vector2(g,x))}return c};
+THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,h,j,m,n,p,o,t,u,v,w;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],h=g.action,g=g.args,h){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=g[2];m=g[3];o=g[0];t=g[1];c.length>0?(h=c[c.length-1],u=h.x,v=h.y):(h=this.actions[e-1].args,u=h[h.length-2],v=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,g=THREE.FontUtils.b2(w,u,o,j),w=THREE.FontUtils.b2(w,v,t,m),c.push(new THREE.Vector2(g,
+w));break;case THREE.PathActions.BEZIER_CURVE_TO:j=g[4];m=g[5];o=g[0];t=g[1];n=g[2];p=g[3];c.length>0?(h=c[c.length-1],u=h.x,v=h.y):(h=this.actions[e-1].args,u=h[h.length-2],v=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,g=THREE.FontUtils.b3(w,u,o,n,j),w=THREE.FontUtils.b3(w,v,t,p,m),c.push(new THREE.Vector2(g,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=b*g[0].length;h=h.concat(g[0]);g=new THREE.SplineCurve(h);for(h=1;h<=w;h++)c.push(g.getPointAt(h/
+w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;j=g[0];m=g[1];n=g[2];o=g[3];w=g[4];t=!!g[5];p=h[h.length-2];u=h[h.length-1];h.length==0&&(p=u=0);v=w-o;var z=b*2;for(h=1;h<=z;h++)w=h/z,t||(w=1-w),w=o+w*v,g=p+j+n*Math.cos(w),w=u+m+n*Math.sin(w),c.push(new THREE.Vector2(g,w))}return c};
 THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,j,m;j=0;for(m=b.length;j<m;j++){h=b[j];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>e)e=h.y;else if(h.y<e)g=h.y}return{minX:f,minY:g,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
 THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};
 THREE.Path.prototype.createPathGeometry=function(b,c){var e=this.getPoints(b),f,g=new THREE.Object3D;c||(c=new THREE.LineBasicMaterial({color:0,opacity:0.7}));for(var h=1;h<e.length;h++)f=new THREE.Geometry,f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h-1].x,e[h-1].y,0))),f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h].x,e[h].y,0))),f=new THREE.Line(f,c),g.addChild(f);return g};
 THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,h,j,m,n;f=0;for(g=e.length;f<g;f++)h=e[f],j=h.x,m=h.y,n=j/c.maxX,j=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),h.x=j.x+m.x,h.y=j.y+m.y;return e};
-THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var j=this.getPoints(),m,n,p,o,u;m=0;for(n=j.length;m<n;m++)p=j[m],o=p.x,u=p.y,p.x=b*o+c*u+e,p.y=f*u+g*o+h;return j};
+THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var j=this.getPoints(),m,n,p,o,t;m=0;for(n=j.length;m<n;m++)p=j[m],o=p.x,t=p.y,p.x=b*o+c*t+e,p.y=f*t+g*o+h;return j};
 THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
 -0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
 THREE.Shape.prototype.getHoles=function(b){var b=b?"getSpacedPoints":"getPoints",c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c][b]();return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this[b?"getSpacedPoints":"getPoints"](),holes:this.getHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,h,j,m,n,p,o,u,v,w,x=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);h=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){v=p[g];w=[];for(u=0;u<e.length;u++)o=e[u],o=v.distanceTo(o),w.push(o),o<h&&(h=o,j=g,m=u)}g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;var y=[p[j],e[m],e[g]];u=THREE.FontUtils.Triangulate.area(y);var D=[p[j],p[h],e[m]];v=THREE.FontUtils.Triangulate.area(D);w=m;o=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
-j<0&&(j+=p.length);j%=p.length;g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;y=[p[j],e[m],e[g]];y=THREE.FontUtils.Triangulate.area(y);D=[p[j],p[h],e[m]];D=THREE.FontUtils.Triangulate.area(D);u+v>y+D&&(m=w,j=o,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,g=m-1>=0?m-1:e.length-1,h=j-1>=0?j-1:p.length-1);u=e.slice(0,m);v=e.slice(m);w=p.slice(j);o=p.slice(0,j);h=[p[j],p[h],e[m]];x.push([p[j],e[m],e[g]]);x.push(h);e=u.concat(w).concat(o).concat(v)}return{shape:e,isolatedPts:x,allpoints:f}},
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,h,j,m,n,p,o,t,u,v,w=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);h=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){u=p[g];v=[];for(t=0;t<e.length;t++)o=e[t],o=u.distanceTo(o),v.push(o),o<h&&(h=o,j=g,m=t)}g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;var z=[p[j],e[m],e[g]];t=THREE.FontUtils.Triangulate.area(z);var x=[p[j],p[h],e[m]];u=THREE.FontUtils.Triangulate.area(x);v=m;o=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
+j<0&&(j+=p.length);j%=p.length;g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;z=[p[j],e[m],e[g]];z=THREE.FontUtils.Triangulate.area(z);x=[p[j],p[h],e[m]];x=THREE.FontUtils.Triangulate.area(x);t+u>z+x&&(m=v,j=o,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,g=m-1>=0?m-1:e.length-1,h=j-1>=0?j-1:p.length-1);t=e.slice(0,m);u=e.slice(m);v=p.slice(j);o=p.slice(0,j);h=[p[j],p[h],e[m]];w.push([p[j],e[m],e[g]]);w.push(h);e=t.concat(v).concat(o).concat(u)}return{shape:e,isolatedPts:w,allpoints:f}},
 triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h,j,m,n;for(h=0;h<e.length;h++){n=e[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}for(h=0;h<g.length;h++){n=g[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
-THREE.CubeGeometry=function(b,c,e,f,g,h,j,m,n){function p(b,e,c,j,m,n,p,u){var v,w,x=f||1,y=g||1,K=m/2,X=n/2,Q=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",y=h||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",x=h||1;var U=x+1,k=y+1;m/=x;var ia=n/y;for(w=0;w<k;w++)for(n=0;n<U;n++){var L=new THREE.Vector3;L[b]=(n*m-K)*c;L[e]=(w*ia-X)*j;L[v]=p;o.vertices.push(new THREE.Vertex(L))}for(w=0;w<y;w++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+U*
-w+Q,n+U*(w+1)+Q,n+1+U*(w+1)+Q,n+1+U*w+Q,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var o=this,u=b/2,v=c/2,w=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var y in n)this.sides[y]!=void 0&&(this.sides[y]=
-n[y]);this.sides.px&&p("z","y",1*m,-1,e,c,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,u,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
+THREE.CubeGeometry=function(b,c,e,f,g,h,j,m,n){function p(b,e,c,j,m,n,p,t){var u,v,w=f||1,z=g||1,J=m/2,Y=n/2,K=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")u="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")u="y",z=h||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")u="x",w=h||1;var S=w+1,k=z+1;m/=w;var V=n/z;for(v=0;v<k;v++)for(n=0;n<S;n++){var O=new THREE.Vector3;O[b]=(n*m-J)*c;O[e]=(v*V-Y)*j;O[u]=p;o.vertices.push(new THREE.Vertex(O))}for(v=0;v<z;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+S*v+
+K,n+S*(v+1)+K,n+1+S*(v+1)+K,n+1+S*v+K,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/z),new THREE.UV(n/w,(v+1)/z),new THREE.UV((n+1)/w,(v+1)/z),new THREE.UV((n+1)/w,v/z)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var z in n)this.sides[z]!=void 0&&(this.sides[z]=
+n[z]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
 h.position.y==n.position.y&&h.position.z==n.position.z){e[c]=j;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=o.faces.length;c<f;c++)h=o.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,g,h){function j(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)j(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)j(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){j(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){j(0,0,o+
-(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/p,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){vectorFromCentroid=b.clone().subSelf(e);adj=c/vectorFromCentroid.length();f?adj+=1:adj=1-adj;return vectorFromCentroid.multiplyScalar(adj).addSelf(e)}function f(b){for(F=b.length;--F>=0;){Q=F;U=F-1;U<0&&(U=b.length-1);for(var e=0;e<u+o*2;e++){var c=K*e,f=K*(e+1);H.faces.push(new THREE.Face4(k+Q+c,k+U+c,k+U+f,k+Q+f))}}}function g(b,e,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){H.faces.push(new THREE.Face3(b,
-e,c))}var j=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var u=c.steps!==void 0?c.steps:1,v=c.path!==void 0?c.path:null,w,x=!1;if(v)w=v.getPoints(),u=w.length,x=!0;THREE.Geometry.call(this);var y,D,A,H=this,v=b.extractAllPoints(!1),C=v.shape,v=v.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();D=0;for(A=v.length;D<A;D++)y=
-v[D],THREE.Shape.Utils.isClockWise(y)&&(v[D]=y.reverse());E=!1}var E=THREE.Shape.Utils.triangulateShape(C,v),I=C;D=0;for(A=v.length;D<A;D++)y=v[D],C=C.concat(y);var J,S=new THREE.Vector2,R,N,F=0;for(il=I.length;F<il;F++)S.addSelf(I[F]);R=S.divideScalar(I.length);N=[];D=0;for(A=v.length;D<A;D++){S=new THREE.Vector2;y=v[D];F=0;for(il=y.length;F<il;F++)S.addSelf(y[F]);N[D]=S.divideScalar(y.length)}var F,W,K=C.length,S=E.length,X;for(J=o;J>0;J--){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=
-I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,-z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],X,!0),g(W.x,W.y,-z)}}for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[0].y,w[0].x):g(W.x,W.y,0);for(y=1;y<=u;y++)for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[y-1].y,w[y-1].x):g(W.x,W.y,j/u*y);for(J=1;J<=o;J++){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,j+z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],
-X,!0),x?g(W.x,W.y+w[u-1].y,w[u-1].x+z):g(W.x,W.y,j+z)}}if(p){m=K*0;for(F=0;F<S;F++)j=E[F],h(j[2]+m,j[1]+m,j[0]+m);m=K*(u+o*2);for(F=0;F<S;F++)j=E[F],h(j[0]+m,j[1]+m,j[2]+m)}else{for(F=0;F<S;F++)j=E[F],h(j[2],j[1],j[0]);for(F=0;F<S;F++)j=E[F],h(j[0]+K*u,j[1]+K*u,j[2]+K*u)}var Q,U,k=0;f(I);k+=I.length;D=0;for(A=v.length;D<A;D++)y=v[D],f(y),k+=y.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){b=b.clone().subSelf(e);c/=b.length();return b.multiplyScalar(f?1+c:1-c).addSelf(e)}function f(b){for(B=b.length;--B>=0;){k=B;V=B-1;V<0&&(V=b.length-1);for(var e=0,e=0;e<t+o*2;e++){var c=S*e,f=S*(e+1);F.faces.push(new THREE.Face4(O+k+c,O+V+c,O+V+f,O+k+f))}}}function g(b,e,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){F.faces.push(new THREE.Face3(b,e,c))}var j=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==
+void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var t=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,v,w=!1;if(u)v=u.getPoints(),t=v.length,w=!0;THREE.Geometry.call(this);var z,x,y,F=this,u=b.extractAllPoints(!1),C=u.shape,u=u.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();x=0;for(y=u.length;x<y;x++)z=u[x],THREE.Shape.Utils.isClockWise(z)&&(u[x]=z.reverse());E=
+!1}var E=THREE.Shape.Utils.triangulateShape(C,u),G=C;x=0;for(y=u.length;x<y;x++)z=u[x],C=C.concat(z);var B,P,I=new THREE.Vector2;B=0;for(P=G.length;B<P;B++)I.addSelf(G[B]);var H=I.divideScalar(G.length),T=[];x=0;for(y=u.length;x<y;x++){I=new THREE.Vector2;z=u[x];B=0;for(P=z.length;B<P;B++)I.addSelf(z[B]);T[x]=I.divideScalar(z.length)}var U,J,Y,K,S=C.length,I=E.length;for(U=o;U>0;U--){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,-Y);x=0;for(y=
+u.length;x<y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),g(K.x,K.y,-Y)}}for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[0].y,v[0].x):g(K.x,K.y,0);for(z=1;z<=t;z++)for(B=0;B<S;B++)K=C[B],w?g(K.x,K.y+v[z-1].y,v[z-1].x):g(K.x,K.y,j/t*z);for(U=1;U<=o;U++){z=U/o;Y=m*z;J=n*(1-Math.sin((1-z)*Math.PI/2));B=0;for(P=G.length;B<P;B++)K=e(G[B],H,J,!1),g(K.x,K.y,j+Y);x=0;for(y=u.length;x<y;x++){z=u[x];B=0;for(P=z.length;B<P;B++)K=e(z[B],T[x],J,!0),w?g(K.x,K.y+v[t-1].y,v[t-1].x+Y):g(K.x,K.y,j+Y)}}if(p){m=S*
+0;for(B=0;B<I;B++)j=E[B],h(j[2]+m,j[1]+m,j[0]+m);m=S*(t+o*2);for(B=0;B<I;B++)j=E[B],h(j[0]+m,j[1]+m,j[2]+m)}else{for(B=0;B<I;B++)j=E[B],h(j[2],j[1],j[0]);for(B=0;B<I;B++)j=E[B],h(j[0]+S*t,j[1]+S*t,j[2]+S*t)}var k,V,O=0;f(G);O+=G.length;x=0;for(y=u.length;x<y;x++)z=u[x],f(z),O+=z.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=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);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,j);e(h.faces[m].b,p,n,j);
 e(h.faces[m].c,o,p,j);e(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
@@ -469,27 +469,27 @@ THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;t
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,v=n*Math.sin(u*g),u=n*Math.cos(u*g);(e==0||e==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,v)))-1);p.push(o)}c.push(p)}for(var w,x,y,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;j=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
-h-1:f];p=c[e-1][p?0:f+1];v=e/(g-1);w=(e-1)/(g-1);x=(f+1)/h;var u=f/h,o=new THREE.UV(1-x,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,w),D=new THREE.UV(1-x,w);e<c.length-1&&(w=this.vertices[j].position.clone(),x=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,v,u]));e>1&&(w=
-this.vertices[j].position.clone(),x=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,u,D]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var t=2*f/h,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(o)}c.push(p)}for(var v,w,z,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;j=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
+h-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/h;var t=f/h,o=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),x=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[j].position.clone(),w=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),v.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
+this.vertices[j].position.clone(),w=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,x]))}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 e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,u=c.bezelEnabled!==
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,v=m.faces,j=m.contour,w=m.bezel,x=this;x.vertices=[];x.faces=[];for(var y,n=h.length,D=v.length,o=w.length,m=0;m<n;m++)y=h[m],e(y.x,y.y,0);for(m=0;m<n;m++)y=h[m],e(y.x,y.y,g);if(u){for(m=0;m<o;m++)y=w[m],e(y.x,y.y,p);for(m=0;m<o;m++)y=w[m],e(y.x,y.y,g-p)}for(m=
-0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var A;if(u)for(m=w.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];p=n*2+m;v=p-1;f(p,v,v+o,p+o);for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,v,p);f(p+o,v+o,g+n,u+n)}else for(m=j.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=
-0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,g+n,u+n)}this.computeCentroids();this.computeFaceNormals()};
+THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){w.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=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=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,u=m.faces,j=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var z,n=h.length,x=u.length,o=v.length,m=0;m<n;m++)z=h[m],e(z.x,z.y,0);for(m=0;m<n;m++)z=h[m],e(z.x,z.y,g);if(t){for(m=0;m<o;m++)z=v[m],e(z.x,z.y,p);for(m=0;m<o;m++)z=v[m],e(z.x,z.y,g-p)}for(m=
+0;m<x;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<x;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(j[m])){y=null;continue}}else y=j[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(h[t].equals(j[m]))break;for(g=0;g<n;g++)if(h[g].equals(j[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=j.length;--m>0;){if(y){if(y.equals(j[m])){y=null;continue}}else y=j[m];for(t=0;t<n;t++)if(h[t].equals(j[m]))break;for(g=
+0;g<n;g++)if(h[g].equals(j[m-1]))break;f(t,g,g+n,t+n)}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:[]};for(var e,f,g,h,j,m=[],n=0;n<c.length;n++){j=c[n];h=[];for(e=0;e<j.length;e++)f=j[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(j.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var u=j.slice(p,e+1);o?this.Triangulate.area(u)<0?(p>0&&m.push({shape:g,holes:f}),g=u,f=[]):f.push(u):this.Triangulate.area(u)<0?(m.push({shape:u,holes:f}),f=[]):f.push(u);e++}o&&m.push({shape:g,holes:f})}var v,w,x,
-y,D,A;h=[];for(j=0;j<m.length;j++){n=m[j];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(u=0;u<o.length;u++){D=o[u];for(e=0;e<g.length;e++)y=g[e],y=D.distanceTo(y),y<x&&(x=y,v=u,w=e)}e=w-1>=0?w-1:g.length-1;var u=v-1>=0?v-1:o.length-1,H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);x=this.Triangulate.area(H);var C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);D=this.Triangulate.area(C);y=w;A=v;w+=1;v+=-1;w<0&&(w+=g.length);w%=g.length;v<0&&(v+=o.length);v%=g.length;e=w-
-1>=0?w-1:g.length-1;u=v-1>=0?v-1:o.length-1;H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);H=this.Triangulate.area(H);C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);C=this.Triangulate.area(C);x+D>H+C&&(w=y,v=A,w<0&&(w+=g.length),w%=g.length,v<0&&(v+=o.length),v%=g.length,e=w-1>=0?w-1:g.length-1,u=v-1>=0?v-1:o.length-1);x=g.slice(0,w);D=g.slice(w);y=o.slice(v);A=o.slice(0,v);h.push(o[v]);h.push(g[w]);h.push(g[e]);h.push(o[v]);h.push(o[u]);h.push(g[w]);g=x.concat(y).concat(A).concat(D)}n.shape=g}v=[];w=[];
-for(j=p=0;j<m.length;j++){n=m[j];g=n.shape;v=v.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;w=w.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){j=!1;for(g=0;g<v.length&&!j;g++)E=f*3+m,v[g].equals(h[E])&&(n.push(g),j=!0);j||(v.push(h[E]),n.push(v.length-1),console.log("not found"))}w.push(n)}return{points:v,faces:w}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,j=0;f=String(b).split("");
+{points:b,faces:[]};for(var e,f,g,h,j,m=[],n=0;n<c.length;n++){j=c[n];h=[];for(e=0;e<j.length;e++)f=j[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(j.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=j.slice(p,e+1);o?this.Triangulate.area(t)<0?(p>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}o&&m.push({shape:g,holes:f})}var u,v,w,
+z,x,y;h=[];for(j=0;j<m.length;j++){n=m[j];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];w=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){x=o[t];for(e=0;e<g.length;e++)z=g[e],z=x.distanceTo(z),z<w&&(w=z,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:o.length-1,F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);w=this.Triangulate.area(F);var C=[];C.push(o[u]);C.push(o[t]);C.push(g[v]);x=this.Triangulate.area(C);z=v;y=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=o.length);u%=g.length;e=v-
+1>=0?v-1:g.length-1;t=u-1>=0?u-1:o.length-1;F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);F=this.Triangulate.area(F);C=[];C.push(o[u]);C.push(o[t]);C.push(g[v]);C=this.Triangulate.area(C);w+x>F+C&&(v=z,u=y,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=o.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:o.length-1);w=g.slice(0,v);x=g.slice(v);z=o.slice(u);y=o.slice(0,u);h.push(o[u]);h.push(g[v]);h.push(g[e]);h.push(o[u]);h.push(o[t]);h.push(g[v]);g=w.concat(z).concat(y).concat(x)}n.shape=g}u=[];v=[];
+for(j=p=0;j<m.length;j++){n=m[j];g=n.shape;u=u.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;v=v.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){j=!1;for(g=0;g<u.length&&!j;g++)E=f*3+m,u[g].equals(h[E])&&(n.push(g),j=!0);j||(u.push(h[E]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,j=0;f=String(b).split("");
 for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,h,j,n);j+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=j/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var j=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;j.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
 0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),j[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*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,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],j,m,n,p,o,u,v,w,x,y,D=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(D){if(D.o){c=D._cachedOutline||(D._cachedOutline=D.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
-p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;w=c[b++]*e;g.quadraticCurveTo(v,w,m,p);if(j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var A=j/divisions,H=THREE.FontUtils.b2(A,o,v,m),A=THREE.FontUtils.b2(A,u,w,p);h.push(new THREE.Vector2(H,A))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,w=c[b++]*-e,x=c[b++]*e+f,y=c[b++]*-e,g.bezierCurveTo(m,p,v,w,x,y),j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)A=
-j/divisions,H=THREE.FontUtils.b3(A,o,v,x,m),A=THREE.FontUtils.b3(A,u,w,y,p),h.push(new THREE.Vector2(H,A))}}}return{offset:D.ha*e,points:h,path:g}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,j=0;j<c;h=j++)g+=b[h].x*b[j].y-b[j].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],j=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)j[p]=p;else for(p=0;p<g;p++)j[p]=g-1-p;var u=2*g;for(p=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var v;a:{v=b;var w=n,x=p,y=o,D=g,A=j,H=void 0,C=void 0,E=void 0,
-I=void 0,J=void 0,S=void 0,R=void 0,N=void 0,F=void 0,C=v[A[w]].x,E=v[A[w]].y,I=v[A[x]].x,J=v[A[x]].y,S=v[A[y]].x,R=v[A[y]].y;if(1.0E-10>(I-C)*(R-E)-(J-E)*(S-C))v=!1;else{for(H=0;H<D;H++)if(!(H==w||H==x||H==y)){var N=v[A[H]].x,F=v[A[H]].y,W=void 0,K=void 0,X=void 0,Q=void 0,U=void 0,k=void 0,ia=void 0,L=void 0,ga=void 0,fa=void 0,$=void 0,ha=void 0,W=X=U=void 0,W=S-I,K=R-J,X=C-S,Q=E-R,U=I-C,k=J-E,ia=N-C,L=F-E,ga=N-I,fa=F-J,$=N-S,ha=F-R,W=W*fa-K*ga,U=U*L-k*ia,X=X*ha-Q*$;if(W>=0&&X>=0&&U>=0){v=!1;break a}}v=
-!0}}if(v){h.push([b[j[n]],b[j[p]],b[j[o]]]);m.push([j[n],j[p],j[o]]);n=p;for(o=p+1;o<g;n++,o++)j[n]=j[o];g--;u=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],j,m,n,p,o,t,u,v,w,z,x=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
+p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;g.quadraticCurveTo(u,v,m,p);if(j=h[h.length-1]){o=j.x;t=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var y=j/divisions,F=THREE.FontUtils.b2(y,o,u,m),y=THREE.FontUtils.b2(y,t,v,p);h.push(new THREE.Vector2(F,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,w=c[b++]*e+f,z=c[b++]*-e,g.bezierCurveTo(m,p,u,v,w,z),j=h[h.length-1]){o=j.x;t=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)y=
+j/divisions,F=THREE.FontUtils.b3(y,o,u,w,m),y=THREE.FontUtils.b3(y,t,v,z,p),h.push(new THREE.Vector2(F,y))}}}return{offset:x.ha*e,points:h,path:g}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,j=0;j<c;h=j++)g+=b[h].x*b[j].y-b[j].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],j=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)j[p]=p;else for(p=0;p<g;p++)j[p]=g-1-p;var t=2*g;for(p=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var u;a:{u=b;var v=n,w=p,z=o,x=g,y=j,F=void 0,C=void 0,E=void 0,
+G=void 0,B=void 0,P=void 0,I=void 0,H=void 0,T=void 0,C=u[y[v]].x,E=u[y[v]].y,G=u[y[w]].x,B=u[y[w]].y,P=u[y[z]].x,I=u[y[z]].y;if(1.0E-10>(G-C)*(I-E)-(B-E)*(P-C))u=!1;else{for(F=0;F<x;F++)if(!(F==v||F==w||F==z)){var H=u[y[F]].x,T=u[y[F]].y,U=void 0,J=void 0,Y=void 0,K=void 0,S=void 0,k=void 0,V=void 0,O=void 0,fa=void 0,ea=void 0,W=void 0,da=void 0,U=Y=S=void 0,U=P-G,J=I-B,Y=C-P,K=E-I,S=G-C,k=B-E,V=H-C,O=T-E,fa=H-G,ea=T-B,W=H-P,da=T-I,U=U*ea-J*fa,S=S*O-k*V,Y=Y*da-K*W;if(U>=0&&Y>=0&&S>=0){u=!1;break a}}u=
+!0}}if(u){h.push([b[j[n]],b[j[p]],b[j[o]]]);m.push([j[n],j[p],j[o]]);n=p;for(o=p+1;o<g;n++,o++)j[n]=j[o];g--;t=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,j=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][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;
@@ -503,59 +503,59 @@ new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow
 1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var j,m,n;m="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.colorDiffuse)j.color=h(b.colorDiffuse);
 else if(b.DbgColor)j.color=b.DbgColor;if(b.colorSpecular)j.specular=h(b.colorSpecular);if(b.colorAmbient)j.ambient=h(b.colorAmbient);if(b.transparency)j.opacity=b.transparency;if(b.specularCoef)j.shininess=b.specularCoef;b.mapDiffuse&&c&&g(j,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(j,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(j,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&g(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),u=j.color;m=j.specular;n=j.ambient;var v=j.shininess;o.tNormal.texture=j.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(j.map)o.tDiffuse.texture=j.map,o.enableDiffuse.value=!0;if(j.specularMap)o.tSpecular.texture=j.specularMap,o.enableSpecular.value=!0;if(j.lightMap)o.tAO.texture=
-j.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(u);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(j.opacity)o.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else j=new THREE[m](j);return j}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+b.mapSpecular&&c&&g(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=j.color;m=j.specular;n=j.ambient;var u=j.shininess;o.tNormal.texture=j.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(j.map)o.tDiffuse.texture=j.map,o.enableDiffuse.value=!0;if(j.specularMap)o.tSpecular.texture=j.specularMap,o.enableSpecular.value=!0;if(j.lightMap)o.tAO.texture=
+j.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=u;if(j.opacity)o.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else j=new THREE[m](j);return j}};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,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,u,v,w,x,y,D,A,H,C,E=b.faces;u=b.vertices;var I=b.normals,J=b.colors,S=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&S++;for(c=0;c<S;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=u.length;p<o;)v=new THREE.Vertex,v.position.x=u[p++]*e,v.position.y=
-u[p++]*e,v.position.z=u[p++]*e,f.vertices.push(v);p=0;for(o=E.length;p<o;){e=E[p++];u=e&1;n=e&2;c=e&4;g=e&8;w=e&16;v=e&32;y=e&64;e&=128;u?(D=new THREE.Face4,D.a=E[p++],D.b=E[p++],D.c=E[p++],D.d=E[p++],u=4):(D=new THREE.Face3,D.a=E[p++],D.b=E[p++],D.c=E[p++],u=3);if(n)n=E[p++],D.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<S;c++)A=b.uvs[c],x=E[p++],C=A[x*2],x=A[x*2+1],f.faceUvs[c][n]=new THREE.UV(C,x);if(g)for(c=0;c<S;c++){A=b.uvs[c];H=[];for(g=0;g<u;g++)x=E[p++],C=A[x*2],x=A[x*2+1],H[g]=
-new THREE.UV(C,x);f.faceVertexUvs[c][n]=H}if(w)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.normal=g;if(v)for(c=0;c<u;c++)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.vertexNormals.push(g);if(y)v=E[p++],v=new THREE.Color(J[v]),D.color=v;if(e)for(c=0;c<u;c++)v=E[p++],v=new THREE.Color(J[v]),D.vertexColors.push(v);f.faces.push(D)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,u,v,w,x;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*c,u=x[n+1]*
-c,v=x[n+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(o,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)u=new THREE.Color(16755200),u.setRGB(o[c],o[c+1],o[c+2]),p.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,t,u,v,w,z,x,y,F,C,E=b.faces;t=b.vertices;var G=b.normals,B=b.colors,P=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&P++;for(c=0;c<P;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=t.length;p<o;)u=new THREE.Vertex,u.position.x=t[p++]*e,u.position.y=
+t[p++]*e,u.position.z=t[p++]*e,f.vertices.push(u);p=0;for(o=E.length;p<o;){e=E[p++];t=e&1;n=e&2;c=e&4;g=e&8;v=e&16;u=e&32;z=e&64;e&=128;t?(x=new THREE.Face4,x.a=E[p++],x.b=E[p++],x.c=E[p++],x.d=E[p++],t=4):(x=new THREE.Face3,x.a=E[p++],x.b=E[p++],x.c=E[p++],t=3);if(n)n=E[p++],x.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<P;c++)y=b.uvs[c],w=E[p++],C=y[w*2],w=y[w*2+1],f.faceUvs[c][n]=new THREE.UV(C,w);if(g)for(c=0;c<P;c++){y=b.uvs[c];F=[];for(g=0;g<t;g++)w=E[p++],C=y[w*2],w=y[w*2+1],F[g]=
+new THREE.UV(C,w);f.faceVertexUvs[c][n]=F}if(v)v=E[p++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],x.normal=g;if(u)for(c=0;c<t;c++)v=E[p++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],x.vertexNormals.push(g);if(z)u=E[p++],u=new THREE.Color(B[u]),x.color=u;if(e)for(c=0;c<t;c++)u=E[p++],u=new THREE.Color(B[u]),x.vertexColors.push(u);f.faces.push(x)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(p=w.length;n<p;n+=3)o=w[n]*c,t=w[n+1]*
+c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};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,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var j=new XMLHttpRequest,m=f+"/"+b,n=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?h&&(n==0&&(n=j.getResponseHeader("Content-Length")),h({total:n,loaded:j.responseText.length})):j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
-c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+J);h=g(b,c+S);c=n(b,c+R);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+J);h=g(b,c+S);j=n(b,c+R);k=g(b,c+N);o=g(b,c+F);c=g(b,c+W);THREE.BinaryLoader.prototype.f3n(A,E,e,f,h,j,k,o,c)}function w(c){var e,f,h,j;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);c=n(b,c+U);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,u,v;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);o=n(b,
-c+U);p=g(b,c+k);u=g(b,c+ia);v=g(b,c+L);c=g(b,c+ga);THREE.BinaryLoader.prototype.f4n(A,E,e,f,h,j,o,p,u,v,c)}function y(c){var e,f;e=g(b,c);f=g(b,c+fa);c=g(b,c+$);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[c*2],I[c*2+1])}function D(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+ja);c=g(b,c+ma);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[c*2],I[c*2+1])}var A=this,H=0,C,E=[],I=[],J,S,R,N,F,W,K,X,Q,U,k,ia,L,
-ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);C={signature:b.substr(H,8),header_bytes:o(b,H+8),vertex_coordinate_bytes:o(b,H+9),normal_coordinate_bytes:o(b,H+10),uv_coordinate_bytes:o(b,H+11),vertex_index_bytes:o(b,H+12),normal_index_bytes:o(b,H+13),uv_index_bytes:o(b,H+14),material_index_bytes:o(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
-H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=C.header_bytes;J=C.vertex_index_bytes;S=C.vertex_index_bytes*2;R=C.vertex_index_bytes*3;N=C.vertex_index_bytes*3+C.material_index_bytes;F=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;W=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;K=C.vertex_index_bytes;X=C.vertex_index_bytes*2;Q=C.vertex_index_bytes*3;U=C.vertex_index_bytes*4;k=C.vertex_index_bytes*
-4+C.material_index_bytes;ia=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;L=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ga=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;fa=C.uv_index_bytes;$=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ma=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;da=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*c;T=C.ntri_smooth*(c+C.normal_index_bytes*3);ka=
-C.ntri_flat_uv*(c+C.uv_index_bytes*3);ca=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);oa=C.nquad_flat*da;c=C.nquad_smooth*(da+C.normal_index_bytes*4);da=C.nquad_flat_uv*(da+C.uv_index_bytes*4);H+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,h);return C.nvertices*k}(H);H+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,
-j=c+C.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+C.normal_coordinate_bytes),g=p(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return C.nnormals*h}(H);H+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),I.push(f,g);return C.nuvs*h}(H);ra=H+ra;T=ra+T;ka=T+ka;ca=ka+ca;oa=ca+oa;c=oa+c;da=c+da;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),y(c+e);return g-
-b})(T);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),y(c+e);return g-b})(ka);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(c=b;c<g;c+=f)w(c),D(c+e);return g-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),
-D(c+e);return g-b})(da);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(H);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ra);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ca);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
-4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(oa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
-f3n:function(b,c,e,f,g,h,j,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],u=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(u,v,n)],null,h))},f4n:function(b,c,e,f,g,h,j,m,n,p,o){var j=b.materials[j],u=c[n*3],v=c[n*3+1],n=c[n*3+2],w=c[p*3],x=c[p*3+1],p=c[p*3+2],y=c[o*3],D=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(u,
-v,n),new THREE.Vector3(w,x,p),new THREE.Vector3(y,D,o)],null,j))},uv3:function(b,c,e,f,g,h,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,j));b.push(m)},uv4:function(b,c,e,f,g,h,j,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(m,n));b.push(p)}};
+c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+B);h=g(b,c+P);c=n(b,c+I);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+B);h=g(b,c+P);j=n(b,c+I);k=g(b,c+H);o=g(b,c+T);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(y,E,e,f,h,j,k,o,c)}function v(c){var e,f,h,j;e=g(b,c);f=g(b,c+J);h=g(b,c+Y);j=g(b,c+K);c=n(b,c+S);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function w(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+J);h=g(b,c+Y);j=g(b,c+K);o=n(b,
+c+S);p=g(b,c+k);t=g(b,c+V);u=g(b,c+O);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(y,E,e,f,h,j,o,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+ea);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function x(c){var e,f,h;e=g(b,c);f=g(b,c+da);h=g(b,c+ga);c=g(b,c+ka);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var y=this,F=0,C,E=[],G=[],B,P,I,H,T,U,J,Y,K,S,k,V,O,fa,
+ea,W,da,ga,ka,pa,R,ha,$,ma,aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);C={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
+F+16+24),nquad_flat:g(b,F+16+28),nquad_smooth:g(b,F+16+32),nquad_flat_uv:g(b,F+16+36),nquad_smooth_uv:g(b,F+16+40)};F+=C.header_bytes;B=C.vertex_index_bytes;P=C.vertex_index_bytes*2;I=C.vertex_index_bytes*3;H=C.vertex_index_bytes*3+C.material_index_bytes;T=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;J=C.vertex_index_bytes;Y=C.vertex_index_bytes*2;K=C.vertex_index_bytes*3;S=C.vertex_index_bytes*4;k=C.vertex_index_bytes*
+4+C.material_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;O=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;ea=C.uv_index_bytes;W=C.uv_index_bytes*2;da=C.uv_index_bytes;ga=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes;pa=C.ntri_flat*c;R=C.ntri_smooth*(c+C.normal_index_bytes*3);ha=
+C.ntri_flat_uv*(c+C.uv_index_bytes*3);$=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ma=C.nquad_flat*aa;c=C.nquad_smooth*(aa+C.normal_index_bytes*4);aa=C.nquad_flat_uv*(aa+C.uv_index_bytes*4);F+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,h);return C.nvertices*k}(F);F+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,
+j=c+C.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+C.normal_coordinate_bytes),g=p(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return C.nnormals*h}(F);F+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),G.push(f,g);return C.nuvs*h}(F);pa=F+pa;R=pa+R;ha=R+ha;$=ha+$;ma=$+ma;c=ma+c;aa=c+aa;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),z(c+e);return g-
+b})(R);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),z(c+e);return g-b})(ha);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
+x(c+e);return g-b})(aa);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(F);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(pa);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})($);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
+f3n:function(b,c,e,f,g,h,j,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,h))},f4n:function(b,c,e,f,g,h,j,m,n,p,o){var j=b.materials[j],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],w=c[p*3+1],p=c[p*3+2],z=c[o*3],x=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
+u,n),new THREE.Vector3(v,w,p),new THREE.Vector3(z,x,o)],null,j))},uv3:function(b,c,e,f,g,h,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,j));b.push(m)},uv4:function(b,c,e,f,g,h,j,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(m,n));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 e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(w in K.objects)if(!L.objects[w])if(H=K.objects[w],H.geometry!==void 0){if(J=L.geometries[H.geometry]){var b=!1;F=[];for(fa=0;fa<H.materials.length;fa++)F[fa]=L.materials[H.materials[fa]],b=F[fa]instanceof THREE.MeshShaderMaterial;b&&J.computeTangents();C=H.position;r=
-H.rotation;q=H.quaternion;s=H.scale;q=0;F.length==0&&(F[0]=new THREE.MeshFaceMaterial);F.length>1&&(F=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(J,F);object.name=w;object.position.set(C[0],C[1],C[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=H.visible;L.scene.addObject(object);L.objects[w]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
-if(H.castsShadow)b=new THREE.ShadowVolume(J),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}}else C=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[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=H.visible!==void 0?H.visible:!1,L.scene.addObject(object),L.objects[w]=object,L.empties[w]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function n(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();o()}}function p(b){return function(c){L.geometries[b]=c}}function o(){e.callbackProgress({totalModels:k,totalTextures:ia,loadedModels:k-Q,loadedTextures:ia-U},L);e.onLoadProgress();Q==0&&U==0&&c(L)}
-var u,v,w,x,y,D,A,H,C,E,I,J,S,R,N,F,W,K,X,Q,U,k,ia,L;K=b.data;N=new THREE.BinaryLoader;X=new THREE.JSONLoader;U=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in K.objects)if(H=K.objects[w],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;E=K.transform.rotation;var ga=K.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);E&&L.scene.rotation.set(E[0],
-E[1],E[2]);ga&&L.scene.scale.set(ga[0],ga[1],ga[2]);(b||E||ga)&&L.scene.updateMatrix()}b=function(){U-=1;o();e.onLoadComplete()};for(y in K.cameras){E=K.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;S.position.set(C[0],C[1],C[2]);S.target.position.set(E[0],E[1],E[2]);L.cameras[y]=S}for(x in K.lights)y=K.lights[x],
-S=y.color!==void 0?y.color:16777215,E=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(C=y.direction,W=new THREE.DirectionalLight(S,E),W.position.set(C[0],C[1],C[2]),W.position.normalize()):y.type=="point"?(C=y.position,d=y.distance,W=new THREE.PointLight(S,E,d),W.position.set(C[0],C[1],C[2])):y.type=="ambient"&&(W=new THREE.AmbientLight(S)),L.scene.addLight(W),L.lights[x]=W;for(D in K.fogs)x=K.fogs[D],x.type=="linear"?R=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(R=new THREE.FogExp2(0,
-x.density)),E=x.color,R.color.setRGB(E[0],E[1],E[2]),L.fogs[D]=R;if(L.cameras&&K.defaults.camera)L.currentCamera=L.cameras[K.defaults.camera];if(L.fogs&&K.defaults.fog)L.scene.fog=L.fogs[K.defaults.fog];E=K.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(E[0],E[1],E[2]);L.bgColorAlpha=K.defaults.bgalpha;for(u in K.geometries)if(D=K.geometries[u],D.type=="bin_mesh"||D.type=="ascii_mesh")Q+=1,e.onLoadStart();k=Q;for(u in K.geometries)D=K.geometries[u],D.type=="cube"?(J=new THREE.CubeGeometry(D.width,
-D.height,D.depth,D.segmentsWidth,D.segmentsHeight,D.segmentsDepth,null,D.flipped,D.sides),L.geometries[u]=J):D.type=="plane"?(J=new THREE.PlaneGeometry(D.width,D.height,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="sphere"?(J=new THREE.SphereGeometry(D.radius,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="cylinder"?(J=new THREE.CylinderGeometry(D.numSegs,D.topRad,D.botRad,D.height,D.topOffset,D.botOffset),L.geometries[u]=J):D.type=="torus"?(J=new THREE.TorusGeometry(D.radius,
-D.tube,D.segmentsR,D.segmentsT),L.geometries[u]=J):D.type=="icosahedron"?(J=new THREE.IcosahedronGeometry(D.subdivisions),L.geometries[u]=J):D.type=="bin_mesh"?N.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="ascii_mesh"?X.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="embedded_mesh"&&(D=K.embeds[D.id])&&X.createModel(D,p(u),"");for(A in K.textures)if(u=K.textures[A],u.url instanceof Array){U+=u.url.length;for(N=0;N<u.url.length;N++)e.onLoadStart()}else U+=1,e.onLoadStart();
-ia=U;for(A in K.textures){u=K.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){N=[];for(var fa=0;fa<u.url.length;fa++)N[fa]=f(u.url[fa],K.urlBaseType);N=THREE.ImageUtils.loadTextureCube(N,u.mapping,b)}else{N=THREE.ImageUtils.loadTexture(f(u.url,K.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)N.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)N.magFilter=THREE[u.magFilter];if(u.repeat){N.repeat.set(u.repeat[0],
-u.repeat[1]);if(u.repeat[0]!=1)N.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)N.wrapT=THREE.RepeatWrapping}u.offset&&N.offset.set(u.offset[0],u.offset[1]);if(u.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[u.wrap[0]]!==void 0)N.wrapS=X[u.wrap[0]];if(X[u.wrap[1]]!==void 0)N.wrapT=X[u.wrap[1]]}}L.textures[A]=N}for(v in K.materials){A=K.materials[v];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=L.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=
-A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(A.parameters[I]=="face")A.parameters[I]=THREE.FaceColors;else if(A.parameters[I])A.parameters[I]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
-!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);N=A.parameters.color;X=A.parameters.specular;D=A.parameters.ambient;R=A.parameters.shininess;b.tNormal.texture=L.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
-L.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(N);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(D);b.uShininess.value=R;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);L.materials[v]=A}m();e.callbackSync(L)}}};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in J.objects)if(!O.objects[v])if(F=J.objects[v],F.geometry!==void 0){if(B=O.geometries[F.geometry]){var b=!1;T=[];for(ea=0;ea<F.materials.length;ea++)T[ea]=O.materials[F.materials[ea]],b=T[ea]instanceof THREE.MeshShaderMaterial;b&&B.computeTangents();C=F.position;r=
+F.rotation;q=F.quaternion;s=F.scale;q=0;T.length==0&&(T[0]=new THREE.MeshFaceMaterial);T.length>1&&(T=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,T);object.name=v;object.position.set(C[0],C[1],C[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=F.visible;O.scene.addObject(object);O.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),O.scene.collisions.colliders.push(b));
+if(F.castsShadow)b=new THREE.ShadowVolume(B),O.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[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=F.visible!==void 0?F.visible:!1,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}function n(b){return function(c){O.geometries[b]=c;m();K-=1;e.onLoadComplete();o()}}function p(b){return function(c){O.geometries[b]=c}}function o(){e.callbackProgress({totalModels:k,totalTextures:V,loadedModels:k-K,loadedTextures:V-S},O);e.onLoadProgress();K==0&&S==0&&c(O)}var t,
+u,v,w,z,x,y,F,C,E,G,B,P,I,H,T,U,J,Y,K,S,k,V,O;J=b.data;H=new THREE.BinaryLoader;Y=new THREE.JSONLoader;S=K=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in J.objects)if(F=J.objects[v],F.meshCollider){b=!0;break}if(b)O.scene.collisions=new THREE.CollisionSystem;if(J.transform){b=J.transform.position;E=J.transform.rotation;var fa=J.transform.scale;b&&O.scene.position.set(b[0],b[1],b[2]);E&&O.scene.rotation.set(E[0],
+E[1],E[2]);fa&&O.scene.scale.set(fa[0],fa[1],fa[2]);(b||E||fa)&&O.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in J.cameras){E=J.cameras[z];if(E.type=="perspective")P=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;P.position.set(C[0],C[1],C[2]);P.target.position.set(E[0],E[1],E[2]);O.cameras[z]=P}for(w in J.lights)z=J.lights[w],
+P=z.color!==void 0?z.color:16777215,E=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(C=z.direction,U=new THREE.DirectionalLight(P,E),U.position.set(C[0],C[1],C[2]),U.position.normalize()):z.type=="point"?(C=z.position,d=z.distance,U=new THREE.PointLight(P,E,d),U.position.set(C[0],C[1],C[2])):z.type=="ambient"&&(U=new THREE.AmbientLight(P)),O.scene.addLight(U),O.lights[w]=U;for(x in J.fogs)w=J.fogs[x],w.type=="linear"?I=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(I=new THREE.FogExp2(0,
+w.density)),E=w.color,I.color.setRGB(E[0],E[1],E[2]),O.fogs[x]=I;if(O.cameras&&J.defaults.camera)O.currentCamera=O.cameras[J.defaults.camera];if(O.fogs&&J.defaults.fog)O.scene.fog=O.fogs[J.defaults.fog];E=J.defaults.bgcolor;O.bgColor=new THREE.Color;O.bgColor.setRGB(E[0],E[1],E[2]);O.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(x=J.geometries[t],x.type=="bin_mesh"||x.type=="ascii_mesh")K+=1,e.onLoadStart();k=K;for(t in J.geometries)x=J.geometries[t],x.type=="cube"?(B=new THREE.CubeGeometry(x.width,
+x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),O.geometries[t]=B):x.type=="plane"?(B=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),O.geometries[t]=B):x.type=="sphere"?(B=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),O.geometries[t]=B):x.type=="cylinder"?(B=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),O.geometries[t]=B):x.type=="torus"?(B=new THREE.TorusGeometry(x.radius,
+x.tube,x.segmentsR,x.segmentsT),O.geometries[t]=B):x.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(x.subdivisions),O.geometries[t]=B):x.type=="bin_mesh"?H.load({model:f(x.url,J.urlBaseType),callback:n(t)}):x.type=="ascii_mesh"?Y.load({model:f(x.url,J.urlBaseType),callback:n(t)}):x.type=="embedded_mesh"&&(x=J.embeds[x.id])&&Y.createModel(x,p(t),"");for(y in J.textures)if(t=J.textures[y],t.url instanceof Array){S+=t.url.length;for(H=0;H<t.url.length;H++)e.onLoadStart()}else S+=1,e.onLoadStart();
+V=S;for(y in J.textures){t=J.textures[y];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){H=[];for(var ea=0;ea<t.url.length;ea++)H[ea]=f(t.url[ea],J.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,t.mapping,b)}else{H=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)H.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)H.magFilter=THREE[t.magFilter];if(t.repeat){H.repeat.set(t.repeat[0],t.repeat[1]);
+if(t.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}t.offset&&H.offset.set(t.offset[0],t.offset[1]);if(t.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[t.wrap[0]]!==void 0)H.wrapS=Y[t.wrap[0]];if(Y[t.wrap[1]]!==void 0)H.wrapT=Y[t.wrap[1]]}}O.textures[y]=H}for(u in J.materials){y=J.materials[u];for(G in y.parameters)if(G=="envMap"||G=="map"||G=="lightMap")y.parameters[G]=O.textures[y.parameters[G]];else if(G=="shading")y.parameters[G]=
+y.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")y.parameters[G]=THREE[y.parameters[G]]?THREE[y.parameters[G]]:THREE.NormalBlending;else if(G=="combine")y.parameters[G]=y.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(y.parameters[G]=="face")y.parameters[G]=THREE.FaceColors;else if(y.parameters[G])y.parameters[G]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
+!0;if(y.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);H=y.parameters.color;Y=y.parameters.specular;x=y.parameters.ambient;I=y.parameters.shininess;b.tNormal.texture=O.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
+O.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(H);b.uSpecularColor.value.setHex(Y);b.uAmbientColor.value.setHex(x);b.uShininess.value=I;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);O.materials[u]=y}m();e.callbackSync(O)}}};
 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,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m+j*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],j);g[h+1]=this.lerp(o[b+1],o[b+4],j);g[h+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n+j*this.delta;c[h+
-2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.VIntZ=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+j*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[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,g,h,j,m){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,v=n+this.zd,w=h+this.yd+this.zd,x=n+this.yd+this.zd,y=0,D=this.field[h],A=this.field[n],H=this.field[p],C=this.field[u],E=this.field[o],I=this.field[v],J=this.field[w],S=this.field[x];D<j&&(y|=1);A<j&&(y|=2);H<j&&(y|=8);C<j&&(y|=4);E<j&&(y|=16);I<j&&(y|=32);J<j&&(y|=128);S<j&&(y|=64);var R=THREE.edgeTable[y];if(R==0)return 0;var N=this.delta,
-F=b+N,W=c+N,N=g+N;R&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,g,D,A));R&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,j,F,c,g,A,C));R&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,W,g,H,C));R&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,g,D,H));R&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,j,b,c,N,E,I));R&32&&(this.compNorm(v),
-this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,j,F,c,N,I,S));R&64&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,18,j,b,W,N,J,S));R&128&&(this.compNorm(o),this.compNorm(w),this.VIntY(o*3,this.vlist,this.nlist,21,j,b,c,N,E,J));R&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,g,D,E));R&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,j,F,c,g,A,I));R&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
-3,this.vlist,this.nlist,30,j,F,W,g,C,S));R&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,W,g,H,J));y<<=4;for(j=h=0;THREE.triTable[y+j]!=-1;)b=y+j,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),j+=3,h++;return h};this.posnormtriv=function(b,c,g,h,j,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,j,m,n,p,o,t){j=(j-o)/(t-o);o=this.normal_cache;c[h]=m+j*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],j);g[h+1]=this.lerp(o[b+1],o[b+4],j);g[h+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,c,g,h,j,m,n,p,o,t){j=(j-o)/(t-o);o=this.normal_cache;c[h]=m;c[h+1]=n+j*this.delta;c[h+
+2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.VIntZ=function(b,c,g,h,j,m,n,p,o,t){j=(j-o)/(t-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+j*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[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,g,h,j,m){var n=h+1,p=h+this.yd,o=h+this.zd,t=n+this.yd,u=n+this.zd,v=h+this.yd+this.zd,w=n+this.yd+this.zd,z=0,x=this.field[h],y=this.field[n],F=this.field[p],C=this.field[t],E=this.field[o],G=this.field[u],B=this.field[v],P=this.field[w];x<j&&(z|=1);y<j&&(z|=2);F<j&&(z|=8);C<j&&(z|=4);E<j&&(z|=16);G<j&&(z|=32);B<j&&(z|=128);P<j&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var H=this.delta,
+T=b+H,U=c+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,g,x,y));I&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,j,T,c,g,y,C));I&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,U,g,F,C));I&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,g,x,F));I&16&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,12,j,b,c,H,E,G));I&32&&(this.compNorm(u),
+this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,j,T,c,H,G,P));I&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,j,b,U,H,B,P));I&128&&(this.compNorm(o),this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,21,j,b,c,H,E,B));I&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,g,x,E));I&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,j,T,c,g,y,G));I&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
+3,this.vlist,this.nlist,30,j,T,U,g,C,P));I&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,U,g,F,B));z<<=4;for(j=h=0;THREE.triTable[z+j]!=-1;)b=z+j,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),j+=3,h++;return h};this.posnormtriv=function(b,c,g,h,j,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
 4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[j];this.positionArray[n+7]=b[j+1];this.positionArray[n+8]=b[j+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[j];this.normalArray[n+7]=c[j+1];this.normalArray[n+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(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,g,h,j){var m=this.size*Math.sqrt(h/j),n=g*this.size,p=c*this.size,o=b*this.size,u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
-1);for(var x,y,D,A,H,C;u<n;u++){o=this.size2*u;y=u/this.size-g;H=y*y;for(y=v;y<p;y++){D=o+this.size*y;x=y/this.size-c;C=x*x;for(x=w;x<m;x++)A=x/this.size-b,A=h/(1.0E-6+A*A+C+H)-j,A>0&&(this.field[D+x]+=A)}}};this.addPlaneX=function(b,c){var g,h,j,m,n,p=this.size,o=this.yd,u=this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(g=0;g<w;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(j=0;j<p;j++)v[u*j+n]+=m}};this.addPlaneY=function(b,c){var g,h,j,m,n,p,o=this.size,u=this.yd,v=
-this.zd,w=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(h=0;h<x;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)w[v*j+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,j,m,n,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(g=j/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};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,g,h,j,m,n,p,o,u,v=this.size-2;for(j=1;j<v;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var j,m,n,p,o,u,v,w;for(j=0;j<h.count;j++)v=j*3,o=v+1,w=v+2,m=h.positionArray[v],
-n=h.positionArray[o],p=h.positionArray[w],u=new THREE.Vector3(m,n,p),m=h.normalArray[v],n=h.normalArray[o],p=h.normalArray[w],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(u),c.vertices.push(o),g.push(v);nfaces=h.count/3;for(j=0;j<nfaces;j++)v=(b+j)*3,o=v+1,w=v+2,u=g[v],m=g[o],n=g[w],v=new THREE.Face3(v,o,w,[u,m,n]),c.faces.push(v);b+=nfaces;h.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,g,h,j){var m=this.size*Math.sqrt(h/j),n=g*this.size,p=c*this.size,o=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
+1);for(var w,z,x,y,F,C;t<n;t++){o=this.size2*t;z=t/this.size-g;F=z*z;for(z=u;z<p;z++){x=o+this.size*z;w=z/this.size-c;C=w*w;for(w=v;w<m;w++)y=w/this.size-b,y=h/(1.0E-6+y*y+C+F)-j,y>0&&(this.field[x+w]+=y)}}};this.addPlaneX=function(b,c){var g,h,j,m,n,p=this.size,o=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(j=0;j<p;j++)u[t*j+n]+=m}};this.addPlaneY=function(b,c){var g,h,j,m,n,p,o=this.size,t=this.yd,u=
+this.zd,v=this.field,w=o*Math.sqrt(b/c);w>o&&(w=o);for(h=0;h<w;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*t;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[u*j+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,j,m,n,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(g=j/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};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,g,h,j,m,n,p,o,t,u=this.size-2;for(j=1;j<u;j++){t=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<u;h++){o=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var j,m,n,p,o,t,u,v;for(j=0;j<h.count;j++)u=j*3,o=u+1,v=u+2,m=h.positionArray[u],
+n=h.positionArray[o],p=h.positionArray[v],t=new THREE.Vector3(m,n,p),m=h.normalArray[u],n=h.normalArray[o],p=h.normalArray[v],u=new THREE.Vector3(m,n,p),u.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(u);nfaces=h.count/3;for(j=0;j<nfaces;j++)u=(b+j)*3,o=u+1,v=u+2,t=g[u],m=g[o],n=g[v],u=new THREE.Face3(u,o,v,[t,m,n]),c.faces.push(u);b+=nfaces;h.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]);
@@ -598,9 +598,9 @@ f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);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,e=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]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};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,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var A=e.projectionMatrix.clone(),H=125/30*0.5,C=H*p/125,E=p*Math.tan(o*Math.PI/360),I;j.n14=H;m.n14=-H;H=-E*n+C;I=E*n+C;A.n11=2*p/(I-H);A.n13=(I+H)/(I-H);g.projectionMatrix=A.clone();H=-E*n-C;I=E*n-C;A.n11=2*p/(I-H);
-A.n13=(I+H)/(I-H);h.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,u,!0);h.matrix=e.matrixWorld.clone().multiplySelf(j);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,v,!0);f.call(c,x,w)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var y=e.projectionMatrix.clone(),F=125/30*0.5,C=F*p/125,E=p*Math.tan(o*Math.PI/360),G;j.n14=F;m.n14=-F;F=-E*n+C;G=E*n+C;y.n11=2*p/(G-F);y.n13=(G+F)/(G-F);g.projectionMatrix=y.clone();F=-E*n-C;G=E*n-C;y.n11=2*p/(G-F);
+y.n13=(G+F)/(G-F);h.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);h.matrix=e.matrixWorld.clone().multiplySelf(j);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,u,!0);f.call(c,w,v)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,j=new THREE.Camera,m=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,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far;
 j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,j);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};

+ 18 - 12
examples/canvas_geometry_shape.html → examples/webgl_geometry_shapes.html

@@ -62,13 +62,18 @@
 
 				scene = new THREE.Scene();
 
+				var light = new THREE.DirectionalLight( 0xffffff );
+				light.position.set( 0, 0, 1 );
+				light.position.normalize();
+				scene.addLight( light );
+
 				parent = new THREE.Object3D();
 				parent.position.y = 50;
 				scene.addChild( parent );
 
 				function addGeometry( geometry, color, x, y, z, rx, ry, rz, s ) {
 
-					var mesh = new THREE.Mesh( geometry, [ new THREE.MeshBasicMaterial( { color: color } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true } ) ] );
+					var mesh = new THREE.Mesh( geometry, [ new THREE.MeshLambertMaterial( { color: color } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true } ) ] );
 					mesh.position.set( x, y, z );
 					mesh.rotation.set( rx, ry, rz );
 					mesh.scale.set( s, s, s );
@@ -76,7 +81,7 @@
 
 				}
 
-				var extrudeSettings = {	amount: 20,  bevelEnabled: true, bevelSegments: 2, steps: 2 }; //amount: 40, steps: 2 
+				var extrudeSettings = {	amount: 20,  bevelEnabled: true, bevelSegments: 2, steps: 2 }; //amount: 40, steps: 2
 
 				// California
 
@@ -210,20 +215,21 @@
 				fishShape.quadraticCurveTo( x + 50, y - 80, x, y );
 
 				var fish3d = fishShape.extrude( extrudeSettings );
-				
+
 				// Arc Circle
+
 				var arcShape = new THREE.Shape();
 				arcShape.moveTo( 0, 0);
-				arcShape.arc(10,10, 40, 0, Math.PI*2,false);
-				
+				arcShape.arc( 10, 10, 40, 0, Math.PI*2, false );
+
 				var holePath = new THREE.Path();
-				holePath.moveTo( 0, 0);
-				holePath.arc(10, 10, 10, 0, Math.PI*2, true);
-				arcShape.holes.push(holePath);
-				
+				holePath.moveTo( 0, 0 );
+				holePath.arc( 10, 10, 10, 0, Math.PI*2, true );
+				arcShape.holes.push( holePath );
+
 				var arc3d = arcShape.extrude( extrudeSettings );
 
-				// Spline shape + Path Extrusion
+				// Spline shape + path extrusion
 
 				var splinepts = [];
 				splinepts.push( new THREE.Vector2 ( 350, 100 ) );
@@ -239,7 +245,7 @@
 
 				var extrudePath = new THREE.Path();
 
-				extrudePath.moveTo(0,0);
+				extrudePath.moveTo( 0, 0 );
 				extrudePath.lineTo( 10, 10 );
 				extrudePath.quadraticCurveTo( 80, 60, 160, 10 );
 				extrudePath.quadraticCurveTo( 240, -40, 320, 10 );
@@ -259,7 +265,7 @@
 				addGeometry( splineShape3d, 		0x888888,  -50,  -100, -50,     0, 0, 0, 0.2 );
 				addGeometry( arc3d, 		0xbb4422,  150,    0, 0,     0, 0, 0, 1 );
 
-				renderer = new THREE.CanvasRenderer();
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
                 renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );

+ 177 - 157
src/extras/geometries/ExtrudeGeometry.js

@@ -8,16 +8,19 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 	var amount = options.amount !== undefined ? options.amount : 100;
 
 	// todo: bevel
+
 	var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 8; // 10
-	var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness; // 8 
+	var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness; // 8
 	var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false
 	var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
+
 	// We should set bevel segments to 0 if bevel is not enabled.
-	if (!bevelEnabled) bevelSegments = 0 ;
-	
+
+	if ( !bevelEnabled ) bevelSegments = 0;
+
 
 	var steps = options.steps !== undefined ? options.steps : 1;
-	
+
 	var extrudePath = options.path !== undefined ? options.path : null;
 	var extrudePts, extrudeByPath = false;
 
@@ -28,102 +31,109 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		extrudeByPath = true;
 
 	}
-	
+
 
 	// TODO, extrude by path's tangents? also via 3d path?
 
 	THREE.Geometry.call( this );
 
-	
 	// Variables initalization
+
 	var ahole, h, hl; // looping of holes
 	var scope = this;
 	var bevelPoints = [];
 
 
 	// getPoints
-	var shapePoints = shape.extractAllPoints(false);
 	// false for getPoints | true for getSpacedPoints() for points with equal divisions
-	
-    var vertices = shapePoints.shape; 
-	var holes =  shapePoints.holes;
-	
+
+	var shapePoints = shape.extractAllPoints( false );
+
+    var vertices = shapePoints.shape;
+	var holes = shapePoints.holes;
+
 	var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ;
 
-	if (reverse) {
+	if ( reverse ) {
 
 		vertices = vertices.reverse();
-		
-		// Maybe we should also check if holes are in the opposite direction, just to be safe...
-		
-		for (h = 0, hl = holes.length;  h < hl; h++ ) {
-			
-			ahole = holes[h];
-			if (THREE.Shape.Utils.isClockWise(ahole)) {
-				
-				holes[h] = ahole.reverse();
-				
+
+		// Maybe we should also check if holes are in the opposite direction, just to be safe ...
+
+		for ( h = 0, hl = holes.length;  h < hl; h++ ) {
+
+			ahole = holes[ h ];
+
+			if ( THREE.Shape.Utils.isClockWise( ahole ) ) {
+
+				holes[ h ] = ahole.reverse();
+
 			}
+
 		}
-		
+
 		reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)!
+
 	}
-	
-	
-	
-	var faces = THREE.Shape.Utils.triangulateShape(vertices, holes);
-	//var faces = THREE.Shape.Utils.triangulate2(vertices, holes);
+
+
+	var faces = THREE.Shape.Utils.triangulateShape( vertices, holes );
+	//var faces = THREE.Shape.Utils.triangulate2( vertices, holes );
 
 	//console.log(faces);
-	
+
 	////
 	///   Handle Vertices
 	////
-	
+
 	var contour = vertices; // vertices has all points but contour has only points of circumference
-	
-	for (h = 0, hl = holes.length;  h < hl; h++ ) {
 
-		ahole = holes[h];
+	for ( h = 0, hl = holes.length;  h < hl; h ++ ) {
+
+		ahole = holes[ h ];
 
-		vertices = vertices.concat(ahole);
+		vertices = vertices.concat( ahole );
 
 	}
-	
+
 	// Find all centroids of shapes and holes
-	
-	var b;	
+
+	var i, il;
 	var sum = new THREE.Vector2();
-	var contourCentroid, holesCentroids;
-	
-	for (i=0, il = contour.length; i<il; i++) {
-		sum.addSelf(contour[i]);
+
+	for ( i = 0, il = contour.length; i < il; i ++ ) {
+
+		sum.addSelf( contour[ i ] );
+
 	}
-	
-	contourCentroid = sum.divideScalar( contour.length ) ;
-	
-	holesCentroids = [];
-	
-	
-	for (h=0, hl = holes.length; h<hl; h++) {
+
+	var contourCentroid = sum.divideScalar( contour.length );
+
+	var holesCentroids = [];
+
+	for ( h = 0, hl = holes.length; h < hl; h ++ ) {
+
 		sum = new THREE.Vector2();
-		ahole = holes[h];
-		
-		for (i=0, il = ahole.length; i<il; i++) {
-			sum.addSelf(ahole[i]);
+		ahole = holes[ h ];
+
+		for ( i=0, il = ahole.length; i < il; i ++ ) {
+
+			sum.addSelf( ahole[ i ] );
+
 		}
-		
-		holesCentroids[h] = sum.divideScalar( ahole.length ) ;
-		
+
+		holesCentroids[ h ] = sum.divideScalar( ahole.length );
+
 	}
-	
-	function scalePt (pt, centroid, size, expandOutwards /* Boolean */ ) {
-		vectorFromCentroid = pt.clone().subSelf( centroid );
-		adj = size / vectorFromCentroid.length();
+
+	function scalePt ( pt, centroid, size, expandOutwards /* Boolean */ ) {
+
+		var vectorFromCentroid = pt.clone().subSelf( centroid );
+		var adj = size / vectorFromCentroid.length();
 
 		if ( expandOutwards ) {
 
-			adj += 1;
+			adj = 1 + adj;
 
 		}  else {
 
@@ -132,57 +142,60 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		}
 
 		return vectorFromCentroid.multiplyScalar( adj ).addSelf( centroid );
+
 	}
-	
 
 
-	var i,
+	var b, bs, t, z,
 		vert, vlen = vertices.length,
 		face, flen = faces.length,
-		cont, clen = contour.length,
-		hol, hlen;
-		
+		cont, clen = contour.length;
 
-	var bs;
-	
 	// Loop bevelSegments, 1 for the front, 1 for the back
-	
-	for (b=bevelSegments; b > 0; b--) {
-		t =  b / bevelSegments;
+
+	for ( b = bevelSegments; b > 0; b-- ) {
+
+		t = b / bevelSegments;
 		z = bevelThickness * t;
+
 		// Formula could probably be simplified
-		bs = bevelSize * (1-Math.sin ((1-t) * Math.PI/2 )) ; //bevelSize * t ;
+
+		bs = bevelSize * ( 1 - Math.sin ( ( 1 - t ) * Math.PI/2 ) ) ; // bevelSize * t ;
 
 		// contract shape
-		for ( i = 0, il = contour.length; i < il; i++ ) {
-			
-			vert = scalePt(contour[i], contourCentroid, bs , false);
-			v( vert.x, vert.y,  -z);
-			
+
+		for ( i = 0, il = contour.length; i < il; i ++ ) {
+
+			vert = scalePt( contour[ i ], contourCentroid, bs, false );
+			v( vert.x, vert.y, -z );
+
 		}
-		
+
 		// expand holes
+
 		for ( h = 0, hl = holes.length; h < hl; h++ ) {
-			
-			ahole = holes[h];
+
+			ahole = holes[ h ];
+
 			for ( i = 0, il = ahole.length; i < il; i++ ) {
-				vert = scalePt(ahole[i], holesCentroids[h] , bs , true);	
-				v( vert.x, vert.y,  -z);
+
+				vert = scalePt( ahole[ i ], holesCentroids[ h ], bs, true );
+				v( vert.x, vert.y,  -z );
+
 			}
-			
+
 		}
-		
+
 	}
-	
-	
+
+
 	// Back facing vertices
 
 	for ( i = 0; i < vlen; i++ ) {
 
 		vert = vertices[ i ];
 		//v( vert.x, vert.y, 0 );
-		
-		
+
 		if ( !extrudeByPath ) {
 
 			v( vert.x, vert.y, 0 );
@@ -195,11 +208,12 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 	}
 
-	// Add steped vertices...
+	// Add stepped vertices...
 	// Including front facing vertices
 
-	var s = 1;
-	for ( ; s <= steps; s++ ) {
+	var s;
+
+	for ( s = 1; s <= steps; s++ ) {
 
 		for ( i = 0; i < vlen; i ++ ) {
 
@@ -218,76 +232,79 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		}
 
 	}
-	
-	
-	// Add Bevel Segments planes
-
-	for (b=1; b <= bevelSegments; b++) {
-		
-			t =  b / bevelSegments;
-			z = bevelThickness * t;
-			bs = bevelSize * (1-Math.sin ((1-t) * Math.PI/2 )); 
-			
-			// contract shape
-			for ( i = 0, il = contour.length; i < il; i++ ) {
-
-				vert = scalePt(contour[i], contourCentroid, bs , false);
-				v( vert.x, vert.y,  amount + z);
 
-			}
 
-			// expand holes
-			for ( h = 0, hl = holes.length; h < hl; h++ ) {
+	// Add bevel segments planes
+
+	for ( b = 1; b <= bevelSegments; b++ ) {
+
+		t = b / bevelSegments;
+		z = bevelThickness * t;
+		bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );
+
+		// contract shape
+
+		for ( i = 0, il = contour.length; i < il; i++ ) {
+
+			vert = scalePt( contour[ i ], contourCentroid, bs, false );
+			v( vert.x, vert.y,  amount + z);
+
+		}
+
+		// expand holes
+
+		for ( h = 0, hl = holes.length; h < hl; h++ ) {
+
+			ahole = holes[ h ];
+
+			for ( i = 0, il = ahole.length; i < il; i++ ) {
+
+				vert = scalePt( ahole[ i ], holesCentroids[h], bs, true );
 
-				ahole = holes[h];
-				for ( i = 0, il = ahole.length; i < il; i++ ) {
-					vert = scalePt(ahole[i], holesCentroids[h] , bs , true);
-					
-					if ( !extrudeByPath ) {
+				if ( !extrudeByPath ) {
 
-						v( vert.x, vert.y,  amount + z);
+					v( vert.x, vert.y,  amount + z );
 
-					} else {
+				} else {
 
-						v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x +z);
+					v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x +z );
 
-					}
-					
 				}
 
 			}
-		
-	}
-	
 
+		}
+
+	}
 
 
-	
 	////
 	///   Handle Faces
 	////
-	
+
+	// not used anywhere
+	// var layers = ( steps + bevelSegments * 2 ) * vlen;
 
 	// Bottom faces
-	if (bevelEnabled ) {
-		
-		
-		var layer = 0 ; //steps + 1
+
+	if ( bevelEnabled ) {
+
+		var layer = 0 ; // steps + 1
 		var offset = vlen * layer;
-		
-		for ( i = 0; i < flen; i++ ) {
+
+		for ( i = 0; i < flen; i ++ ) {
 
 			face = faces[ i ];
-			f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset);
+			f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset );
 
 		}
 
-		layer = steps + bevelSegments* 2;
+		layer = steps + bevelSegments * 2;
 		offset = vlen * layer;
-		
+
 		// Top faces
-		var layers = (steps + bevelSegments * 2)  * vlen; 
-		for ( i = 0; i < flen; i++ ) {
+
+		for ( i = 0; i < flen; i ++ ) {
 
 			face = faces[ i ];
 			f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );
@@ -304,35 +321,40 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		}
 
 		// Top faces
-		var layers = (steps + bevelSegments * 2)  * vlen; 
-		for ( i = 0; i < flen; i++ ) {
+
+		for ( i = 0; i < flen; i ++ ) {
 
 			face = faces[ i ];
-			f3( face[ 0 ] + vlen* steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
+			f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
 
 		}
+
 	}
 
 	var tmpPt;
 	var j, k, l, m;
 
 	var layeroffset = 0;
-	
+
 	// Sides faces
-	
-	sidewalls(contour);
+
+	sidewalls( contour );
 	layeroffset += contour.length;
-	
-	for (h = 0, hl = holes.length;  h < hl; h++ ) {
-		ahole = holes[h];
-		sidewalls(ahole); 
+
+	for ( h = 0, hl = holes.length;  h < hl; h ++ ) {
+
+		ahole = holes[ h ];
+		sidewalls( ahole );
+
 		//, true
 		layeroffset += ahole.length;
+
 	}
 
-	// Create faces for the z-sides of the shape	
-	function sidewalls(contour) {
-	
+	// Create faces for the z-sides of the shape
+
+	function sidewalls( contour ) {
+
 		i = contour.length;
 
 		while ( --i >= 0 ) {
@@ -340,7 +362,6 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 			tmpPt = contour[ i ];
 
 			j = i;
-		
 			k = i - 1;
 
 			if ( k < 0 ) k = contour.length - 1;
@@ -349,20 +370,19 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 			var s = 0;
 
-			for ( ; s < (steps  + bevelSegments * 2) ; s++ ) {
+			for ( s = 0; s < ( steps  + bevelSegments * 2 ); s ++ ) {
 
 				var slen1 = vlen * s;
 				var slen2 = vlen * ( s + 1 );
-		
-			
+
 				f4( layeroffset + j + slen1, layeroffset + k + slen1, layeroffset + k + slen2, layeroffset + j + slen2 );
-				
 
 			}
 
 		}
+
 	}
-	
+
 	// UVs to be added
 
 	this.computeCentroids();
@@ -378,13 +398,13 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 	function f3( a, b, c ) {
 
 		// if ( reverse ) { // Can now be removed
-		// 
+		//
 		// 		scope.faces.push( new THREE.Face3( c, b, a ) );
-		// 
+		//
 		// 	} else {
-		// 
+		//
 		 		scope.faces.push( new THREE.Face3( a, b, c ) );
-		// 
+		//
 		// 	}
 
 	}

+ 2 - 2
src/extras/geometries/Path.js

@@ -426,7 +426,7 @@ THREE.Path.prototype.getPoint = function( t ) {
 
 	while ( i < curveLengths.length ) {
 
-		if ( curveLengths[ i ] >= d) {
+		if ( curveLengths[ i ] >= d ) {
 
 			diff = curveLengths[ i ] - d;
 			curve = this.curves[ i ];
@@ -488,7 +488,7 @@ THREE.Path.prototype.createPathGeometry = function( divisions, lineMaterial ) {
 
         var pathSegment = new THREE.Geometry();
         pathSegment.vertices.push( new THREE.Vertex( new THREE.Vector3( pts[i-1].x, pts[i-1].y, 0 ) ) );
-        pathSegment.vertices.push( new THREE.Vertex( new THREE.Vector3( pts[i].x, pts[i].y, 0) ) );
+        pathSegment.vertices.push( new THREE.Vertex( new THREE.Vector3( pts[i].x, pts[i].y, 0 ) ) );
         segment = new THREE.Line( pathSegment , lineMaterial );
         pathGeometry.addChild(segment);