Browse Source

Rebuild libs.

alteredq 14 years ago
parent
commit
822b52e07b

+ 246 - 246
build/Three.js

@@ -16,20 +16,20 @@ subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this}
 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={constructor:THREE.Ray,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),h=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(h),g=c.dot(c),c=c.dot(h),h=1/(b*g-e*e),g=(g*f-e*c)*h,b=(b*c-e*f)*h;return g>0&&b>0&&g+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 h,j,g,m,
-n,p,o,t,v,u,w=b.geometry,B=w.vertices,x=[],f=0;for(h=w.faces.length;f<h;f++)if(j=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,g=p.multiplyVector3(B[j.a].position.clone()),m=p.multiplyVector3(B[j.b].position.clone()),n=p.multiplyVector3(B[j.c].position.clone()),p=j instanceof THREE.Face4?p.multiplyVector3(B[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(g,
+n,p,o,t,v,u,y=b.geometry,z=y.vertices,x=[],f=0;for(h=y.faces.length;f<h;f++)if(j=y.faces[f],v=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,g=p.multiplyVector3(z[j.a].position.clone()),m=p.multiplyVector3(z[j.b].position.clone()),n=p.multiplyVector3(z[j.c].position.clone()),p=j instanceof THREE.Face4?p.multiplyVector3(z[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(g,
 v))/t,v=v.addSelf(u.multiplyScalar(o)),j instanceof THREE.Face3)e(v,g,m,n)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},x.push(j));else if(j instanceof THREE.Face4&&(e(v,g,m,p)||e(v,m,n,p)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},x.push(j);return x}else return[]}};
 THREE.Rectangle=function(){function b(){j=f-c;g=h-e}var c,e,f,h,j,g,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,j,o,t){m=!1;c=g;e=j;f=o;h=t;b()};this.addPoint=function(g,j){m?(m=!1,c=g,e=j,f=g,h=j):(c=c<g?c:g,e=e<j?e:j,f=f>g?f:g,h=h>j?h:j);b()};this.add3Points=
 function(g,j,o,t,v,u){m?(m=!1,c=g<o?g<v?g:v:o<v?o:v,e=j<t?j<u?j:u:t<u?t:u,f=g>o?g>v?g:v:o>v?o:v,h=j>t?j>u?j:u:t>u?t:u):(c=g<o?g<v?g<c?g:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<t?j<u?j<e?j:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=g>o?g>v?g>f?g:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,h=j>t?j>u?j>h?j:h:u>h?u:h:t>u?t>h?t:h:u>h?u:h);b()};this.addRectangle=function(g){m?(m=!1,c=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),e=e<g.getTop()?e:g.getTop(),f=f>g.getRight()?f:g.getRight(),h=h>
 g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f<g.getRight()?f:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,h,j,g,m,n,p,o,t,v,u,w,B){this.set(b||1,c||0,e||0,f||0,h||0,j||1,g||0,m||0,n||0,p||0,o||1,t||0,v||0,u||0,w||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,j,g,m,n,p,o,t,v,u,w,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=j;this.n23=g;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,h,j,g,m,n,p,o,t,v,u,y,z){this.set(b||1,c||0,e||0,f||0,h||0,j||1,g||0,m||0,n||0,p||0,o||1,t||0,v||0,u||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,j,g,m,n,p,o,t,v,u,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=j;this.n23=g;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=v;this.n42=u;this.n43=y;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,h=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());h.cross(j,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=j.x;this.n21=f.y;this.n22=h.y;this.n23=j.y;this.n31=f.z;this.n32=h.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=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)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;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,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,x=b.n43,A=b.n44,E=c.n11,F=c.n12,
-J=c.n13,C=c.n14,G=c.n21,O=c.n22,D=c.n23,I=c.n24,V=c.n31,da=c.n32,S=c.n33,z=c.n34,ea=c.n41,R=c.n42,P=c.n43,k=c.n44;this.n11=e*E+f*G+h*V+j*ea;this.n12=e*F+f*O+h*da+j*R;this.n13=e*J+f*D+h*S+j*P;this.n14=e*C+f*I+h*z+j*k;this.n21=g*E+m*G+n*V+p*ea;this.n22=g*F+m*O+n*da+p*R;this.n23=g*J+m*D+n*S+p*P;this.n24=g*C+m*I+n*z+p*k;this.n31=o*E+t*G+v*V+u*ea;this.n32=o*F+t*O+v*da+u*R;this.n33=o*J+t*D+v*S+u*P;this.n34=o*C+t*I+v*z+u*k;this.n41=w*E+B*G+x*V+A*ea;this.n42=w*F+B*O+x*da+A*R;this.n43=w*J+B*D+x*S+A*P;this.n44=
-w*C+B*I+x*z+A*k;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,h=this.n21,j=this.n22,g=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,B=this.n44;return f*g*p*v-e*m*p*v-f*j*o*v+c*m*o*v+e*j*t*v-c*g*t*v-f*g*n*u+e*m*n*u+f*h*o*u-b*m*o*u-e*h*t*u+b*g*t*u+f*j*n*w-c*m*n*w-f*h*p*w+b*m*p*w+c*h*t*w-b*j*t*w-e*j*n*B+c*g*n*B+e*h*p*B-b*g*p*B-c*h*
-o*B+b*j*o*B},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=
+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,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,y=b.n41,z=b.n42,x=b.n43,w=b.n44,H=c.n11,B=c.n12,
+J=c.n13,C=c.n14,G=c.n21,O=c.n22,F=c.n23,I=c.n24,R=c.n31,ca=c.n32,T=c.n33,D=c.n34,da=c.n41,S=c.n42,P=c.n43,k=c.n44;this.n11=e*H+f*G+h*R+j*da;this.n12=e*B+f*O+h*ca+j*S;this.n13=e*J+f*F+h*T+j*P;this.n14=e*C+f*I+h*D+j*k;this.n21=g*H+m*G+n*R+p*da;this.n22=g*B+m*O+n*ca+p*S;this.n23=g*J+m*F+n*T+p*P;this.n24=g*C+m*I+n*D+p*k;this.n31=o*H+t*G+v*R+u*da;this.n32=o*B+t*O+v*ca+u*S;this.n33=o*J+t*F+v*T+u*P;this.n34=o*C+t*I+v*D+u*k;this.n41=y*H+z*G+x*R+w*da;this.n42=y*B+z*O+x*ca+w*S;this.n43=y*J+z*F+x*T+w*P;this.n44=
+y*C+z*I+x*D+w*k;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,h=this.n21,j=this.n22,g=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,v=this.n41,u=this.n42,y=this.n43,z=this.n44;return f*g*p*v-e*m*p*v-f*j*o*v+c*m*o*v+e*j*t*v-c*g*t*v-f*g*n*u+e*m*n*u+f*h*o*u-b*m*o*u-e*h*t*u+b*g*t*u+f*j*n*y-c*m*n*y-f*h*p*y+b*m*p*y+c*h*t*y-b*j*t*y-e*j*n*z+c*g*n*z+e*h*p*z-b*g*p*z-c*h*
+o*z+b*j*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,
@@ -39,8 +39,8 @@ g*m,p=g*h,o=f*m,t=f*h;this.n11=n+t*e;this.n12=o*e-p;this.n13=j*f;this.n21=j*h;th
 j*f;o=e*g;t=e*f;this.n11=g*m;this.n12=t-n*h;this.n13=o*h+p;this.n21=h;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*h+o;this.n33=n-t*h;break;case "XZY":n=j*g;p=j*f;o=e*g;t=e*f;this.n11=g*m;this.n12=-h;this.n13=f*m;this.n21=n*h+t;this.n22=j*m;this.n23=p*h-o;this.n31=o*h-p;this.n32=e*m;this.n33=t*h+n;break;default:n=j*m,p=j*h,o=e*m,t=e*h,this.n11=g*m,this.n12=-g*h,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*g,this.n31=t-n*f,this.n32=o+p*f,this.n33=j*g}return this},setRotationFromQuaternion:function(b){var c=
 b.x,e=b.y,f=b.z,h=b.w,j=c+c,g=e+e,m=f+f,b=c*j,n=c*g;c*=m;var p=e*g;e*=m;f*=m;j*=h;g*=h;h*=m;this.n11=1-(p+f);this.n12=n-h;this.n13=c+g;this.n21=n+h;this.n22=1-(b+f);this.n23=e-j;this.n31=c-g;this.n32=e+j;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,h=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*h;this.n23=b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,x=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*B-p*v*B+p*t*x-m*u*x-n*t*A+m*v*A;c.n12=j*v*B-h*u*B-j*t*x+f*u*x+h*t*A-f*v*A;c.n13=h*p*B-j*n*B+j*m*x-f*p*x-h*m*A+f*n*A;c.n14=j*n*t-h*p*t-j*m*v+f*p*v+h*m*u-f*n*u;c.n21=p*v*w-n*u*w-p*o*x+g*u*x+n*o*A-g*v*A;c.n22=h*u*w-j*v*w+j*o*x-e*u*x-h*o*A+e*v*A;c.n23=j*n*w-h*p*w-j*g*x+e*p*x+h*g*A-e*n*A;c.n24=
-h*p*o-j*n*o+j*g*v-e*p*v-h*g*u+e*n*u;c.n31=m*u*w-p*t*w+p*o*B-g*u*B-m*o*A+g*t*A;c.n32=j*t*w-f*u*w-j*o*B+e*u*B+f*o*A-e*t*A;c.n33=h*p*w-j*m*w+j*g*B-e*p*B-f*g*A+e*m*A;c.n34=j*m*o-f*p*o-j*g*t+e*p*t+f*g*u-e*m*u;c.n41=n*t*w-m*v*w-n*o*B+g*v*B+m*o*x-g*t*x;c.n42=f*v*w-h*t*w+h*o*B-e*v*B-f*o*x+e*t*x;c.n43=h*m*w-f*n*w-h*g*B+e*n*B+f*g*x-e*m*x;c.n44=f*n*o-h*m*o+h*g*t-e*n*t-f*g*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,y=b.n41,z=b.n42,x=b.n43,w=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*z-p*v*z+p*t*x-m*u*x-n*t*w+m*v*w;c.n12=j*v*z-h*u*z-j*t*x+f*u*x+h*t*w-f*v*w;c.n13=h*p*z-j*n*z+j*m*x-f*p*x-h*m*w+f*n*w;c.n14=j*n*t-h*p*t-j*m*v+f*p*v+h*m*u-f*n*u;c.n21=p*v*y-n*u*y-p*o*x+g*u*x+n*o*w-g*v*w;c.n22=h*u*y-j*v*y+j*o*x-e*u*x-h*o*w+e*v*w;c.n23=j*n*y-h*p*y-j*g*x+e*p*x+h*g*w-e*n*w;c.n24=
+h*p*o-j*n*o+j*g*v-e*p*v-h*g*u+e*n*u;c.n31=m*u*y-p*t*y+p*o*z-g*u*z-m*o*w+g*t*w;c.n32=j*t*y-f*u*y-j*o*z+e*u*z+f*o*w-e*t*w;c.n33=h*p*y-j*m*y+j*g*z-e*p*z-f*g*w+e*m*w;c.n34=j*m*o-f*p*o-j*g*t+e*p*t+f*g*u-e*m*u;c.n41=n*t*y-m*v*y-n*o*z+g*v*z+m*o*x-g*t*x;c.n42=f*v*y-h*t*y+h*o*z-e*v*z-f*o*x+e*t*x;c.n43=h*m*y-f*n*y-h*g*z+e*n*z+f*g*x-e*m*x;c.n44=f*n*o-h*m*o+h*g*t-e*n*t-f*g*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,h=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,g=-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*g+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*j;e[3]=b*g;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,h,j){var g;g=new THREE.Matrix4;g.n11=2*h/(c-b);g.n12=0;g.n13=(c+b)/(c-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(j+h)/(j-h);g.n34=-2*j*h/(j-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,c,e,f,h,j){var g,m,n,p;g=new THREE.Matrix4;m=c-b;n=e-f;p=j-h;g.n11=2/m;g.n12=0;g.n13=0;g.n14=-((c+b)/m);g.n21=0;g.n22=2/n;g.n23=0;g.n24=-((e+f)/n);g.n31=0;g.n32=0;g.n33=-2/p;g.n34=-((j+h)/p);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){t
 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,h=this.w,j=b.x,g=b.y,m=b.z,b=b.w;this.x=c*b+h*j+e*m-f*g;this.y=e*b+h*g+f*j-c*m;this.z=f*b+h*m+c*g-e*j;this.w=h*b-c*j-e*g-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,h=b.z,j=this.x,g=this.y,m=this.z,
 n=this.w,p=n*e+g*h-m*f,o=n*f+m*e-j*h,t=n*h+j*f-g*e,e=-j*e-g*f-m*h;c.x=p*n+e*-j+o*-m-t*-g;c.y=o*n+e*-g+t*-j-p*-m;c.z=t*n+e*-m+p*-g-o*-j;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)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;h=Math.sin((1-f)*j)/g;f=Math.sin(f*j)/g;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<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;h=Math.sin((1-f)*j)/g;f=Math.sin(f*j)/g;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,h,j){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=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.Face4=function(b,c,e,f,h,j,g){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -62,9 +62,9 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,j,g,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],g=this.vertices[j.c],m.sub(g.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 m.normalize();j.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,j,h,D){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=g[j];t=g[h];v=g[D];u=n.x-m.x;w=p.x-m.x;B=n.y-m.y;x=p.y-m.y;A=n.z-m.z;E=p.z-m.z;F=t.u-o.u;J=v.u-o.u;C=t.v-o.v;G=v.v-o.v;O=1/(F*G-J*C);da.set((G*u-C*w)*
-O,(G*B-C*x)*O,(G*A-C*E)*O);S.set((F*w-J*u)*O,(F*x-J*B)*O,(F*E-J*A)*O);I[e].addSelf(da);I[c].addSelf(da);I[f].addSelf(da);V[e].addSelf(S);V[c].addSelf(S);V[f].addSelf(S)}var c,e,f,h,j,g,m,n,p,o,t,v,u,w,B,x,A,E,F,J,C,G,O,D,I=[],V=[],da=new THREE.Vector3,S=new THREE.Vector3,z=new THREE.Vector3,ea=new THREE.Vector3,R=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,V[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],g=this.faceVertexUvs[0][c],j instanceof
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var P=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)R.copy(j.vertexNormals[f]),h=j[P[f]],D=I[h],z.copy(D),z.subSelf(R.multiplyScalar(R.dot(D))).normalize(),ea.cross(j.vertexNormals[f],D),h=ea.dot(V[h]),h=h<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(z.x,z.y,z.z,h)}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,j,h,F){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=g[j];t=g[h];v=g[F];u=n.x-m.x;y=p.x-m.x;z=n.y-m.y;x=p.y-m.y;w=n.z-m.z;H=p.z-m.z;B=t.u-o.u;J=v.u-o.u;C=t.v-o.v;G=v.v-o.v;O=1/(B*G-J*C);ca.set((G*u-C*y)*
+O,(G*z-C*x)*O,(G*w-C*H)*O);T.set((B*y-J*u)*O,(B*x-J*z)*O,(B*H-J*w)*O);I[e].addSelf(ca);I[c].addSelf(ca);I[f].addSelf(ca);R[e].addSelf(T);R[c].addSelf(T);R[f].addSelf(T)}var c,e,f,h,j,g,m,n,p,o,t,v,u,y,z,x,w,H,B,J,C,G,O,F,I=[],R=[],ca=new THREE.Vector3,T=new THREE.Vector3,D=new THREE.Vector3,da=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,R[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],g=this.faceVertexUvs[0][c],j instanceof
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var P=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),h=j[P[f]],F=I[h],D.copy(F),D.subSelf(S.multiplyScalar(S.dot(F))).normalize(),da.cross(j.vertexNormals[f],F),h=da.dot(R[h]),h=h<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(D.x,D.y,D.z,h)}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,h,j,g,m={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.a,g.c),c(m,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),c(m,h,e),h=b(g.a,g.b),c(m,h,e),h=b(g.a,g.d),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.c,g.d),c(m,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];j=g.vertexIndices[1];
@@ -126,12 +126,12 @@ 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,h,j,g,m,n,p,o,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var B=w.egdes=this.geometry.edges,x=w.edgeFaces=[];h=0;var A=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],A.push(h),h+=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=B.length;b<c;b++)m=B[b],e=m.faces[0],f=m.faces[1],h=m.faceIndices[0],j=m.faceIndices[1],g=m.vertexIndices[0],m=m.vertexIndices[1],e.a===g?(n="a",o=A[h]+0):e.b===g?(n="b",o=A[h]+1):e.c===g?(n="c",o=A[h]+2):e.d===g&&(n="d",o=A[h]+3),e.a===m?(n+="a",t=A[h]+0):e.b===m?(n+="b",t=A[h]+1):e.c===m?(n+="c",t=A[h]+2):e.d===m&&(n+="d",t=A[h]+3),f.a===g?(p="a",v=A[j]+0):f.b===g?(p="b",v=A[j]+1):f.c===g?(p="c",v=A[j]+2):f.d===g&&(p="d",v=A[j]+3),f.a===m?(p+="a",u=A[j]+0):f.b===m?(p+="b",u=A[j]+
-1):f.c===m?(p+="c",u=A[j]+2):f.d===m&&(p+="d",u=A[j]+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"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,t,v,u),e.normal.set(1,0,0),x.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,h,j,g,m,n,p,o,t,v,u,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var z=y.egdes=this.geometry.edges,x=y.edgeFaces=[];h=0;var w=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],w.push(h),h+=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],h=m.faceIndices[0],j=m.faceIndices[1],g=m.vertexIndices[0],m=m.vertexIndices[1],e.a===g?(n="a",o=w[h]+0):e.b===g?(n="b",o=w[h]+1):e.c===g?(n="c",o=w[h]+2):e.d===g&&(n="d",o=w[h]+3),e.a===m?(n+="a",t=w[h]+0):e.b===m?(n+="b",t=w[h]+1):e.c===m?(n+="c",t=w[h]+2):e.d===m&&(n+="d",t=w[h]+3),f.a===g?(p="a",v=w[j]+0):f.b===g?(p="b",v=w[j]+1):f.c===g?(p="c",v=w[j]+2):f.d===g&&(p="d",v=w[j]+3),f.a===m?(p+="a",u=w[j]+0):f.b===m?(p+="b",u=w[j]+
+1):f.c===m?(p+="c",u=w[j]+2):f.d===m&&(p+="d",u=w[j]+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"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,t,v,u),e.normal.set(1,0,0),x.push(e);this.geometry=y}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,h=b.faces,b=b.vertices,j=h.length,g,m,n,p,o,t=["a","b","c","d"];for(n=0;n<j;n++){m=c.length;g=h[n];g 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(g.normal);e.push(m);
 for(m=0;m<p;m++)o=b[g[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<h.length-1;j++){b=e[j];for(g=j+1;g<h.length;g++)m=e[g],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,h,j,g,m,n,p,o,t,v,u,w,B,x=0,A=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){j=c[A[w]];m=b[j];for(B=0;B<h;B++)if(g=e[A[B]],n=b[g],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=j,v=g,u=A[w]),x===2))return u+=A[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,v,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,h,j,g,m,n,p,o,t,v,u,y,z,x=0,w=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){j=c[w[y]];m=b[j];for(z=0;z<h;z++)if(g=e[w[z]],n=b[g],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=j,v=g,u=w[y]),x===2))return u+=w[y],u==="ad"||u==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,v,
 g,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,j,g,v],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;
@@ -141,57 +141,57 @@ 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,j=e.z+e.w,k=-b.z+b.w,h=-e.z+e.w;return g>=0&&j>=0&&k>=0&&h>=0?!0:g<0&&j<0||k<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,j=[],g,m,n=[],p,o,t=[],v,u=[],w,B,x=[],A,E,F=[],J=new THREE.Vector4,C=new THREE.Vector4,
-G=new THREE.Matrix4,O=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,g){var e=[],m,n,p;h=0;n=
-b.objects;b=0;for(m=n.length;b<m;b++){p=n[b];var k;if(!(k=!p.visible))if(k=p instanceof THREE.Mesh){a:{k=void 0;for(var t=p.matrixWorld,u=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(k=D[o].x*t.n14+D[o].y*t.n24+D[o].z*t.n34+D[o].w,k<=u){k=!1;break a}k=!0}k=!k}if(!k)k=j[h]=j[h]||new THREE.RenderableObject,h++,f=k,J.copy(p.position),G.multiplyVector3(J),f.object=p,f.z=J.z,e.push(f)}g&&e.sort(c);return e};this.projectScene=function(f,j,h){var J=[],
-R=j.near,P=j.far,k,K,X,$,Y,ha,ja,fa,M,W,ca,ma,ka,na,la,T,ga;E=B=v=o=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);G.multiply(j.projectionMatrix,j.matrixWorldInverse);D[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);D[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);D[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);D[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);D[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);D[5].set(G.n41+G.n31,G.n42+
-G.n32,G.n43+G.n33,G.n44+G.n34);for(k=0;k<6;k++)M=D[k],M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z));M=this.projectObjects(f,j,!0);f=0;for(k=M.length;f<k;f++)if(W=M[f].object,W.visible)if(ca=W.matrixWorld,ma=W.matrixRotationWorld,ka=W.materials,na=W.overdraw,m=0,W instanceof THREE.Mesh){la=W.geometry;$=la.vertices;T=la.faces;la=la.faceVertexUvs;K=0;for(X=$.length;K<X;K++)g=b(),g.positionWorld.copy($[K].position),ca.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),G.multiplyVector4(g.positionScreen),
-g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>R&&g.positionScreen.z<P;$=0;for(K=T.length;$<K;$++){X=T[$];if(X instanceof THREE.Face3)if(Y=n[X.a],ha=n[X.b],ja=n[X.c],Y.visible&&ha.visible&&ja.visible&&(W.doubleSided||W.flipSided!=(ja.positionScreen.x-Y.positionScreen.x)*(ha.positionScreen.y-Y.positionScreen.y)-(ja.positionScreen.y-Y.positionScreen.y)*(ha.positionScreen.x-Y.positionScreen.x)<0))fa=t[o]=t[o]||new THREE.RenderableFace3,o++,
-p=fa,p.v1.copy(Y),p.v2.copy(ha),p.v3.copy(ja);else continue;else if(X instanceof THREE.Face4)if(Y=n[X.a],ha=n[X.b],ja=n[X.c],fa=n[X.d],Y.visible&&ha.visible&&ja.visible&&fa.visible&&(W.doubleSided||W.flipSided!=((fa.positionScreen.x-Y.positionScreen.x)*(ha.positionScreen.y-Y.positionScreen.y)-(fa.positionScreen.y-Y.positionScreen.y)*(ha.positionScreen.x-Y.positionScreen.x)<0||(ha.positionScreen.x-ja.positionScreen.x)*(fa.positionScreen.y-ja.positionScreen.y)-(ha.positionScreen.y-ja.positionScreen.y)*
-(fa.positionScreen.x-ja.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,p=ga,p.v1.copy(Y),p.v2.copy(ha),p.v3.copy(ja),p.v4.copy(fa);else continue;p.normalWorld.copy(X.normal);ma.multiplyVector3(p.normalWorld);p.centroidWorld.copy(X.centroid);ca.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);G.multiplyVector3(p.centroidScreen);ja=X.vertexNormals;Y=0;for(ha=ja.length;Y<ha;Y++)fa=p.vertexNormalsWorld[Y],fa.copy(ja[Y]),ma.multiplyVector3(fa);Y=0;for(ha=la.length;Y<
-ha;Y++)if(ga=la[Y][$]){ja=0;for(fa=ga.length;ja<fa;ja++)p.uvs[Y][ja]=ga[ja]}p.meshMaterials=ka;p.faceMaterials=X.materials;p.overdraw=na;p.z=p.centroidScreen.z;J.push(p)}}else if(W instanceof THREE.Line){O.multiply(G,ca);$=W.geometry.vertices;Y=b();Y.positionScreen.copy($[0].position);O.multiplyVector4(Y.positionScreen);K=1;for(X=$.length;K<X;K++)if(Y=b(),Y.positionScreen.copy($[K].position),O.multiplyVector4(Y.positionScreen),ha=n[m-2],I.copy(Y.positionScreen),V.copy(ha.positionScreen),e(I,V))I.multiplyScalar(1/
-I.w),V.multiplyScalar(1/V.w),ca=x[B]=x[B]||new THREE.RenderableLine,B++,w=ca,w.v1.positionScreen.copy(I),w.v2.positionScreen.copy(V),w.z=Math.max(I.z,V.z),w.materials=W.materials,J.push(w)}else if(W instanceof THREE.Particle&&(C.set(W.matrixWorld.n14,W.matrixWorld.n24,W.matrixWorld.n34,1),G.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))ca=F[E]=F[E]||new THREE.RenderableParticle,E++,A=ca,A.x=C.x/C.w,A.y=C.y/C.w,A.z=C.z,A.rotation=W.rotation.z,A.scale.x=W.scale.x*Math.abs(A.x-(C.x+j.projectionMatrix.n11)/
-(C.w+j.projectionMatrix.n14)),A.scale.y=W.scale.y*Math.abs(A.y-(C.y+j.projectionMatrix.n22)/(C.w+j.projectionMatrix.n24)),A.materials=W.materials,J.push(A);h&&J.sort(c);return J}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;j=f/2};this.render=function(e,f){var n,p,o,t,v,u,w,B;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*h+h;B=v.y*j+j;o=0;for(t=v.material.length;o<t;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=B+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(x!=b)u.globalAlpha=x=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}A=b}}function f(b){if(E!=b)u.strokeStyle=E=b}function h(b){if(F!=b)u.fillStyle=F=b}var j=this,g=null,m=new THREE.Projector,b=b||{},n=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-p,o,t,v,u=n.getContext("2d"),w=new THREE.Color(0),B=0,x=1,A=0,E=null,F=null,J=null,C=null,G=null,O,D,I,V,da=new THREE.RenderableVertex,S=new THREE.RenderableVertex,z,ea,R,P,k,K,X,$,Y,ha,ja,fa,M=new THREE.Color(0),W=new THREE.Color(0),ca=new THREE.Color(0),ma=new THREE.Color(0),ka=new THREE.Color(0),na=[],la,T,ga,ia,sa,xa,Aa,Ha,Ba,Oa,U=new THREE.Rectangle,pa=new THREE.Rectangle,qa=new THREE.Rectangle,ta=!1,ua=new THREE.Color,wa=new THREE.Color,Da=new THREE.Color,ya=new THREE.Color,ra=new THREE.Vector3,
-Ea,Z,Q,va,N,za,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Z=Ea.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Q=Z.getImageData(0,0,2,2);va=Q.data;N=document.createElement("canvas");N.width=N.height=b;za=N.getContext("2d");za.translate(-b/2,-b/2);za.scale(b,b);b--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.width=p;n.height=o;U.set(-t,-v,t,v);pa.set(-t,-v,
-t,v);x=1;A=0;G=C=J=F=E=null};this.setClearColor=function(b,e){w=b;B=e;pa.set(-t,-v,t,v)};this.setClearColorHex=function(b,e){w.setHex(b);B=e;pa.set(-t,-v,t,v)};this.clear=function(){u.setTransform(1,0,0,-1,t,v);pa.isEmpty()||(pa.inflate(1),pa.minSelf(U),B==0?u.clearRect(pa.getX(),pa.getY(),pa.getWidth(),pa.getHeight()):(e(THREE.NormalBlending),c(1),setContextFillStyle("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+B+")"),u.fillRect(pa.getX(),pa.getY(),pa.getWidth(),
-pa.getHeight())),pa.empty())};this.render=function(b,n){function p(b){var e,c,f,g=b.lights;wa.setRGB(0,0,0);Da.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b)}function o(b,e,c,f){var g,k,j,h,m=b.lights,b=0;for(g=m.length;b<g;b++)k=m[b],j=k.color,k instanceof THREE.DirectionalLight?
-(h=c.dot(k.position),h<=0||(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)):k instanceof THREE.PointLight&&(h=c.dot(ra.sub(k.position,e).normalize()),h<=0||(h*=k.distance==0?1:1-Math.min(e.distanceTo(k.position)/k.distance,1),h!=0&&(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)))}function Xa(b,g,k){c(k.opacity);e(k.blending);var j,m,n,p,aa,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)p=k.map.image,aa=p.width>>1,o=p.height>>1,k=g.scale.x*t,n=g.scale.y*v,j=k*aa,m=n*o,qa.set(b.x-j,b.y-
-m,b.x+j,b.y+m),U.instersects(qa)&&(u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(k,-n),u.translate(-aa,-o),u.drawImage(p,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*t,m=g.scale.y*v,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),U.instersects(qa)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(j,m),k.program(u),u.restore()))}function A(b,g,k,j){c(j.opacity);e(j.blending);u.beginPath();u.moveTo(b.positionScreen.x,
-b.positionScreen.y);u.lineTo(g.positionScreen.x,g.positionScreen.y);u.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(J!=b)u.lineWidth=J=b;b=j.linecap;if(C!=b)u.lineCap=C=b;b=j.linejoin;if(G!=b)u.lineJoin=G=b;f(j.color.getContextStyle());u.stroke();qa.inflate(j.linewidth*2)}}function w(b,f,g,h,m,p,aa,t,u){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);z=b.positionScreen.x;ea=b.positionScreen.y;R=f.positionScreen.x;P=f.positionScreen.y;k=g.positionScreen.x;K=g.positionScreen.y;
-x(z,ea,R,P,k,K);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ia=aa.uvs[0],Va(z,ea,R,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,ia[p].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=n.matrixWorldInverse,ra.copy(aa.vertexNormalsWorld[0]),sa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,xa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(aa.vertexNormalsWorld[1]),Aa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+
-0.5,Ha=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(aa.vertexNormalsWorld[2]),Ba=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Oa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Va(z,ea,R,P,k,K,sa,xa,Aa,Ha,Ba,Oa,t.envMap)}else t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):E(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ia=aa.uvs[0],Va(z,ea,R,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,
-ia[p].v,t.map)),e(THREE.SubtractiveBlending)),ta?!t.wireframe&&t.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(W.r=ca.r=ma.r=wa.r,W.g=ca.g=ma.g=wa.g,W.b=ca.b=ma.b=wa.b,o(u,aa.v1.positionWorld,aa.vertexNormalsWorld[0],W),o(u,aa.v2.positionWorld,aa.vertexNormalsWorld[1],ca),o(u,aa.v3.positionWorld,aa.vertexNormalsWorld[2],ma),ka.r=(ca.r+ma.r)*0.5,ka.g=(ca.g+ma.g)*0.5,ka.b=(ca.b+ma.b)*0.5,ga=Sa(W,ca,ma,ka),Pa(z,ea,R,P,k,K,0,0,1,0,0,1,ga)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,aa.centroidWorld,
-aa.normalWorld,ua),M.r=Math.max(0,Math.min(t.color.r*ua.r,1)),M.g=Math.max(0,Math.min(t.color.g*ua.g,1)),M.b=Math.max(0,Math.min(t.color.b*ua.b,1)),t.wireframe?Ia(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):E(M)):t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):E(t.color);else if(t instanceof THREE.MeshDepthMaterial)la=n.near,T=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,T),ca.r=ca.g=ca.b=1-Ma(f.positionScreen.z,la,T),ma.r=ma.g=ma.b=1-Ma(g.positionScreen.z,
-la,T),ka.r=(ca.r+ma.r)*0.5,ka.g=(ca.g+ma.g)*0.5,ka.b=(ca.b+ma.b)*0.5,ga=Sa(W,ca,ma,ka),Pa(z,ea,R,P,k,K,0,0,1,0,0,1,ga);else if(t instanceof THREE.MeshNormalMaterial)M.r=Qa(aa.normalWorld.x),M.g=Qa(aa.normalWorld.y),M.b=Qa(aa.normalWorld.z),t.wireframe?Ia(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):E(M)}function B(b,f,g,h,m,t,p,aa,u){j.data.vertices+=4;j.data.faces++;c(aa.opacity);e(aa.blending);if(aa.map||aa.envMap)w(b,f,h,0,1,3,p,aa,u),w(m,g,t,1,2,3,p,aa,u);else if(z=b.positionScreen.x,
-ea=b.positionScreen.y,R=f.positionScreen.x,P=f.positionScreen.y,k=g.positionScreen.x,K=g.positionScreen.y,X=h.positionScreen.x,$=h.positionScreen.y,Y=m.positionScreen.x,ha=m.positionScreen.y,ja=t.positionScreen.x,fa=t.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)F(z,ea,R,P,k,K,X,$),aa.wireframe?Ia(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):E(aa.color);else if(aa instanceof THREE.MeshLambertMaterial)ta?!aa.wireframe&&aa.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==
-4?(W.r=ca.r=ma.r=ka.r=wa.r,W.g=ca.g=ma.g=ka.g=wa.g,W.b=ca.b=ma.b=ka.b=wa.b,o(u,p.v1.positionWorld,p.vertexNormalsWorld[0],W),o(u,p.v2.positionWorld,p.vertexNormalsWorld[1],ca),o(u,p.v4.positionWorld,p.vertexNormalsWorld[3],ma),o(u,p.v3.positionWorld,p.vertexNormalsWorld[2],ka),ga=Sa(W,ca,ma,ka),x(z,ea,R,P,X,$),Pa(z,ea,R,P,X,$,0,0,1,0,0,1,ga),x(Y,ha,k,K,ja,fa),Pa(Y,ha,k,K,ja,fa,1,0,1,1,0,1,ga)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,p.centroidWorld,p.normalWorld,ua),M.r=Math.max(0,Math.min(aa.color.r*
-ua.r,1)),M.g=Math.max(0,Math.min(aa.color.g*ua.g,1)),M.b=Math.max(0,Math.min(aa.color.b*ua.b,1)),F(z,ea,R,P,k,K,X,$),aa.wireframe?Ia(M,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):E(M)):(F(z,ea,R,P,k,K,X,$),aa.wireframe?Ia(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):E(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)M.r=Qa(p.normalWorld.x),M.g=Qa(p.normalWorld.y),M.b=Qa(p.normalWorld.z),F(z,ea,R,P,k,K,X,$),aa.wireframe?Ia(M,aa.wireframeLinewidth,
-aa.wireframeLinecap,aa.wireframeLinejoin):E(M);else if(aa instanceof THREE.MeshDepthMaterial)la=n.near,T=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,T),ca.r=ca.g=ca.b=1-Ma(f.positionScreen.z,la,T),ma.r=ma.g=ma.b=1-Ma(h.positionScreen.z,la,T),ka.r=ka.g=ka.b=1-Ma(g.positionScreen.z,la,T),ga=Sa(W,ca,ma,ka),x(z,ea,R,P,X,$),Pa(z,ea,R,P,X,$,0,0,1,0,0,1,ga),x(Y,ha,k,K,ja,fa),Pa(Y,ha,k,K,ja,fa,1,0,1,1,0,1,ga)}function x(b,e,c,f,g,k){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(b,e);u.closePath()}
-function F(b,e,c,f,g,k,j,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(j,h);u.lineTo(b,e);u.closePath()}function Ia(b,e,c,g){if(J!=e)u.lineWidth=J=e;if(C!=c)u.lineCap=C=c;if(G!=g)u.lineJoin=G=g;f(b.getContextStyle());u.stroke();qa.inflate(e*2)}function E(b){h(b.getContextStyle());u.fill()}function Va(b,e,c,f,g,k,j,m,n,aa,p,t,o){if(o.image.width!=0){if(o.needsUpdate==!0||na[o.id]==void 0){var v=o.wrapS==THREE.RepeatWrapping,Ua=o.wrapT==THREE.RepeatWrapping;na[o.id]=u.createPattern(o.image,
-v&&Ua?"repeat":v&&!Ua?"repeat-x":!v&&Ua?"repeat-y":"no-repeat");o.needsUpdate=!1}h(na[o.id]);v=(o.image.width-1)*o.repeat.x;o=(o.image.height-1)*o.repeat.y;j*=v;m*=o;n*=v;aa*=o;p*=v;t*=o;c-=b;f-=e;g-=b;k-=e;n-=j;aa-=m;p-=j;t-=m;v=1/(n*t-p*aa);o=(t*c-aa*g)*v;aa=(t*f-aa*k)*v;c=(n*g-p*c)*v;f=(n*k-p*f)*v;b=b-o*j-c*m;e=e-aa*j-f*m;u.save();u.transform(o,aa,c,f,b,e);u.fill();u.restore()}}function Pa(b,e,c,f,g,k,j,h,m,n,aa,p,t){var o,v;o=t.width-1;v=t.height-1;j*=o;h*=v;m*=o;n*=v;aa*=o;p*=v;c-=b;f-=e;g-=
-b;k-=e;m-=j;n-=h;aa-=j;p-=h;v=1/(m*p-aa*n);o=(p*c-n*g)*v;n=(p*f-n*k)*v;c=(m*g-aa*c)*v;f=(m*k-aa*f)*v;b=b-o*j-c*h;e=e-n*j-f*h;u.save();u.transform(o,n,c,f,b,e);u.clip();u.drawImage(t,0,0);u.restore()}function Sa(b,e,c,f){var g=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),h=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),aa=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);va[0]=g<0?0:g>255?255:g;va[1]=k<0?0:k>255?255:k;va[2]=b<0?0:b>255?255:b;va[4]=j<0?0:j>255?255:j;va[5]=h<0?0:
-h>255?255:h;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=n<0?0:n>255?255:n;va[10]=c<0?0:c>255?255:c;va[12]=aa<0?0:aa>255?255:aa;va[13]=p<0?0:p>255?255:p;va[14]=f<0?0:f>255?255:f;Z.putImageData(Q,0,0);za.drawImage(Ea,0,0);return N}function Ma(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ja(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,Wa,oa,Ca,Ka,Ra,H,y;this.autoClear?this.clear():
-u.setTransform(1,0,0,-1,t,v);j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,n,this.sortElements);(ta=b.lights.length>0)&&p(b);Ta=0;for(Wa=g.length;Ta<Wa;Ta++){oa=g[Ta];qa.empty();if(oa instanceof THREE.RenderableParticle){O=oa;O.x*=t;O.y*=v;Ca=0;for(Ka=oa.materials.length;Ca<Ka;)y=oa.materials[Ca++],y.opacity!=0&&Xa(O,oa,y,b)}else if(oa instanceof THREE.RenderableLine){if(O=oa.v1,D=oa.v2,O.positionScreen.x*=t,O.positionScreen.y*=v,D.positionScreen.x*=t,D.positionScreen.y*=v,qa.addPoint(O.positionScreen.x,
-O.positionScreen.y),qa.addPoint(D.positionScreen.x,D.positionScreen.y),U.instersects(qa)){Ca=0;for(Ka=oa.materials.length;Ca<Ka;)y=oa.materials[Ca++],y.opacity!=0&&A(O,D,oa,y,b)}}else if(oa instanceof THREE.RenderableFace3){if(O=oa.v1,D=oa.v2,I=oa.v3,O.positionScreen.x*=t,O.positionScreen.y*=v,D.positionScreen.x*=t,D.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,oa.overdraw&&(Ja(O.positionScreen,D.positionScreen),Ja(D.positionScreen,I.positionScreen),Ja(I.positionScreen,O.positionScreen)),
-qa.add3Points(O.positionScreen.x,O.positionScreen.y,D.positionScreen.x,D.positionScreen.y,I.positionScreen.x,I.positionScreen.y),U.instersects(qa)){Ca=0;for(Ka=oa.meshMaterials.length;Ca<Ka;)if(y=oa.meshMaterials[Ca++],y instanceof THREE.MeshFaceMaterial){Ra=0;for(H=oa.faceMaterials.length;Ra<H;)(y=oa.faceMaterials[Ra++])&&y.opacity!=0&&w(O,D,I,0,1,2,oa,y,b)}else y.opacity!=0&&w(O,D,I,0,1,2,oa,y,b)}}else if(oa instanceof THREE.RenderableFace4&&(O=oa.v1,D=oa.v2,I=oa.v3,V=oa.v4,O.positionScreen.x*=
-t,O.positionScreen.y*=v,D.positionScreen.x*=t,D.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,da.positionScreen.copy(D.positionScreen),S.positionScreen.copy(V.positionScreen),oa.overdraw&&(Ja(O.positionScreen,D.positionScreen),Ja(D.positionScreen,V.positionScreen),Ja(V.positionScreen,O.positionScreen),Ja(I.positionScreen,da.positionScreen),Ja(I.positionScreen,S.positionScreen)),qa.addPoint(O.positionScreen.x,O.positionScreen.y),qa.addPoint(D.positionScreen.x,
-D.positionScreen.y),qa.addPoint(I.positionScreen.x,I.positionScreen.y),qa.addPoint(V.positionScreen.x,V.positionScreen.y),U.instersects(qa))){Ca=0;for(Ka=oa.meshMaterials.length;Ca<Ka;)if(y=oa.meshMaterials[Ca++],y instanceof THREE.MeshFaceMaterial){Ra=0;for(H=oa.faceMaterials.length;Ra<H;)(y=oa.faceMaterials[Ra++])&&y.opacity!=0&&B(O,D,I,V,da,S,oa,y,b)}else y.opacity!=0&&B(O,D,I,V,da,S,oa,y,b)}pa.addRectangle(qa)}u.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(V.sub(j.position,e.centroidWorld),V.normalize(),h=e.normalWorld.dot(V)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,g,m,p,t){j.data.vertices+=3;j.data.faces++;z=f(ea++);z.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?J.copy(p.color):p instanceof THREE.MeshLambertMaterial?F?(C.r=G.r,C.g=G.g,C.b=G.b,b(t,m,C),J.r=Math.max(0,Math.min(p.color.r*C.r,1)),J.g=Math.max(0,Math.min(p.color.g*C.g,1)),J.b=Math.max(0,Math.min(p.color.b*C.b,1))):J.copy(p.color):p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),
-J.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&J.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));p.wireframe?z.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+p.opacity);n.appendChild(z)}function e(e,c,g,m,p,t,o){j.data.vertices+=4;j.data.faces++;
-z=f(ea++);z.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?J.copy(t.color):t instanceof THREE.MeshLambertMaterial?F?(C.r=G.r,C.g=G.g,C.b=G.b,b(o,p,C),J.r=Math.max(0,Math.min(t.color.r*C.r,1)),J.g=Math.max(0,Math.min(t.color.g*C.g,1)),J.b=Math.max(0,Math.min(t.color.b*C.b,1))):J.copy(t.color):t instanceof
-THREE.MeshDepthMaterial?(I=1-t.__2near/(t.__farPlusNear-p.z*t.__farMinusNear),J.setRGB(I,I,I)):t instanceof THREE.MeshNormalMaterial&&J.setRGB(h(p.normalWorld.x),h(p.normalWorld.y),h(p.normalWorld.z));t.wireframe?z.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):z.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+
-t.opacity);n.appendChild(z)}function f(b){da[b]==null&&(da[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&da[b].setAttribute("shape-rendering","crispEdges"));return da[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,g=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,o,t,v,u,w,B,x,A=new THREE.Rectangle,E=new THREE.Rectangle,F=!1,J=new THREE.Color(16777215),C=new THREE.Color(16777215),G=new THREE.Color(0),O=new THREE.Color(0),
-D=new THREE.Color(0),I,V=new THREE.Vector3,da=[],S=[],z,ea,R,P=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+o);n.setAttribute("width",p);n.setAttribute("height",o);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=
-function(b,f){var h,p,o,J,C,I,M,W;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,f,this.sortElements);R=ea=0;if(F=b.lights.length>0){M=b.lights;G.setRGB(0,0,0);O.setRGB(0,0,0);D.setRGB(0,0,0);h=0;for(p=M.length;h<p;h++)o=M[h],J=o.color,o instanceof THREE.AmbientLight?(G.r+=J.r,G.g+=J.g,G.b+=J.b):o instanceof THREE.DirectionalLight?(O.r+=J.r,O.g+=J.g,O.b+=J.b):o instanceof THREE.PointLight&&(D.r+=J.r,D.g+=J.g,D.b+=J.b)}h=0;for(p=g.length;h<p;h++)if(M=g[h],E.empty(),
-M instanceof THREE.RenderableParticle){u=M;u.x*=t;u.y*=-v;o=0;for(J=M.materials.length;o<J;)o++}else if(M instanceof THREE.RenderableLine){if(u=M.v1,w=M.v2,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(w.positionScreen.x,w.positionScreen.y),A.instersects(E)){o=0;for(J=M.materials.length;o<J;)if((W=M.materials[o++])&&W.opacity!=0){C=u;I=w;var V=R++;S[V]==null&&(S[V]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),P==0&&S[V].setAttribute("shape-rendering","crispEdges"));z=S[V];z.setAttribute("x1",C.positionScreen.x);z.setAttribute("y1",C.positionScreen.y);z.setAttribute("x2",I.positionScreen.x);z.setAttribute("y2",I.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),n.appendChild(z))}}}else if(M instanceof
-THREE.RenderableFace3){if(u=M.v1,w=M.v2,B=M.v3,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,B.positionScreen.x*=t,B.positionScreen.y*=-v,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),A.instersects(E)){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&
-W.opacity!=0&&c(u,w,B,M,W,b)}else W&&W.opacity!=0&&c(u,w,B,M,W,b)}}else if(M instanceof THREE.RenderableFace4&&(u=M.v1,w=M.v2,B=M.v3,x=M.v4,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,B.positionScreen.x*=t,B.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),E.addPoint(x.positionScreen.x,x.positionScreen.y),
-A.instersects(E))){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&W.opacity!=0&&e(u,w,B,x,M,W,b)}else W&&W.opacity!=0&&e(u,w,B,x,M,W,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,j=e.z+e.w,k=-b.z+b.w,h=-e.z+e.w;return g>=0&&j>=0&&k>=0&&h>=0?!0:g<0&&j<0||k<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,j=[],g,m,n=[],p,o,t=[],v,u=[],y,z,x=[],w,H,B=[],J=new THREE.Vector4,C=new THREE.Vector4,
+G=new THREE.Matrix4,O=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,g){var e=[],m,n,p;h=0;n=
+b.objects;b=0;for(m=n.length;b<m;b++){p=n[b];var k;if(!(k=!p.visible))if(k=p instanceof THREE.Mesh){a:{k=void 0;for(var t=p.matrixWorld,u=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(k=F[o].x*t.n14+F[o].y*t.n24+F[o].z*t.n34+F[o].w,k<=u){k=!1;break a}k=!0}k=!k}if(!k)k=j[h]=j[h]||new THREE.RenderableObject,h++,f=k,J.copy(p.position),G.multiplyVector3(J),f.object=p,f.z=J.z,e.push(f)}g&&e.sort(c);return e};this.projectScene=function(f,j,h){var J=[],
+S=j.near,P=j.far,k,K,X,$,Y,ga,ja,ea,M,W,aa,ma,ka,sa,la,U,fa;H=z=v=o=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);G.multiply(j.projectionMatrix,j.matrixWorldInverse);F[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);F[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);F[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);F[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);F[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);F[5].set(G.n41+G.n31,G.n42+
+G.n32,G.n43+G.n33,G.n44+G.n34);for(k=0;k<6;k++)M=F[k],M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z));M=this.projectObjects(f,j,!0);f=0;for(k=M.length;f<k;f++)if(W=M[f].object,W.visible)if(aa=W.matrixWorld,ma=W.matrixRotationWorld,ka=W.materials,sa=W.overdraw,m=0,W instanceof THREE.Mesh){la=W.geometry;$=la.vertices;U=la.faces;la=la.faceVertexUvs;K=0;for(X=$.length;K<X;K++)g=b(),g.positionWorld.copy($[K].position),aa.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),G.multiplyVector4(g.positionScreen),
+g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>S&&g.positionScreen.z<P;$=0;for(K=U.length;$<K;$++){X=U[$];if(X instanceof THREE.Face3)if(Y=n[X.a],ga=n[X.b],ja=n[X.c],Y.visible&&ga.visible&&ja.visible&&(W.doubleSided||W.flipSided!=(ja.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(ja.positionScreen.y-Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0))ea=t[o]=t[o]||new THREE.RenderableFace3,o++,
+p=ea,p.v1.copy(Y),p.v2.copy(ga),p.v3.copy(ja);else continue;else if(X instanceof THREE.Face4)if(Y=n[X.a],ga=n[X.b],ja=n[X.c],ea=n[X.d],Y.visible&&ga.visible&&ja.visible&&ea.visible&&(W.doubleSided||W.flipSided!=((ea.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(ea.positionScreen.y-Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0||(ga.positionScreen.x-ja.positionScreen.x)*(ea.positionScreen.y-ja.positionScreen.y)-(ga.positionScreen.y-ja.positionScreen.y)*
+(ea.positionScreen.x-ja.positionScreen.x)<0)))fa=u[v]=u[v]||new THREE.RenderableFace4,v++,p=fa,p.v1.copy(Y),p.v2.copy(ga),p.v3.copy(ja),p.v4.copy(ea);else continue;p.normalWorld.copy(X.normal);ma.multiplyVector3(p.normalWorld);p.centroidWorld.copy(X.centroid);aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);G.multiplyVector3(p.centroidScreen);ja=X.vertexNormals;Y=0;for(ga=ja.length;Y<ga;Y++)ea=p.vertexNormalsWorld[Y],ea.copy(ja[Y]),ma.multiplyVector3(ea);Y=0;for(ga=la.length;Y<
+ga;Y++)if(fa=la[Y][$]){ja=0;for(ea=fa.length;ja<ea;ja++)p.uvs[Y][ja]=fa[ja]}p.meshMaterials=ka;p.faceMaterials=X.materials;p.overdraw=sa;p.z=p.centroidScreen.z;J.push(p)}}else if(W instanceof THREE.Line){O.multiply(G,aa);$=W.geometry.vertices;Y=b();Y.positionScreen.copy($[0].position);O.multiplyVector4(Y.positionScreen);K=1;for(X=$.length;K<X;K++)if(Y=b(),Y.positionScreen.copy($[K].position),O.multiplyVector4(Y.positionScreen),ga=n[m-2],I.copy(Y.positionScreen),R.copy(ga.positionScreen),e(I,R))I.multiplyScalar(1/
+I.w),R.multiplyScalar(1/R.w),aa=x[z]=x[z]||new THREE.RenderableLine,z++,y=aa,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(R),y.z=Math.max(I.z,R.z),y.materials=W.materials,J.push(y)}else if(W instanceof THREE.Particle&&(C.set(W.matrixWorld.n14,W.matrixWorld.n24,W.matrixWorld.n34,1),G.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))aa=B[H]=B[H]||new THREE.RenderableParticle,H++,w=aa,w.x=C.x/C.w,w.y=C.y/C.w,w.z=C.z,w.rotation=W.rotation.z,w.scale.x=W.scale.x*Math.abs(w.x-(C.x+j.projectionMatrix.n11)/
+(C.w+j.projectionMatrix.n14)),w.scale.y=W.scale.y*Math.abs(w.y-(C.y+j.projectionMatrix.n22)/(C.w+j.projectionMatrix.n24)),w.materials=W.materials,J.push(w);h&&J.sort(c);return J}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;j=f/2};this.render=function(e,f){var n,p,o,t,v,u,y,z;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){y=v.x*h+h;z=v.y*j+j;o=0;for(t=v.material.length;o<t;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(x!=b)u.globalAlpha=x=b}function e(b){if(w!=b){switch(b){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}w=b}}function f(b){if(H!=b)u.strokeStyle=H=b}function h(b){if(B!=b)u.fillStyle=B=b}var j=this,g=null,m=new THREE.Projector,b=b||{},n=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+p,o,t,v,u=n.getContext("2d"),y=new THREE.Color(0),z=0,x=1,w=0,H=null,B=null,J=null,C=null,G=null,O,F,I,R,ca=new THREE.RenderableVertex,T=new THREE.RenderableVertex,D,da,S,P,k,K,X,$,Y,ga,ja,ea,M=new THREE.Color(0),W=new THREE.Color(0),aa=new THREE.Color(0),ma=new THREE.Color(0),ka=new THREE.Color(0),sa=[],la,U,fa,ia,qa,va,za,La,ya,Oa,V=new THREE.Rectangle,ta=new THREE.Rectangle,na=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ra=new THREE.Color,wa=new THREE.Color,Ba=new THREE.Color,pa=new THREE.Vector3,
+xa,Da,Z,Q,Ea,N,b=16;xa=document.createElement("canvas");xa.width=xa.height=2;Da=xa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Z=Da.getImageData(0,0,2,2);Q=Z.data;Ea=document.createElement("canvas");Ea.width=Ea.height=b;N=Ea.getContext("2d");N.translate(-b/2,-b/2);N.scale(b,b);b--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.width=p;n.height=o;V.set(-t,-v,t,v);ta.set(-t,
+-v,t,v);x=1;w=0;G=C=J=B=H=null};this.setClearColor=function(b,e){y=b;z=e;ta.set(-t,-v,t,v)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;ta.set(-t,-v,t,v)};this.clear=function(){u.setTransform(1,0,0,-1,t,v);ta.isEmpty()||(ta.inflate(1),ta.minSelf(V),z==0?u.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),setContextFillStyle("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+z+")"),u.fillRect(ta.getX(),ta.getY(),ta.getWidth(),
+ta.getHeight())),ta.empty())};this.render=function(b,n){function p(b){var e,c,f,g=b.lights;ra.setRGB(0,0,0);wa.setRGB(0,0,0);Ba.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(Ba.r+=f.r,Ba.g+=f.g,Ba.b+=f.b)}function o(b,e,c,f){var g,k,j,h,m=b.lights,b=0;for(g=m.length;b<g;b++)k=m[b],j=k.color,k instanceof THREE.DirectionalLight?
+(h=c.dot(k.position),h<=0||(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)):k instanceof THREE.PointLight&&(h=c.dot(pa.sub(k.position,e).normalize()),h<=0||(h*=k.distance==0?1:1-Math.min(e.distanceTo(k.position)/k.distance,1),h!=0&&(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)))}function Sa(b,g,k){c(k.opacity);e(k.blending);var j,m,n,p,Aa,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)p=k.map.image,Aa=p.width>>1,o=p.height>>1,k=g.scale.x*t,n=g.scale.y*v,j=k*Aa,m=n*o,na.set(b.x-j,b.y-
+m,b.x+j,b.y+m),V.instersects(na)&&(u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(k,-n),u.translate(-Aa,-o),u.drawImage(p,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*t,m=g.scale.y*v,na.set(b.x-j,b.y-m,b.x+j,b.y+m),V.instersects(na)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(j,m),k.program(u),u.restore()))}function Ya(b,g,k,j){c(j.opacity);e(j.blending);u.beginPath();u.moveTo(b.positionScreen.x,
+b.positionScreen.y);u.lineTo(g.positionScreen.x,g.positionScreen.y);u.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(J!=b)u.lineWidth=J=b;b=j.linecap;if(C!=b)u.lineCap=C=b;b=j.linejoin;if(G!=b)u.lineJoin=G=b;f(j.color.getContextStyle());u.stroke();na.inflate(j.linewidth*2)}}function w(b,f,g,h,m,p,t,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);D=b.positionScreen.x;da=b.positionScreen.y;S=f.positionScreen.x;P=f.positionScreen.y;k=g.positionScreen.x;K=g.positionScreen.y;
+z(D,da,S,P,k,K);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ia=t.uvs[0],H(D,da,S,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,ia[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=n.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),qa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),za=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
+La=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),ya=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Oa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,H(D,da,S,P,k,K,qa,va,za,La,ya,Oa,u.envMap)}else u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(ia=t.uvs[0],H(D,da,S,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,ia[p].v,
+u.map)),e(THREE.SubtractiveBlending)),ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(W.r=aa.r=ma.r=ra.r,W.g=aa.g=ma.g=ra.g,W.b=aa.b=ma.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],W),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],ma),ka.r=(aa.r+ma.r)*0.5,ka.g=(aa.g+ma.g)*0.5,ka.b=(aa.b+ma.b)*0.5,fa=Ta(W,aa,ma,ka),Pa(D,da,S,P,k,K,0,0,1,0,0,1,fa)):(ha.r=ra.r,ha.g=ra.g,ha.b=ra.b,o(v,t.centroidWorld,t.normalWorld,
+ha),M.r=Math.max(0,Math.min(u.color.r*ha.r,1)),M.g=Math.max(0,Math.min(u.color.g*ha.g,1)),M.b=Math.max(0,Math.min(u.color.b*ha.b,1)),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)):u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshDepthMaterial)la=n.near,U=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,U),aa.r=aa.g=aa.b=1-Ma(f.positionScreen.z,la,U),ma.r=ma.g=ma.b=1-Ma(g.positionScreen.z,
+la,U),ka.r=(aa.r+ma.r)*0.5,ka.g=(aa.g+ma.g)*0.5,ka.b=(aa.b+ma.b)*0.5,fa=Ta(W,aa,ma,ka),Pa(D,da,S,P,k,K,0,0,1,0,0,1,fa);else if(u instanceof THREE.MeshNormalMaterial)M.r=Qa(t.normalWorld.x),M.g=Qa(t.normalWorld.y),M.b=Qa(t.normalWorld.z),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)}function y(b,f,g,h,m,p,t,u,v){j.data.vertices+=4;j.data.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)w(b,f,h,0,1,3,t,u,v),w(m,g,p,1,2,3,t,u,v);else if(D=b.positionScreen.x,
+da=b.positionScreen.y,S=f.positionScreen.x,P=f.positionScreen.y,k=g.positionScreen.x,K=g.positionScreen.y,X=h.positionScreen.x,$=h.positionScreen.y,Y=m.positionScreen.x,ga=m.positionScreen.y,ja=p.positionScreen.x,ea=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)x(D,da,S,P,k,K,X,$),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
+4?(W.r=aa.r=ma.r=ka.r=ra.r,W.g=aa.g=ma.g=ka.g=ra.g,W.b=aa.b=ma.b=ka.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],W),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),o(v,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],ka),fa=Ta(W,aa,ma,ka),z(D,da,S,P,X,$),Pa(D,da,S,P,X,$,0,0,1,0,0,1,fa),z(Y,ga,k,K,ja,ea),Pa(Y,ga,k,K,ja,ea,1,0,1,1,0,1,fa)):(ha.r=ra.r,ha.g=ra.g,ha.b=ra.b,o(v,t.centroidWorld,t.normalWorld,ha),M.r=Math.max(0,Math.min(u.color.r*ha.r,
+1)),M.g=Math.max(0,Math.min(u.color.g*ha.g,1)),M.b=Math.max(0,Math.min(u.color.b*ha.b,1)),x(D,da,S,P,k,K,X,$),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)):(x(D,da,S,P,k,K,X,$),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color));else if(u instanceof THREE.MeshNormalMaterial)M.r=Qa(t.normalWorld.x),M.g=Qa(t.normalWorld.y),M.b=Qa(t.normalWorld.z),x(D,da,S,P,k,K,X,$),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,
+u.wireframeLinejoin):Ha(M);else if(u instanceof THREE.MeshDepthMaterial)la=n.near,U=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,U),aa.r=aa.g=aa.b=1-Ma(f.positionScreen.z,la,U),ma.r=ma.g=ma.b=1-Ma(h.positionScreen.z,la,U),ka.r=ka.g=ka.b=1-Ma(g.positionScreen.z,la,U),fa=Ta(W,aa,ma,ka),z(D,da,S,P,X,$),Pa(D,da,S,P,X,$,0,0,1,0,0,1,fa),z(Y,ga,k,K,ja,ea),Pa(Y,ga,k,K,ja,ea,1,0,1,1,0,1,fa)}function z(b,e,c,f,g,k){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(b,e);u.closePath()}function x(b,
+e,c,f,g,k,j,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(j,h);u.lineTo(b,e);u.closePath()}function B(b,e,c,g){if(J!=e)u.lineWidth=J=e;if(C!=c)u.lineCap=C=c;if(G!=g)u.lineJoin=G=g;f(b.getContextStyle());u.stroke();na.inflate(e*2)}function Ha(b){h(b.getContextStyle());u.fill()}function H(b,e,c,f,g,k,j,m,n,p,t,Aa,o){if(o.image.width!=0){if(o.needsUpdate==!0||sa[o.id]==void 0){var v=o.wrapS==THREE.RepeatWrapping,Sa=o.wrapT==THREE.RepeatWrapping;sa[o.id]=u.createPattern(o.image,
+v&&Sa?"repeat":v&&!Sa?"repeat-x":!v&&Sa?"repeat-y":"no-repeat");o.needsUpdate=!1}h(sa[o.id]);v=(o.image.width-1)*o.repeat.x;o=(o.image.height-1)*o.repeat.y;j*=v;m*=o;n*=v;p*=o;t*=v;Aa*=o;c-=b;f-=e;g-=b;k-=e;n-=j;p-=m;t-=j;Aa-=m;v=1/(n*Aa-t*p);o=(Aa*c-p*g)*v;p=(Aa*f-p*k)*v;c=(n*g-t*c)*v;f=(n*k-t*f)*v;b=b-o*j-c*m;e=e-p*j-f*m;u.save();u.transform(o,p,c,f,b,e);u.fill();u.restore()}}function Pa(b,e,c,f,g,k,j,h,m,n,p,t,Aa){var o,v;o=Aa.width-1;v=Aa.height-1;j*=o;h*=v;m*=o;n*=v;p*=o;t*=v;c-=b;f-=e;g-=b;
+k-=e;m-=j;n-=h;p-=j;t-=h;v=1/(m*t-p*n);o=(t*c-n*g)*v;n=(t*f-n*k)*v;c=(m*g-p*c)*v;f=(m*k-p*f)*v;b=b-o*j-c*h;e=e-n*j-f*h;u.save();u.transform(o,n,c,f,b,e);u.clip();u.drawImage(Aa,0,0);u.restore()}function Ta(b,e,c,f){var g=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),h=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Q[0]=g<0?0:g>255?255:g;Q[1]=k<0?0:k>255?255:k;Q[2]=b<0?0:b>255?255:b;Q[4]=j<0?0:j>255?255:j;Q[5]=h<0?0:h>255?255:h;
+Q[6]=e<0?0:e>255?255:e;Q[8]=m<0?0:m>255?255:m;Q[9]=n<0?0:n>255?255:n;Q[10]=c<0?0:c>255?255:c;Q[12]=p<0?0:p>255?255:p;Q[13]=u<0?0:u>255?255:u;Q[14]=f<0?0:f>255?255:f;Da.putImageData(Z,0,0);N.drawImage(xa,0,0);return Ea}function Ma(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ia(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 Ua,Xa,oa,Ca,Ja,Ra,Va,E;this.autoClear?this.clear():u.setTransform(1,
+0,0,-1,t,v);j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,n,this.sortElements);(ua=b.lights.length>0)&&p(b);Ua=0;for(Xa=g.length;Ua<Xa;Ua++){oa=g[Ua];na.empty();if(oa instanceof THREE.RenderableParticle){O=oa;O.x*=t;O.y*=v;Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Sa(O,oa,E,b)}else if(oa instanceof THREE.RenderableLine){if(O=oa.v1,F=oa.v2,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=t,F.positionScreen.y*=v,na.addPoint(O.positionScreen.x,O.positionScreen.y),
+na.addPoint(F.positionScreen.x,F.positionScreen.y),V.instersects(na)){Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Ya(O,F,oa,E,b)}}else if(oa instanceof THREE.RenderableFace3){if(O=oa.v1,F=oa.v2,I=oa.v3,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=t,F.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,oa.overdraw&&(Ia(O.positionScreen,F.positionScreen),Ia(F.positionScreen,I.positionScreen),Ia(I.positionScreen,O.positionScreen)),na.add3Points(O.positionScreen.x,
+O.positionScreen.y,F.positionScreen.x,F.positionScreen.y,I.positionScreen.x,I.positionScreen.y),V.instersects(na)){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&w(O,F,I,0,1,2,oa,E,b)}else E.opacity!=0&&w(O,F,I,0,1,2,oa,E,b)}}else if(oa instanceof THREE.RenderableFace4&&(O=oa.v1,F=oa.v2,I=oa.v3,R=oa.v4,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=
+t,F.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,R.positionScreen.x*=t,R.positionScreen.y*=v,ca.positionScreen.copy(F.positionScreen),T.positionScreen.copy(R.positionScreen),oa.overdraw&&(Ia(O.positionScreen,F.positionScreen),Ia(F.positionScreen,R.positionScreen),Ia(R.positionScreen,O.positionScreen),Ia(I.positionScreen,ca.positionScreen),Ia(I.positionScreen,T.positionScreen)),na.addPoint(O.positionScreen.x,O.positionScreen.y),na.addPoint(F.positionScreen.x,F.positionScreen.y),
+na.addPoint(I.positionScreen.x,I.positionScreen.y),na.addPoint(R.positionScreen.x,R.positionScreen.y),V.instersects(na))){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&y(O,F,I,R,ca,T,oa,E,b)}else E.opacity!=0&&y(O,F,I,R,ca,T,oa,E,b)}ta.addRectangle(na)}u.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(R.sub(j.position,e.centroidWorld),R.normalize(),h=e.normalWorld.dot(R)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,g,m,p,u){j.data.vertices+=3;j.data.faces++;D=f(da++);D.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?J.copy(p.color):p instanceof THREE.MeshLambertMaterial?B?(C.r=G.r,C.g=G.g,C.b=G.b,b(u,m,C),J.r=Math.max(0,Math.min(p.color.r*C.r,1)),J.g=Math.max(0,Math.min(p.color.g*C.g,1)),J.b=Math.max(0,Math.min(p.color.b*C.b,1))):J.copy(p.color):p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),
+J.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&J.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));p.wireframe?D.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):D.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+p.opacity);n.appendChild(D)}function e(e,c,g,m,p,u,t){j.data.vertices+=4;j.data.faces++;
+D=f(da++);D.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?J.copy(u.color):u instanceof THREE.MeshLambertMaterial?B?(C.r=G.r,C.g=G.g,C.b=G.b,b(t,p,C),J.r=Math.max(0,Math.min(u.color.r*C.r,1)),J.g=Math.max(0,Math.min(u.color.g*C.g,1)),J.b=Math.max(0,Math.min(u.color.b*C.b,1))):J.copy(u.color):u instanceof
+THREE.MeshDepthMaterial?(I=1-u.__2near/(u.__farPlusNear-p.z*u.__farMinusNear),J.setRGB(I,I,I)):u instanceof THREE.MeshNormalMaterial&&J.setRGB(h(p.normalWorld.x),h(p.normalWorld.y),h(p.normalWorld.z));u.wireframe?D.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):D.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+
+u.opacity);n.appendChild(D)}function f(b){ca[b]==null&&(ca[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&ca[b].setAttribute("shape-rendering","crispEdges"));return ca[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,g=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,o,t,v,u,y,z,x,w=new THREE.Rectangle,H=new THREE.Rectangle,B=!1,J=new THREE.Color(16777215),C=new THREE.Color(16777215),G=new THREE.Color(0),O=new THREE.Color(0),
+F=new THREE.Color(0),I,R=new THREE.Vector3,ca=[],T=[],D,da,S,P=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+o);n.setAttribute("width",p);n.setAttribute("height",o);w.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=
+function(b,f){var h,p,o,J,C,I,M,W;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,f,this.sortElements);S=da=0;if(B=b.lights.length>0){M=b.lights;G.setRGB(0,0,0);O.setRGB(0,0,0);F.setRGB(0,0,0);h=0;for(p=M.length;h<p;h++)o=M[h],J=o.color,o instanceof THREE.AmbientLight?(G.r+=J.r,G.g+=J.g,G.b+=J.b):o instanceof THREE.DirectionalLight?(O.r+=J.r,O.g+=J.g,O.b+=J.b):o instanceof THREE.PointLight&&(F.r+=J.r,F.g+=J.g,F.b+=J.b)}h=0;for(p=g.length;h<p;h++)if(M=g[h],H.empty(),
+M instanceof THREE.RenderableParticle){u=M;u.x*=t;u.y*=-v;o=0;for(J=M.materials.length;o<J;)o++}else if(M instanceof THREE.RenderableLine){if(u=M.v1,y=M.v2,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),w.instersects(H)){o=0;for(J=M.materials.length;o<J;)if((W=M.materials[o++])&&W.opacity!=0){C=u;I=y;var R=S++;T[R]==null&&(T[R]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),P==0&&T[R].setAttribute("shape-rendering","crispEdges"));D=T[R];D.setAttribute("x1",C.positionScreen.x);D.setAttribute("y1",C.positionScreen.y);D.setAttribute("x2",I.positionScreen.x);D.setAttribute("y2",I.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(D.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),n.appendChild(D))}}}else if(M instanceof
+THREE.RenderableFace3){if(u=M.v1,y=M.v2,z=M.v3,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),w.instersects(H)){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&
+W.opacity!=0&&c(u,y,z,M,W,b)}else W&&W.opacity!=0&&c(u,y,z,M,W,b)}}else if(M instanceof THREE.RenderableFace4&&(u=M.v1,y=M.v2,z=M.v3,x=M.v4,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),
+w.instersects(H))){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&W.opacity!=0&&e(u,y,z,x,M,W,b)}else W&&W.opacity!=0&&e(u,y,z,x,M,W,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",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -227,131 +227,131 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,j,h=b.vertices,m=h.length,p=b.colors,n=p.length,t=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,A=b.__webglCustomAttributes,B,x;if(A)for(B in A)A[B].offset=0;if(c.sortParticles){ia.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=h[f].position,Aa.copy(g),ia.multiplyVector3(Aa),u[f]=[Aa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=h[u[f][1]].position,j=f*3,t[j]=g.x,t[j+1]=g.y,t[j+2]=g.z;
-for(f=0;f<n;f++)j=f*3,color=p[u[f][1]],o[j]=color.r,o[j+1]=color.g,o[j+2]=color.b;if(A)for(B in A){f=A[B];p=f.value.length;for(j=0;j<p;j++){index=u[j][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[index];f.size===2?(f.array[n]=x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=
-x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=h[f].position,j=f*3,t[j]=g.x,t[j+1]=g.y,t[j+2]=g.z;if(w)for(f=0;f<n;f++)color=p[f],j=f*3,o[j]=color.r,o[j+1]=color.g,o[j+2]=color.b;if(A)for(B in A)if(f=A[B],f.__original.needsUpdate){p=f.value.length;for(j=0;j<p;j++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[j]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[j];f.size===2?(f.array[n]=
-x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(A)for(B in A)if(f=A[B],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||P.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var j=0,h=P.maxMorphTargets;j<h;j++)g.__webglMorphTargetInfluences[j]=0}var j=f.program,h=j.uniforms,m=f.uniforms;j!=X&&(k.useProgram(j),X=j);k.uniformMatrix4fv(h.projectionMatrix,!1,sa);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 n,p,t,o=0,u=0,v=0,A,w,x,B=Ha,E=B.directional.colors,F=B.directional.positions,D=B.point.colors,J=B.point.positions,C=B.point.distances,
-la=0,H=0,c=p=x=0;for(n=e.length;c<n;c++)if(p=e[c],t=p.color,A=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)o+=t.r,u+=t.g,v+=t.b;else if(p instanceof THREE.DirectionalLight)x=la*3,E[x]=t.r*w,E[x+1]=t.g*w,E[x+2]=t.b*w,F[x]=A.x,F[x+1]=A.y,F[x+2]=A.z,la+=1;else if(p instanceof THREE.SpotLight)x=la*3,E[x]=t.r*w,E[x+1]=t.g*w,E[x+2]=t.b*w,t=1/A.length(),F[x]=A.x*t,F[x+1]=A.y*t,F[x+2]=A.z*t,la+=1;else if(p instanceof THREE.PointLight)p=H*3,D[p]=t.r*w,D[p+1]=t.g*w,D[p+2]=t.b*w,J[p]=
-A.x,J[p+1]=A.y,J[p+2]=A.z,C[H]=x,H+=1;for(c=la*3;c<E.length;c++)E[c]=0;for(c=H*3;c<D.length;c++)D[c]=0;B.point.length=H;B.directional.length=la;B.ambient[0]=o;B.ambient[1]=u;B.ambient[2]=v;c=Ha;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=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,j,h=b.vertices,m=h.length,p=b.colors,n=p.length,u=b.__vertexArray,t=b.__colorArray,o=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){ia.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=h[f].position,za.copy(g),ia.multiplyVector3(za),o[f]=[za.z,f];o.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=h[o[f][1]].position,j=f*3,u[j]=g.x,u[j+1]=g.y,u[j+2]=g.z;
+for(f=0;f<n;f++)j=f*3,color=p[o[f][1]],t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(y)for(z in y){f=y[z];p=f.value.length;for(j=0;j<p;j++){index=o[j][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[index];f.size===2?(f.array[n]=x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=
+x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=h[f].position,j=f*3,u[j]=g.x,u[j+1]=g.y,u[j+2]=g.z;if(w)for(f=0;f<n;f++)color=p[f],j=f*3,t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(y)for(z in y)if(f=y[z],f.__original.needsUpdate){p=f.value.length;for(j=0;j<p;j++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[j]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[j];f.size===2?(f.array[n]=
+x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,u,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,t,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||P.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var j=0,h=P.maxMorphTargets;j<h;j++)g.__webglMorphTargetInfluences[j]=0}var j=f.program,h=j.uniforms,m=f.uniforms;j!=X&&(k.useProgram(j),X=j);k.uniformMatrix4fv(h.projectionMatrix,!1,qa);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 n,p,u,t=0,o=0,v=0,y,w,x,z=La,B=z.directional.colors,H=z.directional.positions,F=z.point.colors,J=z.point.positions,C=z.point.distances,
+la=0,E=0,c=p=x=0;for(n=e.length;c<n;c++)if(p=e[c],u=p.color,y=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)t+=u.r,o+=u.g,v+=u.b;else if(p instanceof THREE.DirectionalLight)x=la*3,B[x]=u.r*w,B[x+1]=u.g*w,B[x+2]=u.b*w,H[x]=y.x,H[x+1]=y.y,H[x+2]=y.z,la+=1;else if(p instanceof THREE.SpotLight)x=la*3,B[x]=u.r*w,B[x+1]=u.g*w,B[x+2]=u.b*w,u=1/y.length(),H[x]=y.x*u,H[x+1]=y.y*u,H[x+2]=y.z*u,la+=1;else if(p instanceof THREE.PointLight)p=E*3,F[p]=u.r*w,F[p+1]=u.g*w,F[p+2]=u.b*w,J[p]=
+y.x,J[p+1]=y.y,J[p+2]=y.z,C[E]=x,E+=1;for(c=la*3;c<B.length;c++)B[c]=0;for(c=E*3;c<F.length;c++)F[c]=0;z.point.length=E;z.directional.length=la;z.ambient[0]=t;z.ambient[1]=o;z.ambient[2]=v;c=La;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=Ba.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;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=P.shadowMap[c];m.shadowDarkness.value=P.shadowMapDarkness;m.shadowBias.value=P.shadowMapBias}for(var y in m)if(o=j.uniforms[y])if(n=m[y],u=n.type,c=n.value,u=="i")k.uniform1i(o,c);else if(u=="f")k.uniform1f(o,c);else if(u=="fv1")k.uniform1fv(o,c);else if(u=="fv")k.uniform3fv(o,c);else if(u==
-"v2")k.uniform2f(o,c.x,c.y);else if(u=="v3")k.uniform3f(o,c.x,c.y,c.z);else if(u=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="m4v"){if(!n._array)n._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(n._array,u*16);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="c")k.uniform3f(o,c.r,c.g,c.b);else if(u=="t"){if(k.uniform1i(o,c),o=n.texture)if(o.image instanceof
-Array&&o.image.length==6){if(n=o,n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[o])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[o]);n.__webglInit=!0}V(k.TEXTURE_CUBE_MAP,
-n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else da(o,c)}else if(u=="tv"){if(!n._array){n._array=[];u=0;for(v=n.texture.length;u<v;u++)n._array[u]=c+u}k.uniform1iv(o,n._array);u=0;for(v=n.texture.length;u<v;u++)(o=n.texture[u])&&da(o,n._array[u])}k.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(h.normalMatrix,!1,g._normalMatrixArray);(f 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=ya.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;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ra.length;c++)m.shadowMatrix.value[c]=ra[c],m.shadowMap.texture[c]=P.shadowMap[c];m.shadowDarkness.value=P.shadowMapDarkness;m.shadowBias.value=P.shadowMapBias}for(var A in m)if(t=j.uniforms[A])if(n=m[A],o=n.type,c=n.value,o=="i")k.uniform1i(t,c);else if(o=="f")k.uniform1f(t,c);else if(o=="fv1")k.uniform1fv(t,c);else if(o=="fv")k.uniform3fv(t,c);else if(o==
+"v2")k.uniform2f(t,c.x,c.y);else if(o=="v3")k.uniform3f(t,c.x,c.y,c.z);else if(o=="v4")k.uniform4f(t,c.x,c.y,c.z,c.w);else if(o=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(t,!1,n._array)}else if(o=="m4v"){if(!n._array)n._array=new Float32Array(16*c.length);o=0;for(v=c.length;o<v;o++)c[o].flattenToArrayOffset(n._array,o*16);k.uniformMatrix4fv(t,!1,n._array)}else if(o=="c")k.uniform3f(t,c.r,c.g,c.b);else if(o=="t"){if(k.uniform1i(t,c),t=n.texture)if(t.image instanceof
+Array&&t.image.length==6){if(n=t,n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[t])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[t]);n.__webglInit=!0}R(k.TEXTURE_CUBE_MAP,
+n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else ca(t,c)}else if(o=="tv"){if(!n._array){n._array=[];o=0;for(v=n.texture.length;o<v;o++)n._array[o]=c+o}k.uniform1iv(t,n._array);o=0;for(v=n.texture.length;o<v;o++)(t=n.texture[o])&&ca(t,n._array[o])}k.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(h.normalMatrix,!1,g._normalMatrixArray);(f instanceof
 THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&h.cameraPosition!==null&&k.uniform3f(h.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,
-!1,xa);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(h.directionalLightDirection,b),k.uniformMatrix4fv(h.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(h.viewMatrix,!1,xa);f.skinning&&(k.uniformMatrix4fv(h.cameraInverseMatrix,!1,xa),k.uniformMatrix4fv(h.boneGlobalMatrices,!1,g.boneMatrices));return j}function f(b,c,f,g,j,h){if(g.opacity!=0){var m,b=e(b,c,f,g,h).attributes;
+!1,va);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(h.directionalLightDirection,b),k.uniformMatrix4fv(h.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(h.viewMatrix,!1,va);f.skinning&&(k.uniformMatrix4fv(h.cameraInverseMatrix,!1,va),k.uniformMatrix4fv(h.boneGlobalMatrices,!1,g.boneMatrices));return j}function f(b,c,f,g,j,h){if(g.opacity!=0){var m,b=e(b,c,f,g,h).attributes;
 if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(h.morphTargetBase){c=g.program.attributes;h.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[h.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length)for(var f=
-0,n=h.morphTargetForcedOrder,p=h.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[n[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],t=-1,o=0,p=h.morphTargetInfluences,u,v=p.length,f=0;for(h.morphTargetBase!==-1&&(n[h.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&p[u]>t&&(o=u,t=p[o]);k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[o]);
-k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[f]=t;n[o]=1;t=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(j.__webglCustomAttributes)for(m in j.__webglCustomAttributes)b[m]>=0&&(c=j.__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,j.__webglColorBuffer),
+0,n=h.morphTargetForcedOrder,p=h.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[n[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],u=-1,t=0,p=h.morphTargetInfluences,o,v=p.length,f=0;for(h.morphTargetBase!==-1&&(n[h.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(o=0;o<v;o++)!n[o]&&p[o]>u&&(t=o,u=p[t]);k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);
+k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[f]=u;n[t]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(j.__webglCustomAttributes)for(m in j.__webglCustomAttributes)b[m]>=0&&(c=j.__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,j.__webglColorBuffer),
 k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(j.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(j.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,
 j.__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,j.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,
 4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));h instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),k.drawElements(k.LINES,j.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)),P.data.vertices+=j.__webglFaceCount,P.data.faces+=j.__webglFaceCount/
 3,P.data.drawCalls++):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(h,0,j.__webglLineCount),P.data.drawCalls++):h instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,j.__webglParticleCount),P.data.drawCalls++):h instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,j.__webglVertexCount),P.data.drawCalls++)}}function h(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,j,g,h,m,n,p,t,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],j=c[u+1],g=c[u+2],h=c[u+3],n=c[u+4],t=c[u+5],m=c[u+6],p=c[u+7],o=c[u+8],f=(f+h+m)/
-3,j=(j+n+p)/3,g=(g+t+o)/3,c[u]=f,c[u+1]=j,c[u+2]=g,c[u+3]=f,c[u+4]=j,c[u+5]=g,c[u+6]=f,c[u+7]=j,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 j(b){if(ha!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ha=b.doubleSided;if(ja!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ja=b.flipSided}
-function g(b){M!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),M=b)}function m(b,e,c){W!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),W=b);if(b&&(ca!=e||ma!=c))k.polygonOffset(e,c),ca=e,ma=c}function n(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
-b.n32,b.n43-b.n33,b.n44-b.n34);ga[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=ga[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=ga[f].x*e.n14+ga[f].y*e.n24+ga[f].z*e.n34+ga[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,j=b.opaque,g=b.transparent;g.count=0;b=
-j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(j,c)}function v(b){var e,c,f,j,g=b.object,h=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=h.materials.length;e<c;e++)(j=h.materials[e])&&(j.transparent?o(m,j):o(k,j))}else(j=e)&&(j.transparent?o(m,j):o(k,j))}function u(b,e){return e.z-b.z}function w(b,c){var m,t,o,u=0,v,A,w,x,B=b.lights;ta||(ta=new THREE.Camera(P.shadowCameraFov,
-c.aspect,P.shadowCameraNear,P.shadowCameraFar));m=0;for(t=B.length;m<t;m++)if(o=B[m],o instanceof THREE.SpotLight&&o.castShadow){P.shadowMap[u]||(P.shadowMap[u]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[u]||(ua[u]=new THREE.Matrix4);v=P.shadowMap[u];A=ua[u];ta.position.copy(o.position);ta.target.position.copy(o.target.position);ta.update(void 0,!0);b.update(void 0,!1,ta);A.set(0.5,0,0,0.5,
-0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);A.multiplySelf(ta.projectionMatrix);A.multiplySelf(ta.matrixWorldInverse);ta.matrixWorldInverse.flattenToArray(xa);ta.projectionMatrix.flattenToArray(sa);ia.multiply(ta.projectionMatrix,ta.matrixWorldInverse);n(ia);P.initWebGLObjects(b);S(v);k.clearColor(1,1,1,1);P.clear();k.clearColor(pa.r,pa.g,pa.b,qa);A=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<A;v++)w=b.__webglObjects[v],x=w.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||
-p(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),E(x,ta,!1),w.render=!0):w.render=!1:w.render=!1;g(!0);I(THREE.NormalBlending);for(v=0;v<A;v++)if(w=b.__webglObjects[v],w.render)x=w.object,buffer=w.buffer,j(x),w=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?ya:Da,f(ta,B,null,w,buffer,x);for(v=0;v<o;v++)w=b.__webglObjectsImmediate[v],x=w.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),E(x,ta,!1),j(x),program=
-e(ta,B,null,Da,x),x.render(function(b){h(b,program,Da.shading)}));u++}}function B(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,j=b.lights,g=[],h,m,n,p,t,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(t=0;t<o;t++)f=b.__webglShadowVolumes[t].object,h=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||P.initMaterial(m,j,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,X!==m&&(k.useProgram(m),X=m,k.uniformMatrix4fv(n.projectionMatrix,!1,sa),k.uniformMatrix4fv(n.viewMatrix,!1,xa),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),
+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,j,g,h,m,n,p,u,t,o,v=b.count*3;for(o=0;o<v;o+=9)c=b.normalArray,f=c[o],j=c[o+1],g=c[o+2],h=c[o+3],n=c[o+4],u=c[o+5],m=c[o+6],p=c[o+7],t=c[o+8],f=(f+h+m)/
+3,j=(j+n+p)/3,g=(g+u+t)/3,c[o]=f,c[o+1]=j,c[o+2]=g,c[o+3]=f,c[o+4]=j,c[o+5]=g,c[o+6]=f,c[o+7]=j,c[o+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 j(b){if(ga!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ga=b.doubleSided;if(ja!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ja=b.flipSided}
+function g(b){M!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),M=b)}function m(b,e,c){W!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),W=b);if(b&&(aa!=e||ma!=c))k.polygonOffset(e,c),aa=e,ma=c}function n(b){fa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);fa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);fa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);fa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);fa[4].set(b.n41-b.n31,b.n42-
+b.n32,b.n43-b.n33,b.n44-b.n34);fa[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=fa[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=fa[f].x*e.n14+fa[f].y*e.n24+fa[f].z*e.n34+fa[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,j=b.opaque,g=b.transparent;g.count=0;b=
+j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(j,c)}function v(b){var e,c,f,j,g=b.object,h=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=h.materials.length;e<c;e++)(j=h.materials[e])&&(j.transparent?o(m,j):o(k,j))}else(j=e)&&(j.transparent?o(m,j):o(k,j))}function u(b,e){return e.z-b.z}function y(b,c){var m,u,o,t=0,v,y,w,x,z=b.lights;ha||(ha=new THREE.Camera(P.shadowCameraFov,
+c.aspect,P.shadowCameraNear,P.shadowCameraFar));m=0;for(u=z.length;m<u;m++)if(o=z[m],o instanceof THREE.SpotLight&&o.castShadow){P.shadowMap[t]||(P.shadowMap[t]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ra[t]||(ra[t]=new THREE.Matrix4);v=P.shadowMap[t];y=ra[t];ha.position.copy(o.position);ha.target.position.copy(o.target.position);ha.update(void 0,!0);b.update(void 0,!1,ha);y.set(0.5,0,0,0.5,
+0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ha.projectionMatrix);y.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(va);ha.projectionMatrix.flattenToArray(qa);ia.multiply(ha.projectionMatrix,ha.matrixWorldInverse);n(ia);P.initWebGLObjects(b);T(v);k.clearColor(1,1,1,1);P.clear();k.clearColor(na.r,na.g,na.b,ua);y=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<y;v++)w=b.__webglObjects[v],x=w.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||
+p(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),H(x,ha,!1),w.render=!0):w.render=!1:w.render=!1;g(!0);I(THREE.NormalBlending);for(v=0;v<y;v++)if(w=b.__webglObjects[v],w.render)x=w.object,buffer=w.buffer,j(x),w=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?pa:Ba,f(ha,z,null,w,buffer,x);for(v=0;v<o;v++)w=b.__webglObjectsImmediate[v],x=w.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),H(x,ha,!1),j(x),program=
+e(ha,z,null,Ba,x),x.render(function(b){h(b,program,Ba.shading)}));t++}}function z(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,j=b.lights,g=[],h,m,n,p,u,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(u=0;u<o;u++)f=b.__webglShadowVolumes[u].object,h=b.__webglShadowVolumes[u].buffer,m=f.materials[0],m.program||P.initMaterial(m,j,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,X!==m&&(k.useProgram(m),X=m,k.uniformMatrix4fv(n.projectionMatrix,!1,qa),k.uniformMatrix4fv(n.viewMatrix,!1,va),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),
 k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(p.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(p.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,h.__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);M=fa=-1;X=Z.program;k.useProgram(Z.program);k.uniformMatrix4fv(Z.projectionLocation,!1,sa);k.uniform1f(Z.darknessLocation,Z.darkness);k.bindBuffer(k.ARRAY_BUFFER,Z.vertexBuffer);k.vertexAttribPointer(Z.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Z.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,
-0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function x(b,e){var c,f,j;c=N.attributes;var g=N.uniforms,h=T/la,m,n=[],p=la*0.5,t=T*0.5,o=!0;k.useProgram(N.program);X=N.program;M=fa=-1;za||(k.enableVertexAttribArray(N.attributes.position),k.enableVertexAttribArray(N.attributes.uv),za=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,N.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,N.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,sa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&
-j.map.image.width&&(j.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(j.position.x-p)/p,(t-j.position.y)/t,Math.max(0,Math.min(1,j.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,j.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?T:1),n[0]=m*h*j.scale.x,n[1]=m*j.scale.y,k.uniform2f(g.uvScale,j.uvScale.x,j.uvScale.y),k.uniform2f(g.uvOffset,
-j.uvOffset.x,j.uvOffset.y),k.uniform2f(g.alignment,j.alignment.x,j.alignment.y),k.uniform1f(g.opacity,j.opacity),k.uniform1f(g.rotation,j.rotation),k.uniform2fv(g.scale,n),j.mergeWith3D&&!o?(k.enable(k.DEPTH_TEST),o=!0):!j.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),I(j.blending),da(j.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function A(b,e){var c,f,j=b.__webglLensFlares.length,g,h,m,n=new THREE.Vector3,p=T/la,t=la*0.5,
-o=T*0.5,u=16/T,v=[u*p,u],A=[1,1,0],w=[1,1],x=Q.uniforms;c=Q.attributes;k.useProgram(Q.program);X=Q.program;M=fa=-1;va||(k.enableVertexAttribArray(Q.attributes.vertex),k.enableVertexAttribArray(Q.attributes.uv),va=!0);k.uniform1i(x.occlusionMap,0);k.uniform1i(x.map,1);k.bindBuffer(k.ARRAY_BUFFER,Q.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,Q.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);
-k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<j;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),A[0]=n.x,A[1]=n.y,A[2]=n.z,w[0]=A[0]*t+t,w[1]=A[1]*o+o,Q.hasVertexTexture||w[0]>0&&w[0]<la&&w[1]>0&&w[1]<T){k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,
-0);k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,A);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=A[0];c.positionScreen.y=A[1];c.positionScreen.z=A[2];c.customUpdateCallback?c.customUpdateCallback(c):
-c.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);g=0;for(h=c.lensFlares.length;g<h;g++)if(m=c.lensFlares[g],m.opacity>0.001&&m.scale>0.001)A[0]=m.x,A[1]=m.y,A[2]=m.z,u=m.size*m.scale/T,v[0]=u*p,v[1]=u,k.uniform3fv(x.screenPosition,A),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),da(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
-b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function F(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b){var e,f,j,g;if(b instanceof THREE.Mesh){f=b.geometry;
-for(e in f.geometryGroups)if(j=f.geometryGroups[e],g=F(j),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=j;var h=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,t=void 0,o=void 0,u=t=void 0,v=void 0,A=void 0,w=void 0,x=void 0,B=void 0,E=void 0,D=void 0,la=void 0,C=void 0,G=void 0,I=void 0,T=void 0,H=o=w=o=A=v=void 0,y=void 0,z=y=H=v=void 0,K=void 0,O=z=y=H=t=t=u=w=o=z=y=H=K=z=y=H=K=z=y=H=void 0,M=
-0,ga=0,W=0,V=0,Y=0,Q=0,N=0,S=0,ia=0,L=0,P=0,z=H=0,z=void 0,R=g.__vertexArray,da=g.__uvArray,ea=g.__uv2Array,ja=g.__normalArray,U=g.__tangentArray,$=g.__colorArray,X=g.__skinVertexAArray,Z=g.__skinVertexBArray,fa=g.__skinIndexArray,ca=g.__skinWeightArray,ma=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,y=void 0,sa=g.__faceArray,ka=g.__lineArray,pa=g.__needsSmoothNormals,B=g.__vertexColorType,x=g.__uvType,E=g.__normalType,na=h.geometry,qa=na.__dirtyVertices,ra=na.__dirtyElements,xa=na.__dirtyUvs,
-ta=na.__dirtyNormals,ua=na.__dirtyTangents,wa=na.__dirtyColors,Aa=na.__dirtyMorphTargets,va=na.vertices,Ba=g.faces,Da=na.faces,Ha=na.faceVertexUvs[0],Ea=na.faceVertexUvs[1],ya=na.skinVerticesA,za=na.skinVerticesB,Na=na.skinIndices,Ga=na.skinWeights,La=h instanceof THREE.ShadowVolume?na.edgeFaces:void 0,Fa=na.morphTargets;if(ha)for(O in ha)ha[O].offset=0,ha[O].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(t=Ba[n],o=Da[t],Ha&&(D=Ha[t]),Ea&&(la=Ea[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,A=o.color,
-w=o.vertexTangents,o instanceof THREE.Face3){if(qa)C=va[o.a].position,G=va[o.b].position,I=va[o.c].position,R[ga]=C.x,R[ga+1]=C.y,R[ga+2]=C.z,R[ga+3]=G.x,R[ga+4]=G.y,R[ga+5]=G.z,R[ga+6]=I.x,R[ga+7]=I.y,R[ga+8]=I.z,ga+=9;if(ha)for(O in ha)if(y=ha[O],y.__original.needsUpdate)H=y.offset,z=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[H]=y.value[o.a],y.array[H+1]=y.value[o.b],y.array[H+2]=y.value[o.c]):y.boundTo==="faces"?(z=y.value[z],y.array[H]=z,y.array[H+1]=z,y.array[H+
-2]=z,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[H]=y.value[z],y.array[H+1]=y.value[z+1],y.array[H+2]=y.value[z+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[o.a],G=y.value[o.b],I=y.value[o.c]):y.boundTo==="faces"?(I=G=C=z=y.value[z],y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[z],G=y.value[z+1],I=y.value[z+2],y.offsetSrc+=3),y.size===2?(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=G.x,y.array[H+3]=G.y,y.array[H+4]=I.x,y.array[H+5]=I.y,y.offset+=
-6):y.size===3?(y.type==="c"?(y.array[H]=C.r,y.array[H+1]=C.g,y.array[H+2]=C.b,y.array[H+3]=G.r,y.array[H+4]=G.g,y.array[H+5]=G.b,y.array[H+6]=I.r,y.array[H+7]=I.g,y.array[H+8]=I.b):(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=C.z,y.array[H+3]=G.x,y.array[H+4]=G.y,y.array[H+5]=G.z,y.array[H+6]=I.x,y.array[H+7]=I.y,y.array[H+8]=I.z),y.offset+=9):(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=C.z,y.array[H+3]=C.w,y.array[H+4]=G.x,y.array[H+5]=G.y,y.array[H+6]=G.z,y.array[H+7]=G.w,y.array[H+8]=I.x,y.array[H+
-9]=I.y,y.array[H+10]=I.z,y.array[H+11]=I.w,y.offset+=12));if(Aa){H=0;for(y=Fa.length;H<y;H++)C=Fa[H].vertices[o.a].position,G=Fa[H].vertices[o.b].position,I=Fa[H].vertices[o.c].position,z=ma[H],z[P]=C.x,z[P+1]=C.y,z[P+2]=C.z,z[P+3]=G.x,z[P+4]=G.y,z[P+5]=G.z,z[P+6]=I.x,z[P+7]=I.y,z[P+8]=I.z;P+=9}if(Ga.length)H=Ga[o.a],y=Ga[o.b],z=Ga[o.c],ca[L]=H.x,ca[L+1]=H.y,ca[L+2]=H.z,ca[L+3]=H.w,ca[L+4]=y.x,ca[L+5]=y.y,ca[L+6]=y.z,ca[L+7]=y.w,ca[L+8]=z.x,ca[L+9]=z.y,ca[L+10]=z.z,ca[L+11]=z.w,H=Na[o.a],y=Na[o.b],
-z=Na[o.c],fa[L]=H.x,fa[L+1]=H.y,fa[L+2]=H.z,fa[L+3]=H.w,fa[L+4]=y.x,fa[L+5]=y.y,fa[L+6]=y.z,fa[L+7]=y.w,fa[L+8]=z.x,fa[L+9]=z.y,fa[L+10]=z.z,fa[L+11]=z.w,H=ya[o.a],y=ya[o.b],z=ya[o.c],X[L]=H.x,X[L+1]=H.y,X[L+2]=H.z,X[L+3]=1,X[L+4]=y.x,X[L+5]=y.y,X[L+6]=y.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,H=za[o.a],y=za[o.b],z=za[o.c],Z[L]=H.x,Z[L+1]=H.y,Z[L+2]=H.z,Z[L+3]=1,Z[L+4]=y.x,Z[L+5]=y.y,Z[L+6]=y.z,Z[L+7]=1,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=1,L+=12;if(wa&&B)v.length==3&&B==THREE.VertexColors?
-(o=v[0],H=v[1],y=v[2]):y=H=o=A,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=H.r,$[ia+4]=H.g,$[ia+5]=H.b,$[ia+6]=y.r,$[ia+7]=y.g,$[ia+8]=y.b,ia+=9;if(ua&&na.hasTangents)v=w[0],A=w[1],o=w[2],U[N]=v.x,U[N+1]=v.y,U[N+2]=v.z,U[N+3]=v.w,U[N+4]=A.x,U[N+5]=A.y,U[N+6]=A.z,U[N+7]=A.w,U[N+8]=o.x,U[N+9]=o.y,U[N+10]=o.z,U[N+11]=o.w,N+=12;if(ta&&E)if(t.length==3&&pa)for(w=0;w<3;w++)u=t[w],ja[Q]=u.x,ja[Q+1]=u.y,ja[Q+2]=u.z,Q+=3;else for(w=0;w<3;w++)ja[Q]=u.x,ja[Q+1]=u.y,ja[Q+2]=u.z,Q+=3;if(xa&&D!==void 0&&x)for(w=
-0;w<3;w++)t=D[w],da[W]=t.u,da[W+1]=t.v,W+=2;if(xa&&la!==void 0&&x)for(w=0;w<3;w++)t=la[w],ea[V]=t.u,ea[V+1]=t.v,V+=2;ra&&(sa[Y]=M,sa[Y+1]=M+1,sa[Y+2]=M+2,Y+=3,ka[S]=M,ka[S+1]=M+1,ka[S+2]=M,ka[S+3]=M+2,ka[S+4]=M+1,ka[S+5]=M+2,S+=6,M+=3)}else if(o instanceof THREE.Face4){if(qa)C=va[o.a].position,G=va[o.b].position,I=va[o.c].position,T=va[o.d].position,R[ga]=C.x,R[ga+1]=C.y,R[ga+2]=C.z,R[ga+3]=G.x,R[ga+4]=G.y,R[ga+5]=G.z,R[ga+6]=I.x,R[ga+7]=I.y,R[ga+8]=I.z,R[ga+9]=T.x,R[ga+10]=T.y,R[ga+11]=T.z,ga+=12;
-if(ha)for(O in ha)if(y=ha[O],y.__original.needsUpdate)H=y.offset,z=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[H]=y.value[o.a],y.array[H+1]=y.value[o.b],y.array[H+2]=y.value[o.c],y.array[H+3]=y.value[o.d]):y.boundTo==="faces"?(z=y.value[z],y.array[H]=z,y.array[H+1]=z,y.array[H+2]=z,y.array[H+3]=z,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[H]=y.value[z],y.array[H+1]=y.value[z+1],y.array[H+2]=y.value[z+2],y.array[H+3]=y.value[z+3],y.offsetSrc+=4),y.offset+=4):
-(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[o.a],G=y.value[o.b],I=y.value[o.c],T=y.value[o.d]):y.boundTo==="faces"?(T=I=G=C=z=y.value[z],y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[z],G=y.value[z+1],I=y.value[z+2],T=y.value[z+3],y.offsetSrc+=4),y.size===2?(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=G.x,y.array[H+3]=G.y,y.array[H+4]=I.x,y.array[H+5]=I.y,y.array[H+6]=T.x,y.array[H+7]=T.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[H]=C.r,y.array[H+1]=C.g,y.array[H+2]=C.b,y.array[H+
-3]=G.r,y.array[H+4]=G.g,y.array[H+5]=G.b,y.array[H+6]=I.r,y.array[H+7]=I.g,y.array[H+8]=I.b,y.array[H+9]=T.r,y.array[H+10]=T.g,y.array[H+11]=T.b):(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=C.z,y.array[H+3]=G.x,y.array[H+4]=G.y,y.array[H+5]=G.z,y.array[H+6]=I.x,y.array[H+7]=I.y,y.array[H+8]=I.z,y.array[H+9]=T.x,y.array[H+10]=T.y,y.array[H+11]=T.z),y.offset+=12):(y.array[H]=C.x,y.array[H+1]=C.y,y.array[H+2]=C.z,y.array[H+3]=C.w,y.array[H+4]=G.x,y.array[H+5]=G.y,y.array[H+6]=G.z,y.array[H+7]=G.w,
-y.array[H+8]=I.x,y.array[H+9]=I.y,y.array[H+10]=I.z,y.array[H+11]=I.w,y.array[H+12]=T.x,y.array[H+13]=T.y,y.array[H+14]=T.z,y.array[H+15]=T.w,y.offset+=16));if(Aa){H=0;for(y=Fa.length;H<y;H++)C=Fa[H].vertices[o.a].position,G=Fa[H].vertices[o.b].position,I=Fa[H].vertices[o.c].position,T=Fa[H].vertices[o.d].position,z=ma[H],z[P]=C.x,z[P+1]=C.y,z[P+2]=C.z,z[P+3]=G.x,z[P+4]=G.y,z[P+5]=G.z,z[P+6]=I.x,z[P+7]=I.y,z[P+8]=I.z,z[P+9]=T.x,z[P+10]=T.y,z[P+11]=T.z;P+=12}if(Ga.length)H=Ga[o.a],y=Ga[o.b],z=Ga[o.c],
-K=Ga[o.d],ca[L]=H.x,ca[L+1]=H.y,ca[L+2]=H.z,ca[L+3]=H.w,ca[L+4]=y.x,ca[L+5]=y.y,ca[L+6]=y.z,ca[L+7]=y.w,ca[L+8]=z.x,ca[L+9]=z.y,ca[L+10]=z.z,ca[L+11]=z.w,ca[L+12]=K.x,ca[L+13]=K.y,ca[L+14]=K.z,ca[L+15]=K.w,H=Na[o.a],y=Na[o.b],z=Na[o.c],K=Na[o.d],fa[L]=H.x,fa[L+1]=H.y,fa[L+2]=H.z,fa[L+3]=H.w,fa[L+4]=y.x,fa[L+5]=y.y,fa[L+6]=y.z,fa[L+7]=y.w,fa[L+8]=z.x,fa[L+9]=z.y,fa[L+10]=z.z,fa[L+11]=z.w,fa[L+12]=K.x,fa[L+13]=K.y,fa[L+14]=K.z,fa[L+15]=K.w,H=ya[o.a],y=ya[o.b],z=ya[o.c],K=ya[o.d],X[L]=H.x,X[L+1]=H.y,
-X[L+2]=H.z,X[L+3]=1,X[L+4]=y.x,X[L+5]=y.y,X[L+6]=y.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,X[L+12]=K.x,X[L+13]=K.y,X[L+14]=K.z,X[L+15]=1,H=za[o.a],y=za[o.b],z=za[o.c],o=za[o.d],Z[L]=H.x,Z[L+1]=H.y,Z[L+2]=H.z,Z[L+3]=1,Z[L+4]=y.x,Z[L+5]=y.y,Z[L+6]=y.z,Z[L+7]=1,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=1,Z[L+12]=o.x,Z[L+13]=o.y,Z[L+14]=o.z,Z[L+15]=1,L+=16;if(wa&&B)v.length==4&&B==THREE.VertexColors?(o=v[0],H=v[1],y=v[2],v=v[3]):v=y=H=o=A,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=H.r,$[ia+
-4]=H.g,$[ia+5]=H.b,$[ia+6]=y.r,$[ia+7]=y.g,$[ia+8]=y.b,$[ia+9]=v.r,$[ia+10]=v.g,$[ia+11]=v.b,ia+=12;if(ua&&na.hasTangents)v=w[0],A=w[1],o=w[2],w=w[3],U[N]=v.x,U[N+1]=v.y,U[N+2]=v.z,U[N+3]=v.w,U[N+4]=A.x,U[N+5]=A.y,U[N+6]=A.z,U[N+7]=A.w,U[N+8]=o.x,U[N+9]=o.y,U[N+10]=o.z,U[N+11]=o.w,U[N+12]=w.x,U[N+13]=w.y,U[N+14]=w.z,U[N+15]=w.w,N+=16;if(ta&&E)if(t.length==4&&pa)for(w=0;w<4;w++)u=t[w],ja[Q]=u.x,ja[Q+1]=u.y,ja[Q+2]=u.z,Q+=3;else for(w=0;w<4;w++)ja[Q]=u.x,ja[Q+1]=u.y,ja[Q+2]=u.z,Q+=3;if(xa&&D!==void 0&&
-x)for(w=0;w<4;w++)t=D[w],da[W]=t.u,da[W+1]=t.v,W+=2;if(xa&&la!==void 0&&x)for(w=0;w<4;w++)t=la[w],ea[V]=t.u,ea[V+1]=t.v,V+=2;ra&&(sa[Y]=M,sa[Y+1]=M+1,sa[Y+2]=M+3,sa[Y+3]=M+1,sa[Y+4]=M+2,sa[Y+5]=M+3,Y+=6,ka[S]=M,ka[S+1]=M+1,ka[S+2]=M,ka[S+3]=M+3,ka[S+4]=M+1,ka[S+5]=M+2,ka[S+6]=M+2,ka[S+7]=M+3,S+=8,M+=4)}if(La){n=0;for(p=La.length;n<p;n++)sa[Y]=La[n].a,sa[Y+1]=La[n].b,sa[Y+2]=La[n].c,sa[Y+3]=La[n].a,sa[Y+4]=La[n].c,sa[Y+5]=La[n].d,Y+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,
-R,m));if(ha)for(O in ha)y=ha[O],y.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,y.buffer),k.bufferData(k.ARRAY_BUFFER,y.array,m));if(Aa){H=0;for(y=Fa.length;H<y;H++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[H]),k.bufferData(k.ARRAY_BUFFER,ma[H],m)}wa&&ia>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ja,m));ua&&na.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,
-g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,U,m));xa&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));xa&&V>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ea,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,sa,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ka,m));L>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),
-k.bufferData(k.ARRAY_BUFFER,X,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m));h.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;J(j)}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;B=x.length;h=g.length;E=b.__vertexArray;m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)p=
-x[n].position,j=n*3,E[j]=p.x,E[j+1]=p.y,E[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+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;B=x.length;h=g.length;E=b.__vertexArray;
-m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)p=x[n].position,j=n*3,E[j]=p.x,E[j+1]=p.y,E[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+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,J(f)}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,j,h,k,m,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(j=b.faces.length;g<j;g++)h=b.faces[g],k=h.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),n=
-o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=h}function D(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function I(b){if(b!=fa){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)}fa=b}}function V(b,e,c){(c.width&
-c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,R(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,R(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,R(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,R(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,ea(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,ea(e.minFilter)))}function da(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
-k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,R(b.format),b.image.width,b.image.height,0,R(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);V(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 S(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,R(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,R(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,R(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,R(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,R(b.format),
-b.width,b.height,0,R(b.format),R(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=la,b=T);e!=$&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ka,na,c,b),$=e)}function z(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 ea(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function R(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
+0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);M=ea=-1;X=Z.program;k.useProgram(Z.program);k.uniformMatrix4fv(Z.projectionLocation,!1,qa);k.uniform1f(Z.darknessLocation,Z.darkness);k.bindBuffer(k.ARRAY_BUFFER,Z.vertexBuffer);k.vertexAttribPointer(Z.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Z.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,
+0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function x(b,e){var c,f,j;c=N.attributes;var g=N.uniforms,h=U/la,m,n=[],p=la*0.5,o=U*0.5,t=!0;k.useProgram(N.program);X=N.program;M=ea=-1;Wa||(k.enableVertexAttribArray(N.attributes.position),k.enableVertexAttribArray(N.attributes.uv),Wa=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,N.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,N.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,qa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&
+j.map.image.width&&(j.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(j.position.x-p)/p,(o-j.position.y)/o,Math.max(0,Math.min(1,j.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,j.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?U:1),n[0]=m*h*j.scale.x,n[1]=m*j.scale.y,k.uniform2f(g.uvScale,j.uvScale.x,j.uvScale.y),k.uniform2f(g.uvOffset,
+j.uvOffset.x,j.uvOffset.y),k.uniform2f(g.alignment,j.alignment.x,j.alignment.y),k.uniform1f(g.opacity,j.opacity),k.uniform1f(g.rotation,j.rotation),k.uniform2fv(g.scale,n),j.mergeWith3D&&!t?(k.enable(k.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(k.disable(k.DEPTH_TEST),t=!1),I(j.blending),ca(j.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function w(b,e){var c,f,j=b.__webglLensFlares.length,g,h,m,n=new THREE.Vector3,p=U/la,u=la*0.5,
+o=U*0.5,t=16/U,v=[t*p,t],y=[1,1,0],w=[1,1],x=Q.uniforms;c=Q.attributes;k.useProgram(Q.program);X=Q.program;M=ea=-1;Ea||(k.enableVertexAttribArray(Q.attributes.vertex),k.enableVertexAttribArray(Q.attributes.uv),Ea=!0);k.uniform1i(x.occlusionMap,0);k.uniform1i(x.map,1);k.bindBuffer(k.ARRAY_BUFFER,Q.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,Q.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);
+k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<j;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),y[0]=n.x,y[1]=n.y,y[2]=n.z,w[0]=y[0]*u+u,w[1]=y[1]*o+o,Q.hasVertexTexture||w[0]>0&&w[0]<la&&w[1]>0&&w[1]<U){k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,
+0);k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=y[0];c.positionScreen.y=y[1];c.positionScreen.z=y[2];c.customUpdateCallback?c.customUpdateCallback(c):
+c.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);g=0;for(h=c.lensFlares.length;g<h;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)y[0]=m.x,y[1]=m.y,y[2]=m.z,t=m.size*m.scale/U,v[0]=t*p,v[1]=t,k.uniform3fv(x.screenPosition,y),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),ca(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function H(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
+b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b){var e,f,j,g;if(b instanceof THREE.Mesh){f=b.geometry;
+for(e in f.geometryGroups)if(j=f.geometryGroups[e],g=B(j),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=j;var h=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,u=void 0,o=void 0,t=u=void 0,v=void 0,y=void 0,w=void 0,x=void 0,z=void 0,H=void 0,F=void 0,la=void 0,C=void 0,G=void 0,I=void 0,U=void 0,E=o=w=o=y=v=void 0,A=void 0,D=A=E=v=void 0,K=void 0,O=D=A=E=u=u=t=w=o=D=A=E=K=D=A=E=K=D=A=E=void 0,M=
+0,fa=0,W=0,Q=0,R=0,Y=0,N=0,T=0,ia=0,L=0,P=0,D=E=0,D=void 0,S=g.__vertexArray,ca=g.__uvArray,da=g.__uv2Array,ja=g.__normalArray,V=g.__tangentArray,$=g.__colorArray,X=g.__skinVertexAArray,ea=g.__skinVertexBArray,aa=g.__skinIndexArray,Z=g.__skinWeightArray,ma=g.__morphTargetsArrays,ga=g.__webglCustomAttributes,A=void 0,qa=g.__faceArray,ka=g.__lineArray,na=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,H=g.__normalType,ha=h.geometry,sa=ha.__dirtyVertices,pa=ha.__dirtyElements,va=ha.__dirtyUvs,
+ra=ha.__dirtyNormals,za=ha.__dirtyTangents,ta=ha.__dirtyColors,ya=ha.__dirtyMorphTargets,ua=ha.vertices,Ba=g.faces,La=ha.faces,Da=ha.faceVertexUvs[0],Ea=ha.faceVertexUvs[1],wa=ha.skinVerticesA,xa=ha.skinVerticesB,Na=ha.skinIndices,Ga=ha.skinWeights,Ka=h instanceof THREE.ShadowVolume?ha.edgeFaces:void 0,Fa=ha.morphTargets;if(ga)for(O in ga)ga[O].offset=0,ga[O].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(u=Ba[n],o=La[u],Da&&(F=Da[u]),Ea&&(la=Ea[u]),u=o.vertexNormals,t=o.normal,v=o.vertexColors,y=o.color,
+w=o.vertexTangents,o instanceof THREE.Face3){if(sa)C=ua[o.a].position,G=ua[o.b].position,I=ua[o.c].position,S[fa]=C.x,S[fa+1]=C.y,S[fa+2]=C.z,S[fa+3]=G.x,S[fa+4]=G.y,S[fa+5]=G.z,S[fa+6]=I.x,S[fa+7]=I.y,S[fa+8]=I.z,fa+=9;if(ga)for(O in ga)if(A=ga[O],A.__original.needsUpdate)E=A.offset,D=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c]):A.boundTo==="faces"?(D=A.value[D],A.array[E]=D,A.array[E+1]=D,A.array[E+
+2]=D,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[D],A.array[E+1]=A.value[D+1],A.array[E+2]=A.value[D+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(C=A.value[o.a],G=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=G=C=D=A.value[D],A.offsetSrc++):A.boundTo==="faceVertices"&&(C=A.value[D],G=A.value[D+1],I=A.value[D+2],A.offsetSrc+=3),A.size===2?(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=G.x,A.array[E+3]=G.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.offset+=
+6):A.size===3?(A.type==="c"?(A.array[E]=C.r,A.array[E+1]=C.g,A.array[E+2]=C.b,A.array[E+3]=G.r,A.array[E+4]=G.g,A.array[E+5]=G.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=G.x,A.array[E+4]=G.y,A.array[E+5]=G.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z),A.offset+=9):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=C.w,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=G.z,A.array[E+7]=G.w,A.array[E+8]=I.x,A.array[E+
+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.offset+=12));if(ya){E=0;for(A=Fa.length;E<A;E++)C=Fa[E].vertices[o.a].position,G=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,D=ma[E],D[P]=C.x,D[P+1]=C.y,D[P+2]=C.z,D[P+3]=G.x,D[P+4]=G.y,D[P+5]=G.z,D[P+6]=I.x,D[P+7]=I.y,D[P+8]=I.z;P+=9}if(Ga.length)E=Ga[o.a],A=Ga[o.b],D=Ga[o.c],Z[L]=E.x,Z[L+1]=E.y,Z[L+2]=E.z,Z[L+3]=E.w,Z[L+4]=A.x,Z[L+5]=A.y,Z[L+6]=A.z,Z[L+7]=A.w,Z[L+8]=D.x,Z[L+9]=D.y,Z[L+10]=D.z,Z[L+11]=D.w,E=Na[o.a],A=Na[o.b],D=Na[o.c],
+aa[L]=E.x,aa[L+1]=E.y,aa[L+2]=E.z,aa[L+3]=E.w,aa[L+4]=A.x,aa[L+5]=A.y,aa[L+6]=A.z,aa[L+7]=A.w,aa[L+8]=D.x,aa[L+9]=D.y,aa[L+10]=D.z,aa[L+11]=D.w,E=wa[o.a],A=wa[o.b],D=wa[o.c],X[L]=E.x,X[L+1]=E.y,X[L+2]=E.z,X[L+3]=1,X[L+4]=A.x,X[L+5]=A.y,X[L+6]=A.z,X[L+7]=1,X[L+8]=D.x,X[L+9]=D.y,X[L+10]=D.z,X[L+11]=1,E=xa[o.a],A=xa[o.b],D=xa[o.c],ea[L]=E.x,ea[L+1]=E.y,ea[L+2]=E.z,ea[L+3]=1,ea[L+4]=A.x,ea[L+5]=A.y,ea[L+6]=A.z,ea[L+7]=1,ea[L+8]=D.x,ea[L+9]=D.y,ea[L+10]=D.z,ea[L+11]=1,L+=12;if(ta&&z)v.length==3&&z==THREE.VertexColors?
+(o=v[0],E=v[1],A=v[2]):A=E=o=y,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=E.r,$[ia+4]=E.g,$[ia+5]=E.b,$[ia+6]=A.r,$[ia+7]=A.g,$[ia+8]=A.b,ia+=9;if(za&&ha.hasTangents)v=w[0],y=w[1],o=w[2],V[N]=v.x,V[N+1]=v.y,V[N+2]=v.z,V[N+3]=v.w,V[N+4]=y.x,V[N+5]=y.y,V[N+6]=y.z,V[N+7]=y.w,V[N+8]=o.x,V[N+9]=o.y,V[N+10]=o.z,V[N+11]=o.w,N+=12;if(ra&&H)if(u.length==3&&na)for(w=0;w<3;w++)t=u[w],ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;else for(w=0;w<3;w++)ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;if(va&&F!==void 0&&x)for(w=
+0;w<3;w++)u=F[w],ca[W]=u.u,ca[W+1]=u.v,W+=2;if(va&&la!==void 0&&x)for(w=0;w<3;w++)u=la[w],da[Q]=u.u,da[Q+1]=u.v,Q+=2;pa&&(qa[R]=M,qa[R+1]=M+1,qa[R+2]=M+2,R+=3,ka[T]=M,ka[T+1]=M+1,ka[T+2]=M,ka[T+3]=M+2,ka[T+4]=M+1,ka[T+5]=M+2,T+=6,M+=3)}else if(o instanceof THREE.Face4){if(sa)C=ua[o.a].position,G=ua[o.b].position,I=ua[o.c].position,U=ua[o.d].position,S[fa]=C.x,S[fa+1]=C.y,S[fa+2]=C.z,S[fa+3]=G.x,S[fa+4]=G.y,S[fa+5]=G.z,S[fa+6]=I.x,S[fa+7]=I.y,S[fa+8]=I.z,S[fa+9]=U.x,S[fa+10]=U.y,S[fa+11]=U.z,fa+=12;
+if(ga)for(O in ga)if(A=ga[O],A.__original.needsUpdate)E=A.offset,D=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c],A.array[E+3]=A.value[o.d]):A.boundTo==="faces"?(D=A.value[D],A.array[E]=D,A.array[E+1]=D,A.array[E+2]=D,A.array[E+3]=D,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[D],A.array[E+1]=A.value[D+1],A.array[E+2]=A.value[D+2],A.array[E+3]=A.value[D+3],A.offsetSrc+=4),A.offset+=4):
+(A.boundTo===void 0||A.boundTo==="vertices"?(C=A.value[o.a],G=A.value[o.b],I=A.value[o.c],U=A.value[o.d]):A.boundTo==="faces"?(U=I=G=C=D=A.value[D],A.offsetSrc++):A.boundTo==="faceVertices"&&(C=A.value[D],G=A.value[D+1],I=A.value[D+2],U=A.value[D+3],A.offsetSrc+=4),A.size===2?(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=G.x,A.array[E+3]=G.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.array[E+6]=U.x,A.array[E+7]=U.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E]=C.r,A.array[E+1]=C.g,A.array[E+2]=C.b,A.array[E+
+3]=G.r,A.array[E+4]=G.g,A.array[E+5]=G.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b,A.array[E+9]=U.r,A.array[E+10]=U.g,A.array[E+11]=U.b):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=G.x,A.array[E+4]=G.y,A.array[E+5]=G.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z,A.array[E+9]=U.x,A.array[E+10]=U.y,A.array[E+11]=U.z),A.offset+=12):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=C.w,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=G.z,A.array[E+7]=G.w,
+A.array[E+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.array[E+12]=U.x,A.array[E+13]=U.y,A.array[E+14]=U.z,A.array[E+15]=U.w,A.offset+=16));if(ya){E=0;for(A=Fa.length;E<A;E++)C=Fa[E].vertices[o.a].position,G=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,U=Fa[E].vertices[o.d].position,D=ma[E],D[P]=C.x,D[P+1]=C.y,D[P+2]=C.z,D[P+3]=G.x,D[P+4]=G.y,D[P+5]=G.z,D[P+6]=I.x,D[P+7]=I.y,D[P+8]=I.z,D[P+9]=U.x,D[P+10]=U.y,D[P+11]=U.z;P+=12}if(Ga.length)E=Ga[o.a],A=Ga[o.b],D=Ga[o.c],
+K=Ga[o.d],Z[L]=E.x,Z[L+1]=E.y,Z[L+2]=E.z,Z[L+3]=E.w,Z[L+4]=A.x,Z[L+5]=A.y,Z[L+6]=A.z,Z[L+7]=A.w,Z[L+8]=D.x,Z[L+9]=D.y,Z[L+10]=D.z,Z[L+11]=D.w,Z[L+12]=K.x,Z[L+13]=K.y,Z[L+14]=K.z,Z[L+15]=K.w,E=Na[o.a],A=Na[o.b],D=Na[o.c],K=Na[o.d],aa[L]=E.x,aa[L+1]=E.y,aa[L+2]=E.z,aa[L+3]=E.w,aa[L+4]=A.x,aa[L+5]=A.y,aa[L+6]=A.z,aa[L+7]=A.w,aa[L+8]=D.x,aa[L+9]=D.y,aa[L+10]=D.z,aa[L+11]=D.w,aa[L+12]=K.x,aa[L+13]=K.y,aa[L+14]=K.z,aa[L+15]=K.w,E=wa[o.a],A=wa[o.b],D=wa[o.c],K=wa[o.d],X[L]=E.x,X[L+1]=E.y,X[L+2]=E.z,X[L+
+3]=1,X[L+4]=A.x,X[L+5]=A.y,X[L+6]=A.z,X[L+7]=1,X[L+8]=D.x,X[L+9]=D.y,X[L+10]=D.z,X[L+11]=1,X[L+12]=K.x,X[L+13]=K.y,X[L+14]=K.z,X[L+15]=1,E=xa[o.a],A=xa[o.b],D=xa[o.c],o=xa[o.d],ea[L]=E.x,ea[L+1]=E.y,ea[L+2]=E.z,ea[L+3]=1,ea[L+4]=A.x,ea[L+5]=A.y,ea[L+6]=A.z,ea[L+7]=1,ea[L+8]=D.x,ea[L+9]=D.y,ea[L+10]=D.z,ea[L+11]=1,ea[L+12]=o.x,ea[L+13]=o.y,ea[L+14]=o.z,ea[L+15]=1,L+=16;if(ta&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2],v=v[3]):v=A=E=o=y,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=E.r,
+$[ia+4]=E.g,$[ia+5]=E.b,$[ia+6]=A.r,$[ia+7]=A.g,$[ia+8]=A.b,$[ia+9]=v.r,$[ia+10]=v.g,$[ia+11]=v.b,ia+=12;if(za&&ha.hasTangents)v=w[0],y=w[1],o=w[2],w=w[3],V[N]=v.x,V[N+1]=v.y,V[N+2]=v.z,V[N+3]=v.w,V[N+4]=y.x,V[N+5]=y.y,V[N+6]=y.z,V[N+7]=y.w,V[N+8]=o.x,V[N+9]=o.y,V[N+10]=o.z,V[N+11]=o.w,V[N+12]=w.x,V[N+13]=w.y,V[N+14]=w.z,V[N+15]=w.w,N+=16;if(ra&&H)if(u.length==4&&na)for(w=0;w<4;w++)t=u[w],ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;else for(w=0;w<4;w++)ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;if(va&&F!==
+void 0&&x)for(w=0;w<4;w++)u=F[w],ca[W]=u.u,ca[W+1]=u.v,W+=2;if(va&&la!==void 0&&x)for(w=0;w<4;w++)u=la[w],da[Q]=u.u,da[Q+1]=u.v,Q+=2;pa&&(qa[R]=M,qa[R+1]=M+1,qa[R+2]=M+3,qa[R+3]=M+1,qa[R+4]=M+2,qa[R+5]=M+3,R+=6,ka[T]=M,ka[T+1]=M+1,ka[T+2]=M,ka[T+3]=M+3,ka[T+4]=M+1,ka[T+5]=M+2,ka[T+6]=M+2,ka[T+7]=M+3,T+=8,M+=4)}if(Ka){n=0;for(p=Ka.length;n<p;n++)qa[R]=Ka[n].a,qa[R+1]=Ka[n].b,qa[R+2]=Ka[n].c,qa[R+3]=Ka[n].a,qa[R+4]=Ka[n].c,qa[R+5]=Ka[n].d,R+=6}sa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),
+k.bufferData(k.ARRAY_BUFFER,S,m));if(ga)for(O in ga)A=ga[O],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(ya){E=0;for(A=Fa.length;E<A;E++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,ma[E],m)}ta&&ia>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));ra&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ja,m));za&&ha.hasTangents&&
+(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,V,m));va&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m));va&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));pa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,qa,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ka,m));L>0&&(k.bindBuffer(k.ARRAY_BUFFER,
+g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,X,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));h.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;J(j)}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;h=g.length;H=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(n=
+0;n<z;n++)p=x[n].position,j=n*3,H[j]=p.x,H[j+1]=p.y,H[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(F){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+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;h=g.length;
+H=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)p=x[n].position,j=n*3,H[j]=p.x,H[j+1]=p.y,H[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(F){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+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=B(f),(f.__dirtyVertices||
+f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,J(f)}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,j,h,k,m,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(j=b.faces.length;g<j;g++)h=b.faces[g],k=h.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,
+counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=h}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],
+count:0}})}function I(b){if(b!=ea){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)}ea=b}}function R(b,e,c){(c.width&
+c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(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,da(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,da(e.minFilter)))}function ca(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
+k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);R(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 T(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,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),
+b.width,b.height,0,S(b.format),S(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=la,b=U);e!=$&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ka,sa,c,b),$=e)}function D(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 da(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(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 P=this,k,K=[],X=null,$=null,Y=!0,ha=null,ja=null,fa=null,M=null,W=null,ca=null,ma=null,ka=0,na=0,la=0,T=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Matrix4,sa=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?b.stencil:!0,U=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==
-void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:U,stencil:Oa})))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(ra){console.error(ra)}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(pa.r,pa.g,pa.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Oa){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness=0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;
+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 P=this,k,K=[],X=null,$=null,Y=!0,ga=null,ja=null,ea=null,M=null,W=null,aa=null,ma=null,ka=0,sa=0,la=0,U=0,fa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Matrix4,qa=new Float32Array(16),va=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?b.stencil:!0,V=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):
+new THREE.Color(0),ua=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ha,ra=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:wa}),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Ba._shadowPass=!0;pa._shadowPass=!0;try{if(!(k=ya.getContext("experimental-webgl",{antialias:ta,stencil:Oa,preserveDrawingBuffer:V})))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(xa){console.error(xa)}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(na.r,na.g,na.b,ua);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Oa){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness=0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;
 Z.vertices[5]=-1;Z.vertices[6]=20;Z.vertices[7]=20;Z.vertices[8]=-1;Z.vertices[9]=-20;Z.vertices[10]=20;Z.vertices[11]=-1;Z.faces[0]=0;Z.faces[1]=1;Z.faces[2]=2;Z.faces[3]=0;Z.faces[4]=2;Z.faces[5]=3;Z.vertexBuffer=k.createBuffer();Z.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Z.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,Z.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Z.faces,k.STATIC_DRAW);Z.program=k.createProgram();
-k.attachShader(Z.program,z("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Z.program,z("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Z.program);Z.vertexLocation=k.getAttribLocation(Z.program,"position");Z.projectionLocation=k.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=k.getUniformLocation(Z.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);U=0;Q.vertices[U++]=-1;Q.vertices[U++]=-1;Q.vertices[U++]=
-0;Q.vertices[U++]=0;Q.vertices[U++]=1;Q.vertices[U++]=-1;Q.vertices[U++]=1;Q.vertices[U++]=0;Q.vertices[U++]=1;Q.vertices[U++]=1;Q.vertices[U++]=1;Q.vertices[U++]=1;Q.vertices[U++]=-1;Q.vertices[U++]=1;Q.vertices[U++]=0;Q.vertices[U++]=1;U=0;Q.faces[U++]=0;Q.faces[U++]=1;Q.faces[U++]=2;Q.faces[U++]=0;Q.faces[U++]=2;Q.faces[U++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);
+k.attachShader(Z.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Z.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Z.program);Z.vertexLocation=k.getAttribLocation(Z.program,"position");Z.projectionLocation=k.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=k.getUniformLocation(Z.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);V=0;Q.vertices[V++]=-1;Q.vertices[V++]=-1;Q.vertices[V++]=
+0;Q.vertices[V++]=0;Q.vertices[V++]=1;Q.vertices[V++]=-1;Q.vertices[V++]=1;Q.vertices[V++]=0;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=-1;Q.vertices[V++]=1;Q.vertices[V++]=0;Q.vertices[V++]=1;V=0;Q.faces[V++]=0;Q.faces[V++]=1;Q.faces[V++]=2;Q.faces[V++]=0;Q.faces[V++]=2;Q.faces[V++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();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);k.bindTexture(k.TEXTURE_2D,Q.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,Q.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?(Q.hasVertexTexture=!1,Q.program=k.createProgram(),k.attachShader(Q.program,
-z("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,z("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,z("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,z("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=
-k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var va=!1,N={};N.vertices=
-new Float32Array(16);N.faces=new Uint16Array(6);U=0;N.vertices[U++]=-1;N.vertices[U++]=-1;N.vertices[U++]=0;N.vertices[U++]=1;N.vertices[U++]=1;N.vertices[U++]=-1;N.vertices[U++]=1;N.vertices[U++]=1;N.vertices[U++]=1;N.vertices[U++]=1;N.vertices[U++]=1;N.vertices[U++]=0;N.vertices[U++]=-1;N.vertices[U++]=1;N.vertices[U++]=0;U=N.vertices[U++]=0;N.faces[U++]=0;N.faces[U++]=1;N.faces[U++]=2;N.faces[U++]=0;N.faces[U++]=2;N.faces[U++]=3;N.vertexBuffer=k.createBuffer();N.elementBuffer=k.createBuffer();
-k.bindBuffer(k.ARRAY_BUFFER,N.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,N.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,N.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,N.faces,k.STATIC_DRAW);N.program=k.createProgram();k.attachShader(N.program,z("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(N.program,z("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=k.getAttribLocation(N.program,"position");
+D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=
+k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var Ea=!1,N={};N.vertices=
+new Float32Array(16);N.faces=new Uint16Array(6);V=0;N.vertices[V++]=-1;N.vertices[V++]=-1;N.vertices[V++]=0;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=-1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=0;N.vertices[V++]=-1;N.vertices[V++]=1;N.vertices[V++]=0;V=N.vertices[V++]=0;N.faces[V++]=0;N.faces[V++]=1;N.faces[V++]=2;N.faces[V++]=0;N.faces[V++]=2;N.faces[V++]=3;N.vertexBuffer=k.createBuffer();N.elementBuffer=k.createBuffer();
+k.bindBuffer(k.ARRAY_BUFFER,N.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,N.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,N.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,N.faces,k.STATIC_DRAW);N.program=k.createProgram();k.attachShader(N.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(N.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=k.getAttribLocation(N.program,"position");
 N.attributes.uv=k.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=k.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=k.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=k.getUniformLocation(N.program,"rotation");N.uniforms.scale=k.getUniformLocation(N.program,"scale");N.uniforms.alignment=k.getUniformLocation(N.program,"alignment");N.uniforms.map=k.getUniformLocation(N.program,"map");N.uniforms.opacity=k.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=
-k.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=k.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=k.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=k.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=k.getUniformLocation(N.program,"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,
-c,f){ka=b;na=e;la=c;T=f;k.viewport(ka,na,la,T)};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){Y=b;k.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);qa=e;k.clearColor(pa.r,pa.g,pa.b,qa)};this.setClearColor=function(b,e){pa.copy(b);qa=e;k.clearColor(pa.r,pa.g,pa.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};
+k.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=k.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=k.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=k.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=k.getUniformLocation(N.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,e){ya.width=b;ya.height=e;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,e,
+c,f){ka=b;sa=e;la=c;U=f;k.viewport(ka,sa,la,U)};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){Y=b;k.depthMask(b)};this.setClearColorHex=function(b,e){na.setHex(b);ua=e;k.clearColor(na.r,na.g,na.b,ua)};this.setClearColor=function(b,e){na.copy(b);ua=e;k.clearColor(na.r,na.g,na.b,ua)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};
 this.setStencilShadowDarkness=function(b){Z.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var g,j,h;b instanceof THREE.MeshDepthMaterial?h="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?h="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?h="normal":b instanceof THREE.MeshBasicMaterial?h="basic":b instanceof THREE.MeshLambertMaterial?h="lambert":b instanceof THREE.MeshPhongMaterial?h="phong":b instanceof THREE.LineBasicMaterial?h="basic":b instanceof
 THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var m=THREE.ShaderLib[h];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=e.length;n<o;n++)j=e[n],j instanceof THREE.SpotLight&&p++,j instanceof THREE.DirectionalLight&&p++,j instanceof THREE.PointLight&&m++;m+p<=4?n=p:(n=Math.ceil(4*p/(m+p)),m=4-n);j={directional:n,point:m};m=p=0;for(n=e.length;m<n;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&p++;
-var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{n=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:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,f=[];h?f.push(h):(f.push(n),f.push(o));for(v in c)f.push(v),f.push(c[v]);h=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==h){u=K[v].program;break a}v=k.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
+var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var t;a:{n=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:j.directional,maxPointLights:j.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,f=[];h?f.push(h):(f.push(n),f.push(o));for(v in c)f.push(v),f.push(c[v]);h=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==h){t=K[v].program;break a}v=k.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
 "#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",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":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,z("fragment",j+n));k.attachShader(v,z("vertex",f+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,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)n=w[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(u in e)f.push(u);u=f;w=0;for(e=u.length;w<e;w++)c=
-u[w],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,code:h});u=v}b.program=u;u=b.program.attributes;u.position>=0&&k.enableVertexAttribArray(u.position);u.color>=0&&k.enableVertexAttribArray(u.color);u.normal>=0&&k.enableVertexAttribArray(u.normal);u.tangent>=0&&k.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(k.enableVertexAttribArray(u.skinVertexA),k.enableVertexAttribArray(u.skinVertexB),k.enableVertexAttribArray(u.skinIndex),
-k.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(g in b.attributes)u[g]!==void 0&&u[g]>=0&&k.enableVertexAttribArray(u[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,u[w]>=0&&(k.enableVertexAttribArray(u[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,C){var z,F,G,D,J,la,T,M,K=b.lights,ga=b.fog;this.shadowMapEnabled&&w(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
-!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(sa);ia.multiply(c.projectionMatrix,c.matrixWorldInverse);n(ia);this.initWebGLObjects(b);S(o);(this.autoClear||C)&&this.clear();J=b.__webglObjects.length;for(C=0;C<J;C++)if(z=b.__webglObjects[C],T=z.object,T.visible)if(!(T instanceof THREE.Mesh)||p(T)){if(T.matrixWorld.flattenToArray(T._objectMatrixArray),E(T,c,!0),v(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(Aa.copy(T.position),ia.multiplyVector3(Aa),
-z.z=Aa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(u);la=b.__webglObjectsImmediate.length;for(C=0;C<la;C++)z=b.__webglObjectsImmediate[C],T=z.object,T.visible&&(T.matrixAutoUpdate&&T.matrixWorld.flattenToArray(T._objectMatrixArray),E(T,c,!0),t(z));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(C=0;C<J;C++)if(z=b.__webglObjects[C],z.render)T=z.object,M=z.buffer,j(T),f(c,K,ga,b.overrideMaterial,M,T);for(C=0;C<la;C++)z=b.__webglObjectsImmediate[C],
-T=z.object,T.visible&&(j(T),F=e(c,K,ga,b.overrideMaterial,T),T.render(function(c){h(c,F,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(C=J-1;C>=0;C--)if(z=b.__webglObjects[C],z.render){T=z.object;M=z.buffer;G=z.opaque;j(T);for(z=0;z<G.count;z++)D=G.list[z],g(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,M,T)}for(C=0;C<la;C++)if(z=b.__webglObjectsImmediate[C],T=z.object,T.visible){G=z.opaque;j(T);for(z=0;z<G.count;z++)D=G.list[z],g(D.depthTest),
-m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),F=e(c,K,ga,D,T),T.render(function(b){h(b,F,D.shading)})}for(C=0;C<J;C++)if(z=b.__webglObjects[C],z.render){T=z.object;M=z.buffer;G=z.transparent;j(T);for(z=0;z<G.count;z++)D=G.list[z],I(D.blending),g(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,M,T)}for(C=0;C<la;C++)if(z=b.__webglObjectsImmediate[C],T=z.object,T.visible){G=z.transparent;j(T);for(z=0;z<G.count;z++)D=G.list[z],I(D.blending),g(D.depthTest),
-m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),F=e(c,K,ga,D,T),T.render(function(b){h(b,F,D.shading)})}}b.__webglSprites.length&&x(b,c);Oa&&b.__webglShadowVolumes.length&&b.lights.length&&B(b);b.__webglLensFlares.length&&A(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=[],
+"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,D("fragment",j+n));k.attachShader(v,D("vertex",f+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,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)n=w[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(t in e)f.push(t);t=f;w=0;for(e=t.length;w<e;w++)c=
+t[w],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,code:h});t=v}b.program=t;t=b.program.attributes;t.position>=0&&k.enableVertexAttribArray(t.position);t.color>=0&&k.enableVertexAttribArray(t.color);t.normal>=0&&k.enableVertexAttribArray(t.normal);t.tangent>=0&&k.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(k.enableVertexAttribArray(t.skinVertexA),k.enableVertexAttribArray(t.skinVertexB),k.enableVertexAttribArray(t.skinIndex),
+k.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(g in b.attributes)t[g]!==void 0&&t[g]>=0&&k.enableVertexAttribArray(t[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,t[w]>=0&&(k.enableVertexAttribArray(t[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var C,D,G,F,J,la,U,M,K=b.lights,fa=b.fog;this.shadowMapEnabled&&y(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
+!1,c);c.matrixWorldInverse.flattenToArray(va);c.projectionMatrix.flattenToArray(qa);ia.multiply(c.projectionMatrix,c.matrixWorldInverse);n(ia);this.initWebGLObjects(b);T(o);(this.autoClear||B)&&this.clear();J=b.__webglObjects.length;for(B=0;B<J;B++)if(C=b.__webglObjects[B],U=C.object,U.visible)if(!(U instanceof THREE.Mesh)||p(U)){if(U.matrixWorld.flattenToArray(U._objectMatrixArray),H(U,c,!0),v(C),C.render=!0,this.sortObjects)C.object.renderDepth?C.z=C.object.renderDepth:(za.copy(U.position),ia.multiplyVector3(za),
+C.z=za.z)}else C.render=!1;else C.render=!1;this.sortObjects&&b.__webglObjects.sort(u);la=b.__webglObjectsImmediate.length;for(B=0;B<la;B++)C=b.__webglObjectsImmediate[B],U=C.object,U.visible&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),H(U,c,!0),t(C));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(B=0;B<J;B++)if(C=b.__webglObjects[B],C.render)U=C.object,M=C.buffer,j(U),f(c,K,fa,b.overrideMaterial,M,U);for(B=0;B<la;B++)C=b.__webglObjectsImmediate[B],
+U=C.object,U.visible&&(j(U),D=e(c,K,fa,b.overrideMaterial,U),U.render(function(c){h(c,D,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(B=J-1;B>=0;B--)if(C=b.__webglObjects[B],C.render){U=C.object;M=C.buffer;G=C.opaque;j(U);for(C=0;C<G.count;C++)F=G.list[C],g(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,fa,F,M,U)}for(B=0;B<la;B++)if(C=b.__webglObjectsImmediate[B],U=C.object,U.visible){G=C.opaque;j(U);for(C=0;C<G.count;C++)F=G.list[C],g(F.depthTest),
+m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,K,fa,F,U),U.render(function(b){h(b,D,F.shading)})}for(B=0;B<J;B++)if(C=b.__webglObjects[B],C.render){U=C.object;M=C.buffer;G=C.transparent;j(U);for(C=0;C<G.count;C++)F=G.list[C],I(F.blending),g(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,fa,F,M,U)}for(B=0;B<la;B++)if(C=b.__webglObjectsImmediate[B],U=C.object,U.visible){G=C.transparent;j(U);for(C=0;C<G.count;C++)F=G.list[C],I(F.blending),g(F.depthTest),
+m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,K,fa,F,U),U.render(function(b){h(b,D,F.shading)})}}b.__webglSprites.length&&x(b,c);Oa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&w(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 c=b.__objectsAdded[0],e=b,f=void 0,g=void 0,j=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(f in g=c.geometry,g.geometryGroups==void 0&&
 O(g),g.geometryGroups){j=g.geometryGroups[f];if(!j.__webglVertexBuffer){var h=j;h.__webglVertexBuffer=k.createBuffer();h.__webglNormalBuffer=k.createBuffer();h.__webglTangentBuffer=k.createBuffer();h.__webglColorBuffer=k.createBuffer();h.__webglUVBuffer=k.createBuffer();h.__webglUV2Buffer=k.createBuffer();h.__webglSkinVertexABuffer=k.createBuffer();h.__webglSkinVertexBBuffer=k.createBuffer();h.__webglSkinIndicesBuffer=k.createBuffer();h.__webglSkinWeightsBuffer=k.createBuffer();h.__webglFaceBuffer=
-k.createBuffer();h.__webglLineBuffer=k.createBuffer();if(h.numMorphTargets){var m=void 0,n=void 0;h.__webglMorphTargetsBuffers=[];m=0;for(n=h.numMorphTargets;m<n;m++)h.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var h=j,m=c,o=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,A=w=n=0,x=t=p=void 0,B=x=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,x=h.faces,o=0,p=x.length;o<p;o++)t=x[o],t=v[t],t instanceof THREE.Face3?(n+=3,w+=1,A+=3):t instanceof THREE.Face4&&(n+=4,w+=2,A+=4);for(var o=h,
-p=m,z=x=v=void 0,E=void 0,z=void 0,t=[],v=0,x=p.materials.length;v<x;v++)if(z=p.materials[v],z instanceof THREE.MeshFaceMaterial){z=0;for(l=o.materials.length;z<l;z++)(E=o.materials[z])&&t.push(E)}else(E=z)&&t.push(E);o=t;h.__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;t=o.length;for(v=0;v<t;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:{t=v=void 0;z=o.length;for(v=0;v<z;v++)if(t=o[v],t.vertexColors){t=t.vertexColors;break a}t=!1}h.__vertexArray=new Float32Array(n*3);if(x)h.__normalArray=new Float32Array(n*3);if(u.hasTangents)h.__tangentArray=new Float32Array(n*4);if(t)h.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)h.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
-1)h.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(n*4),h.__skinVertexBArray=new Float32Array(n*4),h.__skinIndexArray=new Float32Array(n*4),h.__skinWeightArray=new Float32Array(n*4);h.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(A*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];u=0;for(v=h.numMorphTargets;u<v;u++)h.__morphTargetsArrays.push(new Float32Array(n*
-3))}h.__needsSmoothNormals=x==THREE.SmoothShading;h.__uvType=p;h.__vertexColorType=t;h.__normalType=x;h.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);h.__webglLineCount=A*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];x={};for(B in t)x[B]=t[B];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(n*w),x.buffer=k.createBuffer(),x.buffer.belongsToAttribute=a,t.needsUpdate=!0,x.__original=t;h.__webglCustomAttributes[a]=x}}h.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?D(e.__webglShadowVolumes,j,c):D(e.__webglObjects,j,c)}else if(c instanceof THREE.LensFlare)D(e.__webglLensFlares,void 0,
-c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;D(e.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,
-j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;D(e.__webglObjects,g,c)}else if(c instanceof THREE.ParticleSystem){g=c.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;j=c;h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__sortArray=[];f.__webglParticleCount=h;f.__materials=
-j.materials;B=n=m=void 0;m=0;for(n=j.materials.length;m<n;m++)if(B=j.materials[m],B.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in B.attributes){originalAttribute=B.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(h*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}D(e.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
+k.createBuffer();h.__webglLineBuffer=k.createBuffer();if(h.numMorphTargets){var m=void 0,n=void 0;h.__webglMorphTargetsBuffers=[];m=0;for(n=h.numMorphTargets;m<n;m++)h.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var h=j,m=c,o=void 0,t=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=n=0,x=p=t=void 0,z=x=t=o=void 0,p=void 0,u=m.geometry,v=u.faces,x=h.faces,o=0,t=x.length;o<t;o++)p=x[o],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,y+=3):p instanceof THREE.Face4&&(n+=4,w+=2,y+=4);for(var o=h,
+t=m,B=x=v=void 0,H=void 0,B=void 0,p=[],v=0,x=t.materials.length;v<x;v++)if(B=t.materials[v],B instanceof THREE.MeshFaceMaterial){B=0;for(l=o.materials.length;B<l;B++)(H=o.materials[B])&&p.push(H)}else(H=B)&&p.push(H);o=p;h.__materials=o;a:{v=t=void 0;x=o.length;for(t=0;t<x;t++)if(v=o[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{x=v=void 0;p=o.length;for(v=0;v<p;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:{p=v=void 0;B=o.length;for(v=0;v<B;v++)if(p=o[v],p.vertexColors){p=p.vertexColors;break a}p=!1}h.__vertexArray=new Float32Array(n*3);if(x)h.__normalArray=new Float32Array(n*3);if(u.hasTangents)h.__tangentArray=new Float32Array(n*4);if(p)h.__colorArray=new Float32Array(n*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)h.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
+1)h.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(n*4),h.__skinVertexBArray=new Float32Array(n*4),h.__skinIndexArray=new Float32Array(n*4),h.__skinWeightArray=new Float32Array(n*4);h.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(y*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];u=0;for(v=h.numMorphTargets;u<v;u++)h.__morphTargetsArrays.push(new Float32Array(n*
+3))}h.__needsSmoothNormals=x==THREE.SmoothShading;h.__uvType=t;h.__vertexColorType=p;h.__normalType=x;h.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);h.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(t=o[u],t.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in t.attributes){p=t.attributes[a];x={};for(z in p)x[z]=p[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(n*w),x.buffer=k.createBuffer(),x.buffer.belongsToAttribute=a,p.needsUpdate=!0,x.__original=p;h.__webglCustomAttributes[a]=x}}h.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?F(e.__webglShadowVolumes,j,c):F(e.__webglObjects,j,c)}else if(c instanceof THREE.LensFlare)F(e.__webglLensFlares,void 0,
+c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,
+j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,c)}else if(c instanceof THREE.ParticleSystem){g=c.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;j=c;h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__sortArray=[];f.__webglParticleCount=h;f.__materials=
+j.materials;z=n=m=void 0;m=0;for(n=j.materials.length;m<n;m++)if(z=j.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(h*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}F(e.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
 c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];c=b;if(e instanceof THREE.ShadowVolume)G(c.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(c.__webglObjects,e);else if(e instanceof THREE.Sprite){c=c.__webglSprites;g=void 0;for(g=c.length-1;g>=0;g--)c[g]==e&&c.splice(g,1)}else e instanceof THREE.LensFlare?G(c.__webglLensFlares,
 e):e instanceof THREE.MarchingCubes&&G(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)C(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)C(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)C(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="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 Ea}};
+k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
 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};
@@ -359,8 +359,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 h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,j=Math.max(Math.max(e,f),h),g=Math.min(Math.min(e,f),h);if(g==j)g=e=0;else{var m=j-g,g=m/j,e=e==j?(f-h)/m:f==j?2+(h-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=g;c.v=j;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,h=e?c.geometry:c,j=b.vertices,g=h.vertices,m=b.faces,n=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=g.length;o<t;o++){var v=new THREE.Vertex(g[o].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}o=0;for(t=n.length;o<t;o++){var g=n[o],u,w,B=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?u=new THREE.Face3(g.a+f,g.b+f,g.c+
-f):g instanceof THREE.Face4&&(u=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));u.normal.copy(g.normal);e=0;for(j=B.length;e<j;e++)w=B[e],u.vertexNormals.push(w.clone());u.color.copy(g.color);e=0;for(j=v.length;e<j;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=g.materials.slice();u.centroid.copy(g.centroid);m.push(u)}o=0;for(t=h.length;o<t;o++){f=h[o];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,j=b.vertices,g=h.vertices,m=b.faces,n=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=g.length;o<t;o++){var v=new THREE.Vertex(g[o].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}o=0;for(t=n.length;o<t;o++){var g=n[o],u,y,z=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?u=new THREE.Face3(g.a+f,g.b+f,g.c+
+f):g instanceof THREE.Face4&&(u=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));u.normal.copy(g.normal);e=0;for(j=z.length;e<j;e++)y=z[e],u.vertexNormals.push(y.clone());u.color.copy(g.color);e=0;for(j=v.length;e<j;e++)y=v[e],u.vertexColors.push(y.clone());u.materials=g.materials.slice();u.centroid.copy(g.centroid);m.push(u)}o=0;for(t=h.length;o<t;o++){f=h[o];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
 j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var g=new THREE.Vertex(f[b].position.clone());c.vertices.push(g)}b=0;for(e=h.length;b<e;b++){var m=h[b],n,p,o=m.vertexNormals,t=m.vertexColors;m instanceof THREE.Face3?n=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(n=new THREE.Face4(m.a,m.b,m.c,m.d));n.normal.copy(m.normal);f=0;for(g=o.length;f<g;f++)p=o[f],n.vertexNormals.push(p.clone());n.color.copy(m.color);f=0;for(g=t.length;f<g;f++)p=t[f],n.vertexColors.push(p.clone());n.materials=m.materials.slice();
 n.centroid.copy(m.centroid);c.faces.push(n)}b=0;for(e=j.length;b<e;b++){h=j[b];n=[];f=0;for(g=h.length;f<g;f++)n.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(b,c,e){var f,h,j,g=new THREE.Vector3,m=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();f+h>1&&(f=1-f,h=1-h);j=1-f-h;g.copy(b);g.multiplyScalar(f);m.copy(c);m.multiplyScalar(h);g.addSelf(m);m.copy(e);m.multiplyScalar(j);g.addSelf(m);return g},randomPointInFace:function(b,
 c,e){var f,h,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,g;e?b._area1&&b._area2?(e=b._area1,g=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),g=THREE.GeometryUtils.triangleArea(h,j,c),b._area1=e,b._area2=g):(e=THREE.GeometryUtils.triangleArea(f,
@@ -388,15 +388,15 @@ THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?h.skinMatrix:h.matrix;var j=h.animationCache.prevKey;h=h.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.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,h,j,g,m,n,p,o=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&o[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var B=0;B<3;B++){e=c[B];g=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){g=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)g=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do g=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,j,g,m,n,p,o=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&o[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){e=c[z];g=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){g=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)g=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do g=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
 t)}n.prevKey[e]=g;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-g.time)/(m.time-g.time);h=g[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",u,g.index-1).pos,this.points[1]=h,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[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(h,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)o[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,j,g,m,n,p;h=(b.length-1)*c;j=Math.floor(h);h-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=h*h;g=h*e;f[0]=this.interpolate(j[0],m[0],n[0],p[0],h,e,g);f[1]=this.interpolate(j[1],m[1],n[1],p[1],h,e,g);f[2]=this.interpolate(j[2],m[2],n[2],p[2],h,e,g);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,h,j,g){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*g+(-3*(c-e)-2*b-f)*j+b*h+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]};
-THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
 b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
@@ -406,9 +406,9 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown
 1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.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,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},j,h=c.getControlPointsArray(),m=c.getLength(),n=h.length,E=0;j=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[j]={time:f,pos:h[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<n-1;j++)E=f*m.chunks[j]/m.total,c.keys[j]={time:E,pos:h[j]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
+THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},j,h=c.getControlPointsArray(),m=c.getLength(),n=h.length,H=0;j=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[j]={time:f,pos:h[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<n-1;j++)H=f*m.chunks[j]/m.total,c.keys[j]={time:H,pos:h[j]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
 f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),j=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,j);particleObj=new THREE.ParticleSystem(g,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);g=new THREE.SphereGeometry(1,
-16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),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.005;this.lookHorizontal=
+16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),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!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var m=g[1]-g[0];this.phi=
@@ -416,7 +416,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g
 b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,g);b.position.set(0,10,0);this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -426,12 +426,12 @@ 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 h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,v=0,u=0,w=0,B=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*u),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*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 h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,v=0,u=0,y=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*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);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();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);j.set(0,1,0);h.cross(j,g).normalize();j.cross(g,h).normalize();this.matrix.n11=h.x;this.matrix.n12=j.x;this.matrix.n13=g.x;this.matrix.n21=h.y;this.matrix.n22=j.y;this.matrix.n23=g.y;this.matrix.n31=h.z;this.matrix.n32=j.z;this.matrix.n33=g.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){h.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);h.multiplyScalar(b);this.forward.subSelf(h);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-B)/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;
+function(b){u=(b.clientX-z)/window.innerWidth;y=(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: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: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:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
@@ -459,9 +459,9 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,j){var g=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,h,j);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g,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,h,j){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,j));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,j,g,m,n,p,o,t,v,u,w,B;f=0;for(h=this.actions.length;f<h;f++)switch(j=this.actions[f],g=j.action,j=j.args,g){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];n=j[3];t=j[0];v=j[1];e.length>0?(g=e[e.length-1],u=g.x,w=g.y):(g=this.actions[f-1].args,u=g[g.length-2],w=g[g.length-1]);for(g=1;g<=b;g++)B=g/b,j=THREE.Shape.Utils.b2(B,u,t,m),B=THREE.Shape.Utils.b2(B,w,v,
-n),e.push(new THREE.Vector2(j,B));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];n=j[5];t=j[0];v=j[1];p=j[2];o=j[3];e.length>0?(g=e[e.length-1],u=g.x,w=g.y):(g=this.actions[f-1].args,u=g[g.length-2],w=g[g.length-1]);for(g=1;g<=b;g++)B=g/b,j=THREE.Shape.Utils.b3(B,u,t,p,m),B=THREE.Shape.Utils.b3(B,w,v,o,n),e.push(new THREE.Vector2(j,B));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[f-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];B=b*j[0].length;g=g.concat(j[0]);j=new THREE.SplineCurve(g);
-for(g=1;g<=B;g++)e.push(j.getPointAt(g/B));break;case THREE.PathActions.ARC:g=this.actions[f-1].args;m=j[0];n=j[1];p=j[2];t=j[3];B=j[4];v=!!j[5];o=g[g.length-2];u=g[g.length-1];g.length==0&&(o=u=0);w=B-t;var x=b*2;for(g=1;g<=x;g++)B=g/x,v||(B=1-B),B=t+B*w,j=o+m+p*Math.cos(B),B=u+n+p*Math.sin(B),e.push(new THREE.Vector2(j,B))}c&&e.push(e[0]);return e};
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,j,g,m,n,p,o,t,v,u,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(j=this.actions[f],g=j.action,j=j.args,g){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];n=j[3];t=j[0];v=j[1];e.length>0?(g=e[e.length-1],u=g.x,y=g.y):(g=this.actions[f-1].args,u=g[g.length-2],y=g[g.length-1]);for(g=1;g<=b;g++)z=g/b,j=THREE.Shape.Utils.b2(z,u,t,m),z=THREE.Shape.Utils.b2(z,y,v,
+n),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];n=j[5];t=j[0];v=j[1];p=j[2];o=j[3];e.length>0?(g=e[e.length-1],u=g.x,y=g.y):(g=this.actions[f-1].args,u=g[g.length-2],y=g[g.length-1]);for(g=1;g<=b;g++)z=g/b,j=THREE.Shape.Utils.b3(z,u,t,p,m),z=THREE.Shape.Utils.b3(z,y,v,o,n),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[f-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];z=b*j[0].length;g=g.concat(j[0]);j=new THREE.SplineCurve(g);
+for(g=1;g<=z;g++)e.push(j.getPointAt(g/z));break;case THREE.PathActions.ARC:g=this.actions[f-1].args;m=j[0];n=j[1];p=j[2];t=j[3];z=j[4];v=!!j[5];o=g[g.length-2];u=g[g.length-1];g.length==0&&(o=u=0);y=z-t;var x=b*2;for(g=1;g<=x;g++)z=g/x,v||(z=1-z),z=t+z*y,j=o+m+p*Math.cos(z),z=u+n+p*Math.sin(z),e.push(new THREE.Vector2(j,z))}c&&e.push(e[0]);return e};
 THREE.Path.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var j,g,m,n;n=new THREE.Vector2;g=0;for(m=b.length;g<m;g++){j=b[g];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)h=j.y;n.addSelf(j.x,j.y)}return{minX:f,minY:h,maxX:c,maxY:e,centroid:n.divideScalar(m)}};
 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.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
 THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
@@ -472,45 +472,45 @@ this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1
 THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(h.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&h.push(j);if(h.length==0)return[];var g,j=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&j.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=
 f.curves):g.holes.push(f);j.push(g)}else{g=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,j.push(g),g=new THREE.Shape):g.holes.push(f)}return j};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.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getPoints(b);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getSpacedPoints(b);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getPoints(b),holes:this.getPointsHoles(b)}};THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,j,g,m,n,p,o,t,v,u,w=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);j=Number.POSITIVE_INFINITY;for(h=0;h<p.length;h++){v=p[h];u=[];for(t=0;t<e.length;t++)o=e[t],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,g=h,m=t)}h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;var B=[p[g],e[m],e[h]];t=THREE.FontUtils.Triangulate.area(B);var x=[p[g],p[j],e[m]];v=THREE.FontUtils.Triangulate.area(x);u=m;o=g;m+=1;g+=-1;m<0&&(m+=e.length);m%=
-e.length;g<0&&(g+=p.length);g%=p.length;h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;B=[p[g],e[m],e[h]];B=THREE.FontUtils.Triangulate.area(B);x=[p[g],p[j],e[m]];x=THREE.FontUtils.Triangulate.area(x);t+v>B+x&&(m=u,g=o,m<0&&(m+=e.length),m%=e.length,g<0&&(g+=p.length),g%=p.length,h=m-1>=0?m-1:e.length-1,j=g-1>=0?g-1:p.length-1);t=e.slice(0,m);v=e.slice(m);u=p.slice(g);o=p.slice(0,g);j=[p[g],p[j],e[m]];w.push([p[g],e[m],e[h]]);w.push(j);e=t.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:w,
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,j,g,m,n,p,o,t,v,u,y=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);j=Number.POSITIVE_INFINITY;for(h=0;h<p.length;h++){v=p[h];u=[];for(t=0;t<e.length;t++)o=e[t],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,g=h,m=t)}h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;var z=[p[g],e[m],e[h]];t=THREE.FontUtils.Triangulate.area(z);var x=[p[g],p[j],e[m]];v=THREE.FontUtils.Triangulate.area(x);u=m;o=g;m+=1;g+=-1;m<0&&(m+=e.length);m%=
+e.length;g<0&&(g+=p.length);g%=p.length;h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;z=[p[g],e[m],e[h]];z=THREE.FontUtils.Triangulate.area(z);x=[p[g],p[j],e[m]];x=THREE.FontUtils.Triangulate.area(x);t+v>z+x&&(m=u,g=o,m<0&&(m+=e.length),m%=e.length,g<0&&(g+=p.length),g%=p.length,h=m-1>=0?m-1:e.length-1,j=g-1>=0?g-1:p.length-1);t=e.slice(0,m);v=e.slice(m);u=p.slice(g);o=p.slice(0,g);j=[p[g],p[j],e[m]];y.push([p[g],e[m],e[h]]);y.push(j);e=t.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:y,
 allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,g,m,n,p={};j=0;for(g=f.length;j<g;j++)n=f[j].x+":"+f[j].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=j;j=0;for(g=e.length;j<g;j++){m=e[j];for(f=0;f<3;f++)n=m[f].x+":"+m[f].y,n=p[n],n!==void 0&&(m[f]=n)}j=0;for(g=h.length;j<g;j++){m=h[j];for(f=0;f<3;f++)n=m[f].x+":"+m[f].y,n=p[n],n!==void 0&&(m[f]=n)}return e.concat(h)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
 0},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,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,h)}};
 THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",h=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=h;THREE.FontUtils.style=j};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
-THREE.CubeGeometry=function(b,c,e,f,h,j,g,m,n){function p(b,c,e,g,m,n,p,t){var u,v,w=f||1,B=h||1,S=m/2,z=n/2,ea=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",B=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var R=w+1,P=B+1;m/=w;var k=n/B;for(v=0;v<P;v++)for(n=0;n<R;n++){var K=new THREE.Vector3;K[b]=(n*m-S)*e;K[c]=(v*k-z)*g;K[u]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<B;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+R*
-v+ea,n+R*(v+1)+ea,n+1+R*(v+1)+ea,n+1+R*v+ea,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/B),new THREE.UV(n/w,(v+1)/B),new THREE.UV((n+1)/w,(v+1)/B),new THREE.UV((n+1)/w,v/B)])}THREE.Geometry.call(this);var o=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var B in n)this.sides[B]!=void 0&&(this.sides[B]=
-n[B]);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,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,u,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],j=!1,h=0,m=b.length;h<m;h++){var n=b[h];if(g.position.x==n.position.x&&
+THREE.CubeGeometry=function(b,c,e,f,h,j,g,m,n){function p(b,c,e,g,m,n,p,u){var t,v,y=f||1,z=h||1,T=m/2,D=n/2,da=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",y=j||1;var S=y+1,P=z+1;m/=y;var k=n/z;for(v=0;v<P;v++)for(n=0;n<S;n++){var K=new THREE.Vector3;K[b]=(n*m-T)*e;K[c]=(v*k-D)*g;K[t]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<z;v++)for(n=0;n<y;n++)o.faces.push(new THREE.Face4(n+S*
+v+da,n+S*(v+1)+da,n+1+S*(v+1)+da,n+1+S*v+da,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/y,v/z),new THREE.UV(n/y,(v+1)/z),new THREE.UV((n+1)/y,(v+1)/z),new THREE.UV((n+1)/y,v/z)])}THREE.Geometry.call(this);var o=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([g])}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,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,u,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],j=!1,h=0,m=b.length;h<m;h++){var n=b[h];if(g.position.x==n.position.x&&
 g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=h;j=!0;break}}if(!j)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.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,h,j){function g(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)g(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)g(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){g(0,0,-o-(j||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){g(0,0,o+
 (h||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],h=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];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(j.position.x,j.position.y)/p,0.5+j.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){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;for(e=0;e<f;e++)h=b[e],this.addShape(h,c)}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,j=THREE.ExtrudeGeometry.__v3,h=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();j.set(-f.y,f.x);h.set(g.y,-g.x);k.copy(b).addSelf(j);m.copy(b).addSelf(h);if(k.equals(m))return h.clone();
-k.copy(c).addSelf(j);m.copy(e).addSelf(h);j=f.dot(h);h=m.subSelf(k).dot(h);j==0&&(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=j;if(h<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(h).addSelf(k).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){$=D;Y=D-1;Y<0&&(Y=b.length-
-1);for(var c=0,c=0;c<u+o*2;c++){var e=ea*c,f=ea*(c+1),g=ha+$+e,e=ha+Y+e,j=ha+Y+f,f=ha+$+f;g+=C;e+=C;j+=C;f+=C;J.faces.push(new THREE.Face4(g,e,j,f))}}}function j(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function g(b,c,e){b+=C;c+=C;e+=C;J.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,w=c.path!==void 0?c.path:null,B,x=!1;if(w)B=w.getPoints(v),u=B.length,x=!0,t=!1;t||(p=n=o=0);var A,E,F,J=this,C=this.vertices.length,v=b.extractAllPoints(v),w=v.shape,v=v.holes,G=!THREE.Shape.Utils.isClockWise(w);if(G){w=w.reverse();E=0;for(F=v.length;E<F;E++)A=v[E],THREE.Shape.Utils.isClockWise(A)&&(v[E]=A.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(w,v),O=w;E=0;for(F=v.length;E<F;E++)A=v[E],w=w.concat(A);
-var D,I,V,da,S,z,ea=w.length,R=G.length,P=[];D=0;I=O.length;$=I-1;for(Y=D+1;D<I;D++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),P[D]=f(O[D],O[$],O[Y]);var k=[],K,X=P.concat();E=0;for(F=v.length;E<F;E++){A=v[E];K=[];D=0;I=A.length;$=I-1;for(Y=D+1;D<I;D++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),K[D]=f(A[D],A[$],A[Y]);k.push(K);X=X.concat(K)}for(V=0;V<o;V++){da=V/o;S=n*(1-da);da=p*Math.sin(da*Math.PI/2);D=0;for(I=O.length;D<I;D++)z=e(O[D],P[D],da),j(z.x,z.y,-S);E=0;for(F=v.length;E<F;E++){A=v[E];K=k[E];D=0;for(I=A.length;D<
-I;D++)z=e(A[D],K[D],da),j(z.x,z.y,-S)}}da=p;for(D=0;D<ea;D++)z=t?e(w[D],X[D],da):w[D],x?j(z.x,z.y+B[0].y,B[0].x):j(z.x,z.y,0);for(V=1;V<=u;V++)for(D=0;D<ea;D++)z=t?e(w[D],X[D],da):w[D],x?j(z.x,z.y+B[V-1].y,B[V-1].x):j(z.x,z.y,m/u*V);for(V=o-1;V>=0;V--){da=V/o;S=n*(1-da);da=p*Math.sin(da*Math.PI/2);D=0;for(I=O.length;D<I;D++)z=e(O[D],P[D],da),j(z.x,z.y,m+S);E=0;for(F=v.length;E<F;E++){A=v[E];K=k[E];D=0;for(I=A.length;D<I;D++)z=e(A[D],K[D],da),x?j(z.x,z.y+B[u-1].y,B[u-1].x+S):j(z.x,z.y,m+S)}}if(t){n=
-ea*0;for(D=0;D<R;D++)m=G[D],g(m[2]+n,m[1]+n,m[0]+n);n=ea*(u+o*2);for(D=0;D<R;D++)m=G[D],g(m[0]+n,m[1]+n,m[2]+n)}else{for(D=0;D<R;D++)m=G[D],g(m[2],m[1],m[0]);for(D=0;D<R;D++)m=G[D],g(m[0]+ea*u,m[1]+ea*u,m[2]+ea*u)}var $,Y,ha=0;h(O);ha+=O.length;E=0;for(F=v.length;E<F;E++)A=v[E],h(A),ha+=A.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;
+k.copy(c).addSelf(j);m.copy(e).addSelf(h);j=f.dot(h);h=m.subSelf(k).dot(h);j==0&&(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=j;if(h<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(h).addSelf(k).subSelf(b).clone()}function h(b){for(F=b.length;--F>=0;){$=F;Y=F-1;Y<0&&(Y=b.length-
+1);for(var c=0,c=0;c<u+o*2;c++){var e=da*c,f=da*(c+1),g=ga+$+e,e=ga+Y+e,j=ga+Y+f,f=ga+$+f;g+=C;e+=C;j+=C;f+=C;J.faces.push(new THREE.Face4(g,e,j,f))}}}function j(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function g(b,c,e){b+=C;c+=C;e+=C;J.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.path!==void 0?c.path:null,z,x=!1;if(y)z=y.getPoints(v),u=z.length,x=!0,t=!1;t||(p=n=o=0);var w,H,B,J=this,C=this.vertices.length,v=b.extractAllPoints(v),y=v.shape,v=v.holes,G=!THREE.Shape.Utils.isClockWise(y);if(G){y=y.reverse();H=0;for(B=v.length;H<B;H++)w=v[H],THREE.Shape.Utils.isClockWise(w)&&(v[H]=w.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(y,v),O=y;H=0;for(B=v.length;H<B;H++)w=v[H],y=y.concat(w);
+var F,I,R,ca,T,D,da=y.length,S=G.length,P=[];F=0;I=O.length;$=I-1;for(Y=F+1;F<I;F++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),P[F]=f(O[F],O[$],O[Y]);var k=[],K,X=P.concat();H=0;for(B=v.length;H<B;H++){w=v[H];K=[];F=0;I=w.length;$=I-1;for(Y=F+1;F<I;F++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),K[F]=f(w[F],w[$],w[Y]);k.push(K);X=X.concat(K)}for(R=0;R<o;R++){ca=R/o;T=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);F=0;for(I=O.length;F<I;F++)D=e(O[F],P[F],ca),j(D.x,D.y,-T);H=0;for(B=v.length;H<B;H++){w=v[H];K=k[H];F=0;for(I=w.length;F<
+I;F++)D=e(w[F],K[F],ca),j(D.x,D.y,-T)}}ca=p;for(F=0;F<da;F++)D=t?e(y[F],X[F],ca):y[F],x?j(D.x,D.y+z[0].y,z[0].x):j(D.x,D.y,0);for(R=1;R<=u;R++)for(F=0;F<da;F++)D=t?e(y[F],X[F],ca):y[F],x?j(D.x,D.y+z[R-1].y,z[R-1].x):j(D.x,D.y,m/u*R);for(R=o-1;R>=0;R--){ca=R/o;T=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);F=0;for(I=O.length;F<I;F++)D=e(O[F],P[F],ca),j(D.x,D.y,m+T);H=0;for(B=v.length;H<B;H++){w=v[H];K=k[H];F=0;for(I=w.length;F<I;F++)D=e(w[F],K[F],ca),x?j(D.x,D.y+z[u-1].y,z[u-1].x+T):j(D.x,D.y,m+T)}}if(t){n=
+da*0;for(F=0;F<S;F++)m=G[F],g(m[2]+n,m[1]+n,m[0]+n);n=da*(u+o*2);for(F=0;F<S;F++)m=G[F],g(m[0]+n,m[1]+n,m[2]+n)}else{for(F=0;F<S;F++)m=G[F],g(m[2],m[1],m[0]);for(F=0;F<S;F++)m=G[F],g(m[0]+da*u,m[1]+da*u,m[2]+da*u)}var $,Y,ga=0;h(O);ga+=O.length;H=0;for(B=v.length;H<B;H++)w=v[H],h(w),ga+=w.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,g=h.vertices[e].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var h=this,j=new THREE.Geometry,g;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,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){g=new THREE.Geometry;for(var m in j.faces){var n=f(j.faces[m].a,j.faces[m].b),p=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,n,o,g);e(j.faces[m].b,p,n,g);
 e(j.faces[m].c,o,p,g);e(n,p,o,g)}j.faces=g.faces}h.faces=j.faces;delete j;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],j=[],g=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.001;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=g.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),h[m]=this.vertices.length-1):h=j;n==0&&(j=f);
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],j=[],g=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=g.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),h[m]=this.vertices.length-1):h=j;n==0&&(j=f);
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(h[m],h[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=h;h=[]}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 h,j=b/2,g=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(h=0;h<n;h++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(h*p-g),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*h,c+m*(h+1),c+1+m*(h+1),c+1+m*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/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,h=Math.PI,j=Math.max(3,c||8),g=Math.max(2,e||6),c=[],e=0;e<g+1;e++){f=e/g;var m=b*Math.cos(f*h),n=b*Math.sin(f*h),p=[],o=0;for(f=0;f<j;f++){var t=2*f/j,v=n*Math.sin(t*h),t=n*Math.cos(t*h);(e==0||e==g)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);p.push(o)}c.push(p)}for(var u,w,B,h=c.length,e=0;e<h;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){p=f==j-1;g=c[e][p?0:f+1];m=c[e][p?j-1:f];n=c[e-1][p?
-j-1:f];p=c[e-1][p?0:f+1];v=e/(h-1);u=(e-1)/(h-1);w=(f+1)/j;var t=f/j,o=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),x=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[g].position.clone(),w=this.vertices[m].position.clone(),B=this.vertices[n].position.clone(),u.normalize(),w.normalize(),B.normalize(),this.faces.push(new THREE.Face3(g,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,v,t]));e>1&&(u=
-this.vertices[g].position.clone(),w=this.vertices[n].position.clone(),B=this.vertices[p].position.clone(),u.normalize(),w.normalize(),B.normalize(),this.faces.push(new THREE.Face3(g,n,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(B.x,B.y,B.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=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,j=Math.max(3,c||8),g=Math.max(2,e||6),c=[],e=0;e<g+1;e++){f=e/g;var m=b*Math.cos(f*h),n=b*Math.sin(f*h),p=[],o=0;for(f=0;f<j;f++){var t=2*f/j,v=n*Math.sin(t*h),t=n*Math.cos(t*h);(e==0||e==g)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);p.push(o)}c.push(p)}for(var u,y,z,h=c.length,e=0;e<h;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){p=f==j-1;g=c[e][p?0:f+1];m=c[e][p?j-1:f];n=c[e-1][p?
+j-1:f];p=c[e-1][p?0:f+1];v=e/(h-1);u=(e-1)/(h-1);y=(f+1)/j;var t=f/j,o=new THREE.UV(1-y,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),x=new THREE.UV(1-y,u);e<c.length-1&&(u=this.vertices[g].position.clone(),y=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(g,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,v,t]));e>1&&(u=
+this.vertices[g].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),u.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(g,n,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.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){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},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},drawText:function(b){for(var c=
-this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),j=h.length,g=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;g.push(m.path)}return{paths:g,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,n,p,o,t,v,u,w,B,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;j.push(new THREE.Vector2(m,
-p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var A=g/divisions,E=THREE.Shape.Utils.b2(A,o,v,m),A=THREE.Shape.Utils.b2(A,t,u,p);j.push(new THREE.Vector2(E,A))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=c[b++]*e+f,B=c[b++]*-e,h.bezierCurveTo(m,p,
-v,u,w,B),g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)A=g/divisions,E=THREE.Shape.Utils.b3(A,o,v,w,m),A=THREE.Shape.Utils.b3(A,t,u,B,p),j.push(new THREE.Vector2(E,A))}}}return{offset:x.ha*e,points:j,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,j=c-1,g=0;g<c;j=g++)h+=b[j].x*b[g].y-b[g].x*b[j].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var j=[],g=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<h;p++)g[p]=p;else for(p=0;p<h;p++)g[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}n=p;h<=n&&(n=0);p=n+1;h<=p&&(p=0);o=p+1;h<=o&&(o=0);var v;a:{v=b;var u=n,w=p,B=o,x=h,A=g,E=void 0,F=void 0,J=void 0,
-C=void 0,G=void 0,O=void 0,D=void 0,I=void 0,V=void 0,F=v[A[u]].x,J=v[A[u]].y,C=v[A[w]].x,G=v[A[w]].y,O=v[A[B]].x,D=v[A[B]].y;if(1.0E-10>(C-F)*(D-J)-(G-J)*(O-F))v=!1;else{for(E=0;E<x;E++)if(!(E==u||E==w||E==B)){var I=v[A[E]].x,V=v[A[E]].y,da=void 0,S=void 0,z=void 0,ea=void 0,R=void 0,P=void 0,k=void 0,K=void 0,X=void 0,$=void 0,Y=void 0,ha=void 0,da=z=R=void 0,da=O-C,S=D-G,z=F-O,ea=J-D,R=C-F,P=G-J,k=I-F,K=V-J,X=I-C,$=V-G,Y=I-O,ha=V-D,da=da*$-S*X,R=R*K-P*k,z=z*ha-ea*Y;if(da>=0&&z>=0&&R>=0){v=!1;break a}}v=
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),j=h.length,g=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;g.push(m.path)}return{paths:g,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,n,p,o,t,v,u,y,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;j.push(new THREE.Vector2(m,
+p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var w=g/divisions,H=THREE.Shape.Utils.b2(w,o,v,m),w=THREE.Shape.Utils.b2(w,t,u,p);j.push(new THREE.Vector2(H,w))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(m,p,
+v,u,y,z),g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)w=g/divisions,H=THREE.Shape.Utils.b3(w,o,v,y,m),w=THREE.Shape.Utils.b3(w,t,u,z,p),j.push(new THREE.Vector2(H,w))}}}return{offset:x.ha*e,points:j,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,j=c-1,g=0;g<c;j=g++)h+=b[j].x*b[g].y-b[g].x*b[j].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var j=[],g=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<h;p++)g[p]=p;else for(p=0;p<h;p++)g[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}n=p;h<=n&&(n=0);p=n+1;h<=p&&(p=0);o=p+1;h<=o&&(o=0);var v;a:{v=b;var u=n,y=p,z=o,x=h,w=g,H=void 0,B=void 0,J=void 0,
+C=void 0,G=void 0,O=void 0,F=void 0,I=void 0,R=void 0,B=v[w[u]].x,J=v[w[u]].y,C=v[w[y]].x,G=v[w[y]].y,O=v[w[z]].x,F=v[w[z]].y;if(1.0E-10>(C-B)*(F-J)-(G-J)*(O-B))v=!1;else{for(H=0;H<x;H++)if(!(H==u||H==y||H==z)){var I=v[w[H]].x,R=v[w[H]].y,ca=void 0,T=void 0,D=void 0,da=void 0,S=void 0,P=void 0,k=void 0,K=void 0,X=void 0,$=void 0,Y=void 0,ga=void 0,ca=D=S=void 0,ca=O-C,T=F-G,D=B-O,da=J-F,S=C-B,P=G-J,k=I-B,K=R-J,X=I-C,$=R-G,Y=I-O,ga=R-F,ca=ca*$-T*X,S=S*K-P*k,D=D*ga-da*Y;if(ca>=0&&D>=0&&S>=0){v=!1;break a}}v=
 !0}}if(v){j.push([b[g[n]],b[g[p]],b[g[o]]]);m.push([g[n],g[p],g[o]]);n=p;for(o=p+1;o<h;n++,o++)g[n]=g[o];h--;t=2*h}}if(f)return m;return j};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,h=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));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,h=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,g=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,h,j,g));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[g][0],b[g][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
@@ -528,54 +528,54 @@ else if(b.DbgColor)g.color=b.DbgColor;if(b.colorSpecular)g.specular=j(b.colorSpe
 b.mapSpecular&&c&&h(g,"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=g.color;m=g.specular;n=g.ambient;var v=g.shininess;o.tNormal.texture=g.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(g.map)o.tDiffuse.texture=g.map,o.enableDiffuse.value=!0;if(g.specularMap)o.tSpecular.texture=g.specularMap,o.enableSpecular.value=!0;if(g.lightMap)o.tAO.texture=
 g.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(g.opacity)o.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else g=new THREE[m](g);return g},constructor:THREE.Loader};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,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,n,p,o,t,v,u,w,B,x,A,E,F,J=b.faces;t=b.vertices;var C=b.normals,G=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(o=t.length;p<o;)v=new THREE.Vertex,v.position.x=t[p++]*c,v.position.y=
-t[p++]*c,v.position.z=t[p++]*c,f.vertices.push(v);p=0;for(o=J.length;p<o;){c=J[p++];t=c&1;n=c&2;e=c&4;h=c&8;u=c&16;v=c&32;B=c&64;c&=128;t?(x=new THREE.Face4,x.a=J[p++],x.b=J[p++],x.c=J[p++],x.d=J[p++],t=4):(x=new THREE.Face3,x.a=J[p++],x.b=J[p++],x.c=J[p++],t=3);if(n)n=J[p++],x.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<O;e++)A=b.uvs[e],w=J[p++],F=A[w*2],w=A[w*2+1],f.faceUvs[e][n]=new THREE.UV(F,w);if(h)for(e=0;e<O;e++){A=b.uvs[e];E=[];for(h=0;h<t;h++)w=J[p++],F=A[w*2],w=A[w*2+1],E[h]=
-new THREE.UV(F,w);f.faceVertexUvs[e][n]=E}if(u)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.normal=h;if(v)for(e=0;e<t;e++)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.vertexNormals.push(h);if(B)v=J[p++],v=new THREE.Color(G[v]),x.color=v;if(c)for(e=0;e<t;e++)v=J[p++],v=new THREE.Color(G[v]),x.vertexColors.push(v);f.faces.push(x)}}})(h);(function(){var c,e,h,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,n,p,o,t,v,u,w;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=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,v=w[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,t,v)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;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)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=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,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,n,p,o,t,v,u,y,z,x,w,H,B,J=b.faces;t=b.vertices;var C=b.normals,G=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(o=t.length;p<o;)v=new THREE.Vertex,v.position.x=t[p++]*c,v.position.y=
+t[p++]*c,v.position.z=t[p++]*c,f.vertices.push(v);p=0;for(o=J.length;p<o;){c=J[p++];t=c&1;n=c&2;e=c&4;h=c&8;u=c&16;v=c&32;z=c&64;c&=128;t?(x=new THREE.Face4,x.a=J[p++],x.b=J[p++],x.c=J[p++],x.d=J[p++],t=4):(x=new THREE.Face3,x.a=J[p++],x.b=J[p++],x.c=J[p++],t=3);if(n)n=J[p++],x.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<O;e++)w=b.uvs[e],y=J[p++],B=w[y*2],y=w[y*2+1],f.faceUvs[e][n]=new THREE.UV(B,y);if(h)for(e=0;e<O;e++){w=b.uvs[e];H=[];for(h=0;h<t;h++)y=J[p++],B=w[y*2],y=w[y*2+1],H[h]=
+new THREE.UV(B,y);f.faceVertexUvs[e][n]=H}if(u)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.normal=h;if(v)for(e=0;e<t;e++)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.vertexNormals.push(h);if(z)v=J[p++],v=new THREE.Color(G[v]),x.color=v;if(c)for(e=0;e<t;e++)v=J[p++],v=new THREE.Color(G[v]),x.vertexColors.push(v);f.faces.push(x)}}})(h);(function(){var c,e,h,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,n,p,o,t,v,u,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;n=0;for(p=y.length;n<p;n+=3)o=y[n]*c,t=y[n+1]*
+c,v=y[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,t,v)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;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)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[h],e,h))}})();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),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,h,j){var g=new XMLHttpRequest,m=f+"/"+b,n=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,e,h,c):alert("Couldn't load ["+m+"] ["+g.status+"]"):g.readyState==3?j&&(n==0&&(n=g.getResponseHeader("Content-Length")),j({total:n,loaded:g.responseText.length})):g.readyState==2&&(n=g.getResponseHeader("Content-Length"))};g.open("GET",m,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(b,c,e,f){var h=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 h(b,c){var e=o(b,c),f=o(b,c+1),g=o(b,c+2);return(o(b,c+3)<<24)+(g<<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 t(c){var e,f,g;e=h(b,c);f=h(b,c+G);g=h(b,c+O);c=n(b,c+D);THREE.BinaryLoader.prototype.f3(A,e,f,g,c)}function v(c){var e,f,g,j,k,o;e=h(b,c);f=h(b,c+G);g=h(b,c+O);j=n(b,c+D);k=h(b,c+I);o=h(b,c+V);c=h(b,c+da);THREE.BinaryLoader.prototype.f3n(A,J,e,f,g,j,k,o,c)}function u(c){var e,f,g,j;e=h(b,c);f=h(b,c+S);g=h(b,c+z);j=h(b,c+ea);c=n(b,c+R);THREE.BinaryLoader.prototype.f4(A,e,f,g,j,c)}function w(c){var e,f,g,j,o,p,t,u;e=h(b,c);f=h(b,c+S);g=h(b,c+z);j=h(b,c+ea);o=
-n(b,c+R);p=h(b,c+P);t=h(b,c+k);u=h(b,c+K);c=h(b,c+X);THREE.BinaryLoader.prototype.f4n(A,J,e,f,g,j,o,p,t,u,c)}function B(c){var e,f;e=h(b,c);f=h(b,c+$);c=h(b,c+Y);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[c*2],C[c*2+1])}function x(c){var e,f,g;e=h(b,c);f=h(b,c+ha);g=h(b,c+ja);c=h(b,c+fa);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var A=this,E=0,F,J=[],C=[],G,O,D,I,V,da,S,z,ea,R,P,k,
-K,X,$,Y,ha,ja,fa,M,W,ca,ma,ka,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);F={signature:b.substr(E,8),header_bytes:o(b,E+8),vertex_coordinate_bytes:o(b,E+9),normal_coordinate_bytes:o(b,E+10),uv_coordinate_bytes:o(b,E+11),vertex_index_bytes:o(b,E+12),normal_index_bytes:o(b,E+13),uv_index_bytes:o(b,E+14),material_index_bytes:o(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,
-E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=F.header_bytes;G=F.vertex_index_bytes;O=F.vertex_index_bytes*2;D=F.vertex_index_bytes*3;I=F.vertex_index_bytes*3+F.material_index_bytes;V=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes;da=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*2;S=F.vertex_index_bytes;z=F.vertex_index_bytes*2;ea=F.vertex_index_bytes*3;R=F.vertex_index_bytes*4;P=F.vertex_index_bytes*
-4+F.material_index_bytes;k=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes;K=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*2;X=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*3;$=F.uv_index_bytes;Y=F.uv_index_bytes*2;ha=F.uv_index_bytes;ja=F.uv_index_bytes*2;fa=F.uv_index_bytes*3;c=F.vertex_index_bytes*3+F.material_index_bytes;na=F.vertex_index_bytes*4+F.material_index_bytes;M=F.ntri_flat*c;W=F.ntri_smooth*(c+F.normal_index_bytes*3);ca=F.ntri_flat_uv*
-(c+F.uv_index_bytes*3);ma=F.ntri_smooth_uv*(c+F.normal_index_bytes*3+F.uv_index_bytes*3);ka=F.nquad_flat*na;c=F.nquad_smooth*(na+F.normal_index_bytes*4);na=F.nquad_flat_uv*(na+F.uv_index_bytes*4);E+=function(c){for(var f,h,j,k=F.vertex_coordinate_bytes*3,m=c+F.nvertices*k;c<m;c+=k)f=e(b,c),h=e(b,c+F.vertex_coordinate_bytes),j=e(b,c+F.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,h,j);return F.nvertices*k}(E);E+=function(c){for(var e,f,g,h=F.normal_coordinate_bytes*3,j=c+F.nnormals*
-h;c<j;c+=h)e=p(b,c),f=p(b,c+F.normal_coordinate_bytes),g=p(b,c+F.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return F.nnormals*h}(E);E+=function(c){for(var f,h,j=F.uv_coordinate_bytes*2,k=c+F.nuvs*j;c<k;c+=j)f=e(b,c),h=e(b,c+F.uv_coordinate_bytes),C.push(f,h);return F.nuvs*j}(E);M=E+M;W=M+W;ca=W+ca;ma=ca+ma;ka=ma+ka;c=ka+c;na=c+na;(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,f=e+F.uv_index_bytes*3,g=b+F.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(W);(function(b){var c,
-e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=e+F.uv_index_bytes*3,g=b+F.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),B(c+e);return g-b})(ca);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=e+F.uv_index_bytes*4,g=b+F.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(c);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*4,f=e+F.uv_index_bytes*4,g=b+F.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),x(c+e);return g-b})(na);
-(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,f=b+F.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(E);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=b+F.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(M);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=b+F.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ma);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*4,f=b+F.nquad_smooth*
-e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(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,h){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[h]))},f4:function(b,c,e,f,h,j){b.faces.push(new THREE.Face4(c,e,f,h,null,null,b.materials[j]))},f3n:function(b,c,e,
-f,h,j,g,m,n){var j=b.materials[j],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,v,n)],null,j))},f4n:function(b,c,e,f,h,j,g,m,n,p,o){var g=b.materials[g],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[p*3],w=c[p*3+1],p=c[p*3+2],B=c[o*3],x=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,h,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,n),new THREE.Vector3(u,
-w,p),new THREE.Vector3(B,x,o)],null,g))},uv3:function(b,c,e,f,h,j,g){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,h));m.push(new THREE.UV(j,g));b.push(m)},uv4:function(b,c,e,f,h,j,g,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,h));p.push(new THREE.UV(j,g));p.push(new THREE.UV(m,n));b.push(p)},constructor:THREE.BinaryLoader};
+c){return b.charCodeAt(c)&255}function t(c){var e,f,g;e=h(b,c);f=h(b,c+G);g=h(b,c+O);c=n(b,c+F);THREE.BinaryLoader.prototype.f3(w,e,f,g,c)}function v(c){var e,f,g,j,k,o;e=h(b,c);f=h(b,c+G);g=h(b,c+O);j=n(b,c+F);k=h(b,c+I);o=h(b,c+R);c=h(b,c+ca);THREE.BinaryLoader.prototype.f3n(w,J,e,f,g,j,k,o,c)}function u(c){var e,f,g,j;e=h(b,c);f=h(b,c+T);g=h(b,c+D);j=h(b,c+da);c=n(b,c+S);THREE.BinaryLoader.prototype.f4(w,e,f,g,j,c)}function y(c){var e,f,g,j,o,p,t,u;e=h(b,c);f=h(b,c+T);g=h(b,c+D);j=h(b,c+da);o=
+n(b,c+S);p=h(b,c+P);t=h(b,c+k);u=h(b,c+K);c=h(b,c+X);THREE.BinaryLoader.prototype.f4n(w,J,e,f,g,j,o,p,t,u,c)}function z(c){var e,f;e=h(b,c);f=h(b,c+$);c=h(b,c+Y);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[c*2],C[c*2+1])}function x(c){var e,f,g;e=h(b,c);f=h(b,c+ga);g=h(b,c+ja);c=h(b,c+ea);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var w=this,H=0,B,J=[],C=[],G,O,F,I,R,ca,T,D,da,S,P,k,
+K,X,$,Y,ga,ja,ea,M,W,aa,ma,ka,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);B={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:h(b,H+16),nnormals:h(b,H+16+4),nuvs:h(b,H+16+8),ntri_flat:h(b,H+16+12),ntri_smooth:h(b,H+16+16),ntri_flat_uv:h(b,H+16+20),ntri_smooth_uv:h(b,
+H+16+24),nquad_flat:h(b,H+16+28),nquad_smooth:h(b,H+16+32),nquad_flat_uv:h(b,H+16+36),nquad_smooth_uv:h(b,H+16+40)};H+=B.header_bytes;G=B.vertex_index_bytes;O=B.vertex_index_bytes*2;F=B.vertex_index_bytes*3;I=B.vertex_index_bytes*3+B.material_index_bytes;R=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;ca=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;T=B.vertex_index_bytes;D=B.vertex_index_bytes*2;da=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;P=B.vertex_index_bytes*
+4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;X=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;$=B.uv_index_bytes;Y=B.uv_index_bytes*2;ga=B.uv_index_bytes;ja=B.uv_index_bytes*2;ea=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;sa=B.vertex_index_bytes*4+B.material_index_bytes;M=B.ntri_flat*c;W=B.ntri_smooth*(c+B.normal_index_bytes*3);aa=B.ntri_flat_uv*
+(c+B.uv_index_bytes*3);ma=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);ka=B.nquad_flat*sa;c=B.nquad_smooth*(sa+B.normal_index_bytes*4);sa=B.nquad_flat_uv*(sa+B.uv_index_bytes*4);H+=function(c){for(var f,h,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),h=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,f,h,j);return B.nvertices*k}(H);H+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,j=c+B.nnormals*
+h;c<j;c+=h)e=p(b,c),f=p(b,c+B.normal_coordinate_bytes),g=p(b,c+B.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return B.nnormals*h}(H);H+=function(c){for(var f,h,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),h=e(b,c+B.uv_coordinate_bytes),C.push(f,h);return B.nuvs*j}(H);M=H+M;W=M+W;aa=W+aa;ma=aa+ma;ka=ma+ka;c=ka+c;sa=c+sa;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),z(c+e);return g-b})(W);(function(b){var c,
+e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(aa);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)y(c),x(c+e);return g-b})(sa);
+(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(H);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(M);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ma);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=b+B.nquad_smooth*
+e;for(c=b;c<f;c+=e)y(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(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,h){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[h]))},f4:function(b,c,e,f,h,j){b.faces.push(new THREE.Face4(c,e,f,h,null,null,b.materials[j]))},f3n:function(b,c,e,
+f,h,j,g,m,n){var j=b.materials[j],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,v,n)],null,j))},f4n:function(b,c,e,f,h,j,g,m,n,p,o){var g=b.materials[g],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[p*3],y=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,h,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,n),new THREE.Vector3(u,
+y,p),new THREE.Vector3(z,x,o)],null,g))},uv3:function(b,c,e,f,h,j,g){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,h));m.push(new THREE.UV(j,g));b.push(m)},uv4:function(b,c,e,f,h,j,g,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,h));p.push(new THREE.UV(j,g));p.push(new THREE.UV(m,n));b.push(p)},constructor:THREE.BinaryLoader};
 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 h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(u in S.objects)if(!K.objects[u])if(E=S.objects[u],E.geometry!==void 0){if(G=K.geometries[E.geometry]){var b=!1;V=[];for($=0;$<E.materials.length;$++)V[$]=K.materials[E.materials[$]],b=V[$]instanceof THREE.MeshShaderMaterial;b&&G.computeTangents();F=E.position;r=E.rotation;
-q=E.quaternion;s=E.scale;q=0;V.length==0&&(V[0]=new THREE.MeshFaceMaterial);V.length>1&&(V=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,V);object.name=u;object.position.set(F[0],F[1],F[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;K.scene.addObject(object);K.objects[u]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
-if(E.castsShadow)b=new THREE.ShadowVolume(G),K.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},K.triggers[object.name]=b)}}else F=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(F[0],F[1],F[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();ea-=1;e.onLoadComplete();o()}}function p(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:P,totalTextures:k,loadedModels:P-ea,loadedTextures:k-R},K);e.onLoadProgress();ea==0&&R==0&&c(K)}
-var t,v,u,w,B,x,A,E,F,J,C,G,O,D,I,V,da,S,z,ea,R,P,k,K;S=b.data;I=new THREE.BinaryLoader;z=new THREE.JSONLoader;R=ea=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in S.objects)if(E=S.objects[u],E.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;J=S.transform.rotation;var X=S.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);J&&K.scene.rotation.set(J[0],
-J[1],J[2]);X&&K.scene.scale.set(X[0],X[1],X[2]);(b||J||X)&&K.scene.updateMatrix()}b=function(){R-=1;o();e.onLoadComplete()};for(B in S.cameras){J=S.cameras[B];if(J.type=="perspective")O=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);F=J.position;J=J.target;O.position.set(F[0],F[1],F[2]);O.target.position.set(J[0],J[1],J[2]);K.cameras[B]=O}for(w in S.lights)B=S.lights[w],
-O=B.color!==void 0?B.color:16777215,J=B.intensity!==void 0?B.intensity:1,B.type=="directional"?(F=B.direction,da=new THREE.DirectionalLight(O,J),da.position.set(F[0],F[1],F[2]),da.position.normalize()):B.type=="point"?(F=B.position,d=B.distance,da=new THREE.PointLight(O,J,d),da.position.set(F[0],F[1],F[2])):B.type=="ambient"&&(da=new THREE.AmbientLight(O)),K.scene.addLight(da),K.lights[w]=da;for(x in S.fogs)w=S.fogs[x],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,
-w.density)),J=w.color,D.color.setRGB(J[0],J[1],J[2]),K.fogs[x]=D;if(K.cameras&&S.defaults.camera)K.currentCamera=K.cameras[S.defaults.camera];if(K.fogs&&S.defaults.fog)K.scene.fog=K.fogs[S.defaults.fog];J=S.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(J[0],J[1],J[2]);K.bgColorAlpha=S.defaults.bgalpha;for(t in S.geometries)if(x=S.geometries[t],x.type=="bin_mesh"||x.type=="ascii_mesh")ea+=1,e.onLoadStart();P=ea;for(t in S.geometries)x=S.geometries[t],x.type=="cube"?(G=new THREE.CubeGeometry(x.width,
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(u in T.objects)if(!K.objects[u])if(H=T.objects[u],H.geometry!==void 0){if(G=K.geometries[H.geometry]){var b=!1;R=[];for($=0;$<H.materials.length;$++)R[$]=K.materials[H.materials[$]],b=R[$]instanceof THREE.MeshShaderMaterial;b&&G.computeTangents();B=H.position;r=H.rotation;
+q=H.quaternion;s=H.scale;q=0;R.length==0&&(R[0]=new THREE.MeshFaceMaterial);R.length>1&&(R=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,R);object.name=u;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;K.scene.addObject(object);K.objects[u]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
+if(H.castsShadow)b=new THREE.ShadowVolume(G),K.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},K.triggers[object.name]=b)}}else B=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();da-=1;e.onLoadComplete();o()}}function p(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:P,totalTextures:k,loadedModels:P-da,loadedTextures:k-S},K);e.onLoadProgress();da==0&&S==0&&c(K)}
+var t,v,u,y,z,x,w,H,B,J,C,G,O,F,I,R,ca,T,D,da,S,P,k,K;T=b.data;I=new THREE.BinaryLoader;D=new THREE.JSONLoader;S=da=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in T.objects)if(H=T.objects[u],H.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;J=T.transform.rotation;var X=T.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);J&&K.scene.rotation.set(J[0],
+J[1],J[2]);X&&K.scene.scale.set(X[0],X[1],X[2]);(b||J||X)&&K.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in T.cameras){J=T.cameras[z];if(J.type=="perspective")O=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);B=J.position;J=J.target;O.position.set(B[0],B[1],B[2]);O.target.position.set(J[0],J[1],J[2]);K.cameras[z]=O}for(y in T.lights)z=T.lights[y],
+O=z.color!==void 0?z.color:16777215,J=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(B=z.direction,ca=new THREE.DirectionalLight(O,J),ca.position.set(B[0],B[1],B[2]),ca.position.normalize()):z.type=="point"?(B=z.position,d=z.distance,ca=new THREE.PointLight(O,J,d),ca.position.set(B[0],B[1],B[2])):z.type=="ambient"&&(ca=new THREE.AmbientLight(O)),K.scene.addLight(ca),K.lights[y]=ca;for(x in T.fogs)y=T.fogs[x],y.type=="linear"?F=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(F=new THREE.FogExp2(0,
+y.density)),J=y.color,F.color.setRGB(J[0],J[1],J[2]),K.fogs[x]=F;if(K.cameras&&T.defaults.camera)K.currentCamera=K.cameras[T.defaults.camera];if(K.fogs&&T.defaults.fog)K.scene.fog=K.fogs[T.defaults.fog];J=T.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(J[0],J[1],J[2]);K.bgColorAlpha=T.defaults.bgalpha;for(t in T.geometries)if(x=T.geometries[t],x.type=="bin_mesh"||x.type=="ascii_mesh")da+=1,e.onLoadStart();P=da;for(t in T.geometries)x=T.geometries[t],x.type=="cube"?(G=new THREE.CubeGeometry(x.width,
 x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),K.geometries[t]=G):x.type=="plane"?(G=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),K.geometries[t]=G):x.type=="sphere"?(G=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),K.geometries[t]=G):x.type=="cylinder"?(G=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),K.geometries[t]=G):x.type=="torus"?(G=new THREE.TorusGeometry(x.radius,
-x.tube,x.segmentsR,x.segmentsT),K.geometries[t]=G):x.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(x.subdivisions),K.geometries[t]=G):x.type=="bin_mesh"?I.load({model:f(x.url,S.urlBaseType),callback:n(t)}):x.type=="ascii_mesh"?z.load({model:f(x.url,S.urlBaseType),callback:n(t)}):x.type=="embedded_mesh"&&(x=S.embeds[x.id])&&z.createModel(x,p(t),"");for(A in S.textures)if(t=S.textures[A],t.url instanceof Array){R+=t.url.length;for(I=0;I<t.url.length;I++)e.onLoadStart()}else R+=1,e.onLoadStart();
-k=R;for(A in S.textures){t=S.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){I=[];for(var $=0;$<t.url.length;$++)I[$]=f(t.url[$],S.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,t.mapping,b)}else{I=THREE.ImageUtils.loadTexture(f(t.url,S.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)I.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)I.magFilter=THREE[t.magFilter];if(t.repeat){I.repeat.set(t.repeat[0],t.repeat[1]);
-if(t.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}t.offset&&I.offset.set(t.offset[0],t.offset[1]);if(t.wrap){z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(z[t.wrap[0]]!==void 0)I.wrapS=z[t.wrap[0]];if(z[t.wrap[1]]!==void 0)I.wrapT=z[t.wrap[1]]}}K.textures[A]=I}for(v in S.materials){A=S.materials[v];for(C in A.parameters)if(C=="envMap"||C=="map"||C=="lightMap")A.parameters[C]=K.textures[A.parameters[C]];else if(C=="shading")A.parameters[C]=
-A.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")A.parameters[C]=THREE[A.parameters[C]]?THREE[A.parameters[C]]:THREE.NormalBlending;else if(C=="combine")A.parameters[C]=A.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(A.parameters[C]=="face")A.parameters[C]=THREE.FaceColors;else if(A.parameters[C])A.parameters[C]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
-!0;if(A.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);I=A.parameters.color;z=A.parameters.specular;x=A.parameters.ambient;D=A.parameters.shininess;b.tNormal.texture=K.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=
-K.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(I);b.uSpecularColor.value.setHex(z);b.uAmbientColor.value.setHex(x);b.uShininess.value=D;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);K.materials[v]=A}m();e.callbackSync(K)}},constructor:THREE.SceneLoader};
+x.tube,x.segmentsR,x.segmentsT),K.geometries[t]=G):x.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(x.subdivisions),K.geometries[t]=G):x.type=="bin_mesh"?I.load({model:f(x.url,T.urlBaseType),callback:n(t)}):x.type=="ascii_mesh"?D.load({model:f(x.url,T.urlBaseType),callback:n(t)}):x.type=="embedded_mesh"&&(x=T.embeds[x.id])&&D.createModel(x,p(t),"");for(w in T.textures)if(t=T.textures[w],t.url instanceof Array){S+=t.url.length;for(I=0;I<t.url.length;I++)e.onLoadStart()}else S+=1,e.onLoadStart();
+k=S;for(w in T.textures){t=T.textures[w];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){I=[];for(var $=0;$<t.url.length;$++)I[$]=f(t.url[$],T.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,t.mapping,b)}else{I=THREE.ImageUtils.loadTexture(f(t.url,T.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)I.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)I.magFilter=THREE[t.magFilter];if(t.repeat){I.repeat.set(t.repeat[0],t.repeat[1]);
+if(t.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}t.offset&&I.offset.set(t.offset[0],t.offset[1]);if(t.wrap){D={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(D[t.wrap[0]]!==void 0)I.wrapS=D[t.wrap[0]];if(D[t.wrap[1]]!==void 0)I.wrapT=D[t.wrap[1]]}}K.textures[w]=I}for(v in T.materials){w=T.materials[v];for(C in w.parameters)if(C=="envMap"||C=="map"||C=="lightMap")w.parameters[C]=K.textures[w.parameters[C]];else if(C=="shading")w.parameters[C]=
+w.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")w.parameters[C]=THREE[w.parameters[C]]?THREE[w.parameters[C]]:THREE.NormalBlending;else if(C=="combine")w.parameters[C]=w.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(w.parameters[C]=="face")w.parameters[C]=THREE.FaceColors;else if(w.parameters[C])w.parameters[C]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
+!0;if(w.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);I=w.parameters.color;D=w.parameters.specular;x=w.parameters.ambient;F=w.parameters.shininess;b.tNormal.texture=K.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)b.uNormalScale.value=w.parameters.normalMapFactor;if(w.parameters.map)b.tDiffuse.texture=w.parameters.map,b.enableDiffuse.value=!0;if(w.parameters.lightMap)b.tAO.texture=w.parameters.lightMap,b.enableAO.value=!0;if(w.parameters.specularMap)b.tSpecular.texture=
+K.textures[w.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(I);b.uSpecularColor.value.setHex(D);b.uAmbientColor.value.setHex(x);b.uShininess.value=F;if(w.parameters.opacity)b.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);K.materials[v]=w}m();e.callbackSync(K)}},constructor:THREE.SceneLoader};
 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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m+g*this.delta;c[j+1]=n;c[j+2]=p;h[j]=this.lerp(o[b],o[b+3],g);h[j+1]=this.lerp(o[b+1],o[b+4],g);h[j+2]=this.lerp(o[b+2],o[b+5],g)};this.VIntY=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n+g*this.delta;c[j+
 2]=p;c=b+this.yd*3;h[j]=this.lerp(o[b],o[c],g);h[j+1]=this.lerp(o[b+1],o[c+1],g);h[j+2]=this.lerp(o[b+2],o[c+2],g)};this.VIntZ=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=p+g*this.delta;c=b+this.zd*3;h[j]=this.lerp(o[b],o[c],g);h[j+1]=this.lerp(o[b+1],o[c+1],g);h[j+2]=this.lerp(o[b+2],o[c+2],g)};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,h,j,g,m){var n=j+1,p=j+this.yd,o=j+this.zd,t=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,w=n+this.yd+this.zd,B=0,x=this.field[j],A=this.field[n],E=this.field[p],F=this.field[t],J=this.field[o],C=this.field[v],G=this.field[u],O=this.field[w];x<g&&(B|=1);A<g&&(B|=2);E<g&&(B|=8);F<g&&(B|=4);J<g&&(B|=16);C<g&&(B|=32);G<g&&(B|=128);O<g&&(B|=64);var D=THREE.edgeTable[B];if(D==0)return 0;var I=this.delta,
-V=b+I,da=c+I,I=h+I;D&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,g,b,c,h,x,A));D&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,g,V,c,h,A,F));D&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,g,b,da,h,E,F));D&8&&(this.compNorm(j),this.compNorm(p),this.VIntY(j*3,this.vlist,this.nlist,9,g,b,c,h,x,E));D&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,g,b,c,I,J,C));D&32&&(this.compNorm(v),
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,g,V,c,I,C,O));D&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,g,b,da,I,G,O));D&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,g,b,c,I,J,G));D&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,g,b,c,h,x,J));D&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,g,V,c,h,A,C));D&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
-3,this.vlist,this.nlist,30,g,V,da,h,F,O));D&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,g,b,da,h,E,G));B<<=4;for(g=j=0;THREE.triTable[B+g]!=-1;)b=B+g,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),g+=3,j++;return j};this.posnormtriv=function(b,c,h,j,g,m){var n=this.count*3;this.positionArray[n]=b[h];this.positionArray[n+1]=b[h+1];this.positionArray[n+2]=b[h+2];this.positionArray[n+3]=b[j];this.positionArray[n+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,j,g,m){var n=j+1,p=j+this.yd,o=j+this.zd,t=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,y=n+this.yd+this.zd,z=0,x=this.field[j],w=this.field[n],H=this.field[p],B=this.field[t],J=this.field[o],C=this.field[v],G=this.field[u],O=this.field[y];x<g&&(z|=1);w<g&&(z|=2);H<g&&(z|=8);B<g&&(z|=4);J<g&&(z|=16);C<g&&(z|=32);G<g&&(z|=128);O<g&&(z|=64);var F=THREE.edgeTable[z];if(F==0)return 0;var I=this.delta,
+R=b+I,ca=c+I,I=h+I;F&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,g,b,c,h,x,w));F&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,g,R,c,h,w,B));F&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,g,b,ca,h,H,B));F&8&&(this.compNorm(j),this.compNorm(p),this.VIntY(j*3,this.vlist,this.nlist,9,g,b,c,h,x,H));F&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,g,b,c,I,J,C));F&32&&(this.compNorm(v),
+this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,g,R,c,I,C,O));F&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,g,b,ca,I,G,O));F&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,g,b,c,I,J,G));F&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,g,b,c,h,x,J));F&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,g,R,c,h,w,C));F&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
+3,this.vlist,this.nlist,30,g,R,ca,h,B,O));F&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,g,b,ca,h,H,G));z<<=4;for(g=j=0;THREE.triTable[z+g]!=-1;)b=z+g,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),g+=3,j++;return j};this.posnormtriv=function(b,c,h,j,g,m){var n=this.count*3;this.positionArray[n]=b[h];this.positionArray[n+1]=b[h+1];this.positionArray[n+2]=b[h+2];this.positionArray[n+3]=b[j];this.positionArray[n+
 4]=b[j+1];this.positionArray[n+5]=b[j+2];this.positionArray[n+6]=b[g];this.positionArray[n+7]=b[g+1];this.positionArray[n+8]=b[g+2];this.normalArray[n]=c[h];this.normalArray[n+1]=c[h+1];this.normalArray[n+2]=c[h+2];this.normalArray[n+3]=c[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+2];this.normalArray[n+6]=c[g];this.normalArray[n+7]=c[g+1];this.normalArray[n+8]=c[g+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,h,j,g){var m=this.size*Math.sqrt(j/g),n=h*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 v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
-1);for(var w,B,x,A,E,F;t<n;t++){o=this.size2*t;B=t/this.size-h;E=B*B;for(B=v;B<p;B++){x=o+this.size*B;w=B/this.size-c;F=w*w;for(w=u;w<m;w++)A=w/this.size-b,A=j/(1.0E-6+A*A+F+E)-g,A>0&&(this.field[x+w]+=A)}}};this.addPlaneX=function(b,c){var h,j,g,m,n,p=this.size,o=this.yd,t=this.zd,v=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(h=0;h<u;h++)if(j=h/p,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<p;j++){n=h+j*o;for(g=0;g<p;g++)v[t*g+n]+=m}};this.addPlaneY=function(b,c){var h,j,g,m,n,p,o=this.size,t=this.yd,v=
-this.zd,u=this.field,w=o*Math.sqrt(b/c);w>o&&(w=o);for(j=0;j<w;j++)if(h=j/o,h*=h,m=b/(1.0E-4+h)-c,m>0){n=j*t;for(h=0;h<o;h++){p=n+h;for(g=0;g<o;g++)u[v*g+p]+=m}}};this.addPlaneZ=function(b,c){var h,j,g,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(g=0;g<dist;g++)if(h=g/size,h*=h,m=b/(1.0E-4+h)-c,m>0){n=zd*g;for(j=0;j<size;j++){p=n+j*yd;for(h=0;h<size;h++)field[p+h]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+1);for(var y,z,x,w,H,B;t<n;t++){o=this.size2*t;z=t/this.size-h;H=z*z;for(z=v;z<p;z++){x=o+this.size*z;y=z/this.size-c;B=y*y;for(y=u;y<m;y++)w=y/this.size-b,w=j/(1.0E-6+w*w+B+H)-g,w>0&&(this.field[x+y]+=w)}}};this.addPlaneX=function(b,c){var h,j,g,m,n,p=this.size,o=this.yd,t=this.zd,v=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(h=0;h<u;h++)if(j=h/p,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<p;j++){n=h+j*o;for(g=0;g<p;g++)v[t*g+n]+=m}};this.addPlaneY=function(b,c){var h,j,g,m,n,p,o=this.size,t=this.yd,v=
+this.zd,u=this.field,y=o*Math.sqrt(b/c);y>o&&(y=o);for(j=0;j<y;j++)if(h=j/o,h*=h,m=b/(1.0E-4+h)-c,m>0){n=j*t;for(h=0;h<o;h++){p=n+h;for(g=0;g<o;g++)u[v*g+p]+=m}}};this.addPlaneZ=function(b,c){var h,j,g,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(g=0;g<dist;g++)if(h=g/size,h*=h,m=b/(1.0E-4+h)-c,m>0){n=zd*g;for(j=0;j<size;j++){p=n+j*yd;for(h=0;h<size;h++)field[p+h]+=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,h,j,g,m,n,p,o,t,v=this.size-2;for(g=1;g<v;g++){t=this.size2*g;p=(g-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=t+this.size*j;n=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++)m=(h-this.halfsize)/this.halfsize,c=o+h,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(j){var g,m,n,p,o,t,v,u;for(g=0;g<j.count;g++)v=g*3,o=v+1,u=v+2,m=j.positionArray[v],
 n=j.positionArray[o],p=j.positionArray[u],t=new THREE.Vector3(m,n,p),m=j.normalArray[v],n=j.normalArray[o],p=j.normalArray[u],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),h.push(v);nfaces=j.count/3;for(g=0;g<nfaces;g++)v=(b+g)*3,o=v+1,u=v+2,t=h[v],m=h[o],n=h[u],v=new THREE.Face3(v,o,u,[t,m,n]),c.faces.push(v);b+=nfaces;j.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,
@@ -622,7 +622,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 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,h=new THREE.Camera,j=new THREE.Camera,g=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;h.useTarget=j.useTarget=!1;h.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture: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 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;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(),E=125/30*0.5,F=E*p/125,J=p*Math.tan(o*Math.PI/360),C;g.n14=E;m.n14=-E;E=-J*n+F;C=J*n+F;A.n11=2*p/(C-E);A.n13=(C+E)/(C-E);h.projectionMatrix=A.clone();E=-J*n-F;C=J*n-F;A.n11=2*p/(C-E);
-A.n13=(C+E)/(C-E);j.projectionMatrix=A.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(g);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,u)}};
+var y=new THREE.Scene;y.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;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 w=e.projectionMatrix.clone(),H=125/30*0.5,B=H*p/125,J=p*Math.tan(o*Math.PI/360),C;g.n14=H;m.n14=-H;H=-J*n+B;C=J*n+B;w.n11=2*p/(C-H);w.n13=(C+H)/(C-H);h.projectionMatrix=w.clone();H=-J*n-B;C=J*n-B;w.n11=2*p/(C-H);
+w.n13=(C+H)/(C-H);j.projectionMatrix=w.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(g);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,y,u)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,j,g=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);h=b/2;j=f};this.render=function(b,e){this.clear();g.fov=e.fov;g.aspect=0.5*e.aspect;g.near=e.near;g.far=e.far;
 g.updateProjectionMatrix();g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(c.separation);m.projectionMatrix=g.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,j);f.call(c,b,g);this.setViewport(h,0,h,j);f.call(c,b,m,!1)}};

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,
 k=this.w,l=k*c+e*f-h*d,m=k*d+h*c-g*f,i=k*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*k+c*-g+m*-h-i*-e;b.y=m*k+c*-e+i*-g-l*-h;b.z=i*k+c*-h+l*-e-m*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,
 j=this.w,i=j*c+f*e-h*d,k=j*d+h*c-g*e,l=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||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;

+ 4 - 4
build/custom/ThreeExtras.js

@@ -38,7 +38,7 @@ this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,g,j,k,l;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];l=a[c[3]];c=f*f;g=f*c;e[0]=this.interpolate(h[0],j[0],k[0],l[0],f,c,g);e[1]=this.interpolate(h[1],j[1],k[1],l[1],f,c,g);e[2]=this.interpolate(h[2],j[2],k[2],l[2],f,c,g);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -50,7 +50,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
 THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,v=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)v=e*j.chunks[h]/j.total,c.keys[h]={time:v,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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.005;this.lookHorizontal=
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
@@ -58,7 +58,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g
 a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,g);a.position.set(0,10,0);this.animation=
 b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -139,7 +139,7 @@ THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THRE
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var j in h.faces){var k=e(h.faces[j].a,h.faces[j].b),l=e(h.faces[j].b,h.faces[j].c),m=e(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,g);c(h.faces[j].b,l,k,g);
 c(h.faces[j].c,m,l,g);c(k,l,m,g)}h.faces=g.faces}f.faces=h.faces;delete h;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),e[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.001;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),f[j]=this.vertices.length-1):f=h;k==0&&(h=e);
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),e[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),f[j]=this.vertices.length-1):f=h;k==0&&(h=e);
 for(j=0;j<e.length-1;j++)this.faces.push(new THREE.Face4(f[j],f[j+1],e[j+1],e[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,j/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,g=b/2,c=c||1,e=e||1,j=c+1,k=e+1;a/=c;var l=b/e;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*l-g),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;

+ 1 - 1
build/custom/ThreeSVG.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,
 l=this.w,i=l*c+e*f-h*d,k=l*d+h*c-g*f,j=l*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*l+c*-g+k*-h-j*-e;b.y=k*l+c*-e+j*-g-i*-h;b.z=j*l+c*-h+i*-e-k*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 59 - 59
build/custom/ThreeWebGL.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,d,e,f){t
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
 b,this.w*=b);return this},multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,h=this.w,i=b.x,g=b.y,j=b.z,b=b.w;this.x=d*b+h*i+e*j-f*g;this.y=e*b+h*g+f*i-d*j;this.z=f*b+h*j+d*g-e*i;this.w=h*b-d*i-e*g-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,h=b.z,i=this.x,g=this.y,j=this.z,
 k=this.w,q=k*e+g*h-j*f,n=k*f+j*e-i*h,r=k*h+i*f-g*e,e=-i*e-g*f-j*h;d.x=q*k+e*-i+n*-j-r*-g;d.y=n*k+e*-g+r*-i-q*-j;d.z=r*k+e*-j+q*-g-n*-i;return d}};
-THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -227,64 +227,64 @@ g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uni
 h,i,j,k=new THREE.Vector3,q=qa/la,p=la*0.5,n=qa*0.5,r=16/qa,t=[r*q,r],o=[1,1,0],w=[1,1],v=A.uniforms;d=A.attributes;c.useProgram(A.program);R=A.program;T=da=-1;Ua||(c.enableVertexAttribArray(A.attributes.vertex),c.enableVertexAttribArray(A.attributes.uv),Ua=!0);c.uniform1i(v.occlusionMap,0);c.uniform1i(v.map,1);c.bindBuffer(c.ARRAY_BUFFER,A.vertexBuffer);c.vertexAttribPointer(d.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(d.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.elementBuffer);
 c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(d=b.__webglLensFlares[f].object,k.set(d.matrixWorld.n14,d.matrixWorld.n24,d.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(k),e.projectionMatrix.multiplyVector3(k),o[0]=k.x,o[1]=k.y,o[2]=k.z,w[0]=o[0]*p+p,w[1]=o[1]*n+n,A.hasVertexTexture||w[0]>0&&w[0]<la&&w[1]>0&&w[1]<qa){c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
 0,c.RGB,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,0);c.uniform2fv(v.scale,t);c.uniform3fv(v.screenPosition,o);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);d.positionScreen.x=o[0];d.positionScreen.y=
-o[1];d.positionScreen.z=o[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(v.renderType,2);c.enable(c.BLEND);h=0;for(i=d.lensFlares.length;h<i;h++)if(j=d.lensFlares[h],j.opacity>0.001&&j.scale>0.001)o[0]=j.x,o[1]=j.y,o[2]=j.z,r=j.size*j.scale/qa,t[0]=r*q,t[1]=r,c.uniform3fv(v.screenPosition,o),c.uniform2fv(v.scale,t),c.uniform1f(v.rotation,j.rotation),c.uniform1f(v.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);
-c.enable(c.DEPTH_TEST);c.depthMask(L)}function U(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ta(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function fa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=
-!1}function I(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=ta(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var i=b,j=c.DYNAMIC_DRAW;if(h.__inittedArrays){var k=void 0,q=void 0,n=void 0,p=void 0,r=n=void 0,C=void 0,t=void 0,o=void 0,w=void 0,v=void 0,A=void 0,E=void 0,F=void 0,x=void 0,y=void 0,u=void 0,G=void 0,s=p=o=p=t=C=void 0,m=void 0,B=
-m=s=C=void 0,K=void 0,L=B=m=s=n=n=r=o=p=B=m=s=K=B=m=s=K=B=m=s=void 0,I=0,J=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,B=s=0,B=void 0,ia=h.__vertexArray,aa=h.__uvArray,ca=h.__uv2Array,Q=h.__normalArray,W=h.__tangentArray,ja=h.__colorArray,X=h.__skinVertexAArray,Y=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,da=h.__morphTargetsArrays,U=h.__webglCustomAttributes,m=void 0,P=h.__faceArray,T=h.__lineArray,ma=h.__needsSmoothNormals,v=h.__vertexColorType,w=h.__uvType,A=h.__normalType,oa=i.geometry,
-la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=h.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Da=oa.skinVerticesA,Ea=oa.skinVerticesB,Fa=oa.skinIndices,za=oa.skinWeights,Aa=i instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(L in U)U[L].offset=0,U[L].offsetSrc=0;k=0;for(q=ua.length;k<q;k++)if(n=ua[k],p=va[n],wa&&(E=wa[n]),xa&&(F=xa[n]),
-n=p.vertexNormals,r=p.normal,C=p.vertexColors,t=p.color,o=p.vertexTangents,p instanceof THREE.Face3){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,J+=9;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo==="faces"?
-(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c]):m.boundTo==="faces"?(u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],m.offsetSrc+=3),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+
-3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z),m.offset+=9):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+5]=y.y,m.array[s+
-6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.offset+=12));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z;ga+=9}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+
-9]=B.y,$[z+10]=B.z,$[z+11]=B.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=
-1,z+=12;if(ra&&v)C.length==3&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2]):m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,V+=12;if(pa&&A)if(n.length==3&&ma)for(o=0;o<3;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<3;o++)Q[N]=r.x,
-Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<3;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<3;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+2,M+=3,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+2,T[O+4]=I+1,T[O+5]=I+2,O+=6,I+=3)}else if(p instanceof THREE.Face4){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,G=ka[p.d].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,
-ia[J+9]=G.x,ia[J+10]=G.y,ia[J+11]=G.z,J+=12;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.array[s+3]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.array[s+3]=
-m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c],G=m.value[p.d]):m.boundTo==="faces"?(G=u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],G=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=G.x,m.array[s+7]=G.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=
-x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b,m.array[s+9]=G.r,m.array[s+10]=G.g,m.array[s+11]=G.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z,m.array[s+9]=G.x,m.array[s+10]=G.y,m.array[s+11]=G.z),m.offset+=12):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+
-5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.array[s+12]=G.x,m.array[s+13]=G.y,m.array[s+14]=G.z,m.array[s+15]=G.w,m.offset+=16));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,G=ya[s].vertices[p.d].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z,B[ga+9]=G.x,B[ga+10]=G.y,B[ga+
-11]=G.z;ga+=12}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],K=za[p.d],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,$[z+12]=K.x,$[z+13]=K.y,$[z+14]=K.z,$[z+15]=K.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],K=Fa[p.d],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,Z[z+12]=K.x,Z[z+13]=K.y,Z[z+14]=K.z,Z[z+15]=K.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],K=Da[p.d],
-X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,X[z+12]=K.x,X[z+13]=K.y,X[z+14]=K.z,X[z+15]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],p=Ea[p.d],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,Y[z+12]=p.x,Y[z+13]=p.y,Y[z+14]=p.z,Y[z+15]=1,z+=16;if(ra&&v)C.length==4&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2],C=C[3]):C=m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+
-2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=C.r,ja[ea+10]=C.g,ja[ea+11]=C.b,ea+=12;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],o=o[3],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,W[V+12]=o.x,W[V+13]=o.y,W[V+14]=o.z,W[V+15]=o.w,V+=16;if(pa&&A)if(n.length==4&&ma)for(o=0;o<4;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<4;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+
-2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<4;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<4;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+3,P[M+3]=I+1,P[M+4]=I+2,P[M+5]=I+3,M+=6,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+3,T[O+4]=I+1,T[O+5]=I+2,T[O+6]=I+2,T[O+7]=I+3,O+=8,I+=4)}if(Aa){k=0;for(q=Aa.length;k<q;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),
-c.bufferData(c.ARRAY_BUFFER,ia,j));if(U)for(L in U)m=U[L],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(m=ya.length;s<m;s++)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,da[s],j)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&oa.hasTangents&&
-(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,j));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,T,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,
-h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));i.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
-delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;fa(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=
-0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;
-A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=ta(f),(f.__dirtyVertices||
-f.__dirtyColors||b.sortParticles||h)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,fa(f)}function w(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function P(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,g,i,j,k,p={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)g=b.faces[f],i=g.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,
-counter:0}),k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n}),g=g instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+g>65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=g}function J(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function M(b){if(b!=da){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}da=b}}function Q(b,d,e){(e.width&
-e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,va(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,va(d.minFilter)))}function ra(b,d){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
-c.createTexture(),b.__webglInit=!0;c.bindTexture(c.TEXTURE_2D,b.__webglTexture);b.image.data?c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.image.width,b.image.height,0,N(b.format),c.UNSIGNED_BYTE,b.image.data):c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);Q(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ka(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
-!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(b.format),
-b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,
-c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=la,b=qa);d!=pa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(Ha,Ia,e,b),pa=d)}function aa(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):
-b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
-case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
-case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var K=this,c,ha=[],R=null,pa=null,L=!0,ca=null,O=null,da=null,T=null,S=null,ua=null,Ga=null,Ha=0,Ia=0,la=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],wa=new THREE.Matrix4,Ka=new Float32Array(16),La=new Float32Array(16),Ja=new THREE.Vector4,Ra={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"),Pa=b.stencil!==void 0?b.stencil:!0,y=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ma=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;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var na,Na=[],b=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(b.uniforms),Oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:Va}),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va,morphTargets:!0});Oa._shadowPass=!0;Sa._shadowPass=!0;try{if(!(c=xa.getContext("experimental-webgl",{antialias:y,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Xa){console.error(Xa)}c.clearColor(0,
-0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(sa.r,sa.g,sa.b,Ma);this.context=c;var Wa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Pa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;
-u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();
-c.attachShader(u.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var A={};A.vertices=new Float32Array(16);A.faces=new Uint16Array(6);y=0;A.vertices[y++]=-1;A.vertices[y++]=-1;A.vertices[y++]=
-0;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;y=0;A.faces[y++]=0;A.faces[y++]=1;A.faces[y++]=2;A.faces[y++]=0;A.faces[y++]=2;A.faces[y++]=3;A.vertexBuffer=c.createBuffer();A.elementBuffer=c.createBuffer();A.tempTexture=c.createTexture();A.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,A.vertexBuffer);
-c.bufferData(c.ARRAY_BUFFER,A.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,A.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
-c.NEAREST);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(A.hasVertexTexture=!1,A.program=c.createProgram(),c.attachShader(A.program,
-aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(A.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(A.hasVertexTexture=!0,A.program=c.createProgram(),c.attachShader(A.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(A.program,aa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(A.program);A.attributes={};A.uniforms={};A.attributes.vertex=c.getAttribLocation(A.program,"position");A.attributes.uv=
-c.getAttribLocation(A.program,"UV");A.uniforms.renderType=c.getUniformLocation(A.program,"renderType");A.uniforms.map=c.getUniformLocation(A.program,"map");A.uniforms.occlusionMap=c.getUniformLocation(A.program,"occlusionMap");A.uniforms.opacity=c.getUniformLocation(A.program,"opacity");A.uniforms.scale=c.getUniformLocation(A.program,"scale");A.uniforms.rotation=c.getUniformLocation(A.program,"rotation");A.uniforms.screenPosition=c.getUniformLocation(A.program,"screenPosition");var Ua=!1,v={};v.vertices=
-new Float32Array(16);v.faces=new Uint16Array(6);y=0;v.vertices[y++]=-1;v.vertices[y++]=-1;v.vertices[y++]=0;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=0;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=0;y=v.vertices[y++]=0;v.faces[y++]=0;v.faces[y++]=1;v.faces[y++]=2;v.faces[y++]=0;v.faces[y++]=2;v.faces[y++]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();
-c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,v.faces,c.STATIC_DRAW);v.program=c.createProgram();c.attachShader(v.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(v.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.position=c.getAttribLocation(v.program,"position");
-v.attributes.uv=c.getAttribLocation(v.program,"uv");v.uniforms.uvOffset=c.getUniformLocation(v.program,"uvOffset");v.uniforms.uvScale=c.getUniformLocation(v.program,"uvScale");v.uniforms.rotation=c.getUniformLocation(v.program,"rotation");v.uniforms.scale=c.getUniformLocation(v.program,"scale");v.uniforms.alignment=c.getUniformLocation(v.program,"alignment");v.uniforms.map=c.getUniformLocation(v.program,"map");v.uniforms.opacity=c.getUniformLocation(v.program,"opacity");v.uniforms.useScreenCoordinates=
-c.getUniformLocation(v.program,"useScreenCoordinates");v.uniforms.affectedByDistance=c.getUniformLocation(v.program,"affectedByDistance");v.uniforms.screenPosition=c.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=c.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=c.getUniformLocation(v.program,"projectionMatrix");var Ta=!1;this.setSize=function(b,c){xa.width=b;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,d,
-e,f){Ha=b;Ia=d;la=e;qa=f;c.viewport(Ha,Ia,la,qa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;c.depthMask(b)};this.setClearColorHex=function(b,d){sa.setHex(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.setClearColor=function(b,d){sa.copy(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};
-this.setStencilShadowDarkness=function(b){u.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var h,g,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof
-THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,n,p;k=p=j=0;for(n=d.length;k<n;k++)g=d[k],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&j++;j+p<=4?k=p:(k=Math.ceil(4*p/(j+p)),j=4-k);g={directional:k,point:j};j=p=0;for(k=d.length;j<k;j++)n=d[j],n instanceof THREE.SpotLight&&n.castShadow&&p++;
-var q=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)q=f.bones.length;var o;a:{k=b.fragmentShader;n=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},r,f=[];i?f.push(i):(f.push(k),f.push(n));for(r in e)f.push(r),f.push(e[r]);i=f.join();r=0;for(f=ha.length;r<f;r++)if(ha[r].code==i){o=ha[r].program;break a}r=c.createProgram();f=[Wa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?
-"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
+o[1];d.positionScreen.z=o[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(v.renderType,2);c.enable(c.BLEND);h=0;for(i=d.lensFlares.length;h<i;h++)if(j=d.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)o[0]=j.x,o[1]=j.y,o[2]=j.z,r=j.size*j.scale/qa,t[0]=r*q,t[1]=r,c.uniform3fv(v.screenPosition,o),c.uniform2fv(v.scale,t),c.uniform1f(v.rotation,j.rotation),c.uniform1f(v.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
+0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(L)}function U(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ta(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function fa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=
+f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function I(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=ta(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var i=b,j=c.DYNAMIC_DRAW;if(h.__inittedArrays){var k=void 0,q=void 0,n=void 0,p=void 0,r=n=void 0,C=void 0,t=void 0,o=void 0,w=void 0,v=void 0,A=void 0,E=void 0,F=void 0,
+x=void 0,y=void 0,u=void 0,G=void 0,s=p=o=p=t=C=void 0,m=void 0,B=m=s=C=void 0,K=void 0,L=B=m=s=n=n=r=o=p=B=m=s=K=B=m=s=K=B=m=s=void 0,I=0,J=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,B=s=0,B=void 0,ia=h.__vertexArray,aa=h.__uvArray,ca=h.__uv2Array,Q=h.__normalArray,W=h.__tangentArray,ja=h.__colorArray,X=h.__skinVertexAArray,Y=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,da=h.__morphTargetsArrays,U=h.__webglCustomAttributes,m=void 0,P=h.__faceArray,T=h.__lineArray,ma=h.__needsSmoothNormals,
+v=h.__vertexColorType,w=h.__uvType,A=h.__normalType,oa=i.geometry,la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=h.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Da=oa.skinVerticesA,Ea=oa.skinVerticesB,Fa=oa.skinIndices,za=oa.skinWeights,Aa=i instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(L in U)U[L].offset=0,U[L].offsetSrc=0;k=0;
+for(q=ua.length;k<q;k++)if(n=ua[k],p=va[n],wa&&(E=wa[n]),xa&&(F=xa[n]),n=p.vertexNormals,r=p.normal,C=p.vertexColors,t=p.color,o=p.vertexTangents,p instanceof THREE.Face3){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,J+=9;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],
+m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c]):m.boundTo==="faces"?(u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],m.offsetSrc+=
+3),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z),m.offset+=9):(m.array[s]=x.x,m.array[s+1]=
+x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.offset+=12));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z;ga+=9}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],$[z]=s.x,$[z+1]=s.y,
+$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+
+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,z+=12;if(ra&&v)C.length==3&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2]):m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,V+=12;if(pa&&A)if(n.length==3&&ma)for(o=0;o<
+3;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<3;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<3;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<3;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+2,M+=3,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+2,T[O+4]=I+1,T[O+5]=I+2,O+=6,I+=3)}else if(p instanceof THREE.Face4){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,G=ka[p.d].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+
+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,ia[J+9]=G.x,ia[J+10]=G.y,ia[J+11]=G.z,J+=12;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.array[s+3]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=
+m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.array[s+3]=m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c],G=m.value[p.d]):m.boundTo==="faces"?(G=u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],G=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+
+6]=G.x,m.array[s+7]=G.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b,m.array[s+9]=G.r,m.array[s+10]=G.g,m.array[s+11]=G.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z,m.array[s+9]=G.x,m.array[s+10]=G.y,m.array[s+11]=G.z),m.offset+=12):(m.array[s]=x.x,
+m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.array[s+12]=G.x,m.array[s+13]=G.y,m.array[s+14]=G.z,m.array[s+15]=G.w,m.offset+=16));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,G=ya[s].vertices[p.d].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,
+B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z,B[ga+9]=G.x,B[ga+10]=G.y,B[ga+11]=G.z;ga+=12}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],K=za[p.d],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,$[z+12]=K.x,$[z+13]=K.y,$[z+14]=K.z,$[z+15]=K.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],K=Fa[p.d],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,Z[z+
+12]=K.x,Z[z+13]=K.y,Z[z+14]=K.z,Z[z+15]=K.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],K=Da[p.d],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,X[z+12]=K.x,X[z+13]=K.y,X[z+14]=K.z,X[z+15]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],p=Ea[p.d],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,Y[z+12]=p.x,Y[z+13]=p.y,Y[z+14]=p.z,Y[z+15]=1,z+=16;if(ra&&v)C.length==4&&v==THREE.VertexColors?
+(p=C[0],s=C[1],m=C[2],C=C[3]):C=m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=C.r,ja[ea+10]=C.g,ja[ea+11]=C.b,ea+=12;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],o=o[3],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,W[V+12]=o.x,W[V+13]=o.y,W[V+14]=o.z,W[V+15]=o.w,V+=16;if(pa&&A)if(n.length==4&&ma)for(o=0;o<4;o++)r=n[o],Q[N]=r.x,Q[N+
+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<4;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<4;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<4;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+3,P[M+3]=I+1,P[M+4]=I+2,P[M+5]=I+3,M+=6,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+3,T[O+4]=I+1,T[O+5]=I+2,T[O+6]=I+2,T[O+7]=I+3,O+=8,I+=4)}if(Aa){k=0;for(q=Aa.length;k<q;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=
+Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,ia,j));if(U)for(L in U)m=U[L],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(m=ya.length;s<m;s++)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,da[s],j)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),
+c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&oa.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,j));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,
+T,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));i.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,
+delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;fa(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;
+E=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;
+w=b.vertices;h=b.colors;v=w.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
+b.geometry,h=ta(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||h)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,fa(f)}function w(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function P(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,g,i,j,k,p={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)g=b.faces[f],i=g.materials,
+j=c(i),p[j]==void 0&&(p[j]={hash:j,counter:0}),k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n}),g=g instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+g>65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=g}function J(b,c,d){b.push({buffer:c,object:d,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(b){if(b!=da){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}da=
+b}}function Q(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,va(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,va(d.minFilter)))}
+function ra(b,d){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=c.createTexture(),b.__webglInit=!0;c.bindTexture(c.TEXTURE_2D,b.__webglTexture);b.image.data?c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.image.width,b.image.height,0,N(b.format),c.UNSIGNED_BYTE,b.image.data):c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);Q(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ka(b){if(b&&
+!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
+N(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):
+b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=la,b=qa);d!=pa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),
+c.viewport(Ha,Ia,e,b),pa=d)}function aa(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;
+case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;
+case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var K=this,c,ha=[],R=null,
+pa=null,L=!0,ca=null,O=null,da=null,T=null,S=null,ua=null,Ga=null,Ha=0,Ia=0,la=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],wa=new THREE.Matrix4,Ka=new Float32Array(16),La=new Float32Array(16),Ja=new THREE.Vector4,Ra={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"),Pa=b.stencil!==void 0?
+b.stencil:!0,y=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Xa=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ma=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;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=
+50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var na,Na=[],b=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(b.uniforms),Oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va}),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va,morphTargets:!0});Oa._shadowPass=!0;Sa._shadowPass=!0;try{if(!(c=xa.getContext("experimental-webgl",{antialias:Xa,stencil:Pa,preserveDrawingBuffer:y})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Ya){console.error(Ya)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(sa.r,sa.g,sa.b,Ma);this.context=c;var Wa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0;if(Pa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,
+u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=
+c.getUniformLocation(u.program,"darkness")}var A={};A.vertices=new Float32Array(16);A.faces=new Uint16Array(6);y=0;A.vertices[y++]=-1;A.vertices[y++]=-1;A.vertices[y++]=0;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;y=0;A.faces[y++]=0;A.faces[y++]=1;A.faces[y++]=2;A.faces[y++]=0;A.faces[y++]=2;A.faces[y++]=3;
+A.vertexBuffer=c.createBuffer();A.elementBuffer=c.createBuffer();A.tempTexture=c.createTexture();A.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,A.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,A.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,A.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,
+c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);
+c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(A.hasVertexTexture=!1,A.program=c.createProgram(),c.attachShader(A.program,aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(A.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(A.hasVertexTexture=!0,A.program=c.createProgram(),c.attachShader(A.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(A.program,aa("vertex",
+THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(A.program);A.attributes={};A.uniforms={};A.attributes.vertex=c.getAttribLocation(A.program,"position");A.attributes.uv=c.getAttribLocation(A.program,"UV");A.uniforms.renderType=c.getUniformLocation(A.program,"renderType");A.uniforms.map=c.getUniformLocation(A.program,"map");A.uniforms.occlusionMap=c.getUniformLocation(A.program,"occlusionMap");A.uniforms.opacity=c.getUniformLocation(A.program,"opacity");A.uniforms.scale=c.getUniformLocation(A.program,
+"scale");A.uniforms.rotation=c.getUniformLocation(A.program,"rotation");A.uniforms.screenPosition=c.getUniformLocation(A.program,"screenPosition");var Ua=!1,v={};v.vertices=new Float32Array(16);v.faces=new Uint16Array(6);y=0;v.vertices[y++]=-1;v.vertices[y++]=-1;v.vertices[y++]=0;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=0;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=0;y=
+v.vertices[y++]=0;v.faces[y++]=0;v.faces[y++]=1;v.faces[y++]=2;v.faces[y++]=0;v.faces[y++]=2;v.faces[y++]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,v.faces,c.STATIC_DRAW);v.program=c.createProgram();c.attachShader(v.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(v.program,
+aa("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.position=c.getAttribLocation(v.program,"position");v.attributes.uv=c.getAttribLocation(v.program,"uv");v.uniforms.uvOffset=c.getUniformLocation(v.program,"uvOffset");v.uniforms.uvScale=c.getUniformLocation(v.program,"uvScale");v.uniforms.rotation=c.getUniformLocation(v.program,"rotation");v.uniforms.scale=c.getUniformLocation(v.program,"scale");v.uniforms.alignment=c.getUniformLocation(v.program,
+"alignment");v.uniforms.map=c.getUniformLocation(v.program,"map");v.uniforms.opacity=c.getUniformLocation(v.program,"opacity");v.uniforms.useScreenCoordinates=c.getUniformLocation(v.program,"useScreenCoordinates");v.uniforms.affectedByDistance=c.getUniformLocation(v.program,"affectedByDistance");v.uniforms.screenPosition=c.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=c.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=c.getUniformLocation(v.program,
+"projectionMatrix");var Ta=!1;this.setSize=function(b,c){xa.width=b;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,d,e,f){Ha=b;Ia=d;la=e;qa=f;c.viewport(Ha,Ia,la,qa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;c.depthMask(b)};this.setClearColorHex=function(b,d){sa.setHex(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.setClearColor=
+function(b,d){sa.copy(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var h,g,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":
+b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,n,p;k=p=j=0;for(n=d.length;k<n;k++)g=d[k],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&
+j++;j+p<=4?k=p:(k=Math.ceil(4*p/(j+p)),j=4-k);g={directional:k,point:j};j=p=0;for(k=d.length;j<k;j++)n=d[j],n instanceof THREE.SpotLight&&n.castShadow&&p++;var q=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)q=f.bones.length;var o;a:{k=b.fragmentShader;n=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:g.directional,maxPointLights:g.point,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},r,f=[];i?f.push(i):(f.push(k),f.push(n));for(r in e)f.push(r),f.push(e[r]);i=f.join();r=0;for(f=ha.length;r<f;r++)if(ha[r].code==i){o=ha[r].program;break a}r=c.createProgram();f=[Wa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
 g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
 "",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");c.attachShader(r,aa("fragment",g+k));c.attachShader(r,aa("vertex",f+n));c.linkProgram(r);c.getProgramParameter(r,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(r,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");r.uniforms=
 {};r.attributes={};var t,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in j)f.push(t);t=f;f=0;for(j=t.length;f<j;f++)k=t[f],r.uniforms[k]=c.getUniformLocation(r,k);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<e.maxMorphTargets;t++)f.push("morphTarget"+t);for(o in d)f.push(o);o=f;t=0;for(d=o.length;t<d;t++)e=