Bläddra i källkod

WebGLRenderer: Sprites can now be removed from the Scene (thx jetienne)
Some white space clean up.

Mr.doob 14 år sedan
förälder
incheckning
7361be39df

+ 177 - 177
build/Three.js

@@ -12,21 +12,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
 THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(H,G,X,A){A=A.clone().subSelf(G);X=X.clone().subSelf(G);var M=H.clone().subSelf(G);H=A.dot(A);G=A.dot(X);A=A.dot(M);var Q=X.dot(X);X=X.dot(M);M=1/(H*Q-G*G);Q=(Q*A-G*X)*M;H=(H*X-G*A)*M;return Q>0&&H>0&&Q+H<1}var c,f,g,h,j,k,m,p,o,u,
-y,t=b.geometry,B=t.vertices,F=[];c=0;for(f=t.faces.length;c<f;c++){g=t.faces[c];u=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(B[g.a].position.clone());j=m.multiplyVector3(B[g.b].position.clone());k=m.multiplyVector3(B[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,u))/
-o;u=u.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(d(u,h,j,k)){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(d(u,h,j,m)||d(u,j,k,m))){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};F.push(g)}}}return F}};
-THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,p,o,u){k=!1;d=m;c=p;f=o;g=u;b()};this.addPoint=function(m,p){if(k){k=!1;d=m;c=p;f=m;g=p}else{d=d<m?d:m;c=c<p?c:p;f=f>m?f:m;g=g>p?g:p}b()};
-this.add3Points=function(m,p,o,u,y,t){if(k){k=!1;d=m<o?m<y?m:y:o<y?o:y;c=p<u?p<t?p:t:u<t?u:t;f=m>o?m>y?m:y:o>y?o:y;g=p>u?p>t?p:t:u>t?u:t}else{d=m<o?m<y?m<d?m:d:y<d?y:d:o<y?o<d?o:d:y<d?y:d;c=p<u?p<t?p<c?p:c:t<c?t:c:u<t?u<c?u:c:t<c?t:c;f=m>o?m>y?m>f?m:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>u?p>t?p>g?p:g:t>g?t:g:u>t?u>g?u:g:t>g?t:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
+THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(H,G,X,A){A=A.clone().subSelf(G);X=X.clone().subSelf(G);var M=H.clone().subSelf(G);H=A.dot(A);G=A.dot(X);A=A.dot(M);var Q=X.dot(X);X=X.dot(M);M=1/(H*Q-G*G);Q=(Q*A-G*X)*M;H=(H*X-G*A)*M;return Q>0&&H>0&&Q+H<1}var c,f,g,h,j,k,m,p,o,v,
+y,t=b.geometry,B=t.vertices,F=[];c=0;for(f=t.faces.length;c<f;c++){g=t.faces[c];v=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(B[g.a].position.clone());j=m.multiplyVector3(B[g.b].position.clone());k=m.multiplyVector3(B[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,v))/
+o;v=v.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(d(v,h,j,k)){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(d(v,h,j,m)||d(v,j,k,m))){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};F.push(g)}}}return F}};
+THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,p,o,v){k=!1;d=m;c=p;f=o;g=v;b()};this.addPoint=function(m,p){if(k){k=!1;d=m;c=p;f=m;g=p}else{d=d<m?d:m;c=c<p?c:p;f=f>m?f:m;g=g>p?g:p}b()};
+this.add3Points=function(m,p,o,v,y,t){if(k){k=!1;d=m<o?m<y?m:y:o<y?o:y;c=p<v?p<t?p:t:v<t?v:t;f=m>o?m>y?m:y:o>y?o:y;g=p>v?p>t?p:t:v>t?v:t}else{d=m<o?m<y?m<d?m:d:y<d?y:d:o<y?o<d?o:d:y<d?y:d;c=p<v?p<t?p<c?p:c:t<c?t:c:v<t?v<c?v:c:t<c?t:c;f=m>o?m>y?m>f?m:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>v?p>t?p>g?p:g:t>g?t:g:v>t?v>g?v:g:t>g?t:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
 f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c:m.getTop();f=f<m.getRight()?f:m.getRight();g=g<m.getBottom()?g:m.getBottom();b()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(d,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
-THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,p,o,u,y,t,B,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,u||0,y||0,t||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,p,o,u,y,t,B,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=o;this.n34=u;this.n41=y;this.n42=t;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
+THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,p,o,v,y,t,B,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,v||0,y||0,t||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,p,o,v,y,t,B,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=o;this.n34=v;this.n41=y;this.n42=t;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,t=b.n34,B=b.n41,F=b.n42,H=b.n43,G=b.n44,X=d.n11,A=d.n12,M=d.n13,Q=d.n14,R=d.n21,Da=d.n22,
-ma=d.n23,va=d.n24,ca=d.n31,e=d.n32,ea=d.n33,ya=d.n34;this.n11=c*X+f*R+g*ca;this.n12=c*A+f*Da+g*e;this.n13=c*M+f*ma+g*ea;this.n14=c*Q+f*va+g*ya+h;this.n21=j*X+k*R+m*ca;this.n22=j*A+k*Da+m*e;this.n23=j*M+k*ma+m*ea;this.n24=j*Q+k*va+m*ya+p;this.n31=o*X+u*R+y*ca;this.n32=o*A+u*Da+y*e;this.n33=o*M+u*ma+y*ea;this.n34=o*Q+u*va+y*ya+t;this.n41=B*X+F*R+H*ca;this.n42=B*A+F*Da+H*e;this.n43=B*M+F*ma+H*ea;this.n44=B*Q+F*va+H*ya+G;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,v=b.n32,y=b.n33,t=b.n34,B=b.n41,F=b.n42,H=b.n43,G=b.n44,X=d.n11,A=d.n12,M=d.n13,Q=d.n14,R=d.n21,Da=d.n22,
+ma=d.n23,va=d.n24,ca=d.n31,e=d.n32,ea=d.n33,ya=d.n34;this.n11=c*X+f*R+g*ca;this.n12=c*A+f*Da+g*e;this.n13=c*M+f*ma+g*ea;this.n14=c*Q+f*va+g*ya+h;this.n21=j*X+k*R+m*ca;this.n22=j*A+k*Da+m*e;this.n23=j*M+k*ma+m*ea;this.n24=j*Q+k*va+m*ya+p;this.n31=o*X+v*R+y*ca;this.n32=o*A+v*Da+y*e;this.n33=o*M+v*ma+y*ea;this.n34=o*Q+v*va+y*ya+t;this.n41=B*X+F*R+H*ca;this.n42=B*A+F*Da+H*e;this.n43=B*M+F*ma+H*ea;this.n44=B*Q+F*va+H*ya+G;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
 this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,o=this.n33,u=this.n34,y=this.n41,t=this.n42,B=this.n43,F=this.n44;return f*j*p*y-c*k*p*y-f*h*o*y+d*k*o*y+c*h*u*y-d*j*u*y-f*j*m*t+c*k*m*t+f*g*o*t-b*k*o*t-c*g*u*t+b*j*u*t+f*h*m*B-d*k*m*B-f*g*p*B+b*k*p*B+d*g*u*B-b*h*u*B-c*h*m*F+d*j*m*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,o=this.n33,v=this.n34,y=this.n41,t=this.n42,B=this.n43,F=this.n44;return f*j*p*y-c*k*p*y-f*h*o*y+d*k*o*y+c*h*v*y-d*j*v*y-f*j*m*t+c*k*m*t+f*g*o*t-b*k*o*t-c*g*v*t+b*j*v*t+f*h*m*B-d*k*m*B-f*g*p*B+b*k*p*B+d*g*v*B-b*h*v*B-c*h*m*F+d*j*m*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
@@ -34,9 +34,9 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 1-c,h=b.x,j=b.y,k=b.z,m=g*h,p=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,p*j+c,p*k-f*h,0,m*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33=
 b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,t=b.n34,B=b.n41,F=b.n42,H=b.n43,G=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*t*F-p*y*F+p*u*H-k*t*H-m*u*G+k*y*G;d.n12=h*y*F-g*t*F-h*u*H+f*t*H+g*u*G-f*y*G;d.n13=g*p*F-h*m*F+h*k*H-f*p*H-g*k*G+f*m*G;d.n14=h*m*u-g*p*u-h*k*y+f*p*y+g*k*t-f*m*t;d.n21=p*y*B-m*t*B-p*o*H+j*t*H+m*o*G-j*y*G;d.n22=g*t*B-h*y*B+h*o*H-c*t*H-g*o*G+c*y*G;d.n23=h*m*B-g*p*B-h*j*H+c*p*H+g*j*G-c*m*G;
-d.n24=g*p*o-h*m*o+h*j*y-c*p*y-g*j*t+c*m*t;d.n31=k*t*B-p*u*B+p*o*F-j*t*F-k*o*G+j*u*G;d.n32=h*u*B-f*t*B-h*o*F+c*t*F+f*o*G-c*u*G;d.n33=g*p*B-h*k*B+h*j*F-c*p*F-f*j*G+c*k*G;d.n34=h*k*o-f*p*o-h*j*u+c*p*u+f*j*t-c*k*t;d.n41=m*u*B-k*y*B-m*o*F+j*y*F+k*o*H-j*u*H;d.n42=f*y*B-g*u*B+g*o*F-c*y*F-f*o*H+c*u*H;d.n43=g*k*B-f*m*B-g*j*F+c*m*F+f*j*H-c*k*H;d.n44=f*m*o-g*k*o+g*j*u-c*m*u-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*p;c[7]=b*o;c[8]=b*u;return d};
+THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,v=b.n32,y=b.n33,t=b.n34,B=b.n41,F=b.n42,H=b.n43,G=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*t*F-p*y*F+p*v*H-k*t*H-m*v*G+k*y*G;d.n12=h*y*F-g*t*F-h*v*H+f*t*H+g*v*G-f*y*G;d.n13=g*p*F-h*m*F+h*k*H-f*p*H-g*k*G+f*m*G;d.n14=h*m*v-g*p*v-h*k*y+f*p*y+g*k*t-f*m*t;d.n21=p*y*B-m*t*B-p*o*H+j*t*H+m*o*G-j*y*G;d.n22=g*t*B-h*y*B+h*o*H-c*t*H-g*o*G+c*y*G;d.n23=h*m*B-g*p*B-h*j*H+c*p*H+g*j*G-c*m*G;
+d.n24=g*p*o-h*m*o+h*j*y-c*p*y-g*j*t+c*m*t;d.n31=k*t*B-p*v*B+p*o*F-j*t*F-k*o*G+j*v*G;d.n32=h*v*B-f*t*B-h*o*F+c*t*F+f*o*G-c*v*G;d.n33=g*p*B-h*k*B+h*j*F-c*p*F-f*j*G+c*k*G;d.n34=h*k*o-f*p*o-h*j*v+c*p*v+f*j*t-c*k*t;d.n41=m*v*B-k*y*B-m*o*F+j*y*F+k*o*H-j*v*H;d.n42=f*y*B-g*v*B+g*o*F-c*y*F-f*o*H+c*v*H;d.n43=g*k*B-f*m*B-g*j*F+c*m*F+f*j*H-c*k*H;d.n44=f*m*o-g*k*o+g*j*v-c*m*v-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*p;c[7]=b*o;c[8]=b*v;return d};
 THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
 THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,p;j=new THREE.Matrix4;k=d-b;m=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
@@ -47,8 +47,8 @@ undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d
 d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?f:1)};
 THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},
-multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,p=m*c+j*g-k*f,o=m*f+k*c-h*g,u=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*m+c*-h+o*-k-u*-j;d.y=o*m+c*-j+u*-h-p*-k;d.z=u*m+c*-k+p*-j-o*-h;return d}};
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,p=m*c+j*g-k*f,o=m*f+k*c-h*g,v=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*m+c*-h+o*-k-v*-j;d.y=o*m+c*-j+v*-h-p*-k;d.z=v*m+c*-k+p*-j-o*-h;return d}};
+THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,15 +56,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(oa,pa,sa,ga,aa,na,Ea){k=oa.vertices[pa].position;m=oa.vertices[sa].position;p=oa.vertices[ga].position;o=j[aa];u=j[na];y=j[Ea];t=m.x-k.x;B=p.x-k.x;F=m.y-k.y;H=p.y-k.y;G=m.z-k.z;X=p.z-k.z;A=u.u-o.u;M=y.u-o.u;Q=u.v-o.v;R=y.v-o.v;Da=1/(A*
-R-M*Q);e.set((R*t-Q*B)*Da,(R*F-Q*H)*Da,(R*G-Q*X)*Da);ea.set((A*B-M*t)*Da,(A*H-M*F)*Da,(A*X-M*G)*Da);va[pa].addSelf(e);va[sa].addSelf(e);va[ga].addSelf(e);ca[pa].addSelf(ea);ca[sa].addSelf(ea);ca[ga].addSelf(ea)}var d,c,f,g,h,j,k,m,p,o,u,y,t,B,F,H,G,X,A,M,Q,R,Da,ma,va=[],ca=[],e=new THREE.Vector3,ea=new THREE.Vector3,ya=new THREE.Vector3,Ba=new THREE.Vector3,Fa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){va[d]=new THREE.Vector3;ca[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(oa,pa,sa,ga,aa,na,Ea){k=oa.vertices[pa].position;m=oa.vertices[sa].position;p=oa.vertices[ga].position;o=j[aa];v=j[na];y=j[Ea];t=m.x-k.x;B=p.x-k.x;F=m.y-k.y;H=p.y-k.y;G=m.z-k.z;X=p.z-k.z;A=v.u-o.u;M=y.u-o.u;Q=v.v-o.v;R=y.v-o.v;Da=1/(A*
+R-M*Q);e.set((R*t-Q*B)*Da,(R*F-Q*H)*Da,(R*G-Q*X)*Da);ea.set((A*B-M*t)*Da,(A*H-M*F)*Da,(A*X-M*G)*Da);va[pa].addSelf(e);va[sa].addSelf(e);va[ga].addSelf(e);ca[pa].addSelf(ea);ca[sa].addSelf(ea);ca[ga].addSelf(ea)}var d,c,f,g,h,j,k,m,p,o,v,y,t,B,F,H,G,X,A,M,Q,R,Da,ma,va=[],ca=[],e=new THREE.Vector3,ea=new THREE.Vector3,ya=new THREE.Vector3,Ba=new THREE.Vector3,Fa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){va[d]=new THREE.Vector3;ca[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
 this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var Z=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Fa.copy(h.vertexNormals[f]);g=h[Z[f]];ma=va[g];ya.copy(ma);ya.subSelf(Fa.multiplyScalar(Fa.dot(ma))).normalize();Ba.cross(h.vertexNormals[f],ma);g=Ba.dot(ca[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(ya.x,
 ya.y,ya.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
 {radius:b}},computeEdgeFaces:function(){function b(m,p){return Math.min(m,p)+"_"+Math.max(m,p)}function d(m,p,o){if(m[p]===undefined){m[p]={set:{},array:[]};m[p].set[o]=1;m[p].array.push(o)}else if(m[p].set[o]===undefined){m[p].set[o]=1;m[p].array.push(o)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
 g=b(j.a,j.d);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.c,j.d);d(k,g,c)}}c=0;for(f=this.edges.length;c<f;c++){j=this.edges[c];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function d(t,B,F,H,G,X,A){t=(F-t)*0.5;H=(H-B)*0.5;return(2*(B-F)+t+H)*A+(-3*(B-F)-2*t-H)*X+t*G+B}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,p,o,u,y;this.initFromArray=function(t){this.points=[];for(var B=0;B<t.length;B++)this.points[B]={x:t[B][0],y:t[B][1],z:t[B][2]}};this.getPoint=function(t){g=(this.points.length-1)*t;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]];
-u=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(p.x,o.x,u.x,y.x,j,k,m);f.y=d(p.y,o.y,u.y,y.y,j,k,m);f.z=d(p.z,o.z,u.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var t,B,F=this.points.length,H=[];for(t=0;t<F;t++){B=this.points[t];H[t]=[B.x,B.y,B.z]}return H};this.getLength=function(t){var B,F,H=B=B=0,G=new THREE.Vector3,X=new THREE.Vector3,A=[],M=0;A[0]=0;t||(t=100);F=this.points.length*t;G.copy(this.points[0]);for(t=1;t<F;t++){B=t/F;position=this.getPoint(B);X.copy(position);
+THREE.Spline=function(b){function d(t,B,F,H,G,X,A){t=(F-t)*0.5;H=(H-B)*0.5;return(2*(B-F)+t+H)*A+(-3*(B-F)-2*t-H)*X+t*G+B}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,p,o,v,y;this.initFromArray=function(t){this.points=[];for(var B=0;B<t.length;B++)this.points[B]={x:t[B][0],y:t[B][1],z:t[B][2]}};this.getPoint=function(t){g=(this.points.length-1)*t;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]];
+v=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(p.x,o.x,v.x,y.x,j,k,m);f.y=d(p.y,o.y,v.y,y.y,j,k,m);f.z=d(p.z,o.z,v.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var t,B,F=this.points.length,H=[];for(t=0;t<F;t++){B=this.points[t];H[t]=[B.x,B.y,B.z]}return H};this.getLength=function(t){var B,F,H=B=B=0,G=new THREE.Vector3,X=new THREE.Vector3,A=[],M=0;A[0]=0;t||(t=100);F=this.points.length*t;G.copy(this.points[0]);for(t=1;t<F;t++){B=t/F;position=this.getPoint(B);X.copy(position);
 M+=X.distanceTo(G);G.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=H){A[B]=M;H=B}}A[A.length]=M;return{chunks:A,total:M}};this.reparametrizeByArcLength=function(t){var B,F,H,G,X,A,M=[],Q=new THREE.Vector3,R=this.getLength();M.push(Q.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){F=R.chunks[B]-R.chunks[B-1];A=Math.ceil(t*F/R.total);G=(B-1)/(this.points.length-1);X=B/(this.points.length-1);for(F=1;F<A-1;F++){H=G+F*(1/A)*(X-G);position=this.getPoint(H);M.push(Q.copy(position).clone())}M.push(Q.copy(this.points[B]).clone())}this.points=
 M}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
@@ -120,13 +120,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
 !1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,p,o,u,y,t,B=new THREE.Geometry;B.vertices=this.geometry.vertices;f=B.faces=this.geometry.faces;var F=B.egdes=this.geometry.edges,H=B.edgeFaces=[];g=0;var G=[];b=0;for(d=f.length;b<d;b++){c=f[b];G.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
-c.normal}b=0;for(d=F.length;b<d;b++){k=F[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";o=G[g]+0}else if(c.b===j){m="b";o=G[g]+1}else if(c.c===j){m="c";o=G[g]+2}else if(c.d===j){m="d";o=G[g]+3}if(c.a===k){m+="a";u=G[g]+0}else if(c.b===k){m+="b";u=G[g]+1}else if(c.c===k){m+="c";u=G[g]+2}else if(c.d===k){m+="d";u=G[g]+3}if(f.a===j){p="a";y=G[h]+0}else if(f.b===j){p="b";y=G[h]+1}else if(f.c===j){p="c";y=G[h]+2}else if(f.d===
-j){p="d";y=G[h]+3}if(f.a===k){p+="a";t=G[h]+0}else if(f.b===k){p+="b";t=G[h]+1}else if(f.c===k){p+="c";t=G[h]+2}else if(f.d===k){p+="d";t=G[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(o>u){c=o;o=u;u=c}}else if(o<u){c=o;o=u;u=c}if(p==="ac"||p==="ad"||p==="ca"||p==="da"){if(y>t){c=y;y=t;t=c}}else if(y<t){c=y;y=t;t=c}c=new THREE.Face4(o,u,y,t);c.normal.set(1,0,0);H.push(c)}this.geometry=B}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,p,o,u=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
-for(k=0;k<p;k++){o=b[j[u[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,m,p,o,u,y,t,B,F,H=0,G=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=d[G[B]];k=b[h];for(F=0;F<g;F++){j=c[G[F]];m=b[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){H++;if(H===1){p=k;o=m;u=h;y=j;t=G[B]}if(H===2){t+=G[B];return t==="ad"||t==="ac"?{faces:[d,c],vertices:[p,o,m,k],indices:[u,
-y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,m,o],indices:[u,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,p,o,v,y,t,B=new THREE.Geometry;B.vertices=this.geometry.vertices;f=B.faces=this.geometry.faces;var F=B.egdes=this.geometry.edges,H=B.edgeFaces=[];g=0;var G=[];b=0;for(d=f.length;b<d;b++){c=f[b];G.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
+c.normal}b=0;for(d=F.length;b<d;b++){k=F[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";o=G[g]+0}else if(c.b===j){m="b";o=G[g]+1}else if(c.c===j){m="c";o=G[g]+2}else if(c.d===j){m="d";o=G[g]+3}if(c.a===k){m+="a";v=G[g]+0}else if(c.b===k){m+="b";v=G[g]+1}else if(c.c===k){m+="c";v=G[g]+2}else if(c.d===k){m+="d";v=G[g]+3}if(f.a===j){p="a";y=G[h]+0}else if(f.b===j){p="b";y=G[h]+1}else if(f.c===j){p="c";y=G[h]+2}else if(f.d===
+j){p="d";y=G[h]+3}if(f.a===k){p+="a";t=G[h]+0}else if(f.b===k){p+="b";t=G[h]+1}else if(f.c===k){p+="c";t=G[h]+2}else if(f.d===k){p+="d";t=G[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(o>v){c=o;o=v;v=c}}else if(o<v){c=o;o=v;v=c}if(p==="ac"||p==="ad"||p==="ca"||p==="da"){if(y>t){c=y;y=t;t=c}}else if(y<t){c=y;y=t;t=c}c=new THREE.Face4(o,v,y,t);c.normal.set(1,0,0);H.push(c)}this.geometry=B}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,p,o,v=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
+for(k=0;k<p;k++){o=b[j[v[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,m,p,o,v,y,t,B,F,H=0,G=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=d[G[B]];k=b[h];for(F=0;F<g;F++){j=c[G[F]];m=b[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){H++;if(H===1){p=k;o=m;v=h;y=j;t=G[B]}if(H===2){t+=G[B];return t==="ad"||t==="ac"?{faces:[d,c],vertices:[p,o,m,k],indices:[v,
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,m,o],indices:[v,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==undefined){this.material=b.material;this.map=undefined;this.blending=material.blending}else if(b.map!==undefined){this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map);this.material=undefined;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending}this.useScreenCoordinates=b.useScreenCoordinates!==undefined?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==undefined?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==undefined?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
@@ -136,56 +136,56 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
 THREE.Projector=function(){function b(){var e=m[k]=m[k]||new THREE.RenderableVertex;k++;return e}function d(e,ea){return ea.z-e.z}function c(e,ea){var ya=0,Ba=1,Fa=e.z+e.w,Z=ea.z+ea.w,oa=-e.z+e.w,pa=-ea.z+ea.w;if(Fa>=0&&Z>=0&&oa>=0&&pa>=0)return!0;else if(Fa<0&&Z<0||oa<0&&pa<0)return!1;else{if(Fa<0)ya=Math.max(ya,Fa/(Fa-Z));else Z<0&&(Ba=Math.min(Ba,Fa/(Fa-Z)));if(oa<0)ya=Math.max(ya,oa/(oa-pa));else pa<0&&(Ba=Math.min(Ba,oa/(oa-pa)));if(Ba<ya)return!1;else{e.lerpSelf(ea,ya);ea.lerpSelf(e,1-Ba);return!0}}}
-var f,g,h=[],j,k,m=[],p,o,u=[],y,t=[],B,F,H=[],G,X,A=[],M=new THREE.Vector4,Q=new THREE.Vector4,R=new THREE.Matrix4,Da=new THREE.Matrix4,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Vector4,ca=new THREE.Vector4;this.projectVector=function(e,ea){R.multiply(ea.projectionMatrix,ea.matrixWorldInverse);R.multiplyVector3(e);return e};this.unprojectVector=function(e,ea){R.multiply(ea.matrixWorld,THREE.Matrix4.makeInvert(ea.projectionMatrix));
+var f,g,h=[],j,k,m=[],p,o,v=[],y,t=[],B,F,H=[],G,X,A=[],M=new THREE.Vector4,Q=new THREE.Vector4,R=new THREE.Matrix4,Da=new THREE.Matrix4,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Vector4,ca=new THREE.Vector4;this.projectVector=function(e,ea){R.multiply(ea.projectionMatrix,ea.matrixWorldInverse);R.multiplyVector3(e);return e};this.unprojectVector=function(e,ea){R.multiply(ea.matrixWorld,THREE.Matrix4.makeInvert(ea.projectionMatrix));
 R.multiplyVector3(e);return e};this.projectObjects=function(e,ea,ya){ea=[];var Ba,Fa,Z;g=0;Fa=e.objects;e=0;for(Ba=Fa.length;e<Ba;e++){Z=Fa[e];var oa;if(!(oa=!Z.visible))if(oa=Z instanceof THREE.Mesh){a:{oa=void 0;for(var pa=Z.matrixWorld,sa=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),ga=0;ga<6;ga++){oa=ma[ga].x*pa.n14+ma[ga].y*pa.n24+ma[ga].z*pa.n34+ma[ga].w;if(oa<=sa){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=h[g]=h[g]||new THREE.RenderableObject;g++;f=oa;M.copy(Z.position);
 R.multiplyVector3(M);f.object=Z;f.z=M.z;ea.push(f)}}ya&&ea.sort(d);return ea};this.projectScene=function(e,ea,ya){var Ba=[],Fa=ea.near,Z=ea.far,oa,pa,sa,ga,aa,na,Ea,ja,la,ua,Ra,Ya,Za,Na,T,P,N;X=F=y=o=0;ea.matrixAutoUpdate&&ea.updateMatrix();e.update(undefined,!1,ea);R.multiply(ea.projectionMatrix,ea.matrixWorldInverse);ma[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);ma[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);ma[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);ma[3].set(R.n41-
 R.n21,R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);ma[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);ma[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(oa=0;oa<6;oa++){la=ma[oa];la.divideScalar(Math.sqrt(la.x*la.x+la.y*la.y+la.z*la.z))}la=this.projectObjects(e,ea,!0);e=0;for(oa=la.length;e<oa;e++){ua=la[e].object;if(ua.visible){Ra=ua.matrixWorld;Ya=ua.matrixRotationWorld;Za=ua.materials;Na=ua.overdraw;k=0;if(ua instanceof THREE.Mesh){T=ua.geometry;ga=T.vertices;P=T.faces;T=T.faceVertexUvs;
 pa=0;for(sa=ga.length;pa<sa;pa++){j=b();j.positionWorld.copy(ga[pa].position);Ra.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);R.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Fa&&j.positionScreen.z<Z}ga=0;for(pa=P.length;ga<pa;ga++){sa=P[ga];if(sa instanceof THREE.Face3){aa=m[sa.a];na=m[sa.b];Ea=m[sa.c];if(aa.visible&&na.visible&&Ea.visible&&(ua.doubleSided||ua.flipSided!=(Ea.positionScreen.x-
-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(Ea.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0)){ja=u[o]=u[o]||new THREE.RenderableFace3;o++;p=ja;p.v1.copy(aa);p.v2.copy(na);p.v3.copy(Ea)}else continue}else if(sa instanceof THREE.Face4){aa=m[sa.a];na=m[sa.b];Ea=m[sa.c];ja=m[sa.d];if(aa.visible&&na.visible&&Ea.visible&&ja.visible&&(ua.doubleSided||ua.flipSided!=((ja.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-
+aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(Ea.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0)){ja=v[o]=v[o]||new THREE.RenderableFace3;o++;p=ja;p.v1.copy(aa);p.v2.copy(na);p.v3.copy(Ea)}else continue}else if(sa instanceof THREE.Face4){aa=m[sa.a];na=m[sa.b];Ea=m[sa.c];ja=m[sa.d];if(aa.visible&&na.visible&&Ea.visible&&ja.visible&&(ua.doubleSided||ua.flipSided!=((ja.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-
 (ja.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0||(na.positionScreen.x-Ea.positionScreen.x)*(ja.positionScreen.y-Ea.positionScreen.y)-(na.positionScreen.y-Ea.positionScreen.y)*(ja.positionScreen.x-Ea.positionScreen.x)<0))){N=t[y]=t[y]||new THREE.RenderableFace4;y++;p=N;p.v1.copy(aa);p.v2.copy(na);p.v3.copy(Ea);p.v4.copy(ja)}else continue}p.normalWorld.copy(sa.normal);Ya.multiplyVector3(p.normalWorld);p.centroidWorld.copy(sa.centroid);Ra.multiplyVector3(p.centroidWorld);
 p.centroidScreen.copy(p.centroidWorld);R.multiplyVector3(p.centroidScreen);Ea=sa.vertexNormals;aa=0;for(na=Ea.length;aa<na;aa++){ja=p.vertexNormalsWorld[aa];ja.copy(Ea[aa]);Ya.multiplyVector3(ja)}aa=0;for(na=T.length;aa<na;aa++)if(N=T[aa][ga]){Ea=0;for(ja=N.length;Ea<ja;Ea++)p.uvs[aa][Ea]=N[Ea]}p.meshMaterials=Za;p.faceMaterials=sa.materials;p.overdraw=Na;p.z=p.centroidScreen.z;Ba.push(p)}}else if(ua instanceof THREE.Line){Da.multiply(R,Ra);ga=ua.geometry.vertices;aa=b();aa.positionScreen.copy(ga[0].position);
 Da.multiplyVector4(aa.positionScreen);pa=1;for(sa=ga.length;pa<sa;pa++){aa=b();aa.positionScreen.copy(ga[pa].position);Da.multiplyVector4(aa.positionScreen);na=m[k-2];va.copy(aa.positionScreen);ca.copy(na.positionScreen);if(c(va,ca)){va.multiplyScalar(1/va.w);ca.multiplyScalar(1/ca.w);Ra=H[F]=H[F]||new THREE.RenderableLine;F++;B=Ra;B.v1.positionScreen.copy(va);B.v2.positionScreen.copy(ca);B.z=Math.max(va.z,ca.z);B.materials=ua.materials;Ba.push(B)}}}else if(ua instanceof THREE.Particle){Q.set(ua.position.x,
 ua.position.y,ua.position.z,1);R.multiplyVector4(Q);Q.z/=Q.w;if(Q.z>0&&Q.z<1){Ra=A[X]=A[X]||new THREE.RenderableParticle;X++;G=Ra;G.x=Q.x/Q.w;G.y=Q.y/Q.w;G.z=Q.z;G.rotation=ua.rotation.z;G.scale.x=ua.scale.x*Math.abs(G.x-(Q.x+ea.projectionMatrix.n11)/(Q.w+ea.projectionMatrix.n14));G.scale.y=ua.scale.y*Math.abs(G.y-(Q.y+ea.projectionMatrix.n22)/(Q.w+ea.projectionMatrix.n24));G.materials=ua.materials;Ba.push(G)}}}}ya&&Ba.sort(d);return Ba}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,p,o,u,y,t,B,F;b=d.projectScene(j,k);m=0;for(p=b.length;m<p;m++){y=b[m];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;F=y.y*h+h;o=0;for(u=y.material.length;o<u;o++){t=y.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=B+"px";t.style.top=F+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(ta){if(t!=ta)o.globalAlpha=t=ta}function d(ta){if(B!=ta){switch(ta){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=ta}}function c(ta){if(F!=ta)o.strokeStyle=F=ta}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,m,p,o=h.getContext("2d"),u=new THREE.Color(0),y=0,t=1,B=0,
-F=null,H=null,G=null,X=null,A=null,M,Q,R,Da,ma=new THREE.RenderableVertex,va=new THREE.RenderableVertex,ca,e,ea,ya,Ba,Fa,Z,oa,pa,sa,ga,aa,na=new THREE.Color,Ea=new THREE.Color,ja=new THREE.Color,la=new THREE.Color,ua=new THREE.Color,Ra,Ya,Za,Na,T,P,N,Ca,Ka,n,C=new THREE.Rectangle,w=new THREE.Rectangle,x=new THREE.Rectangle,z=!1,J=new THREE.Color,K=new THREE.Color,I=new THREE.Color,S=new THREE.Color,D=new THREE.Vector3,O,L,$,V,xa,Ja,za=16;O=document.createElement("canvas");O.width=O.height=2;L=O.getContext("2d");
-L.fillStyle="rgba(0,0,0,1)";L.fillRect(0,0,2,2);$=L.getImageData(0,0,2,2);V=$.data;xa=document.createElement("canvas");xa.width=xa.height=za;Ja=xa.getContext("2d");Ja.translate(-za/2,-za/2);Ja.scale(za,za);za--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ta,Oa){j=ta;k=Oa;m=j/2;p=k/2;h.width=j;h.height=k;C.set(-m,-p,m,p);t=1;B=0;A=X=G=H=F=null};this.setClearColor=function(ta,Oa){u=ta;y=Oa};this.setClearColorHex=function(ta,Oa){u.setHex(ta);y=Oa};
-this.clear=function(){o.setTransform(1,0,0,-1,m,p);if(!w.isEmpty()){w.inflate(1);w.minSelf(C);if(u.hex==0&&y==0)o.clearRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());else{d(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+y+")";o.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight())}w.empty()}};this.render=function(ta,Oa){function Ga(W){var ia,ka,da,ra=W.lights;K.setRGB(0,0,0);I.setRGB(0,0,0);S.setRGB(0,0,0);W=0;for(ia=ra.length;W<
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,p,o,v,y,t,B,F;b=d.projectScene(j,k);m=0;for(p=b.length;m<p;m++){y=b[m];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;F=y.y*h+h;o=0;for(v=y.material.length;o<v;o++){t=y.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=B+"px";t.style.top=F+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(ta){if(t!=ta)o.globalAlpha=t=ta}function d(ta){if(B!=ta){switch(ta){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=ta}}function c(ta){if(F!=ta)o.strokeStyle=F=ta}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,m,p,o=h.getContext("2d"),v=new THREE.Color(0),y=0,t=1,B=0,
+F=null,H=null,G=null,X=null,A=null,M,Q,R,Da,ma=new THREE.RenderableVertex,va=new THREE.RenderableVertex,ca,e,ea,ya,Ba,Fa,Z,oa,pa,sa,ga,aa,na=new THREE.Color,Ea=new THREE.Color,ja=new THREE.Color,la=new THREE.Color,ua=new THREE.Color,Ra,Ya,Za,Na,T,P,N,Ca,Ka,n,C=new THREE.Rectangle,u=new THREE.Rectangle,w=new THREE.Rectangle,z=!1,J=new THREE.Color,K=new THREE.Color,I=new THREE.Color,S=new THREE.Color,D=new THREE.Vector3,O,L,$,V,xa,Ja,za=16;O=document.createElement("canvas");O.width=O.height=2;L=O.getContext("2d");
+L.fillStyle="rgba(0,0,0,1)";L.fillRect(0,0,2,2);$=L.getImageData(0,0,2,2);V=$.data;xa=document.createElement("canvas");xa.width=xa.height=za;Ja=xa.getContext("2d");Ja.translate(-za/2,-za/2);Ja.scale(za,za);za--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ta,Oa){j=ta;k=Oa;m=j/2;p=k/2;h.width=j;h.height=k;C.set(-m,-p,m,p);t=1;B=0;A=X=G=H=F=null};this.setClearColor=function(ta,Oa){v=ta;y=Oa};this.setClearColorHex=function(ta,Oa){v.setHex(ta);y=Oa};
+this.clear=function(){o.setTransform(1,0,0,-1,m,p);if(!u.isEmpty()){u.inflate(1);u.minSelf(C);if(v.hex==0&&y==0)o.clearRect(u.getX(),u.getY(),u.getWidth(),u.getHeight());else{d(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(v.r*255)+","+Math.floor(v.g*255)+","+Math.floor(v.b*255)+","+y+")";o.fillRect(u.getX(),u.getY(),u.getWidth(),u.getHeight())}u.empty()}};this.render=function(ta,Oa){function Ga(W){var ia,ka,da,ra=W.lights;K.setRGB(0,0,0);I.setRGB(0,0,0);S.setRGB(0,0,0);W=0;for(ia=ra.length;W<
 ia;W++){ka=ra[W];da=ka.color;if(ka instanceof THREE.AmbientLight){K.r+=da.r;K.g+=da.g;K.b+=da.b}else if(ka instanceof THREE.DirectionalLight){I.r+=da.r;I.g+=da.g;I.b+=da.b}else if(ka instanceof THREE.PointLight){S.r+=da.r;S.g+=da.g;S.b+=da.b}}}function wa(W,ia,ka,da){var ra,qa,ha,Y,Ia=W.lights;W=0;for(ra=Ia.length;W<ra;W++){qa=Ia[W];ha=qa.color;if(qa instanceof THREE.DirectionalLight){Y=ka.dot(qa.position);if(!(Y<=0)){Y*=qa.intensity;da.r+=ha.r*Y;da.g+=ha.g*Y;da.b+=ha.b*Y}}else if(qa instanceof THREE.PointLight){Y=
-ka.dot(D.sub(qa.position,ia).normalize());if(!(Y<=0)){Y*=qa.distance==0?1:1-Math.min(ia.distanceTo(qa.position)/qa.distance,1);if(Y!=0){Y*=qa.intensity;da.r+=ha.r*Y;da.g+=ha.g*Y;da.b+=ha.b*Y}}}}}function Ha(W,ia,ka){b(ka.opacity);d(ka.blending);var da,ra,qa,ha,Y,Ia;if(ka instanceof THREE.ParticleBasicMaterial){if(ka.map){ha=ka.map.image;Y=ha.width>>1;Ia=ha.height>>1;ka=ia.scale.x*m;qa=ia.scale.y*p;da=ka*Y;ra=qa*Ia;x.set(W.x-da,W.y-ra,W.x+da,W.y+ra);if(C.instersects(x)){o.save();o.translate(W.x,W.y);
-o.rotate(-ia.rotation);o.scale(ka,-qa);o.translate(-Y,-Ia);o.drawImage(ha,0,0);o.restore()}}}else if(ka instanceof THREE.ParticleCanvasMaterial){da=ia.scale.x*m;ra=ia.scale.y*p;x.set(W.x-da,W.y-ra,W.x+da,W.y+ra);if(C.instersects(x)){c(ka.color.__styleString);qa=ka.color.__styleString;if(H!=qa)o.fillStyle=H=qa;o.save();o.translate(W.x,W.y);o.rotate(-ia.rotation);o.scale(da,ra);ka.program(o);o.restore()}}}function Ua(W,ia,ka,da){b(da.opacity);d(da.blending);o.beginPath();o.moveTo(W.positionScreen.x,
-W.positionScreen.y);o.lineTo(ia.positionScreen.x,ia.positionScreen.y);o.closePath();if(da instanceof THREE.LineBasicMaterial){na.__styleString=da.color.__styleString;W=da.linewidth;if(G!=W)o.lineWidth=G=W;W=da.linecap;if(X!=W)o.lineCap=X=W;W=da.linejoin;if(A!=W)o.lineJoin=A=W;c(na.__styleString);o.stroke();x.inflate(da.linewidth*2)}}function E(W,ia,ka,da,ra,qa,ha,Y,Ia){b(Y.opacity);d(Y.blending);ca=W.positionScreen.x;e=W.positionScreen.y;ea=ia.positionScreen.x;ya=ia.positionScreen.y;Ba=ka.positionScreen.x;
-Fa=ka.positionScreen.y;v(ca,e,ea,ya,Ba,Fa);if(Y instanceof THREE.MeshBasicMaterial)if(Y.map){if(Y.map.mapping instanceof THREE.UVMapping){Na=ha.uvs[0];Pa(ca,e,ea,ya,Ba,Fa,Y.map.image,Na[da].u,Na[da].v,Na[ra].u,Na[ra].v,Na[qa].u,Na[qa].v)}}else if(Y.envMap){if(Y.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=Oa.matrixWorldInverse;D.copy(ha.vertexNormalsWorld[0]);T=(D.x*W.n11+D.y*W.n12+D.z*W.n13)*0.5+0.5;P=-(D.x*W.n21+D.y*W.n22+D.z*W.n23)*0.5+0.5;D.copy(ha.vertexNormalsWorld[1]);N=(D.x*
+ka.dot(D.sub(qa.position,ia).normalize());if(!(Y<=0)){Y*=qa.distance==0?1:1-Math.min(ia.distanceTo(qa.position)/qa.distance,1);if(Y!=0){Y*=qa.intensity;da.r+=ha.r*Y;da.g+=ha.g*Y;da.b+=ha.b*Y}}}}}function Ha(W,ia,ka){b(ka.opacity);d(ka.blending);var da,ra,qa,ha,Y,Ia;if(ka instanceof THREE.ParticleBasicMaterial){if(ka.map){ha=ka.map.image;Y=ha.width>>1;Ia=ha.height>>1;ka=ia.scale.x*m;qa=ia.scale.y*p;da=ka*Y;ra=qa*Ia;w.set(W.x-da,W.y-ra,W.x+da,W.y+ra);if(C.instersects(w)){o.save();o.translate(W.x,W.y);
+o.rotate(-ia.rotation);o.scale(ka,-qa);o.translate(-Y,-Ia);o.drawImage(ha,0,0);o.restore()}}}else if(ka instanceof THREE.ParticleCanvasMaterial){da=ia.scale.x*m;ra=ia.scale.y*p;w.set(W.x-da,W.y-ra,W.x+da,W.y+ra);if(C.instersects(w)){c(ka.color.__styleString);qa=ka.color.__styleString;if(H!=qa)o.fillStyle=H=qa;o.save();o.translate(W.x,W.y);o.rotate(-ia.rotation);o.scale(da,ra);ka.program(o);o.restore()}}}function Ua(W,ia,ka,da){b(da.opacity);d(da.blending);o.beginPath();o.moveTo(W.positionScreen.x,
+W.positionScreen.y);o.lineTo(ia.positionScreen.x,ia.positionScreen.y);o.closePath();if(da instanceof THREE.LineBasicMaterial){na.__styleString=da.color.__styleString;W=da.linewidth;if(G!=W)o.lineWidth=G=W;W=da.linecap;if(X!=W)o.lineCap=X=W;W=da.linejoin;if(A!=W)o.lineJoin=A=W;c(na.__styleString);o.stroke();w.inflate(da.linewidth*2)}}function E(W,ia,ka,da,ra,qa,ha,Y,Ia){b(Y.opacity);d(Y.blending);ca=W.positionScreen.x;e=W.positionScreen.y;ea=ia.positionScreen.x;ya=ia.positionScreen.y;Ba=ka.positionScreen.x;
+Fa=ka.positionScreen.y;x(ca,e,ea,ya,Ba,Fa);if(Y instanceof THREE.MeshBasicMaterial)if(Y.map){if(Y.map.mapping instanceof THREE.UVMapping){Na=ha.uvs[0];Pa(ca,e,ea,ya,Ba,Fa,Y.map.image,Na[da].u,Na[da].v,Na[ra].u,Na[ra].v,Na[qa].u,Na[qa].v)}}else if(Y.envMap){if(Y.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=Oa.matrixWorldInverse;D.copy(ha.vertexNormalsWorld[0]);T=(D.x*W.n11+D.y*W.n12+D.z*W.n13)*0.5+0.5;P=-(D.x*W.n21+D.y*W.n22+D.z*W.n23)*0.5+0.5;D.copy(ha.vertexNormalsWorld[1]);N=(D.x*
 W.n11+D.y*W.n12+D.z*W.n13)*0.5+0.5;Ca=-(D.x*W.n21+D.y*W.n22+D.z*W.n23)*0.5+0.5;D.copy(ha.vertexNormalsWorld[2]);Ka=(D.x*W.n11+D.y*W.n12+D.z*W.n13)*0.5+0.5;n=-(D.x*W.n21+D.y*W.n22+D.z*W.n23)*0.5+0.5;Pa(ca,e,ea,ya,Ba,Fa,Y.envMap.image,T,P,N,Ca,Ka,n)}}else Y.wireframe?db(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){if(Y.map.mapping instanceof THREE.UVMapping){Na=ha.uvs[0];
 Pa(ca,e,ea,ya,Ba,Fa,Y.map.image,Na[da].u,Na[da].v,Na[ra].u,Na[ra].v,Na[qa].u,Na[qa].v)}d(THREE.SubtractiveBlending)}if(z)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ea.r=ja.r=la.r=K.r;Ea.g=ja.g=la.g=K.g;Ea.b=ja.b=la.b=K.b;wa(Ia,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ea);wa(Ia,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ja);wa(Ia,ha.v3.positionWorld,ha.vertexNormalsWorld[2],la);ua.r=(ja.r+la.r)*0.5;ua.g=(ja.g+la.g)*0.5;ua.b=(ja.b+la.b)*0.5;Za=hb(Ea,ja,la,
 ua);Pa(ca,e,ea,ya,Ba,Fa,Za,0,0,1,0,0,1)}else{J.r=K.r;J.g=K.g;J.b=K.b;wa(Ia,ha.centroidWorld,ha.normalWorld,J);na.r=Y.color.r*J.r;na.g=Y.color.g*J.g;na.b=Y.color.b*J.b;na.updateStyleString();Y.wireframe?db(na.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(na.__styleString)}else Y.wireframe?db(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){Ra=Oa.near;Ya=Oa.far;Ea.r=
 Ea.g=Ea.b=1-eb(W.positionScreen.z,Ra,Ya);ja.r=ja.g=ja.b=1-eb(ia.positionScreen.z,Ra,Ya);la.r=la.g=la.b=1-eb(ka.positionScreen.z,Ra,Ya);ua.r=(ja.r+la.r)*0.5;ua.g=(ja.g+la.g)*0.5;ua.b=(ja.b+la.b)*0.5;Za=hb(Ea,ja,la,ua);Pa(ca,e,ea,ya,Ba,Fa,Za,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){na.r=$a(ha.normalWorld.x);na.g=$a(ha.normalWorld.y);na.b=$a(ha.normalWorld.z);na.updateStyleString();Y.wireframe?db(na.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(na.__styleString)}}
 function fa(W,ia,ka,da,ra,qa,ha,Y,Ia){b(Y.opacity);d(Y.blending);if(Y.map||Y.envMap){E(W,ia,da,0,1,3,ha,Y,Ia);E(ra,ka,qa,1,2,3,ha,Y,Ia)}else{ca=W.positionScreen.x;e=W.positionScreen.y;ea=ia.positionScreen.x;ya=ia.positionScreen.y;Ba=ka.positionScreen.x;Fa=ka.positionScreen.y;Z=da.positionScreen.x;oa=da.positionScreen.y;pa=ra.positionScreen.x;sa=ra.positionScreen.y;ga=qa.positionScreen.x;aa=qa.positionScreen.y;if(Y instanceof THREE.MeshBasicMaterial){bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(Y.color.__styleString,
 Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(Y.color.__styleString)}else if(Y instanceof THREE.MeshLambertMaterial)if(z)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ea.r=ja.r=la.r=ua.r=K.r;Ea.g=ja.g=la.g=ua.g=K.g;Ea.b=ja.b=la.b=ua.b=K.b;wa(Ia,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ea);wa(Ia,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ja);wa(Ia,ha.v4.positionWorld,ha.vertexNormalsWorld[3],la);wa(Ia,ha.v3.positionWorld,ha.vertexNormalsWorld[2],
-ua);Za=hb(Ea,ja,la,ua);v(ca,e,ea,ya,Z,oa);Pa(ca,e,ea,ya,Z,oa,Za,0,0,1,0,0,1);v(pa,sa,Ba,Fa,ga,aa);Pa(pa,sa,Ba,Fa,ga,aa,Za,1,0,1,1,0,1)}else{J.r=K.r;J.g=K.g;J.b=K.b;wa(Ia,ha.centroidWorld,ha.normalWorld,J);na.r=Y.color.r*J.r;na.g=Y.color.g*J.g;na.b=Y.color.b*J.b;na.updateStyleString();bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(na.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(na.__styleString)}else{bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(Y.color.__styleString,Y.wireframeLinewidth,
+ua);Za=hb(Ea,ja,la,ua);x(ca,e,ea,ya,Z,oa);Pa(ca,e,ea,ya,Z,oa,Za,0,0,1,0,0,1);x(pa,sa,Ba,Fa,ga,aa);Pa(pa,sa,Ba,Fa,ga,aa,Za,1,0,1,1,0,1)}else{J.r=K.r;J.g=K.g;J.b=K.b;wa(Ia,ha.centroidWorld,ha.normalWorld,J);na.r=Y.color.r*J.r;na.g=Y.color.g*J.g;na.b=Y.color.b*J.b;na.updateStyleString();bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(na.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(na.__styleString)}else{bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(Y.color.__styleString,Y.wireframeLinewidth,
 Y.wireframeLinecap,Y.wireframeLinejoin):Ma(Y.color.__styleString)}else if(Y instanceof THREE.MeshNormalMaterial){na.r=$a(ha.normalWorld.x);na.g=$a(ha.normalWorld.y);na.b=$a(ha.normalWorld.z);na.updateStyleString();bb(ca,e,ea,ya,Ba,Fa,Z,oa);Y.wireframe?db(na.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ma(na.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){Ra=Oa.near;Ya=Oa.far;Ea.r=Ea.g=Ea.b=1-eb(W.positionScreen.z,Ra,Ya);ja.r=ja.g=ja.b=1-eb(ia.positionScreen.z,
-Ra,Ya);la.r=la.g=la.b=1-eb(da.positionScreen.z,Ra,Ya);ua.r=ua.g=ua.b=1-eb(ka.positionScreen.z,Ra,Ya);Za=hb(Ea,ja,la,ua);v(ca,e,ea,ya,Z,oa);Pa(ca,e,ea,ya,Z,oa,Za,0,0,1,0,0,1);v(pa,sa,Ba,Fa,ga,aa);Pa(pa,sa,Ba,Fa,ga,aa,Za,1,0,1,1,0,1)}}}function v(W,ia,ka,da,ra,qa){o.beginPath();o.moveTo(W,ia);o.lineTo(ka,da);o.lineTo(ra,qa);o.lineTo(W,ia);o.closePath()}function bb(W,ia,ka,da,ra,qa,ha,Y){o.beginPath();o.moveTo(W,ia);o.lineTo(ka,da);o.lineTo(ra,qa);o.lineTo(ha,Y);o.lineTo(W,ia);o.closePath()}function db(W,
-ia,ka,da){if(G!=ia)o.lineWidth=G=ia;if(X!=ka)o.lineCap=X=ka;if(A!=da)o.lineJoin=A=da;c(W);o.stroke();x.inflate(ia*2)}function Ma(W){if(H!=W)o.fillStyle=H=W;o.fill()}function Pa(W,ia,ka,da,ra,qa,ha,Y,Ia,Va,Ta,ib,Wa){var fb,gb;fb=ha.width-1;gb=ha.height-1;Y*=fb;Ia*=gb;Va*=fb;Ta*=gb;ib*=fb;Wa*=gb;ka-=W;da-=ia;ra-=W;qa-=ia;Va-=Y;Ta-=Ia;ib-=Y;Wa-=Ia;fb=Va*Wa-ib*Ta;if(fb!=0){gb=1/fb;fb=(Wa*ka-Ta*ra)*gb;Ta=(Wa*da-Ta*qa)*gb;ka=(Va*ra-ib*ka)*gb;da=(Va*qa-ib*da)*gb;W=W-fb*Y-ka*Ia;ia=ia-Ta*Y-da*Ia;o.save();
+Ra,Ya);la.r=la.g=la.b=1-eb(da.positionScreen.z,Ra,Ya);ua.r=ua.g=ua.b=1-eb(ka.positionScreen.z,Ra,Ya);Za=hb(Ea,ja,la,ua);x(ca,e,ea,ya,Z,oa);Pa(ca,e,ea,ya,Z,oa,Za,0,0,1,0,0,1);x(pa,sa,Ba,Fa,ga,aa);Pa(pa,sa,Ba,Fa,ga,aa,Za,1,0,1,1,0,1)}}}function x(W,ia,ka,da,ra,qa){o.beginPath();o.moveTo(W,ia);o.lineTo(ka,da);o.lineTo(ra,qa);o.lineTo(W,ia);o.closePath()}function bb(W,ia,ka,da,ra,qa,ha,Y){o.beginPath();o.moveTo(W,ia);o.lineTo(ka,da);o.lineTo(ra,qa);o.lineTo(ha,Y);o.lineTo(W,ia);o.closePath()}function db(W,
+ia,ka,da){if(G!=ia)o.lineWidth=G=ia;if(X!=ka)o.lineCap=X=ka;if(A!=da)o.lineJoin=A=da;c(W);o.stroke();w.inflate(ia*2)}function Ma(W){if(H!=W)o.fillStyle=H=W;o.fill()}function Pa(W,ia,ka,da,ra,qa,ha,Y,Ia,Va,Ta,ib,Wa){var fb,gb;fb=ha.width-1;gb=ha.height-1;Y*=fb;Ia*=gb;Va*=fb;Ta*=gb;ib*=fb;Wa*=gb;ka-=W;da-=ia;ra-=W;qa-=ia;Va-=Y;Ta-=Ia;ib-=Y;Wa-=Ia;fb=Va*Wa-ib*Ta;if(fb!=0){gb=1/fb;fb=(Wa*ka-Ta*ra)*gb;Ta=(Wa*da-Ta*qa)*gb;ka=(Va*ra-ib*ka)*gb;da=(Va*qa-ib*da)*gb;W=W-fb*Y-ka*Ia;ia=ia-Ta*Y-da*Ia;o.save();
 o.transform(fb,Ta,ka,da,W,ia);o.clip();o.drawImage(ha,0,0);o.restore()}}function hb(W,ia,ka,da){var ra=~~(W.r*255),qa=~~(W.g*255);W=~~(W.b*255);var ha=~~(ia.r*255),Y=~~(ia.g*255);ia=~~(ia.b*255);var Ia=~~(ka.r*255),Va=~~(ka.g*255);ka=~~(ka.b*255);var Ta=~~(da.r*255),ib=~~(da.g*255);da=~~(da.b*255);V[0]=ra<0?0:ra>255?255:ra;V[1]=qa<0?0:qa>255?255:qa;V[2]=W<0?0:W>255?255:W;V[4]=ha<0?0:ha>255?255:ha;V[5]=Y<0?0:Y>255?255:Y;V[6]=ia<0?0:ia>255?255:ia;V[8]=Ia<0?0:Ia>255?255:Ia;V[9]=Va<0?0:Va>255?255:Va;
 V[10]=ka<0?0:ka>255?255:ka;V[12]=Ta<0?0:Ta>255?255:Ta;V[13]=ib<0?0:ib>255?255:ib;V[14]=da<0?0:da>255?255:da;L.putImageData($,0,0);Ja.drawImage(O,0,0);return xa}function eb(W,ia,ka){W=(W-ia)/(ka-ia);return W*W*(3-2*W)}function $a(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function ab(W,ia){var ka=ia.x-W.x,da=ia.y-W.y,ra=1/Math.sqrt(ka*ka+da*da);ka*=ra;da*=ra;ia.x+=ka;ia.y+=da;W.x-=ka;W.y-=da}var La,cb,Aa,U,Qa,Sa,jb,Xa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,p);f=g.projectScene(ta,Oa,this.sortElements);
-(z=ta.lights.length>0)&&Ga(ta);La=0;for(cb=f.length;La<cb;La++){Aa=f[La];x.empty();if(Aa instanceof THREE.RenderableParticle){M=Aa;M.x*=m;M.y*=p;U=0;for(Qa=Aa.materials.length;U<Qa;){Xa=Aa.materials[U++];Xa.opacity!=0&&Ha(M,Aa,Xa,ta)}}else if(Aa instanceof THREE.RenderableLine){M=Aa.v1;Q=Aa.v2;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;x.addPoint(M.positionScreen.x,M.positionScreen.y);x.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(C.instersects(x)){U=
-0;for(Qa=Aa.materials.length;U<Qa;){Xa=Aa.materials[U++];Xa.opacity!=0&&Ua(M,Q,Aa,Xa,ta)}}}else if(Aa instanceof THREE.RenderableFace3){M=Aa.v1;Q=Aa.v2;R=Aa.v3;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;R.positionScreen.x*=m;R.positionScreen.y*=p;if(Aa.overdraw){ab(M.positionScreen,Q.positionScreen);ab(Q.positionScreen,R.positionScreen);ab(R.positionScreen,M.positionScreen)}x.add3Points(M.positionScreen.x,M.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,
-R.positionScreen.x,R.positionScreen.y);if(C.instersects(x)){U=0;for(Qa=Aa.meshMaterials.length;U<Qa;){Xa=Aa.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(jb=Aa.faceMaterials.length;Sa<jb;)(Xa=Aa.faceMaterials[Sa++])&&Xa.opacity!=0&&E(M,Q,R,0,1,2,Aa,Xa,ta)}else Xa.opacity!=0&&E(M,Q,R,0,1,2,Aa,Xa,ta)}}}else if(Aa instanceof THREE.RenderableFace4){M=Aa.v1;Q=Aa.v2;R=Aa.v3;Da=Aa.v4;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;R.positionScreen.x*=
-m;R.positionScreen.y*=p;Da.positionScreen.x*=m;Da.positionScreen.y*=p;ma.positionScreen.copy(Q.positionScreen);va.positionScreen.copy(Da.positionScreen);if(Aa.overdraw){ab(M.positionScreen,Q.positionScreen);ab(Q.positionScreen,Da.positionScreen);ab(Da.positionScreen,M.positionScreen);ab(R.positionScreen,ma.positionScreen);ab(R.positionScreen,va.positionScreen)}x.addPoint(M.positionScreen.x,M.positionScreen.y);x.addPoint(Q.positionScreen.x,Q.positionScreen.y);x.addPoint(R.positionScreen.x,R.positionScreen.y);
-x.addPoint(Da.positionScreen.x,Da.positionScreen.y);if(C.instersects(x)){U=0;for(Qa=Aa.meshMaterials.length;U<Qa;){Xa=Aa.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(jb=Aa.faceMaterials.length;Sa<jb;)(Xa=Aa.faceMaterials[Sa++])&&Xa.opacity!=0&&fa(M,Q,R,Da,ma,va,Aa,Xa,ta)}else Xa.opacity!=0&&fa(M,Q,R,Da,ma,va,Aa,Xa,ta)}}}w.addRectangle(x)}o.setTransform(1,0,0,1,0,0)}};
+(z=ta.lights.length>0)&&Ga(ta);La=0;for(cb=f.length;La<cb;La++){Aa=f[La];w.empty();if(Aa instanceof THREE.RenderableParticle){M=Aa;M.x*=m;M.y*=p;U=0;for(Qa=Aa.materials.length;U<Qa;){Xa=Aa.materials[U++];Xa.opacity!=0&&Ha(M,Aa,Xa,ta)}}else if(Aa instanceof THREE.RenderableLine){M=Aa.v1;Q=Aa.v2;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;w.addPoint(M.positionScreen.x,M.positionScreen.y);w.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(C.instersects(w)){U=
+0;for(Qa=Aa.materials.length;U<Qa;){Xa=Aa.materials[U++];Xa.opacity!=0&&Ua(M,Q,Aa,Xa,ta)}}}else if(Aa instanceof THREE.RenderableFace3){M=Aa.v1;Q=Aa.v2;R=Aa.v3;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;R.positionScreen.x*=m;R.positionScreen.y*=p;if(Aa.overdraw){ab(M.positionScreen,Q.positionScreen);ab(Q.positionScreen,R.positionScreen);ab(R.positionScreen,M.positionScreen)}w.add3Points(M.positionScreen.x,M.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,
+R.positionScreen.x,R.positionScreen.y);if(C.instersects(w)){U=0;for(Qa=Aa.meshMaterials.length;U<Qa;){Xa=Aa.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(jb=Aa.faceMaterials.length;Sa<jb;)(Xa=Aa.faceMaterials[Sa++])&&Xa.opacity!=0&&E(M,Q,R,0,1,2,Aa,Xa,ta)}else Xa.opacity!=0&&E(M,Q,R,0,1,2,Aa,Xa,ta)}}}else if(Aa instanceof THREE.RenderableFace4){M=Aa.v1;Q=Aa.v2;R=Aa.v3;Da=Aa.v4;M.positionScreen.x*=m;M.positionScreen.y*=p;Q.positionScreen.x*=m;Q.positionScreen.y*=p;R.positionScreen.x*=
+m;R.positionScreen.y*=p;Da.positionScreen.x*=m;Da.positionScreen.y*=p;ma.positionScreen.copy(Q.positionScreen);va.positionScreen.copy(Da.positionScreen);if(Aa.overdraw){ab(M.positionScreen,Q.positionScreen);ab(Q.positionScreen,Da.positionScreen);ab(Da.positionScreen,M.positionScreen);ab(R.positionScreen,ma.positionScreen);ab(R.positionScreen,va.positionScreen)}w.addPoint(M.positionScreen.x,M.positionScreen.y);w.addPoint(Q.positionScreen.x,Q.positionScreen.y);w.addPoint(R.positionScreen.x,R.positionScreen.y);
+w.addPoint(Da.positionScreen.x,Da.positionScreen.y);if(C.instersects(w)){U=0;for(Qa=Aa.meshMaterials.length;U<Qa;){Xa=Aa.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(jb=Aa.faceMaterials.length;Sa<jb;)(Xa=Aa.faceMaterials[Sa++])&&Xa.opacity!=0&&fa(M,Q,R,Da,ma,va,Aa,Xa,ta)}else Xa.opacity!=0&&fa(M,Q,R,Da,ma,va,Aa,Xa,ta)}}}u.addRectangle(w)}o.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(Z,oa,pa){var sa,ga,aa,na;sa=0;for(ga=Z.lights.length;sa<ga;sa++){aa=Z.lights[sa];if(aa instanceof THREE.DirectionalLight){na=oa.normalWorld.dot(aa.position)*aa.intensity;if(na>0){pa.r+=aa.color.r*na;pa.g+=aa.color.g*na;pa.b+=aa.color.b*na}}else if(aa instanceof THREE.PointLight){va.sub(aa.position,oa.centroidWorld);va.normalize();na=oa.normalWorld.dot(va)*aa.intensity;if(na>0){pa.r+=aa.color.r*na;pa.g+=aa.color.g*na;pa.b+=aa.color.b*na}}}}function d(Z,oa,pa,
 sa,ga,aa){ea=f(ya++);ea.setAttribute("d","M "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)A.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(X){M.r=Q.r;M.g=Q.g;M.b=Q.b;b(aa,sa,M);A.r=ga.color.r*M.r;A.g=ga.color.g*M.g;A.b=ga.color.b*M.b;A.updateStyleString()}else A.__styleString=ga.color.__styleString;else if(ga instanceof
 THREE.MeshDepthMaterial){ma=1-ga.__2near/(ga.__farPlusNear-sa.z*ga.__farMinusNear);A.setRGB(ma,ma,ma)}else ga instanceof THREE.MeshNormalMaterial&&A.setRGB(g(sa.normalWorld.x),g(sa.normalWorld.y),g(sa.normalWorld.z));ga.wireframe?ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):ea.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+
 ga.opacity);k.appendChild(ea)}function c(Z,oa,pa,sa,ga,aa,na){ea=f(ya++);ea.setAttribute("d","M "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)A.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(X){M.r=Q.r;M.g=Q.g;M.b=Q.b;b(na,ga,M);A.r=aa.color.r*M.r;A.g=aa.color.g*M.g;
 A.b=aa.color.b*M.b;A.updateStyleString()}else A.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){ma=1-aa.__2near/(aa.__farPlusNear-ga.z*aa.__farMinusNear);A.setRGB(ma,ma,ma)}else aa instanceof THREE.MeshNormalMaterial&&A.setRGB(g(ga.normalWorld.x),g(ga.normalWorld.y),g(ga.normalWorld.z));aa.wireframe?ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
-"; stroke-linejoin: "+aa.wireframeLinejoin):ea.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild(ea)}function f(Z){if(ca[Z]==null){ca[Z]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&ca[Z].setAttribute("shape-rendering","crispEdges")}return ca[Z]}function g(Z){return Z<0?Math.min((1+Z)*0.5,0.5):0.5+Math.min(Z*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,o,u,y,t,B,F,H=new THREE.Rectangle,
-G=new THREE.Rectangle,X=!1,A=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0),R=new THREE.Color(0),Da=new THREE.Color(0),ma,va=new THREE.Vector3,ca=[],e=[],ea,ya,Ba,Fa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Z){switch(Z){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(Z,oa){m=Z;p=oa;o=m/2;u=p/2;k.setAttribute("viewBox",-o+" "+-u+" "+m+" "+p);k.setAttribute("width",m);k.setAttribute("height",p);
-H.set(-o,-u,o,u)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(Z,oa){var pa,sa,ga,aa,na,Ea,ja,la;this.autoClear&&this.clear();h=j.projectScene(Z,oa,this.sortElements);Ba=ya=0;if(X=Z.lights.length>0){ja=Z.lights;Q.setRGB(0,0,0);R.setRGB(0,0,0);Da.setRGB(0,0,0);pa=0;for(sa=ja.length;pa<sa;pa++){ga=ja[pa];aa=ga.color;if(ga instanceof THREE.AmbientLight){Q.r+=aa.r;Q.g+=aa.g;Q.b+=aa.b}else if(ga instanceof THREE.DirectionalLight){R.r+=aa.r;R.g+=
-aa.g;R.b+=aa.b}else if(ga instanceof THREE.PointLight){Da.r+=aa.r;Da.g+=aa.g;Da.b+=aa.b}}}pa=0;for(sa=h.length;pa<sa;pa++){ja=h[pa];G.empty();if(ja instanceof THREE.RenderableParticle){y=ja;y.x*=o;y.y*=-u;ga=0;for(aa=ja.materials.length;ga<aa;)ga++}else if(ja instanceof THREE.RenderableLine){y=ja.v1;t=ja.v2;y.positionScreen.x*=o;y.positionScreen.y*=-u;t.positionScreen.x*=o;t.positionScreen.y*=-u;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);if(H.instersects(G)){ga=
+"; stroke-linejoin: "+aa.wireframeLinejoin):ea.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild(ea)}function f(Z){if(ca[Z]==null){ca[Z]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&ca[Z].setAttribute("shape-rendering","crispEdges")}return ca[Z]}function g(Z){return Z<0?Math.min((1+Z)*0.5,0.5):0.5+Math.min(Z*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,o,v,y,t,B,F,H=new THREE.Rectangle,
+G=new THREE.Rectangle,X=!1,A=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0),R=new THREE.Color(0),Da=new THREE.Color(0),ma,va=new THREE.Vector3,ca=[],e=[],ea,ya,Ba,Fa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Z){switch(Z){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(Z,oa){m=Z;p=oa;o=m/2;v=p/2;k.setAttribute("viewBox",-o+" "+-v+" "+m+" "+p);k.setAttribute("width",m);k.setAttribute("height",p);
+H.set(-o,-v,o,v)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(Z,oa){var pa,sa,ga,aa,na,Ea,ja,la;this.autoClear&&this.clear();h=j.projectScene(Z,oa,this.sortElements);Ba=ya=0;if(X=Z.lights.length>0){ja=Z.lights;Q.setRGB(0,0,0);R.setRGB(0,0,0);Da.setRGB(0,0,0);pa=0;for(sa=ja.length;pa<sa;pa++){ga=ja[pa];aa=ga.color;if(ga instanceof THREE.AmbientLight){Q.r+=aa.r;Q.g+=aa.g;Q.b+=aa.b}else if(ga instanceof THREE.DirectionalLight){R.r+=aa.r;R.g+=
+aa.g;R.b+=aa.b}else if(ga instanceof THREE.PointLight){Da.r+=aa.r;Da.g+=aa.g;Da.b+=aa.b}}}pa=0;for(sa=h.length;pa<sa;pa++){ja=h[pa];G.empty();if(ja instanceof THREE.RenderableParticle){y=ja;y.x*=o;y.y*=-v;ga=0;for(aa=ja.materials.length;ga<aa;)ga++}else if(ja instanceof THREE.RenderableLine){y=ja.v1;t=ja.v2;y.positionScreen.x*=o;y.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);if(H.instersects(G)){ga=
 0;for(aa=ja.materials.length;ga<aa;)if((la=ja.materials[ga++])&&la.opacity!=0){na=y;Ea=t;var ua=Ba++;if(e[ua]==null){e[ua]=document.createElementNS("http://www.w3.org/2000/svg","line");Fa==0&&e[ua].setAttribute("shape-rendering","crispEdges")}ea=e[ua];ea.setAttribute("x1",na.positionScreen.x);ea.setAttribute("y1",na.positionScreen.y);ea.setAttribute("x2",Ea.positionScreen.x);ea.setAttribute("y2",Ea.positionScreen.y);if(la instanceof THREE.LineBasicMaterial){A.__styleString=la.color.__styleString;
-ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(ea)}}}}else if(ja instanceof THREE.RenderableFace3){y=ja.v1;t=ja.v2;B=ja.v3;y.positionScreen.x*=o;y.positionScreen.y*=-u;t.positionScreen.x*=o;t.positionScreen.y*=-u;B.positionScreen.x*=o;B.positionScreen.y*=-u;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);
-G.addPoint(B.positionScreen.x,B.positionScreen.y);if(H.instersects(G)){ga=0;for(aa=ja.meshMaterials.length;ga<aa;){la=ja.meshMaterials[ga++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ea=ja.faceMaterials.length;na<Ea;)(la=ja.faceMaterials[na++])&&la.opacity!=0&&d(y,t,B,ja,la,Z)}else la&&la.opacity!=0&&d(y,t,B,ja,la,Z)}}}else if(ja instanceof THREE.RenderableFace4){y=ja.v1;t=ja.v2;B=ja.v3;F=ja.v4;y.positionScreen.x*=o;y.positionScreen.y*=-u;t.positionScreen.x*=o;t.positionScreen.y*=-u;B.positionScreen.x*=
-o;B.positionScreen.y*=-u;F.positionScreen.x*=o;F.positionScreen.y*=-u;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);G.addPoint(B.positionScreen.x,B.positionScreen.y);G.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(G)){ga=0;for(aa=ja.meshMaterials.length;ga<aa;){la=ja.meshMaterials[ga++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ea=ja.faceMaterials.length;na<Ea;)(la=ja.faceMaterials[na++])&&la.opacity!=0&&c(y,t,B,F,ja,
+ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(ea)}}}}else if(ja instanceof THREE.RenderableFace3){y=ja.v1;t=ja.v2;B=ja.v3;y.positionScreen.x*=o;y.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;B.positionScreen.x*=o;B.positionScreen.y*=-v;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);
+G.addPoint(B.positionScreen.x,B.positionScreen.y);if(H.instersects(G)){ga=0;for(aa=ja.meshMaterials.length;ga<aa;){la=ja.meshMaterials[ga++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ea=ja.faceMaterials.length;na<Ea;)(la=ja.faceMaterials[na++])&&la.opacity!=0&&d(y,t,B,ja,la,Z)}else la&&la.opacity!=0&&d(y,t,B,ja,la,Z)}}}else if(ja instanceof THREE.RenderableFace4){y=ja.v1;t=ja.v2;B=ja.v3;F=ja.v4;y.positionScreen.x*=o;y.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;B.positionScreen.x*=
+o;B.positionScreen.y*=-v;F.positionScreen.x*=o;F.positionScreen.y*=-v;G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);G.addPoint(B.positionScreen.x,B.positionScreen.y);G.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(G)){ga=0;for(aa=ja.meshMaterials.length;ga<aa;){la=ja.meshMaterials[ga++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ea=ja.faceMaterials.length;na<Ea;)(la=ja.faceMaterials[na++])&&la.opacity!=0&&c(y,t,B,F,ja,
 la,Z)}else la&&la.opacity!=0&&c(y,t,B,F,ja,la,Z)}}}}}};
 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",
@@ -217,81 +217,81 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(n,C,w){var x,z,J,K=n.vertices,I=K.length,S=n.colors,D=S.length,O=n.__vertexArray,L=n.__colorArray,$=n.__sortArray,V=n.__dirtyVertices,xa=n.__dirtyColors;if(w.sortParticles){Ra.multiplySelf(w.matrixWorld);for(x=0;x<I;x++){z=K[x].position;Na.copy(z);Ra.multiplyVector3(Na);$[x]=[Na.z,x]}$.sort(function(Ja,za){return za[0]-Ja[0]});for(x=0;x<I;x++){z=K[$[x][1]].position;J=x*3;O[J]=z.x;O[J+1]=z.y;O[J+2]=z.z}for(x=0;x<D;x++){J=x*3;color=S[$[x][1]];L[J]=color.r;
-L[J+1]=color.g;L[J+2]=color.b}}else{if(V)for(x=0;x<I;x++){z=K[x].position;J=x*3;O[J]=z.x;O[J+1]=z.y;O[J+2]=z.z}if(xa)for(x=0;x<D;x++){color=S[x];J=x*3;L[J]=color.r;L[J+1]=color.g;L[J+2]=color.b}}if(V||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,O,C)}if(xa||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,w,x,z){x.program||oa.initMaterial(x,C,w,z);var J=x.program,K=J.uniforms,I=x.uniforms;
-if(J!=Ba){e.useProgram(J);Ba=J}e.uniformMatrix4fv(K.projectionMatrix,!1,Ya);if(w&&(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial||x instanceof THREE.LineBasicMaterial||x instanceof THREE.ParticleBasicMaterial||x.fog)){I.fogColor.value=w.color;if(w instanceof THREE.Fog){I.fogNear.value=w.near;I.fogFar.value=w.far}else if(w instanceof THREE.FogExp2)I.fogDensity.value=w.density}if(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||
-x.lights){var S,D,O=0,L=0,$=0,V,xa,Ja,za,ta=T,Oa=ta.directional.colors,Ga=ta.directional.positions,wa=ta.point.colors,Ha=ta.point.positions,Ua=ta.point.distances,E=0,fa=0;w=D=za=0;for(S=C.length;w<S;w++){D=C[w];V=D.color;xa=D.position;Ja=D.intensity;za=D.distance;if(D instanceof THREE.AmbientLight){O+=V.r;L+=V.g;$+=V.b}else if(D instanceof THREE.DirectionalLight){za=E*3;Oa[za]=V.r*Ja;Oa[za+1]=V.g*Ja;Oa[za+2]=V.b*Ja;Ga[za]=xa.x;Ga[za+1]=xa.y;Ga[za+2]=xa.z;E+=1}else if(D instanceof THREE.PointLight){D=
-fa*3;wa[D]=V.r*Ja;wa[D+1]=V.g*Ja;wa[D+2]=V.b*Ja;Ha[D]=xa.x;Ha[D+1]=xa.y;Ha[D+2]=xa.z;Ua[fa]=za;fa+=1}}for(w=E*3;w<Oa.length;w++)Oa[w]=0;for(w=fa*3;w<wa.length;w++)wa[w]=0;ta.point.length=fa;ta.directional.length=E;ta.ambient[0]=O;ta.ambient[1]=L;ta.ambient[2]=$;w=T;I.enableLighting.value=w.directional.length+w.point.length;I.ambientLightColor.value=w.ambient;I.directionalLightColor.value=w.directional.colors;I.directionalLightDirection.value=w.directional.positions;I.pointLightColor.value=w.point.colors;
-I.pointLightPosition.value=w.point.positions;I.pointLightDistance.value=w.point.distances}if(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial){I.diffuse.value=x.color;I.opacity.value=x.opacity;I.map.texture=x.map;I.lightMap.texture=x.lightMap;I.envMap.texture=x.envMap;I.reflectivity.value=x.reflectivity;I.refractionRatio.value=x.refractionRatio;I.combine.value=x.combine;I.useRefract.value=x.envMap&&x.envMap.mapping instanceof THREE.CubeRefractionMapping}if(x instanceof
-THREE.LineBasicMaterial){I.diffuse.value=x.color;I.opacity.value=x.opacity}else if(x instanceof THREE.ParticleBasicMaterial){I.psColor.value=x.color;I.opacity.value=x.opacity;I.size.value=x.size;I.scale.value=ea.height/2;I.map.texture=x.map}else if(x instanceof THREE.MeshPhongMaterial){I.ambient.value=x.ambient;I.specular.value=x.specular;I.shininess.value=x.shininess}else if(x instanceof THREE.MeshDepthMaterial){I.mNear.value=n.near;I.mFar.value=n.far;I.opacity.value=x.opacity}else if(x instanceof
-THREE.MeshNormalMaterial)I.opacity.value=x.opacity;for(var v in I)if(L=J.uniforms[v]){S=I[v];O=S.type;w=S.value;if(O=="i")e.uniform1i(L,w);else if(O=="f")e.uniform1f(L,w);else if(O=="fv1")e.uniform1fv(L,w);else if(O=="fv")e.uniform3fv(L,w);else if(O=="v2")e.uniform2f(L,w.x,w.y);else if(O=="v3")e.uniform3f(L,w.x,w.y,w.z);else if(O=="v4")e.uniform4f(L,w.x,w.y,w.z,w.w);else if(O=="c")e.uniform3f(L,w.r,w.g,w.b);else if(O=="t"){e.uniform1i(L,w);if(S=S.texture)if(S.image instanceof Array&&S.image.length==
+THREE.WebGLRenderer=function(b){function d(n,C,u){var w,z,J,K=n.vertices,I=K.length,S=n.colors,D=S.length,O=n.__vertexArray,L=n.__colorArray,$=n.__sortArray,V=n.__dirtyVertices,xa=n.__dirtyColors;if(u.sortParticles){Ra.multiplySelf(u.matrixWorld);for(w=0;w<I;w++){z=K[w].position;Na.copy(z);Ra.multiplyVector3(Na);$[w]=[Na.z,w]}$.sort(function(Ja,za){return za[0]-Ja[0]});for(w=0;w<I;w++){z=K[$[w][1]].position;J=w*3;O[J]=z.x;O[J+1]=z.y;O[J+2]=z.z}for(w=0;w<D;w++){J=w*3;color=S[$[w][1]];L[J]=color.r;
+L[J+1]=color.g;L[J+2]=color.b}}else{if(V)for(w=0;w<I;w++){z=K[w].position;J=w*3;O[J]=z.x;O[J+1]=z.y;O[J+2]=z.z}if(xa)for(w=0;w<D;w++){color=S[w];J=w*3;L[J]=color.r;L[J+1]=color.g;L[J+2]=color.b}}if(V||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,O,C)}if(xa||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,u,w,z){w.program||oa.initMaterial(w,C,u,z);var J=w.program,K=J.uniforms,I=w.uniforms;
+if(J!=Ba){e.useProgram(J);Ba=J}e.uniformMatrix4fv(K.projectionMatrix,!1,Ya);if(u&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){I.fogColor.value=u.color;if(u instanceof THREE.Fog){I.fogNear.value=u.near;I.fogFar.value=u.far}else if(u instanceof THREE.FogExp2)I.fogDensity.value=u.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||
+w.lights){var S,D,O=0,L=0,$=0,V,xa,Ja,za,ta=T,Oa=ta.directional.colors,Ga=ta.directional.positions,wa=ta.point.colors,Ha=ta.point.positions,Ua=ta.point.distances,E=0,fa=0;u=D=za=0;for(S=C.length;u<S;u++){D=C[u];V=D.color;xa=D.position;Ja=D.intensity;za=D.distance;if(D instanceof THREE.AmbientLight){O+=V.r;L+=V.g;$+=V.b}else if(D instanceof THREE.DirectionalLight){za=E*3;Oa[za]=V.r*Ja;Oa[za+1]=V.g*Ja;Oa[za+2]=V.b*Ja;Ga[za]=xa.x;Ga[za+1]=xa.y;Ga[za+2]=xa.z;E+=1}else if(D instanceof THREE.PointLight){D=
+fa*3;wa[D]=V.r*Ja;wa[D+1]=V.g*Ja;wa[D+2]=V.b*Ja;Ha[D]=xa.x;Ha[D+1]=xa.y;Ha[D+2]=xa.z;Ua[fa]=za;fa+=1}}for(u=E*3;u<Oa.length;u++)Oa[u]=0;for(u=fa*3;u<wa.length;u++)wa[u]=0;ta.point.length=fa;ta.directional.length=E;ta.ambient[0]=O;ta.ambient[1]=L;ta.ambient[2]=$;u=T;I.enableLighting.value=u.directional.length+u.point.length;I.ambientLightColor.value=u.ambient;I.directionalLightColor.value=u.directional.colors;I.directionalLightDirection.value=u.directional.positions;I.pointLightColor.value=u.point.colors;
+I.pointLightPosition.value=u.point.positions;I.pointLightDistance.value=u.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){I.diffuse.value=w.color;I.opacity.value=w.opacity;I.map.texture=w.map;I.lightMap.texture=w.lightMap;I.envMap.texture=w.envMap;I.reflectivity.value=w.reflectivity;I.refractionRatio.value=w.refractionRatio;I.combine.value=w.combine;I.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof
+THREE.LineBasicMaterial){I.diffuse.value=w.color;I.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){I.psColor.value=w.color;I.opacity.value=w.opacity;I.size.value=w.size;I.scale.value=ea.height/2;I.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){I.ambient.value=w.ambient;I.specular.value=w.specular;I.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){I.mNear.value=n.near;I.mFar.value=n.far;I.opacity.value=w.opacity}else if(w instanceof
+THREE.MeshNormalMaterial)I.opacity.value=w.opacity;for(var x in I)if(L=J.uniforms[x]){S=I[x];O=S.type;u=S.value;if(O=="i")e.uniform1i(L,u);else if(O=="f")e.uniform1f(L,u);else if(O=="fv1")e.uniform1fv(L,u);else if(O=="fv")e.uniform3fv(L,u);else if(O=="v2")e.uniform2f(L,u.x,u.y);else if(O=="v3")e.uniform3f(L,u.x,u.y,u.z);else if(O=="v4")e.uniform4f(L,u.x,u.y,u.z,u.w);else if(O=="c")e.uniform3f(L,u.r,u.g,u.b);else if(O=="t"){e.uniform1i(L,u);if(S=S.texture)if(S.image instanceof Array&&S.image.length==
 6){if(S.image.length==6){if(S.needsUpdate){if(S.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube);for(O=0;O<6;++O)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,0,0,e.RGBA,e.UNSIGNED_BYTE,S.image[O])}else{S.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube);for(O=0;O<6;++O)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,S.image[O]);S.__webglInit=!0}Q(e.TEXTURE_CUBE_MAP,S,S.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
-null);S.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube)}}else R(S,w)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,z._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
-!1,z._objectMatrixArray);(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshShaderMaterial||x.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(x instanceof THREE.ShadowVolumeDynamicMaterial){n=I.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(x.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
-!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,z.boneMatrices)}return J}function f(n,C,w,x,z,J){if(x.opacity!=0){var K;n=c(n,C,w,x,J).attributes;if(x.morphTargets){C=x.program.attributes;J.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[J.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(J.morphTargetForcedOrder.length){w=0;for(var I=J.morphTargetForcedOrder,S=J.morphTargetInfluences;w<x.numSupportedMorphTargets&&
-w<I.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[I[w]]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[w]=S[I[w]];w++}}else{I=[];var D=-1,O=0;S=J.morphTargetInfluences;var L,$=S.length;w=0;for(J.morphTargetBase!==-1&&(I[J.morphTargetBase]=!0);w<x.numSupportedMorphTargets;){for(L=0;L<$;L++)if(!I[L]&&S[L]>D){O=L;D=S[O]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[O]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);
-J.__webglMorphTargetInfluences[w]=D;I[O]=1;D=-1;w++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,J.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(K in z.__webglCustomAttributes)if(n[K]>=0){C=z.__webglCustomAttributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);
+null);S.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube)}}else R(S,u)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,z._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
+!1,z._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(w instanceof THREE.ShadowVolumeDynamicMaterial){n=I.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(w.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
+!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,z.boneMatrices)}return J}function f(n,C,u,w,z,J){if(w.opacity!=0){var K;n=c(n,C,u,w,J).attributes;if(w.morphTargets){C=w.program.attributes;J.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[J.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(J.morphTargetForcedOrder.length){u=0;for(var I=J.morphTargetForcedOrder,S=J.morphTargetInfluences;u<w.numSupportedMorphTargets&&
+u<I.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[I[u]]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[u]=S[I[u]];u++}}else{I=[];var D=-1,O=0;S=J.morphTargetInfluences;var L,$=S.length;u=0;for(J.morphTargetBase!==-1&&(I[J.morphTargetBase]=!0);u<w.numSupportedMorphTargets;){for(L=0;L<$;L++)if(!I[L]&&S[L]>D){O=L;D=S[O]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[O]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);
+J.__webglMorphTargetInfluences[u]=D;I[O]=1;D=-1;u++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,J.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(K in z.__webglCustomAttributes)if(n[K]>=0){C=z.__webglCustomAttributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);
 e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,
-z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(x.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(J instanceof THREE.Mesh)if(x.wireframe){e.lineWidth(x.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(J instanceof THREE.Line){J=J.type==THREE.LineStrip?
-e.LINE_STRIP:e.LINES;e.lineWidth(x.linewidth);e.drawArrays(J,0,z.__webglLineCount)}else if(J instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else J instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,C,w){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,
-e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(w==THREE.FlatShading){var x,z,J,K,I,S,D,O,L,$,V=n.count*3;for($=0;$<V;$+=9){w=n.normalArray;x=w[$];z=w[$+1];J=w[$+2];K=w[$+3];S=w[$+4];O=w[$+5];I=w[$+6];D=w[$+7];L=w[$+8];x=(x+K+I)/3;z=(z+S+D)/3;J=(J+O+L)/3;w[$]=x;w[$+1]=z;w[$+2]=J;w[$+3]=x;w[$+4]=z;w[$+5]=J;w[$+6]=x;w[$+7]=z;w[$+8]=J}}e.bufferData(e.ARRAY_BUFFER,
+z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(w.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(J instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(J instanceof THREE.Line){J=J.type==THREE.LineStrip?
+e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(J,0,z.__webglLineCount)}else if(J instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else J instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,C,u){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,
+e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(u==THREE.FlatShading){var w,z,J,K,I,S,D,O,L,$,V=n.count*3;for($=0;$<V;$+=9){u=n.normalArray;w=u[$];z=u[$+1];J=u[$+2];K=u[$+3];S=u[$+4];O=u[$+5];I=u[$+6];D=u[$+7];L=u[$+8];w=(w+K+I)/3;z=(z+S+D)/3;J=(J+O+L)/3;u[$]=w;u[$+1]=z;u[$+2]=J;u[$+3]=w;u[$+4]=z;u[$+5]=J;u[$+6]=w;u[$+7]=z;u[$+8]=J}}e.bufferData(e.ARRAY_BUFFER,
 n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(pa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);pa=n.doubleSided}if(sa!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);sa=n.flipSided}}function j(n){if(aa!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);aa=n}}function k(n){ua[0].set(n.n41-n.n11,n.n42-
-n.n12,n.n43-n.n13,n.n44-n.n14);ua[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ua[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ua[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ua[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ua[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=ua[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,
-Math.max(n.scale.y,n.scale.z)),x=0;x<6;x++){n=ua[x].x*C.n14+ua[x].y*C.n24+ua[x].z*C.n34+ua[x].w;if(n<=w)return!1}return!0}function p(n,C){n.list[n.count]=C;n.count+=1}function o(n){var C,w,x=n.object,z=n.opaque,J=n.transparent;J.count=0;n=z.count=0;for(C=x.materials.length;n<C;n++){w=x.materials[n];w.transparent?p(J,w):p(z,w)}}function u(n){var C,w,x,z,J=n.object,K=n.buffer,I=n.opaque,S=n.transparent;S.count=0;n=I.count=0;for(x=J.materials.length;n<x;n++){C=J.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=
-0;for(w=K.materials.length;C<w;C++)(z=K.materials[C])&&(z.transparent?p(S,z):p(I,z))}else(z=C)&&(z.transparent?p(S,z):p(I,z))}}function y(n,C){return C.z-n.z}function t(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,w=n.lights.length,x,z=n.lights,J=[],K,I,S,D,O,L=n.__webglShadowVolumes.length;
-for(C=0;C<w;C++){x=n.lights[C];if(x instanceof THREE.DirectionalLight){J[0]=-x.position.x;J[1]=-x.position.y;J[2]=-x.position.z;for(O=0;O<L;O++){x=n.__webglShadowVolumes[O].object;K=n.__webglShadowVolumes[O].buffer;I=x.materials[0];I.program||oa.initMaterial(I,z,undefined,x);I=I.program;S=I.uniforms;D=I.attributes;if(Ba!==I){e.useProgram(I);Ba=I;e.uniformMatrix4fv(S.projectionMatrix,!1,Ya);e.uniformMatrix4fv(S.viewMatrix,!1,Za);e.uniform3fv(S.directionalLightDirection,J)}x.matrixWorld.flattenToArray(x._objectMatrixArray);
-e.uniformMatrix4fv(S.objectMatrix,!1,x._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(D.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);
+n.n12,n.n43-n.n13,n.n44-n.n14);ua[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ua[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ua[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ua[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ua[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=ua[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,
+Math.max(n.scale.y,n.scale.z)),w=0;w<6;w++){n=ua[w].x*C.n14+ua[w].y*C.n24+ua[w].z*C.n34+ua[w].w;if(n<=u)return!1}return!0}function p(n,C){n.list[n.count]=C;n.count+=1}function o(n){var C,u,w=n.object,z=n.opaque,J=n.transparent;J.count=0;n=z.count=0;for(C=w.materials.length;n<C;n++){u=w.materials[n];u.transparent?p(J,u):p(z,u)}}function v(n){var C,u,w,z,J=n.object,K=n.buffer,I=n.opaque,S=n.transparent;S.count=0;n=I.count=0;for(w=J.materials.length;n<w;n++){C=J.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=
+0;for(u=K.materials.length;C<u;C++)(z=K.materials[C])&&(z.transparent?p(S,z):p(I,z))}else(z=C)&&(z.transparent?p(S,z):p(I,z))}}function y(n,C){return C.z-n.z}function t(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,u=n.lights.length,w,z=n.lights,J=[],K,I,S,D,O,L=n.__webglShadowVolumes.length;
+for(C=0;C<u;C++){w=n.lights[C];if(w instanceof THREE.DirectionalLight){J[0]=-w.position.x;J[1]=-w.position.y;J[2]=-w.position.z;for(O=0;O<L;O++){w=n.__webglShadowVolumes[O].object;K=n.__webglShadowVolumes[O].buffer;I=w.materials[0];I.program||oa.initMaterial(I,z,undefined,w);I=I.program;S=I.uniforms;D=I.attributes;if(Ba!==I){e.useProgram(I);Ba=I;e.uniformMatrix4fv(S.projectionMatrix,!1,Ya);e.uniformMatrix4fv(S.viewMatrix,!1,Za);e.uniform3fv(S.directionalLightDirection,J)}w.matrixWorld.flattenToArray(w._objectMatrixArray);
+e.uniformMatrix4fv(S.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(D.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);
 e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);ga="";Ba=P.program;e.useProgram(P.program);e.uniformMatrix4fv(P.projectionLocation,!1,Ya);e.uniform1f(P.darknessLocation,P.darkness);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(P.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(P.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);
-e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Z)}function B(n,C){var w,x,z;w=_sprite.attributes;var J=_sprite.uniforms,K=la/ja,I,S=[],D=ja*0.5,O=la*0.5,L=!0;e.useProgram(_sprite.program);Ba=_sprite.program;ga="";if(!Ka){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);Ka=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);
-e.vertexAttribPointer(w.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(J.projectionMatrix,!1,Ya);e.activeTexture(e.TEXTURE0);e.uniform1i(J.map,0);w=0;for(x=n.__webglSprites.length;w<x;w++){z=n.__webglSprites[w];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);
-w=0;for(x=n.__webglSprites.length;w<x;w++){z=n.__webglSprites[w];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(J.useScreenCoordinates,1);e.uniform3f(J.screenPosition,(z.position.x-D)/D,(O-z.position.y)/O,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(J.useScreenCoordinates,0);e.uniform1i(J.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(J.modelViewMatrix,!1,z._modelViewMatrixArray)}I=z.map.image.width/(z.affectedByDistance?
+e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Z)}function B(n,C){var u,w,z;u=_sprite.attributes;var J=_sprite.uniforms,K=la/ja,I,S=[],D=ja*0.5,O=la*0.5,L=!0;e.useProgram(_sprite.program);Ba=_sprite.program;ga="";if(!Ka){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);Ka=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);
+e.vertexAttribPointer(u.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(J.projectionMatrix,!1,Ya);e.activeTexture(e.TEXTURE0);e.uniform1i(J.map,0);u=0;for(w=n.__webglSprites.length;u<w;u++){z=n.__webglSprites[u];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);
+u=0;for(w=n.__webglSprites.length;u<w;u++){z=n.__webglSprites[u];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(J.useScreenCoordinates,1);e.uniform3f(J.screenPosition,(z.position.x-D)/D,(O-z.position.y)/O,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(J.useScreenCoordinates,0);e.uniform1i(J.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(J.modelViewMatrix,!1,z._modelViewMatrixArray)}I=z.map.image.width/(z.affectedByDistance?
 1:la);S[0]=I*K*z.scale.x;S[1]=I*z.scale.y;e.uniform2f(J.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(J.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(J.alignment,z.alignment.x,z.alignment.y);e.uniform1f(J.opacity,z.opacity);e.uniform1f(J.rotation,z.rotation);e.uniform2fv(J.scale,S);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}M(z.blending);R(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);
-e.depthMask(Z)}function F(n,C){var w,x,z=n.__webglLensFlares.length,J,K,I,S=new THREE.Vector3,D=la/ja,O=ja*0.5,L=la*0.5,$=16/la,V=[$*D,$],xa=[1,1,0],Ja=[1,1],za=N.uniforms;w=N.attributes;e.useProgram(N.program);Ba=N.program;ga="";if(!Ca){e.enableVertexAttribArray(N.attributes.vertex);e.enableVertexAttribArray(N.attributes.uv);Ca=!0}e.uniform1i(za.occlusionMap,0);e.uniform1i(za.map,1);e.bindBuffer(e.ARRAY_BUFFER,N.vertexBuffer);e.vertexAttribPointer(w.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,
-2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,N.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,N.occlusionTexture);e.activeTexture(e.TEXTURE1);for(x=0;x<z;x++){w=n.__webglLensFlares[x].object;S.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(S);C.projectionMatrix.multiplyVector3(S);xa[0]=S.x;xa[1]=S.y;xa[2]=S.z;Ja[0]=xa[0]*O+O;Ja[1]=xa[1]*L+L;if(N.hasVertexTexture||Ja[0]>0&&Ja[0]<
+e.depthMask(Z)}function F(n,C){var u,w,z=n.__webglLensFlares.length,J,K,I,S=new THREE.Vector3,D=la/ja,O=ja*0.5,L=la*0.5,$=16/la,V=[$*D,$],xa=[1,1,0],Ja=[1,1],za=N.uniforms;u=N.attributes;e.useProgram(N.program);Ba=N.program;ga="";if(!Ca){e.enableVertexAttribArray(N.attributes.vertex);e.enableVertexAttribArray(N.attributes.uv);Ca=!0}e.uniform1i(za.occlusionMap,0);e.uniform1i(za.map,1);e.bindBuffer(e.ARRAY_BUFFER,N.vertexBuffer);e.vertexAttribPointer(u.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,
+2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,N.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,N.occlusionTexture);e.activeTexture(e.TEXTURE1);for(w=0;w<z;w++){u=n.__webglLensFlares[w].object;S.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(S);C.projectionMatrix.multiplyVector3(S);xa[0]=S.x;xa[1]=S.y;xa[2]=S.z;Ja[0]=xa[0]*O+O;Ja[1]=xa[1]*L+L;if(N.hasVertexTexture||Ja[0]>0&&Ja[0]<
 ja&&Ja[1]>0&&Ja[1]<la){e.bindTexture(e.TEXTURE_2D,N.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ja[0]-8,Ja[1]-8,16,16,0);e.uniform1i(za.renderType,0);e.uniform2fv(za.scale,V);e.uniform3fv(za.screenPosition,xa);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,N.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ja[0]-8,Ja[1]-8,16,16,0);e.uniform1i(za.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,N.tempTexture);
-e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);w.positionScreen.x=xa[0];w.positionScreen.y=xa[1];w.positionScreen.z=xa[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(za.renderType,2);e.enable(e.BLEND);J=0;for(K=w.lensFlares.length;J<K;J++){I=w.lensFlares[J];if(I.opacity>0.0010&&I.scale>0.0010){xa[0]=I.x;xa[1]=I.y;xa[2]=I.z;$=I.size*I.scale/la;V[0]=$*D;V[1]=$;e.uniform3fv(za.screenPosition,xa);e.uniform2fv(za.scale,V);e.uniform1f(za.rotation,I.rotation);e.uniform1f(za.opacity,
-I.opacity);M(I.blending);R(I.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Z)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function G(n){var C,w,x,z,J;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){x=w.geometryGroups[C];J=!1;for(z in x.__webglCustomAttributes)if(x.__webglCustomAttributes[z].needsUpdate){J=
-!0;break}if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents||J){J=e.DYNAMIC_DRAW;var K=void 0,I=void 0,S=void 0,D=void 0;S=void 0;var O=void 0,L=void 0,$=void 0,V=void 0,xa=void 0,Ja=void 0,za=void 0,ta=void 0,Oa=void 0,Ga=void 0,wa=void 0,Ha=void 0,Ua=void 0;L=void 0;$=void 0;D=void 0;V=void 0;D=void 0;var E=void 0,fa=void 0;L=void 0;E=void 0;fa=void 0;var v=void 0,bb=void 0;E=void 0;fa=void 0;v=void 0;bb=void 0;E=void 0;
-fa=void 0;v=void 0;bb=void 0;E=void 0;fa=void 0;v=void 0;D=void 0;V=void 0;O=void 0;S=void 0;S=void 0;E=void 0;fa=void 0;v=void 0;var db=void 0,Ma=0,Pa=0,hb=0,eb=0,$a=0,ab=0,La=0,cb=0,Aa=0,U=0,Qa=0;fa=E=0;var Sa=x.__vertexArray,jb=x.__uvArray,Xa=x.__uv2Array,W=x.__normalArray,ia=x.__tangentArray,ka=x.__colorArray,da=x.__skinVertexAArray,ra=x.__skinVertexBArray,qa=x.__skinIndexArray,ha=x.__skinWeightArray,Y=x.__morphTargetsArrays,Ia=x.__webglCustomAttributes;v=void 0;var Va=x.__faceArray,Ta=x.__lineArray,
-ib=x.__needsSmoothNormals;Ja=x.__vertexColorType;xa=x.__uvType;za=x.__normalType;var Wa=n.geometry,fb=Wa.__dirtyVertices,gb=Wa.__dirtyElements,qb=Wa.__dirtyUvs,rb=Wa.__dirtyNormals,sb=Wa.__dirtyTangents,tb=Wa.__dirtyColors,ub=Wa.__dirtyMorphTargets,mb=Wa.vertices,vb=x.faces,yb=Wa.faces,wb=Wa.faceVertexUvs[0],xb=Wa.faceVertexUvs[1],nb=Wa.skinVerticesA,ob=Wa.skinVerticesB,pb=Wa.skinIndices,kb=Wa.skinWeights,lb=n instanceof THREE.ShadowVolume?Wa.edgeFaces:undefined;morphTargets=Wa.morphTargets;if(Ia)for(db in Ia){Ia[db].offset=
-0;Ia[db].offsetSrc=0}K=0;for(I=vb.length;K<I;K++){S=vb[K];D=yb[S];wb&&(ta=wb[S]);xb&&(Oa=xb[S]);S=D.vertexNormals;O=D.normal;L=D.vertexColors;$=D.color;V=D.vertexTangents;if(D instanceof THREE.Face3){if(fb){Ga=mb[D.a].position;wa=mb[D.b].position;Ha=mb[D.c].position;Sa[Pa]=Ga.x;Sa[Pa+1]=Ga.y;Sa[Pa+2]=Ga.z;Sa[Pa+3]=wa.x;Sa[Pa+4]=wa.y;Sa[Pa+5]=wa.z;Sa[Pa+6]=Ha.x;Sa[Pa+7]=Ha.y;Sa[Pa+8]=Ha.z;Pa+=9}if(Ia)for(db in Ia){v=Ia[db];if(v.needsUpdate){E=v.offset;fa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||
-v.boundTo==="vertices"){v.array[E+0]=v.value[D.a];v.array[E+1]=v.value[D.b];v.array[E+2]=v.value[D.c]}else if(v.boundTo==="faces"){v.array[E+0]=v.value[fa];v.array[E+1]=v.value[fa];v.array[E+2]=v.value[fa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[E+0]=v.value[fa+0];v.array[E+1]=v.value[fa+1];v.array[E+2]=v.value[fa+2];v.offsetSrc+=3}v.offset+=3}else{if(v.boundTo===undefined||v.boundTo==="vertices"){Ga=v.value[D.a];wa=v.value[D.b];Ha=v.value[D.c]}else if(v.boundTo==="faces"){Ga=v.value[fa];
-wa=v.value[fa];Ha=v.value[fa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){Ga=v.value[fa+0];wa=v.value[fa+1];Ha=v.value[fa+2];v.offsetSrc+=3}if(v.size===2){v.array[E+0]=Ga.x;v.array[E+1]=Ga.y;v.array[E+2]=wa.x;v.array[E+3]=wa.y;v.array[E+4]=Ha.x;v.array[E+5]=Ha.y;v.offset+=6}else if(v.size===3){if(v.type==="c"){v.array[E+0]=Ga.r;v.array[E+1]=Ga.g;v.array[E+2]=Ga.b;v.array[E+3]=wa.r;v.array[E+4]=wa.g;v.array[E+5]=wa.b;v.array[E+6]=Ha.r;v.array[E+7]=Ha.g;v.array[E+8]=Ha.b}else{v.array[E+0]=Ga.x;
-v.array[E+1]=Ga.y;v.array[E+2]=Ga.z;v.array[E+3]=wa.x;v.array[E+4]=wa.y;v.array[E+5]=wa.z;v.array[E+6]=Ha.x;v.array[E+7]=Ha.y;v.array[E+8]=Ha.z}v.offset+=9}else{v.array[E+0]=Ga.x;v.array[E+1]=Ga.y;v.array[E+2]=Ga.z;v.array[E+3]=Ga.w;v.array[E+4]=wa.x;v.array[E+5]=wa.y;v.array[E+6]=wa.z;v.array[E+7]=wa.w;v.array[E+8]=Ha.x;v.array[E+9]=Ha.y;v.array[E+10]=Ha.z;v.array[E+11]=Ha.w;v.offset+=12}}}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){Ga=morphTargets[E].vertices[D.a].position;wa=morphTargets[E].vertices[D.b].position;
-Ha=morphTargets[E].vertices[D.c].position;v=Y[E];v[Qa+0]=Ga.x;v[Qa+1]=Ga.y;v[Qa+2]=Ga.z;v[Qa+3]=wa.x;v[Qa+4]=wa.y;v[Qa+5]=wa.z;v[Qa+6]=Ha.x;v[Qa+7]=Ha.y;v[Qa+8]=Ha.z}Qa+=9}if(kb.length){E=kb[D.a];fa=kb[D.b];v=kb[D.c];ha[U]=E.x;ha[U+1]=E.y;ha[U+2]=E.z;ha[U+3]=E.w;ha[U+4]=fa.x;ha[U+5]=fa.y;ha[U+6]=fa.z;ha[U+7]=fa.w;ha[U+8]=v.x;ha[U+9]=v.y;ha[U+10]=v.z;ha[U+11]=v.w;E=pb[D.a];fa=pb[D.b];v=pb[D.c];qa[U]=E.x;qa[U+1]=E.y;qa[U+2]=E.z;qa[U+3]=E.w;qa[U+4]=fa.x;qa[U+5]=fa.y;qa[U+6]=fa.z;qa[U+7]=fa.w;qa[U+8]=
-v.x;qa[U+9]=v.y;qa[U+10]=v.z;qa[U+11]=v.w;E=nb[D.a];fa=nb[D.b];v=nb[D.c];da[U]=E.x;da[U+1]=E.y;da[U+2]=E.z;da[U+3]=1;da[U+4]=fa.x;da[U+5]=fa.y;da[U+6]=fa.z;da[U+7]=1;da[U+8]=v.x;da[U+9]=v.y;da[U+10]=v.z;da[U+11]=1;E=ob[D.a];fa=ob[D.b];v=ob[D.c];ra[U]=E.x;ra[U+1]=E.y;ra[U+2]=E.z;ra[U+3]=1;ra[U+4]=fa.x;ra[U+5]=fa.y;ra[U+6]=fa.z;ra[U+7]=1;ra[U+8]=v.x;ra[U+9]=v.y;ra[U+10]=v.z;ra[U+11]=1;U+=12}if(tb&&Ja){if(L.length==3&&Ja==THREE.VertexColors){D=L[0];E=L[1];fa=L[2]}else fa=E=D=$;ka[Aa]=D.r;ka[Aa+1]=D.g;
+e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);u.positionScreen.x=xa[0];u.positionScreen.y=xa[1];u.positionScreen.z=xa[2];u.customUpdateCallback?u.customUpdateCallback(u):u.updateLensFlares();e.uniform1i(za.renderType,2);e.enable(e.BLEND);J=0;for(K=u.lensFlares.length;J<K;J++){I=u.lensFlares[J];if(I.opacity>0.001&&I.scale>0.001){xa[0]=I.x;xa[1]=I.y;xa[2]=I.z;$=I.size*I.scale/la;V[0]=$*D;V[1]=$;e.uniform3fv(za.screenPosition,xa);e.uniform2fv(za.scale,V);e.uniform1f(za.rotation,I.rotation);e.uniform1f(za.opacity,
+I.opacity);M(I.blending);R(I.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Z)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function G(n){var C,u,w,z,J;if(n instanceof THREE.Mesh){u=n.geometry;for(C in u.geometryGroups){w=u.geometryGroups[C];J=!1;for(z in w.__webglCustomAttributes)if(w.__webglCustomAttributes[z].needsUpdate){J=
+!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||J){J=e.DYNAMIC_DRAW;var K=void 0,I=void 0,S=void 0,D=void 0;S=void 0;var O=void 0,L=void 0,$=void 0,V=void 0,xa=void 0,Ja=void 0,za=void 0,ta=void 0,Oa=void 0,Ga=void 0,wa=void 0,Ha=void 0,Ua=void 0;L=void 0;$=void 0;D=void 0;V=void 0;D=void 0;var E=void 0,fa=void 0;L=void 0;E=void 0;fa=void 0;var x=void 0,bb=void 0;E=void 0;fa=void 0;x=void 0;bb=void 0;E=void 0;
+fa=void 0;x=void 0;bb=void 0;E=void 0;fa=void 0;x=void 0;D=void 0;V=void 0;O=void 0;S=void 0;S=void 0;E=void 0;fa=void 0;x=void 0;var db=void 0,Ma=0,Pa=0,hb=0,eb=0,$a=0,ab=0,La=0,cb=0,Aa=0,U=0,Qa=0;fa=E=0;var Sa=w.__vertexArray,jb=w.__uvArray,Xa=w.__uv2Array,W=w.__normalArray,ia=w.__tangentArray,ka=w.__colorArray,da=w.__skinVertexAArray,ra=w.__skinVertexBArray,qa=w.__skinIndexArray,ha=w.__skinWeightArray,Y=w.__morphTargetsArrays,Ia=w.__webglCustomAttributes;x=void 0;var Va=w.__faceArray,Ta=w.__lineArray,
+ib=w.__needsSmoothNormals;Ja=w.__vertexColorType;xa=w.__uvType;za=w.__normalType;var Wa=n.geometry,fb=Wa.__dirtyVertices,gb=Wa.__dirtyElements,qb=Wa.__dirtyUvs,rb=Wa.__dirtyNormals,sb=Wa.__dirtyTangents,tb=Wa.__dirtyColors,ub=Wa.__dirtyMorphTargets,mb=Wa.vertices,vb=w.faces,yb=Wa.faces,wb=Wa.faceVertexUvs[0],xb=Wa.faceVertexUvs[1],nb=Wa.skinVerticesA,ob=Wa.skinVerticesB,pb=Wa.skinIndices,kb=Wa.skinWeights,lb=n instanceof THREE.ShadowVolume?Wa.edgeFaces:undefined;morphTargets=Wa.morphTargets;if(Ia)for(db in Ia){Ia[db].offset=
+0;Ia[db].offsetSrc=0}K=0;for(I=vb.length;K<I;K++){S=vb[K];D=yb[S];wb&&(ta=wb[S]);xb&&(Oa=xb[S]);S=D.vertexNormals;O=D.normal;L=D.vertexColors;$=D.color;V=D.vertexTangents;if(D instanceof THREE.Face3){if(fb){Ga=mb[D.a].position;wa=mb[D.b].position;Ha=mb[D.c].position;Sa[Pa]=Ga.x;Sa[Pa+1]=Ga.y;Sa[Pa+2]=Ga.z;Sa[Pa+3]=wa.x;Sa[Pa+4]=wa.y;Sa[Pa+5]=wa.z;Sa[Pa+6]=Ha.x;Sa[Pa+7]=Ha.y;Sa[Pa+8]=Ha.z;Pa+=9}if(Ia)for(db in Ia){x=Ia[db];if(x.needsUpdate){E=x.offset;fa=x.offsetSrc;if(x.size===1){if(x.boundTo===undefined||
+x.boundTo==="vertices"){x.array[E+0]=x.value[D.a];x.array[E+1]=x.value[D.b];x.array[E+2]=x.value[D.c]}else if(x.boundTo==="faces"){x.array[E+0]=x.value[fa];x.array[E+1]=x.value[fa];x.array[E+2]=x.value[fa];x.offsetSrc++}else if(x.boundTo==="faceVertices"){x.array[E+0]=x.value[fa+0];x.array[E+1]=x.value[fa+1];x.array[E+2]=x.value[fa+2];x.offsetSrc+=3}x.offset+=3}else{if(x.boundTo===undefined||x.boundTo==="vertices"){Ga=x.value[D.a];wa=x.value[D.b];Ha=x.value[D.c]}else if(x.boundTo==="faces"){Ga=x.value[fa];
+wa=x.value[fa];Ha=x.value[fa];x.offsetSrc++}else if(x.boundTo==="faceVertices"){Ga=x.value[fa+0];wa=x.value[fa+1];Ha=x.value[fa+2];x.offsetSrc+=3}if(x.size===2){x.array[E+0]=Ga.x;x.array[E+1]=Ga.y;x.array[E+2]=wa.x;x.array[E+3]=wa.y;x.array[E+4]=Ha.x;x.array[E+5]=Ha.y;x.offset+=6}else if(x.size===3){if(x.type==="c"){x.array[E+0]=Ga.r;x.array[E+1]=Ga.g;x.array[E+2]=Ga.b;x.array[E+3]=wa.r;x.array[E+4]=wa.g;x.array[E+5]=wa.b;x.array[E+6]=Ha.r;x.array[E+7]=Ha.g;x.array[E+8]=Ha.b}else{x.array[E+0]=Ga.x;
+x.array[E+1]=Ga.y;x.array[E+2]=Ga.z;x.array[E+3]=wa.x;x.array[E+4]=wa.y;x.array[E+5]=wa.z;x.array[E+6]=Ha.x;x.array[E+7]=Ha.y;x.array[E+8]=Ha.z}x.offset+=9}else{x.array[E+0]=Ga.x;x.array[E+1]=Ga.y;x.array[E+2]=Ga.z;x.array[E+3]=Ga.w;x.array[E+4]=wa.x;x.array[E+5]=wa.y;x.array[E+6]=wa.z;x.array[E+7]=wa.w;x.array[E+8]=Ha.x;x.array[E+9]=Ha.y;x.array[E+10]=Ha.z;x.array[E+11]=Ha.w;x.offset+=12}}}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){Ga=morphTargets[E].vertices[D.a].position;wa=morphTargets[E].vertices[D.b].position;
+Ha=morphTargets[E].vertices[D.c].position;x=Y[E];x[Qa+0]=Ga.x;x[Qa+1]=Ga.y;x[Qa+2]=Ga.z;x[Qa+3]=wa.x;x[Qa+4]=wa.y;x[Qa+5]=wa.z;x[Qa+6]=Ha.x;x[Qa+7]=Ha.y;x[Qa+8]=Ha.z}Qa+=9}if(kb.length){E=kb[D.a];fa=kb[D.b];x=kb[D.c];ha[U]=E.x;ha[U+1]=E.y;ha[U+2]=E.z;ha[U+3]=E.w;ha[U+4]=fa.x;ha[U+5]=fa.y;ha[U+6]=fa.z;ha[U+7]=fa.w;ha[U+8]=x.x;ha[U+9]=x.y;ha[U+10]=x.z;ha[U+11]=x.w;E=pb[D.a];fa=pb[D.b];x=pb[D.c];qa[U]=E.x;qa[U+1]=E.y;qa[U+2]=E.z;qa[U+3]=E.w;qa[U+4]=fa.x;qa[U+5]=fa.y;qa[U+6]=fa.z;qa[U+7]=fa.w;qa[U+8]=
+x.x;qa[U+9]=x.y;qa[U+10]=x.z;qa[U+11]=x.w;E=nb[D.a];fa=nb[D.b];x=nb[D.c];da[U]=E.x;da[U+1]=E.y;da[U+2]=E.z;da[U+3]=1;da[U+4]=fa.x;da[U+5]=fa.y;da[U+6]=fa.z;da[U+7]=1;da[U+8]=x.x;da[U+9]=x.y;da[U+10]=x.z;da[U+11]=1;E=ob[D.a];fa=ob[D.b];x=ob[D.c];ra[U]=E.x;ra[U+1]=E.y;ra[U+2]=E.z;ra[U+3]=1;ra[U+4]=fa.x;ra[U+5]=fa.y;ra[U+6]=fa.z;ra[U+7]=1;ra[U+8]=x.x;ra[U+9]=x.y;ra[U+10]=x.z;ra[U+11]=1;U+=12}if(tb&&Ja){if(L.length==3&&Ja==THREE.VertexColors){D=L[0];E=L[1];fa=L[2]}else fa=E=D=$;ka[Aa]=D.r;ka[Aa+1]=D.g;
 ka[Aa+2]=D.b;ka[Aa+3]=E.r;ka[Aa+4]=E.g;ka[Aa+5]=E.b;ka[Aa+6]=fa.r;ka[Aa+7]=fa.g;ka[Aa+8]=fa.b;Aa+=9}if(sb&&Wa.hasTangents){L=V[0];$=V[1];D=V[2];ia[La]=L.x;ia[La+1]=L.y;ia[La+2]=L.z;ia[La+3]=L.w;ia[La+4]=$.x;ia[La+5]=$.y;ia[La+6]=$.z;ia[La+7]=$.w;ia[La+8]=D.x;ia[La+9]=D.y;ia[La+10]=D.z;ia[La+11]=D.w;La+=12}if(rb&&za)if(S.length==3&&ib)for(V=0;V<3;V++){O=S[V];W[ab]=O.x;W[ab+1]=O.y;W[ab+2]=O.z;ab+=3}else for(V=0;V<3;V++){W[ab]=O.x;W[ab+1]=O.y;W[ab+2]=O.z;ab+=3}if(qb&&ta!==undefined&&xa)for(V=0;V<3;V++){S=
 ta[V];jb[hb]=S.u;jb[hb+1]=S.v;hb+=2}if(qb&&Oa!==undefined&&xa)for(V=0;V<3;V++){S=Oa[V];Xa[eb]=S.u;Xa[eb+1]=S.v;eb+=2}if(gb){Va[$a]=Ma;Va[$a+1]=Ma+1;Va[$a+2]=Ma+2;$a+=3;Ta[cb]=Ma;Ta[cb+1]=Ma+1;Ta[cb+2]=Ma;Ta[cb+3]=Ma+2;Ta[cb+4]=Ma+1;Ta[cb+5]=Ma+2;cb+=6;Ma+=3}}else if(D instanceof THREE.Face4){if(fb){Ga=mb[D.a].position;wa=mb[D.b].position;Ha=mb[D.c].position;Ua=mb[D.d].position;Sa[Pa]=Ga.x;Sa[Pa+1]=Ga.y;Sa[Pa+2]=Ga.z;Sa[Pa+3]=wa.x;Sa[Pa+4]=wa.y;Sa[Pa+5]=wa.z;Sa[Pa+6]=Ha.x;Sa[Pa+7]=Ha.y;Sa[Pa+8]=Ha.z;
-Sa[Pa+9]=Ua.x;Sa[Pa+10]=Ua.y;Sa[Pa+11]=Ua.z;Pa+=12}if(Ia)for(db in Ia){v=Ia[db];if(v.needsUpdate){E=v.offset;fa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[E+0]=v.value[D.a];v.array[E+1]=v.value[D.b];v.array[E+2]=v.value[D.c];v.array[E+2]=v.value[D.d]}else if(v.boundTo==="faces"){v.array[E+0]=v.value[fa];v.array[E+1]=v.value[fa];v.array[E+2]=v.value[fa];v.array[E+2]=v.value[fa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[E+0]=v.value[fa+0];v.array[E+
-1]=v.value[fa+1];v.array[E+2]=v.value[fa+2];v.array[E+2]=v.value[fa+3];v.offsetSrc+=4}v.offset+=4}else{if(v.boundTo===undefined||v.boundTo==="vertices"){Ga=v.value[D.a];wa=v.value[D.b];Ha=v.value[D.c];Ua=v.value[D.d]}else if(v.boundTo==="faces"){Ga=v.value[fa];wa=v.value[fa];Ha=v.value[fa];Ua=v.value[fa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){Ga=v.value[fa+0];wa=v.value[fa+1];Ha=v.value[fa+2];Ua=v.value[fa+3];v.offsetSrc+=4}if(v.size===2){v.array[E+0]=Ga.x;v.array[E+1]=Ga.y;v.array[E+2]=
-wa.x;v.array[E+3]=wa.y;v.array[E+4]=Ha.x;v.array[E+5]=Ha.y;v.array[E+6]=Ua.x;v.array[E+7]=Ua.y;v.offset+=8}else if(v.size===3){if(v.type==="c"){v.array[E+0]=Ga.r;v.array[E+1]=Ga.g;v.array[E+2]=Ga.b;v.array[E+3]=wa.r;v.array[E+4]=wa.g;v.array[E+5]=wa.b;v.array[E+6]=Ha.r;v.array[E+7]=Ha.g;v.array[E+8]=Ha.b;v.array[E+9]=Ua.r;v.array[E+10]=Ua.g;v.array[E+11]=Ua.b}else{v.array[E+0]=Ga.x;v.array[E+1]=Ga.y;v.array[E+2]=Ga.z;v.array[E+3]=wa.x;v.array[E+4]=wa.y;v.array[E+5]=wa.z;v.array[E+6]=Ha.x;v.array[E+
-7]=Ha.y;v.array[E+8]=Ha.z;v.array[E+9]=Ua.x;v.array[E+10]=Ua.y;v.array[E+11]=Ua.z}v.offset+=12}else{v.array[E+0]=Ga.x;v.array[E+1]=Ga.y;v.array[E+2]=Ga.z;v.array[E+3]=Ga.w;v.array[E+4]=wa.x;v.array[E+5]=wa.y;v.array[E+6]=wa.z;v.array[E+7]=wa.w;v.array[E+8]=Ha.x;v.array[E+9]=Ha.y;v.array[E+10]=Ha.z;v.array[E+11]=Ha.w;v.array[E+12]=Ua.x;v.array[E+13]=Ua.y;v.array[E+14]=Ua.z;v.array[E+15]=Ua.w;v.offset+=16}}}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){Ga=morphTargets[E].vertices[D.a].position;wa=
-morphTargets[E].vertices[D.b].position;Ha=morphTargets[E].vertices[D.c].position;Ua=morphTargets[E].vertices[D.d].position;v=Y[E];v[Qa+0]=Ga.x;v[Qa+1]=Ga.y;v[Qa+2]=Ga.z;v[Qa+3]=wa.x;v[Qa+4]=wa.y;v[Qa+5]=wa.z;v[Qa+6]=Ha.x;v[Qa+7]=Ha.y;v[Qa+8]=Ha.z;v[Qa+9]=Ua.x;v[Qa+10]=Ua.y;v[Qa+11]=Ua.z}Qa+=12}if(kb.length){E=kb[D.a];fa=kb[D.b];v=kb[D.c];bb=kb[D.d];ha[U]=E.x;ha[U+1]=E.y;ha[U+2]=E.z;ha[U+3]=E.w;ha[U+4]=fa.x;ha[U+5]=fa.y;ha[U+6]=fa.z;ha[U+7]=fa.w;ha[U+8]=v.x;ha[U+9]=v.y;ha[U+10]=v.z;ha[U+11]=v.w;ha[U+
-12]=bb.x;ha[U+13]=bb.y;ha[U+14]=bb.z;ha[U+15]=bb.w;E=pb[D.a];fa=pb[D.b];v=pb[D.c];bb=pb[D.d];qa[U]=E.x;qa[U+1]=E.y;qa[U+2]=E.z;qa[U+3]=E.w;qa[U+4]=fa.x;qa[U+5]=fa.y;qa[U+6]=fa.z;qa[U+7]=fa.w;qa[U+8]=v.x;qa[U+9]=v.y;qa[U+10]=v.z;qa[U+11]=v.w;qa[U+12]=bb.x;qa[U+13]=bb.y;qa[U+14]=bb.z;qa[U+15]=bb.w;E=nb[D.a];fa=nb[D.b];v=nb[D.c];bb=nb[D.d];da[U]=E.x;da[U+1]=E.y;da[U+2]=E.z;da[U+3]=1;da[U+4]=fa.x;da[U+5]=fa.y;da[U+6]=fa.z;da[U+7]=1;da[U+8]=v.x;da[U+9]=v.y;da[U+10]=v.z;da[U+11]=1;da[U+12]=bb.x;da[U+13]=
-bb.y;da[U+14]=bb.z;da[U+15]=1;E=ob[D.a];fa=ob[D.b];v=ob[D.c];D=ob[D.d];ra[U]=E.x;ra[U+1]=E.y;ra[U+2]=E.z;ra[U+3]=1;ra[U+4]=fa.x;ra[U+5]=fa.y;ra[U+6]=fa.z;ra[U+7]=1;ra[U+8]=v.x;ra[U+9]=v.y;ra[U+10]=v.z;ra[U+11]=1;ra[U+12]=D.x;ra[U+13]=D.y;ra[U+14]=D.z;ra[U+15]=1;U+=16}if(tb&&Ja){if(L.length==4&&Ja==THREE.VertexColors){D=L[0];E=L[1];fa=L[2];L=L[3]}else L=fa=E=D=$;ka[Aa]=D.r;ka[Aa+1]=D.g;ka[Aa+2]=D.b;ka[Aa+3]=E.r;ka[Aa+4]=E.g;ka[Aa+5]=E.b;ka[Aa+6]=fa.r;ka[Aa+7]=fa.g;ka[Aa+8]=fa.b;ka[Aa+9]=L.r;ka[Aa+
+Sa[Pa+9]=Ua.x;Sa[Pa+10]=Ua.y;Sa[Pa+11]=Ua.z;Pa+=12}if(Ia)for(db in Ia){x=Ia[db];if(x.needsUpdate){E=x.offset;fa=x.offsetSrc;if(x.size===1){if(x.boundTo===undefined||x.boundTo==="vertices"){x.array[E+0]=x.value[D.a];x.array[E+1]=x.value[D.b];x.array[E+2]=x.value[D.c];x.array[E+2]=x.value[D.d]}else if(x.boundTo==="faces"){x.array[E+0]=x.value[fa];x.array[E+1]=x.value[fa];x.array[E+2]=x.value[fa];x.array[E+2]=x.value[fa];x.offsetSrc++}else if(x.boundTo==="faceVertices"){x.array[E+0]=x.value[fa+0];x.array[E+
+1]=x.value[fa+1];x.array[E+2]=x.value[fa+2];x.array[E+2]=x.value[fa+3];x.offsetSrc+=4}x.offset+=4}else{if(x.boundTo===undefined||x.boundTo==="vertices"){Ga=x.value[D.a];wa=x.value[D.b];Ha=x.value[D.c];Ua=x.value[D.d]}else if(x.boundTo==="faces"){Ga=x.value[fa];wa=x.value[fa];Ha=x.value[fa];Ua=x.value[fa];x.offsetSrc++}else if(x.boundTo==="faceVertices"){Ga=x.value[fa+0];wa=x.value[fa+1];Ha=x.value[fa+2];Ua=x.value[fa+3];x.offsetSrc+=4}if(x.size===2){x.array[E+0]=Ga.x;x.array[E+1]=Ga.y;x.array[E+2]=
+wa.x;x.array[E+3]=wa.y;x.array[E+4]=Ha.x;x.array[E+5]=Ha.y;x.array[E+6]=Ua.x;x.array[E+7]=Ua.y;x.offset+=8}else if(x.size===3){if(x.type==="c"){x.array[E+0]=Ga.r;x.array[E+1]=Ga.g;x.array[E+2]=Ga.b;x.array[E+3]=wa.r;x.array[E+4]=wa.g;x.array[E+5]=wa.b;x.array[E+6]=Ha.r;x.array[E+7]=Ha.g;x.array[E+8]=Ha.b;x.array[E+9]=Ua.r;x.array[E+10]=Ua.g;x.array[E+11]=Ua.b}else{x.array[E+0]=Ga.x;x.array[E+1]=Ga.y;x.array[E+2]=Ga.z;x.array[E+3]=wa.x;x.array[E+4]=wa.y;x.array[E+5]=wa.z;x.array[E+6]=Ha.x;x.array[E+
+7]=Ha.y;x.array[E+8]=Ha.z;x.array[E+9]=Ua.x;x.array[E+10]=Ua.y;x.array[E+11]=Ua.z}x.offset+=12}else{x.array[E+0]=Ga.x;x.array[E+1]=Ga.y;x.array[E+2]=Ga.z;x.array[E+3]=Ga.w;x.array[E+4]=wa.x;x.array[E+5]=wa.y;x.array[E+6]=wa.z;x.array[E+7]=wa.w;x.array[E+8]=Ha.x;x.array[E+9]=Ha.y;x.array[E+10]=Ha.z;x.array[E+11]=Ha.w;x.array[E+12]=Ua.x;x.array[E+13]=Ua.y;x.array[E+14]=Ua.z;x.array[E+15]=Ua.w;x.offset+=16}}}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){Ga=morphTargets[E].vertices[D.a].position;wa=
+morphTargets[E].vertices[D.b].position;Ha=morphTargets[E].vertices[D.c].position;Ua=morphTargets[E].vertices[D.d].position;x=Y[E];x[Qa+0]=Ga.x;x[Qa+1]=Ga.y;x[Qa+2]=Ga.z;x[Qa+3]=wa.x;x[Qa+4]=wa.y;x[Qa+5]=wa.z;x[Qa+6]=Ha.x;x[Qa+7]=Ha.y;x[Qa+8]=Ha.z;x[Qa+9]=Ua.x;x[Qa+10]=Ua.y;x[Qa+11]=Ua.z}Qa+=12}if(kb.length){E=kb[D.a];fa=kb[D.b];x=kb[D.c];bb=kb[D.d];ha[U]=E.x;ha[U+1]=E.y;ha[U+2]=E.z;ha[U+3]=E.w;ha[U+4]=fa.x;ha[U+5]=fa.y;ha[U+6]=fa.z;ha[U+7]=fa.w;ha[U+8]=x.x;ha[U+9]=x.y;ha[U+10]=x.z;ha[U+11]=x.w;ha[U+
+12]=bb.x;ha[U+13]=bb.y;ha[U+14]=bb.z;ha[U+15]=bb.w;E=pb[D.a];fa=pb[D.b];x=pb[D.c];bb=pb[D.d];qa[U]=E.x;qa[U+1]=E.y;qa[U+2]=E.z;qa[U+3]=E.w;qa[U+4]=fa.x;qa[U+5]=fa.y;qa[U+6]=fa.z;qa[U+7]=fa.w;qa[U+8]=x.x;qa[U+9]=x.y;qa[U+10]=x.z;qa[U+11]=x.w;qa[U+12]=bb.x;qa[U+13]=bb.y;qa[U+14]=bb.z;qa[U+15]=bb.w;E=nb[D.a];fa=nb[D.b];x=nb[D.c];bb=nb[D.d];da[U]=E.x;da[U+1]=E.y;da[U+2]=E.z;da[U+3]=1;da[U+4]=fa.x;da[U+5]=fa.y;da[U+6]=fa.z;da[U+7]=1;da[U+8]=x.x;da[U+9]=x.y;da[U+10]=x.z;da[U+11]=1;da[U+12]=bb.x;da[U+13]=
+bb.y;da[U+14]=bb.z;da[U+15]=1;E=ob[D.a];fa=ob[D.b];x=ob[D.c];D=ob[D.d];ra[U]=E.x;ra[U+1]=E.y;ra[U+2]=E.z;ra[U+3]=1;ra[U+4]=fa.x;ra[U+5]=fa.y;ra[U+6]=fa.z;ra[U+7]=1;ra[U+8]=x.x;ra[U+9]=x.y;ra[U+10]=x.z;ra[U+11]=1;ra[U+12]=D.x;ra[U+13]=D.y;ra[U+14]=D.z;ra[U+15]=1;U+=16}if(tb&&Ja){if(L.length==4&&Ja==THREE.VertexColors){D=L[0];E=L[1];fa=L[2];L=L[3]}else L=fa=E=D=$;ka[Aa]=D.r;ka[Aa+1]=D.g;ka[Aa+2]=D.b;ka[Aa+3]=E.r;ka[Aa+4]=E.g;ka[Aa+5]=E.b;ka[Aa+6]=fa.r;ka[Aa+7]=fa.g;ka[Aa+8]=fa.b;ka[Aa+9]=L.r;ka[Aa+
 10]=L.g;ka[Aa+11]=L.b;Aa+=12}if(sb&&Wa.hasTangents){L=V[0];$=V[1];D=V[2];V=V[3];ia[La]=L.x;ia[La+1]=L.y;ia[La+2]=L.z;ia[La+3]=L.w;ia[La+4]=$.x;ia[La+5]=$.y;ia[La+6]=$.z;ia[La+7]=$.w;ia[La+8]=D.x;ia[La+9]=D.y;ia[La+10]=D.z;ia[La+11]=D.w;ia[La+12]=V.x;ia[La+13]=V.y;ia[La+14]=V.z;ia[La+15]=V.w;La+=16}if(rb&&za)if(S.length==4&&ib)for(V=0;V<4;V++){O=S[V];W[ab]=O.x;W[ab+1]=O.y;W[ab+2]=O.z;ab+=3}else for(V=0;V<4;V++){W[ab]=O.x;W[ab+1]=O.y;W[ab+2]=O.z;ab+=3}if(qb&&ta!==undefined&&xa)for(V=0;V<4;V++){S=ta[V];
 jb[hb]=S.u;jb[hb+1]=S.v;hb+=2}if(qb&&Oa!==undefined&&xa)for(V=0;V<4;V++){S=Oa[V];Xa[eb]=S.u;Xa[eb+1]=S.v;eb+=2}if(gb){Va[$a]=Ma;Va[$a+1]=Ma+1;Va[$a+2]=Ma+3;Va[$a+3]=Ma+1;Va[$a+4]=Ma+2;Va[$a+5]=Ma+3;$a+=6;Ta[cb]=Ma;Ta[cb+1]=Ma+1;Ta[cb+2]=Ma;Ta[cb+3]=Ma+3;Ta[cb+4]=Ma+1;Ta[cb+5]=Ma+2;Ta[cb+6]=Ma+2;Ta[cb+7]=Ma+3;cb+=8;Ma+=4}}}if(lb){K=0;for(I=lb.length;K<I;K++){Va[$a]=lb[K].a;Va[$a+1]=lb[K].b;Va[$a+2]=lb[K].c;Va[$a+3]=lb[K].a;Va[$a+4]=lb[K].c;Va[$a+5]=lb[K].d;$a+=6}}if(fb){e.bindBuffer(e.ARRAY_BUFFER,
-x.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Sa,J)}if(Ia)for(db in Ia){v=Ia[db];if(v.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,v.buffer);e.bufferData(e.ARRAY_BUFFER,v.array,J);v.needsUpdate=!1}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){e.bindBuffer(e.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,Y[E],J)}}if(tb&&Aa>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ka,J)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,
-W,J)}if(sb&&Wa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ia,J)}if(qb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,jb,J)}if(qb&&eb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Xa,J)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Va,J);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
-Ta,J)}if(U>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,da,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ra,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,qa,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,J)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=
-!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ja=n.vertices;x=n.colors;za=Ja.length;J=x.length;ta=n.__vertexArray;K=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<za;I++){xa=Ja[I].position;z=I*3;ta[z]=xa.x;ta[z+1]=xa.y;ta[z+2]=xa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ta,C)}if(Oa){for(I=0;I<J;I++){color=x[I];z=I*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
-n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ja=n.vertices;x=n.colors;za=Ja.length;J=x.length;ta=n.__vertexArray;K=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<za;I++){xa=Ja[I].position;z=I*3;ta[z]=xa.x;ta[z+1]=xa.y;ta[z+2]=xa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ta,C)}if(Oa){for(I=
-0;I<J;I++){color=x[I];z=I*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&d(w,e.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function X(n){function C($){var V=[];w=0;for(x=$.length;w<x;w++)$[w]==undefined?V.push("undefined"):V.push($[w].id);return V.join("_")}
-var w,x,z,J,K,I,S,D,O={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(J=n.faces.length;z<J;z++){K=n.faces[z];I=K.materials;S=C(I);O[S]==undefined&&(O[S]={hash:S,counter:0});D=O[S].hash+"_"+O[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]={faces:[],materials:I,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[D].vertices+K>65535){O[S].counter+=1;D=O[S].hash+"_"+O[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]=
-{faces:[],materials:I,vertices:0,numMorphTargets:L})}n.geometryGroups[D].faces.push(z);n.geometryGroups[D].vertices+=K}}function A(n,C,w){n.push({buffer:C,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(n){if(n!=ga){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);
-e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=n}}function Q(n,C,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ca(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ca(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ca(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ca(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,
+w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Sa,J)}if(Ia)for(db in Ia){x=Ia[db];if(x.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,x.buffer);e.bufferData(e.ARRAY_BUFFER,x.array,J);x.needsUpdate=!1}}if(ub){E=0;for(fa=morphTargets.length;E<fa;E++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,Y[E],J)}}if(tb&&Aa>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ka,J)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,
+W,J)}if(sb&&Wa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ia,J)}if(qb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,jb,J)}if(qb&&eb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Xa,J)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Va,J);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
+Ta,J)}if(U>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,da,J);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ra,J);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,qa,J);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,J)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=
+!1}else if(n instanceof THREE.Ribbon){u=n.geometry;if(u.__dirtyVertices||u.__dirtyColors){n=u;C=e.DYNAMIC_DRAW;Ja=n.vertices;w=n.colors;za=Ja.length;J=w.length;ta=n.__vertexArray;K=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<za;I++){xa=Ja[I].position;z=I*3;ta[z]=xa.x;ta[z+1]=xa.y;ta[z+2]=xa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ta,C)}if(Oa){for(I=0;I<J;I++){color=w[I];z=I*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
+n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(n instanceof THREE.Line){u=n.geometry;if(u.__dirtyVertices||u.__dirtyColors){n=u;C=e.DYNAMIC_DRAW;Ja=n.vertices;w=n.colors;za=Ja.length;J=w.length;ta=n.__vertexArray;K=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<za;I++){xa=Ja[I].position;z=I*3;ta[z]=xa.x;ta[z+1]=xa.y;ta[z+2]=xa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ta,C)}if(Oa){for(I=
+0;I<J;I++){color=w[I];z=I*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){u=n.geometry;(u.__dirtyVertices||u.__dirtyColors||n.sortParticles)&&d(u,e.DYNAMIC_DRAW,n);u.__dirtyVertices=!1;u.__dirtyColors=!1}}function X(n){function C($){var V=[];u=0;for(w=$.length;u<w;u++)$[u]==undefined?V.push("undefined"):V.push($[u].id);return V.join("_")}
+var u,w,z,J,K,I,S,D,O={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(J=n.faces.length;z<J;z++){K=n.faces[z];I=K.materials;S=C(I);O[S]==undefined&&(O[S]={hash:S,counter:0});D=O[S].hash+"_"+O[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]={faces:[],materials:I,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[D].vertices+K>65535){O[S].counter+=1;D=O[S].hash+"_"+O[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]=
+{faces:[],materials:I,vertices:0,numMorphTargets:L})}n.geometryGroups[D].faces.push(z);n.geometryGroups[D].vertices+=K}}function A(n,C,u){n.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(n){if(n!=ga){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=n}}function Q(n,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ca(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ca(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ca(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ca(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,
 e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER,va(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,va(C.minFilter))}}function R(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,
 n.image);n.__webglInit=!0}Q(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function Da(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,
 e.TEXTURE_WRAP_S,ca(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,ca(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ca(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ca(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ca(n.format),n.width,n.height,0,ca(n.format),ca(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,
 0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,
-null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,w;if(n){C=n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=ja;n=la}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(na,Ea,w,n);Fa=C}}function ma(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,C);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(C);
-return null}return w}function va(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ca(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
+null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(n){C=n.__webglFramebuffer;u=n.width;n=n.height}else{C=null;u=ja;n=la}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(na,Ea,u,n);Fa=C}}function ma(n,C){var u;if(n=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);
+return null}return u}function va(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ca(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
 case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var e,ea=document.createElement("canvas"),ya=[],Ba=null,Fa=null,Z=!0,oa=this,pa=null,sa=null,ga=null,aa=null,na=0,Ea=0,ja=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ra=new THREE.Matrix4,Ya=new Float32Array(16),Za=new Float32Array(16),Na=new THREE.Vector4,
-T={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.maxMorphTargets=8;this.domElement=ea;this.autoClear=!0;this.sortObjects=!0;(function(n,C,w,x){try{if(!(e=ea.getContext("experimental-webgl",{antialias:n,
-stencil:x})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,
-C.g,C.b,w)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var P={};P.vertices=new Float32Array(12);P.faces=new Uint16Array(6);P.darkness=0.5;P.vertices[0]=-20;P.vertices[1]=-20;P.vertices[2]=-1;P.vertices[3]=20;P.vertices[4]=-20;P.vertices[5]=-1;P.vertices[6]=20;P.vertices[7]=20;P.vertices[8]=-1;P.vertices[9]=-20;P.vertices[10]=20;P.vertices[11]=-1;P.faces[0]=0;P.faces[1]=1;P.faces[2]=2;P.faces[3]=0;P.faces[4]=2;P.faces[5]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();
+T={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.maxMorphTargets=8;this.domElement=ea;this.autoClear=!0;this.sortObjects=!0;(function(n,C,u,w){try{if(!(e=ea.getContext("experimental-webgl",{antialias:n,
+stencil:w})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,
+C.g,C.b,u)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var P={};P.vertices=new Float32Array(12);P.faces=new Uint16Array(6);P.darkness=0.5;P.vertices[0]=-20;P.vertices[1]=-20;P.vertices[2]=-1;P.vertices[3]=20;P.vertices[4]=-20;P.vertices[5]=-1;P.vertices[6]=20;P.vertices[7]=20;P.vertices[8]=-1;P.vertices[9]=-20;P.vertices[10]=20;P.vertices[11]=-1;P.faces[0]=0;P.faces[1]=1;P.faces[2]=2;P.faces[3]=0;P.faces[4]=2;P.faces[5]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();
 e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P.faces,e.STATIC_DRAW);P.program=e.createProgram();e.attachShader(P.program,ma("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(P.program,ma("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(P.program);P.vertexLocation=e.getAttribLocation(P.program,"position");P.projectionLocation=
 e.getUniformLocation(P.program,"projectionMatrix");P.darknessLocation=e.getUniformLocation(P.program,"darkness")}var N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);b=0;N.vertices[b++]=-1;N.vertices[b++]=-1;N.vertices[b++]=0;N.vertices[b++]=0;N.vertices[b++]=1;N.vertices[b++]=-1;N.vertices[b++]=1;N.vertices[b++]=0;N.vertices[b++]=1;N.vertices[b++]=1;N.vertices[b++]=1;N.vertices[b++]=1;N.vertices[b++]=-1;N.vertices[b++]=1;N.vertices[b++]=0;N.vertices[b++]=1;b=0;N.faces[b++]=0;N.faces[b++]=
 1;N.faces[b++]=2;N.faces[b++]=0;N.faces[b++]=2;N.faces[b++]=3;N.vertexBuffer=e.createBuffer();N.elementBuffer=e.createBuffer();N.tempTexture=e.createTexture();N.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,N.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,N.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,N.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,N.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,N.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,
@@ -303,33 +303,33 @@ e.attachShader(N.program,ma("vertex",THREE.ShaderLib.lensFlareVertexTexture.vert
 _sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,ma("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,ma("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");
 _sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");
 _sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var Ka=!1;this.setSize=function(n,C){ea.width=
-n;ea.height=C;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(n,C,w,x){na=n;Ea=C;ja=w;la=x;e.viewport(na,Ea,ja,la)};this.setScissor=function(n,C,w,x){e.scissor(n,C,w,x)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){Z=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var w=new THREE.Color(n);e.clearColor(w.r,w.g,w.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=
-function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){P.darkness=n};this.initMaterial=function(n,C,w,x){var z,J,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof
+n;ea.height=C;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(n,C,u,w){na=n;Ea=C;ja=u;la=w;e.viewport(na,Ea,ja,la)};this.setScissor=function(n,C,u,w){e.scissor(n,C,u,w)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){Z=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var u=new THREE.Color(n);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=
+function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){P.darkness=n};this.initMaterial=function(n,C,u,w){var z,J,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof
 THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var I=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(I.uniforms);n.vertexShader=I.vertexShader;n.fragmentShader=I.fragmentShader}var S,D,O;S=O=I=0;for(D=C.length;S<D;S++){J=C[S];J instanceof THREE.DirectionalLight&&O++;J instanceof THREE.PointLight&&I++}if(I+O<=4)C=O;else{C=Math.ceil(4*O/(I+O));I=4-C}J={directional:C,point:I};O=
-50;if(x!==undefined&&x instanceof THREE.SkinnedMesh)O=x.bones.length;var L;a:{S=n.fragmentShader;D=n.vertexShader;I=n.uniforms;C=n.attributes;w={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:w,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:J.directional,maxPointLights:J.point,maxBones:O};var $;J=[];if(K)J.push(K);else{J.push(S);J.push(D)}for($ in w){J.push($);J.push(w[$])}K=J.join();
-$=0;for(J=ya.length;$<J;$++)if(ya[$].code==K){L=ya[$].program;break a}$=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.morphTargets?"#define USE_MORPHTARGETS":"",w.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");
+50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)O=w.bones.length;var L;a:{S=n.fragmentShader;D=n.vertexShader;I=n.uniforms;C=n.attributes;u={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:u,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:J.directional,maxPointLights:J.point,maxBones:O};var $;J=[];if(K)J.push(K);else{J.push(S);J.push(D)}for($ in u){J.push($);J.push(u[$])}K=J.join();
+$=0;for(J=ya.length;$<J;$++)if(ya[$].code==K){L=ya[$].program;break a}$=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.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");
 e.attachShader($,ma("fragment",prefix_fragment+S));e.attachShader($,ma("vertex",prefix_vertex+D));e.linkProgram($);e.getProgramParameter($,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter($,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");$.uniforms={};$.attributes={};var V;S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(V in I)S.push(V);
-V=S;I=0;for(S=V.length;I<S;I++){D=V[I];$.uniforms[D]=e.getUniformLocation($,D)}S=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(V=0;V<w.maxMorphTargets;V++)S.push("morphTarget"+V);for(L in C)S.push(L);L=S;V=0;for(C=L.length;V<C;V++){w=L[V];$.attributes[w]=e.getAttribLocation($,w)}ya.push({program:$,code:K});L=$}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
+V=S;I=0;for(S=V.length;I<S;I++){D=V[I];$.uniforms[D]=e.getUniformLocation($,D)}S=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(V=0;V<u.maxMorphTargets;V++)S.push("morphTarget"+V);for(L in C)S.push(L);L=S;V=0;for(C=L.length;V<C;V++){u=L[V];$.attributes[u]=e.getAttribLocation($,u)}ya.push({program:$,code:K});L=$}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
 0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(z in n.attributes)L[z]>=0&&e.enableVertexAttribArray(L[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
 n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
-0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)x.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,w,x){var z,J,K,I,S,D,O,L,$=n.lights,V=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);C.projectionMatrix.flattenToArray(Ya);
-Ra.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ra);this.initWebGLObjects(n);Da(w);(this.autoClear||x)&&this.clear();S=n.__webglObjects.length;for(x=0;x<S;x++){z=n.__webglObjects[x];O=z.object;if(O.visible)if(!(O instanceof THREE.Mesh)||m(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);H(O,C);u(z);z.render=!0;if(this.sortObjects){Na.copy(O.position);Ra.multiplyVector3(Na);z.z=Na.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);D=n.__webglObjectsImmediate.length;
-for(x=0;x<D;x++){z=n.__webglObjectsImmediate[x];O=z.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);H(O,C);o(z)}}M(THREE.NormalBlending);for(x=0;x<S;x++){z=n.__webglObjects[x];if(z.render){O=z.object;L=z.buffer;K=z.opaque;h(O);for(z=0;z<K.count;z++){I=K.list[z];j(I.depthTest);f(C,$,V,I,L,O)}}}for(x=0;x<D;x++){z=n.__webglObjectsImmediate[x];O=z.object;if(O.visible){K=z.opaque;h(O);for(z=0;z<K.count;z++){I=K.list[z];j(I.depthTest);J=c(C,$,V,I,O);O.render(function(xa){g(xa,
-J,I.shading)})}}}for(x=0;x<S;x++){z=n.__webglObjects[x];if(z.render){O=z.object;L=z.buffer;K=z.transparent;h(O);for(z=0;z<K.count;z++){I=K.list[z];M(I.blending);j(I.depthTest);f(C,$,V,I,L,O)}}}for(x=0;x<D;x++){z=n.__webglObjectsImmediate[x];O=z.object;if(O.visible){K=z.transparent;h(O);for(z=0;z<K.count;z++){I=K.list[z];M(I.blending);j(I.depthTest);J=c(C,$,V,I,O);O.render(function(xa){g(xa,J,I.shading)})}}}n.__webglSprites.length&&B(n,C);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&t(n);
-n.__webglLensFlares.length&&F(n,C);if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],w=n,x=void 0,z=void 0,J=void 0;if(C._modelViewMatrix==
-undefined){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){z=C.geometry;z.geometryGroups==undefined&&X(z);for(x in z.geometryGroups){J=z.geometryGroups[x];if(!J.__webglVertexBuffer){var K=J;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=e.createBuffer();
+0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)w.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,u,w){var z,J,K,I,S,D,O,L,$=n.lights,V=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);C.projectionMatrix.flattenToArray(Ya);
+Ra.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ra);this.initWebGLObjects(n);Da(u);(this.autoClear||w)&&this.clear();S=n.__webglObjects.length;for(w=0;w<S;w++){z=n.__webglObjects[w];O=z.object;if(O.visible)if(!(O instanceof THREE.Mesh)||m(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);H(O,C);v(z);z.render=!0;if(this.sortObjects){Na.copy(O.position);Ra.multiplyVector3(Na);z.z=Na.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);D=n.__webglObjectsImmediate.length;
+for(w=0;w<D;w++){z=n.__webglObjectsImmediate[w];O=z.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);H(O,C);o(z)}}M(THREE.NormalBlending);for(w=0;w<S;w++){z=n.__webglObjects[w];if(z.render){O=z.object;L=z.buffer;K=z.opaque;h(O);for(z=0;z<K.count;z++){I=K.list[z];j(I.depthTest);f(C,$,V,I,L,O)}}}for(w=0;w<D;w++){z=n.__webglObjectsImmediate[w];O=z.object;if(O.visible){K=z.opaque;h(O);for(z=0;z<K.count;z++){I=K.list[z];j(I.depthTest);J=c(C,$,V,I,O);O.render(function(xa){g(xa,
+J,I.shading)})}}}for(w=0;w<S;w++){z=n.__webglObjects[w];if(z.render){O=z.object;L=z.buffer;K=z.transparent;h(O);for(z=0;z<K.count;z++){I=K.list[z];M(I.blending);j(I.depthTest);f(C,$,V,I,L,O)}}}for(w=0;w<D;w++){z=n.__webglObjectsImmediate[w];O=z.object;if(O.visible){K=z.transparent;h(O);for(z=0;z<K.count;z++){I=K.list[z];M(I.blending);j(I.depthTest);J=c(C,$,V,I,O);O.render(function(xa){g(xa,J,I.shading)})}}}n.__webglSprites.length&&B(n,C);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&t(n);
+n.__webglLensFlares.length&&F(n,C);if(u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,u.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],u=n,w=void 0,z=void 0,J=void 0;if(C._modelViewMatrix==
+undefined){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){z=C.geometry;z.geometryGroups==undefined&&X(z);for(w in z.geometryGroups){J=z.geometryGroups[w];if(!J.__webglVertexBuffer){var K=J;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=e.createBuffer();
 K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var I=void 0,S=void 0;K.__webglMorphTargetsBuffers=[];I=0;for(S=K.numMorphTargets;I<S;I++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=
 J;I=C;var D=void 0,O=void 0,L=void 0;L=void 0;var $=void 0,V=void 0,xa=void 0,Ja=xa=S=0;O=void 0;L=void 0;var za=void 0;D=void 0;O=void 0;$=I.geometry;za=$.faces;V=K.faces;D=0;for(O=V.length;D<O;D++){L=V[D];L=za[L];if(L instanceof THREE.Face3){S+=3;xa+=1;Ja+=3}else if(L instanceof THREE.Face4){S+=4;xa+=2;Ja+=4}}D=K;O=I;za=void 0;V=void 0;var ta=void 0,Oa=void 0;ta=void 0;L=[];za=0;for(V=O.materials.length;za<V;za++){ta=O.materials[za];if(ta instanceof THREE.MeshFaceMaterial){ta=0;for(l=D.materials.length;ta<
 l;ta++)(Oa=D.materials[ta])&&L.push(Oa)}else(Oa=ta)&&L.push(Oa)}D=L;a:{O=void 0;za=void 0;V=D.length;for(O=0;O<V;O++){za=D[O];if(za.map||za.lightMap||za instanceof THREE.MeshShaderMaterial){O=!0;break a}}O=!1}a:{za=D;V=void 0;L=void 0;ta=za.length;for(V=0;V<ta;V++){L=za[V];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){za=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}za=!1}a:{V=void 0;L=void 0;ta=
 D.length;for(V=0;V<ta;V++){L=D[V];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(S*3);if(za)K.__normalArray=new Float32Array(S*3);if($.hasTangents)K.__tangentArray=new Float32Array(S*4);if(L)K.__colorArray=new Float32Array(S*3);if(O){if($.faceUvs.length>0||$.faceVertexUvs.length>0)K.__uvArray=new Float32Array(S*2);if($.faceUvs.length>1||$.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(S*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){K.__skinVertexAArray=
 new Float32Array(S*4);K.__skinVertexBArray=new Float32Array(S*4);K.__skinIndexArray=new Float32Array(S*4);K.__skinWeightArray=new Float32Array(S*4)}K.__faceArray=new Uint16Array(xa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ja*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];$=0;for(V=K.numMorphTargets;$<V;$++)K.__morphTargetsArrays.push(new Float32Array(S*3))}K.__needsSmoothNormals=za==THREE.SmoothShading;K.__uvType=O;K.__vertexColorType=L;K.__normalType=
 za;K.__webglFaceCount=xa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ja*2;$=0;for(V=D.length;$<V;$++)if(D[$].attributes){K.__webglCustomAttributes={};for(a in D[$].attributes){O=D[$].attributes[a];xa=1;if(O.type==="v2")xa=2;else if(O.type==="v3")xa=3;else if(O.type==="v4")xa=4;else O.type==="c"&&(xa=3);O.size=xa;O.needsUpdate=!0;O.array=new Float32Array(S*xa);O.buffer=e.createBuffer();K.__webglCustomAttributes[a]=O}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=
-!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}C instanceof THREE.ShadowVolume?A(w.__webglShadowVolumes,J,C):A(w.__webglObjects,J,C)}}else if(C instanceof THREE.LensFlare)A(w.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){x=z;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=z;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglVertexCount=
-J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(w.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){x=z;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=z;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglLineCount=J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(w.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){x=z;x.__webglVertexBuffer=
-e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=z;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__sortArray=[];x.__webglParticleCount=J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(w.__webglObjects,z,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)w.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&w.__webglSprites.push(C);n.__objectsAdded.splice(0,
-1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];w=n;z=void 0;x=void 0;for(z=w.__webglObjects.length-1;z>=0;z--){x=w.__webglObjects[z].object;if(C==x){w.__webglObjects.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(w=n.__webglObjects.length;C<w;C++)G(n.__webglObjects[C].object,n);C=0;for(w=n.__webglShadowVolumes.length;C<w;C++)G(n.__webglShadowVolumes[C].object,n);C=0;for(w=n.__webglLensFlares.length;C<w;C++)G(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,
-C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}C instanceof THREE.ShadowVolume?A(u.__webglShadowVolumes,J,C):A(u.__webglObjects,J,C)}}else if(C instanceof THREE.LensFlare)A(u.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;J=w.vertices.length;w.__vertexArray=new Float32Array(J*3);w.__colorArray=new Float32Array(J*3);w.__webglVertexCount=
+J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;J=w.vertices.length;w.__vertexArray=new Float32Array(J*3);w.__colorArray=new Float32Array(J*3);w.__webglLineCount=J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=
+e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;J=w.vertices.length;w.__vertexArray=new Float32Array(J*3);w.__colorArray=new Float32Array(J*3);w.__sortArray=[];w.__webglParticleCount=J;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)u.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&u.__webglSprites.push(C);n.__objectsAdded.splice(0,
+1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];u=n;z=void 0;w=void 0;if(C instanceof THREE.Mesh)for(z=u.__webglObjects.length-1;z>=0;z--){w=u.__webglObjects[z].object;if(C==w){u.__webglObjects.splice(z,1);break}}else if(C instanceof THREE.Sprite)for(z=u.__webglSprites.length-1;z>=0;z--){w=u.__webglSprites[z];if(C==w){u.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(u=n.__webglObjects.length;C<u;C++)G(n.__webglObjects[C].object,n);C=0;for(u=n.__webglShadowVolumes.length;C<
+u;C++)G(n.__webglShadowVolumes[C].object,n);C=0;for(u=n.__webglLensFlares.length;C<u;C++)G(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
 undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
@@ -346,16 +346,16 @@ THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=
 g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,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.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,m,p,o=this.data.JIT.hierarchy,u,y;this.currentTime+=b*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,B=this.hierarchy.length;t<B;t++){b=this.hierarchy[t];m=b.animationCache;if(this.JITCompile&&o[t][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var F=0;F<3;F++){c=d[F];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(u<y)if(this.loop){j=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(c,t,1);k.time<u;){j=k;k=this.getNextKeyWith(c,t,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,t,k.index+1)}while(k.time<
-u)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,m,p,o=this.data.JIT.hierarchy,v,y;this.currentTime+=b*this.timeScale;y=this.currentTime;v=this.currentTime%=this.data.length;p=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,B=this.hierarchy.length;t<B;t++){b=this.hierarchy[t];m=b.animationCache;if(this.JITCompile&&o[t][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var F=0;F<3;F++){c=d[F];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(v<y)if(this.loop){j=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(c,t,1);k.time<v;){j=k;k=this.getNextKeyWith(c,t,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,t,k.index+1)}while(k.time<
+v)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(v-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",t,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(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(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)o[t][p]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var c=[],f=[],g,h,j,k,m,p;g=(b.length-1)*d;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];m=b[c[2]];p=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],m[0],p[0],g,c,j);f[1]=this.interpolate(h[1],k[1],m[1],p[1],g,c,j);f[2]=this.interpolate(h[2],k[2],m[2],p[2],g,c,j);return f};
 THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
-var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var o=0,u=j.length;o<u;o++){var y=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(u=m.length;o<u;o++){j=m[o];var t,B,F=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(t=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));t.normal.copy(j.normal);c=0;for(h=F.length;c<h;c++){B=F[c];t.vertexNormals.push(B.clone())}t.color.copy(j.color);c=0;for(h=y.length;c<h;c++){B=y[c];t.vertexColors.push(B.clone())}t.materials=j.materials.slice();t.centroid.copy(j.centroid);k.push(t)}o=0;for(u=g.length;o<u;o++){f=g[o];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));p.push(k)}}};
+var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var o=0,v=j.length;o<v;o++){var y=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(v=m.length;o<v;o++){j=m[o];var t,B,F=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(t=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));t.normal.copy(j.normal);c=0;for(h=F.length;c<h;c++){B=F[c];t.vertexNormals.push(B.clone())}t.color.copy(j.color);c=0;for(h=y.length;c<h;c++){B=y[c];t.vertexColors.push(B.clone())}t.materials=j.materials.slice();t.centroid.copy(j.centroid);k.push(t)}o=0;for(v=g.length;o<v;o++){f=g[o];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));p.push(k)}}};
 THREE.ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}};
 THREE.SceneUtils={addMesh:function(b,d,c,f,g,h,j,k,m,p){d=new THREE.Mesh(d,p);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=m;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);
 return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,f,!0),
@@ -371,7 +371,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
+THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
 b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
 b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();
 c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=
@@ -380,16 +380,16 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
 this.verticalMin)/3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
-THREE.PathCamera=function(b){function d(p,o,u,y){var t={name:u,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),H=o.getLength(),G=F.length,X=0;B=G-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<G-1;B++){X=y*H.chunks[B]/H.total;o.keys[B]={time:X,pos:F[B]}}t.hierarchy[0]=o;THREE.AnimationHandler.add(t);return new THREE.Animation(p,u,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var u,
-y,t=new THREE.Geometry;for(u=0;u<p.points.length*o;u++){y=u/(p.points.length*o);y=p.getPoint(y);t.vertices[u]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return t}function f(p,o){var u=c(o,10),y=c(o,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(u,t);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
-16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){u=new THREE.Mesh(y,t);u.position.copy(o.points[i]);u.updateMatrix();p.addChild(u)}}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.lookVertical=
+THREE.PathCamera=function(b){function d(p,o,v,y){var t={name:v,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),H=o.getLength(),G=F.length,X=0;B=G-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<G-1;B++){X=y*H.chunks[B]/H.total;o.keys[B]={time:X,pos:F[B]}}t.hierarchy[0]=o;THREE.AnimationHandler.add(t);return new THREE.Animation(p,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var v,
+y,t=new THREE.Geometry;for(v=0;v<p.points.length*o;v++){y=v/(p.points.length*o);y=p.getPoint(y);t.vertices[v]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return t}function f(p,o){var v=c(o,10),y=c(o,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(v,t);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
+16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){v=new THREE.Mesh(y,t);v.position.copy(o.points[i]);v.updateMatrix();p.addChild(v)}}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.lookVertical=
 !0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
 if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)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 g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,u){var y,t;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;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0];y=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,u)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,v){var y,t;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;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0];y=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,v)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
 d(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(p,o){return function(){o.apply(p,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 d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.tdiff=0;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==
+THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.tdiff=0;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==
 undefined)this.autoForward=b.autoForward;if(b.domElement!==undefined)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=(new Date).getTime();this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=
 function(c){if(!c.altKey){switch(c.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(c){switch(c.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=
@@ -400,78 +400,78 @@ function(){var c=this.moveState.forward||this.autoForward&&!this.moveState.back?
 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",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);
 window.addEventListener("keyup",d(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.Cube=function(b,d,c,f,g,h,j,k,m){function p(H,G,X,A,M,Q,R,Da){var ma,va,ca=f||1,e=g||1,ea=M/2,ya=Q/2,Ba=o.vertices.length;if(H=="x"&&G=="y"||H=="y"&&G=="x")ma="z";else if(H=="x"&&G=="z"||H=="z"&&G=="x"){ma="y";e=h||1}else if(H=="z"&&G=="y"||H=="y"&&G=="z"){ma="x";ca=h||1}var Fa=ca+1,Z=e+1;M/=ca;var oa=Q/e;for(va=0;va<Z;va++)for(Q=0;Q<Fa;Q++){var pa=new THREE.Vector3;pa[H]=(Q*M-ea)*X;pa[G]=(va*oa-ya)*A;pa[ma]=R;o.vertices.push(new THREE.Vertex(pa))}for(va=0;va<e;va++)for(Q=0;Q<ca;Q++){o.faces.push(new THREE.Face4(Q+
-Fa*va+Ba,Q+Fa*(va+1)+Ba,Q+1+Fa*(va+1)+Ba,Q+1+Fa*va+Ba,null,null,Da));o.faceVertexUvs[0].push([new THREE.UV(Q/ca,va/e),new THREE.UV(Q/ca,(va+1)/e),new THREE.UV((Q+1)/ca,(va+1)/e),new THREE.UV((Q+1)/ca,va/e)])}}THREE.Geometry.call(this);var o=this,u=b/2,y=d/2,t=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
-undefined&&(this.sides[F]=m[F]);this.sides.px&&p("z","y",1*k,-1,c,d,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,u,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,d,t,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-t,this.materials[5]);(function(){for(var H=[],G=[],X=0,A=o.vertices.length;X<A;X++){for(var M=o.vertices[X],Q=!1,R=0,Da=H.length;R<Da;R++){var ma=
+Fa*va+Ba,Q+Fa*(va+1)+Ba,Q+1+Fa*(va+1)+Ba,Q+1+Fa*va+Ba,null,null,Da));o.faceVertexUvs[0].push([new THREE.UV(Q/ca,va/e),new THREE.UV(Q/ca,(va+1)/e),new THREE.UV((Q+1)/ca,(va+1)/e),new THREE.UV((Q+1)/ca,va/e)])}}THREE.Geometry.call(this);var o=this,v=b/2,y=d/2,t=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
+undefined&&(this.sides[F]=m[F]);this.sides.px&&p("z","y",1*k,-1,c,d,-v,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,v,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,d,t,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-t,this.materials[5]);(function(){for(var H=[],G=[],X=0,A=o.vertices.length;X<A;X++){for(var M=o.vertices[X],Q=!1,R=0,Da=H.length;R<Da;R++){var ma=
 H[R];if(M.position.x==ma.position.x&&M.position.y==ma.position.y&&M.position.z==ma.position.z){G[X]=R;Q=!0;break}}if(!Q){G[X]=H.length;H.push(new THREE.Vertex(M.position.clone()))}}X=0;for(A=o.faces.length;X<A;X++){M=o.faces[X];M.a=G[M.a];M.b=G[M.b];M.c=G[M.c];M.d=G[M.d]}o.vertices=H})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 THREE.Cylinder=function(b,d,c,f,g,h){function j(y,t,B){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,t,B)))}THREE.Geometry.call(this);var k=this,m,p=Math.PI*2,o=f/2;for(m=0;m<b;m++)j(Math.sin(p*m/b)*d,Math.cos(p*m/b)*d,-o);for(m=0;m<b;m++)j(Math.sin(p*m/b)*c,Math.cos(p*m/b)*c,o);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-o-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(d>0){j(0,0,o+(g||0));
-for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];o=this.vertices[c.c];var u=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
-f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/p,0.5+u.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-THREE.Icosahedron=function(b){function d(u,y,t){var B=Math.sqrt(u*u+y*y+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(u/B,y/B,t/B)))-1}function c(u,y,t,B){B.faces.push(new THREE.Face3(u,y,t))}function f(u,y){var t=g.vertices[u].position,B=g.vertices[y].position;return d((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
+for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];o=this.vertices[c.c];var v=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
+f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(v.position.x,v.position.y)/p,0.5+v.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Icosahedron=function(b){function d(v,y,t){var B=Math.sqrt(v*v+y*y+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/B,y/B,t/B)))-1}function c(v,y,t,B){B.faces.push(new THREE.Face3(v,y,t))}function f(v,y){var t=g.vertices[v].position,B=g.vertices[y].position;return d((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
 1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,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(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,o,j);c(h.faces[k].b,p,m,j);c(h.faces[k].c,
 o,p,j);c(m,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
+THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.001;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
 for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var p=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,y=m*Math.sin(u*g);u=m*Math.cos(u*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);p.push(o)}d.push(p)}var t,B,F;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){p=f==h-1;j=d[c][p?0:f+1];k=d[c][p?h-1:f];m=d[c-1][p?h-1:f];p=d[c-
-1][p?0:f+1];y=c/(g-1);t=(c-1)/(g-1);B=(f+1)/h;u=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-u,y);u=new THREE.UV(1-u,t);var H=new THREE.UV(1-B,t);if(c<d.length-1){t=this.vertices[j].position.clone();B=this.vertices[k].position.clone();F=this.vertices[m].position.clone();t.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,y,u])}if(c>1){t=this.vertices[j].position.clone();
-B=this.vertices[m].position.clone();F=this.vertices[p].position.clone();t.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,u,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var v=2*f/h,y=m*Math.sin(v*g);v=m*Math.cos(v*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,k,y)))-1);p.push(o)}d.push(p)}var t,B,F;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){p=f==h-1;j=d[c][p?0:f+1];k=d[c][p?h-1:f];m=d[c-1][p?h-1:f];p=d[c-
+1][p?0:f+1];y=c/(g-1);t=(c-1)/(g-1);B=(f+1)/h;v=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-v,y);v=new THREE.UV(1-v,t);var H=new THREE.UV(1-B,t);if(c<d.length-1){t=this.vertices[j].position.clone();B=this.vertices[k].position.clone();F=this.vertices[m].position.clone();t.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,y,v])}if(c>1){t=this.vertices[j].position.clone();
+B=this.vertices[m].position.clone();F=this.vertices[p].position.clone();t.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,v,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
 THREE.Torus=function(b,d,c,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(u,y,t,B,F,H){y=t/B*u;t=Math.cos(y);return new THREE.Vector3(F*(2+t)*0.5*Math.cos(u),F*(2+t)*Math.sin(u)*0.5,H*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var m=
+THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(v,y,t,B,F,H){y=t/B*v;t=Math.cos(y);return new THREE.Vector3(F*(2+t)*0.5*Math.cos(v),F*(2+t)*Math.sin(v)*0.5,H*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var m=
 b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=m.x-g.x;c.y=m.y-g.y;c.z=m.z-g.z;f.x=m.x+g.x;f.y=m.y+g.y;f.z=m.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*f.x+j*h.x;g.y+=m*f.y+j*h.y;g.z+=m*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
 0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var p=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,p,o])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var d="Loaded ";d+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var p=new Image;p.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),u=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=o;k.image.height=u;k.image.getContext("2d").drawImage(this,0,0,o,u)}else k.image=this;k.needsUpdate=!0};p.src=m}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
+this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var p=new Image;p.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=v;k.image.getContext("2d").drawImage(this,0,0,o,v)}else k.image=this;k.needsUpdate=!0};p.src=m}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
 "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};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 d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,p,o,u,y,t,B,F,H,G,X,A=b.faces;t=b.vertices;var M=b.normals,Q=b.colors;p=b.scale!==undefined?b.scale:1;var R=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&R++;for(g=0;g<R;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=t.length;k<m;){o=new THREE.Vertex;o.position.x=t[k++]/
-p;o.position.y=t[k++]/p;o.position.z=t[k++]/p;f.vertices.push(o)}k=0;for(m=A.length;k<m;){t=A[k++];p=t&1;j=t&2;g=t&4;h=t&8;u=t&16;o=t&32;B=t&64;t&=128;if(p){F=new THREE.Face4;F.a=A[k++];F.b=A[k++];F.c=A[k++];F.d=A[k++];p=4}else{F=new THREE.Face3;F.a=A[k++];F.b=A[k++];F.c=A[k++];p=3}if(j){j=A[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<R;g++){H=b.uvs[g];y=A[k++];X=H[y*2];y=H[y*2+1];f.faceUvs[g][j]=new THREE.UV(X,y)}if(h)for(g=0;g<R;g++){H=b.uvs[g];G=[];for(h=0;h<p;h++){y=A[k++];
-X=H[y*2];y=H[y*2+1];G[h]=new THREE.UV(X,y)}f.faceVertexUvs[g][j]=G}if(u){u=A[k++]*3;h=new THREE.Vector3;h.x=M[u++];h.y=M[u++];h.z=M[u];F.normal=h}if(o)for(g=0;g<p;g++){u=A[k++]*3;h=new THREE.Vector3;h.x=M[u++];h.y=M[u++];h.z=M[u];F.vertexNormals.push(h)}if(B){o=A[k++];o=new THREE.Color(Q[o]);F.color=o}if(t)for(g=0;g<p;g++){o=A[k++];o=new THREE.Color(Q[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
+THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,p,o,v,y,t,B,F,H,G,X,A=b.faces;t=b.vertices;var M=b.normals,Q=b.colors;p=b.scale!==undefined?b.scale:1;var R=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&R++;for(g=0;g<R;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=t.length;k<m;){o=new THREE.Vertex;o.position.x=t[k++]/
+p;o.position.y=t[k++]/p;o.position.z=t[k++]/p;f.vertices.push(o)}k=0;for(m=A.length;k<m;){t=A[k++];p=t&1;j=t&2;g=t&4;h=t&8;v=t&16;o=t&32;B=t&64;t&=128;if(p){F=new THREE.Face4;F.a=A[k++];F.b=A[k++];F.c=A[k++];F.d=A[k++];p=4}else{F=new THREE.Face3;F.a=A[k++];F.b=A[k++];F.c=A[k++];p=3}if(j){j=A[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<R;g++){H=b.uvs[g];y=A[k++];X=H[y*2];y=H[y*2+1];f.faceUvs[g][j]=new THREE.UV(X,y)}if(h)for(g=0;g<R;g++){H=b.uvs[g];G=[];for(h=0;h<p;h++){y=A[k++];
+X=H[y*2];y=H[y*2+1];G[h]=new THREE.UV(X,y)}f.faceVertexUvs[g][j]=G}if(v){v=A[k++]*3;h=new THREE.Vector3;h.x=M[v++];h.y=M[v++];h.z=M[v];F.normal=h}if(o)for(g=0;g<p;g++){v=A[k++]*3;h=new THREE.Vector3;h.x=M[v++];h.y=M[v++];h.z=M[v];F.vertexNormals.push(h)}if(B){o=A[k++];o=new THREE.Color(Q[o]);F.color=o}if(t)for(g=0;g<p;g++){o=A[k++];o=new THREE.Color(Q[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
 k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,m,p;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];m=f.morphTargets[g].vertices;p=b.morphTargets[g].vertices;
-j=0;for(k=p.length;j<k;j+=3)m.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,u;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(m=o.length;k<m;k+=3){u=new THREE.Color(16755200);u.setRGB(o[j],o[j+1],o[j+2]);p.push(u)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
+j=0;for(k=p.length;j<k;j+=3)m.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,v;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(m=o.length;k<m;k+=3){v=new THREE.Color(16755200);v.setRGB(o[j],o[j+1],o[j+2]);p.push(v)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
 j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();d(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 d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(T,P){var N=o(T,P),Ca=o(T,P+1),Ka=o(T,P+2),n=o(T,P+3),C=(n<<1&255|Ka>>7)-127;N|=(Ka&127)<<16|Ca<<8;if(N==0&&C==-127)return 0;return(1-2*(n>>7))*(1+N*Math.pow(2,-23))*Math.pow(2,C)}function k(T,P){var N=o(T,P),Ca=o(T,P+1),Ka=o(T,P+2);return(o(T,P+3)<<24)+(Ka<<16)+(Ca<<8)+N}function m(T,P){var N=o(T,P);return(o(T,P+1)<<8)+N}function p(T,P){var N=o(T,P);return N>127?N-256:N}function o(T,
-P){return T.charCodeAt(P)&255}function u(T){var P,N,Ca;P=k(b,T);N=k(b,T+R);Ca=k(b,T+Da);T=m(b,T+ma);THREE.BinaryLoader.prototype.f3(G,P,N,Ca,T)}function y(T){var P,N,Ca,Ka,n,C;P=k(b,T);N=k(b,T+R);Ca=k(b,T+Da);Ka=m(b,T+ma);n=k(b,T+va);C=k(b,T+ca);T=k(b,T+e);THREE.BinaryLoader.prototype.f3n(G,M,P,N,Ca,Ka,n,C,T)}function t(T){var P,N,Ca,Ka;P=k(b,T);N=k(b,T+ea);Ca=k(b,T+ya);Ka=k(b,T+Ba);T=m(b,T+Fa);THREE.BinaryLoader.prototype.f4(G,P,N,Ca,Ka,T)}function B(T){var P,N,Ca,Ka,n,C,w,x;P=k(b,T);N=k(b,T+ea);
-Ca=k(b,T+ya);Ka=k(b,T+Ba);n=m(b,T+Fa);C=k(b,T+Z);w=k(b,T+oa);x=k(b,T+pa);T=k(b,T+sa);THREE.BinaryLoader.prototype.f4n(G,M,P,N,Ca,Ka,n,C,w,x,T)}function F(T){var P,N;P=k(b,T);N=k(b,T+ga);T=k(b,T+aa);THREE.BinaryLoader.prototype.uv3(G.faceVertexUvs[0],Q[P*2],Q[P*2+1],Q[N*2],Q[N*2+1],Q[T*2],Q[T*2+1])}function H(T){var P,N,Ca;P=k(b,T);N=k(b,T+na);Ca=k(b,T+Ea);T=k(b,T+ja);THREE.BinaryLoader.prototype.uv4(G.faceVertexUvs[0],Q[P*2],Q[P*2+1],Q[N*2],Q[N*2+1],Q[Ca*2],Q[Ca*2+1],Q[T*2],Q[T*2+1])}var G=this,X=
+P){return T.charCodeAt(P)&255}function v(T){var P,N,Ca;P=k(b,T);N=k(b,T+R);Ca=k(b,T+Da);T=m(b,T+ma);THREE.BinaryLoader.prototype.f3(G,P,N,Ca,T)}function y(T){var P,N,Ca,Ka,n,C;P=k(b,T);N=k(b,T+R);Ca=k(b,T+Da);Ka=m(b,T+ma);n=k(b,T+va);C=k(b,T+ca);T=k(b,T+e);THREE.BinaryLoader.prototype.f3n(G,M,P,N,Ca,Ka,n,C,T)}function t(T){var P,N,Ca,Ka;P=k(b,T);N=k(b,T+ea);Ca=k(b,T+ya);Ka=k(b,T+Ba);T=m(b,T+Fa);THREE.BinaryLoader.prototype.f4(G,P,N,Ca,Ka,T)}function B(T){var P,N,Ca,Ka,n,C,u,w;P=k(b,T);N=k(b,T+ea);
+Ca=k(b,T+ya);Ka=k(b,T+Ba);n=m(b,T+Fa);C=k(b,T+Z);u=k(b,T+oa);w=k(b,T+pa);T=k(b,T+sa);THREE.BinaryLoader.prototype.f4n(G,M,P,N,Ca,Ka,n,C,u,w,T)}function F(T){var P,N;P=k(b,T);N=k(b,T+ga);T=k(b,T+aa);THREE.BinaryLoader.prototype.uv3(G.faceVertexUvs[0],Q[P*2],Q[P*2+1],Q[N*2],Q[N*2+1],Q[T*2],Q[T*2+1])}function H(T){var P,N,Ca;P=k(b,T);N=k(b,T+na);Ca=k(b,T+Ea);T=k(b,T+ja);THREE.BinaryLoader.prototype.uv4(G.faceVertexUvs[0],Q[P*2],Q[P*2+1],Q[N*2],Q[N*2+1],Q[Ca*2],Q[Ca*2+1],Q[T*2],Q[T*2+1])}var G=this,X=
 0,A,M=[],Q=[],R,Da,ma,va,ca,e,ea,ya,Ba,Fa,Z,oa,pa,sa,ga,aa,na,Ea,ja,la,ua,Ra,Ya,Za,Na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(G,f,h);A={signature:b.substr(X,8),header_bytes:o(b,X+8),vertex_coordinate_bytes:o(b,X+9),normal_coordinate_bytes:o(b,X+10),uv_coordinate_bytes:o(b,X+11),vertex_index_bytes:o(b,X+12),normal_index_bytes:o(b,X+13),uv_index_bytes:o(b,X+14),material_index_bytes:o(b,X+15),nvertices:k(b,X+16),nnormals:k(b,X+16+4),nuvs:k(b,X+16+8),ntri_flat:k(b,X+16+12),ntri_smooth:k(b,
 X+16+16),ntri_flat_uv:k(b,X+16+20),ntri_smooth_uv:k(b,X+16+24),nquad_flat:k(b,X+16+28),nquad_smooth:k(b,X+16+32),nquad_flat_uv:k(b,X+16+36),nquad_smooth_uv:k(b,X+16+40)};X+=A.header_bytes;R=A.vertex_index_bytes;Da=A.vertex_index_bytes*2;ma=A.vertex_index_bytes*3;va=A.vertex_index_bytes*3+A.material_index_bytes;ca=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;ea=A.vertex_index_bytes;ya=A.vertex_index_bytes*
 2;Ba=A.vertex_index_bytes*3;Fa=A.vertex_index_bytes*4;Z=A.vertex_index_bytes*4+A.material_index_bytes;oa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;pa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;sa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ga=A.uv_index_bytes;aa=A.uv_index_bytes*2;na=A.uv_index_bytes;Ea=A.uv_index_bytes*2;ja=A.uv_index_bytes*3;h=A.vertex_index_bytes*3+A.material_index_bytes;Na=A.vertex_index_bytes*4+A.material_index_bytes;
 la=A.ntri_flat*h;ua=A.ntri_smooth*(h+A.normal_index_bytes*3);Ra=A.ntri_flat_uv*(h+A.uv_index_bytes*3);Ya=A.ntri_smooth_uv*(h+A.normal_index_bytes*3+A.uv_index_bytes*3);Za=A.nquad_flat*Na;h=A.nquad_smooth*(Na+A.normal_index_bytes*4);Na=A.nquad_flat_uv*(Na+A.uv_index_bytes*4);X+=function(T){for(var P,N,Ca,Ka=A.vertex_coordinate_bytes*3,n=T+A.nvertices*Ka;T<n;T+=Ka){P=j(b,T);N=j(b,T+A.vertex_coordinate_bytes);Ca=j(b,T+A.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(G,P,N,Ca)}return A.nvertices*
 Ka}(X);X+=function(T){for(var P,N,Ca,Ka=A.normal_coordinate_bytes*3,n=T+A.nnormals*Ka;T<n;T+=Ka){P=p(b,T);N=p(b,T+A.normal_coordinate_bytes);Ca=p(b,T+A.normal_coordinate_bytes*2);M.push(P/127,N/127,Ca/127)}return A.nnormals*Ka}(X);X+=function(T){for(var P,N,Ca=A.uv_coordinate_bytes*2,Ka=T+A.nuvs*Ca;T<Ka;T+=Ca){P=j(b,T);N=j(b,T+A.uv_coordinate_bytes);Q.push(P,N)}return A.nuvs*Ca}(X);la=X+la;ua=la+ua;Ra=ua+Ra;Ya=Ra+Ya;Za=Ya+Za;h=Za+h;Na=h+Na;(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes,
-Ca=N+A.uv_index_bytes*3,Ka=T+A.ntri_flat_uv*Ca;for(P=T;P<Ka;P+=Ca){u(P);F(P+N)}return Ka-T})(ua);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Ca=N+A.uv_index_bytes*3,Ka=T+A.ntri_smooth_uv*Ca;for(P=T;P<Ka;P+=Ca){y(P);F(P+N)}return Ka-T})(Ra);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes,Ca=N+A.uv_index_bytes*4,Ka=T+A.nquad_flat_uv*Ca;for(P=T;P<Ka;P+=Ca){t(P);H(P+N)}return Ka-T})(h);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes+
-A.normal_index_bytes*4,Ca=N+A.uv_index_bytes*4,Ka=T+A.nquad_smooth_uv*Ca;for(P=T;P<Ka;P+=Ca){B(P);H(P+N)}return Ka-T})(Na);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes,Ca=T+A.ntri_flat*N;for(P=T;P<Ca;P+=N)u(P);return Ca-T})(X);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Ca=T+A.ntri_smooth*N;for(P=T;P<Ca;P+=N)y(P);return Ca-T})(la);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes,Ca=T+A.nquad_flat*N;for(P=T;P<Ca;P+=
+Ca=N+A.uv_index_bytes*3,Ka=T+A.ntri_flat_uv*Ca;for(P=T;P<Ka;P+=Ca){v(P);F(P+N)}return Ka-T})(ua);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Ca=N+A.uv_index_bytes*3,Ka=T+A.ntri_smooth_uv*Ca;for(P=T;P<Ka;P+=Ca){y(P);F(P+N)}return Ka-T})(Ra);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes,Ca=N+A.uv_index_bytes*4,Ka=T+A.nquad_flat_uv*Ca;for(P=T;P<Ka;P+=Ca){t(P);H(P+N)}return Ka-T})(h);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes+
+A.normal_index_bytes*4,Ca=N+A.uv_index_bytes*4,Ka=T+A.nquad_smooth_uv*Ca;for(P=T;P<Ka;P+=Ca){B(P);H(P+N)}return Ka-T})(Na);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes,Ca=T+A.ntri_flat*N;for(P=T;P<Ca;P+=N)v(P);return Ca-T})(X);(function(T){var P,N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Ca=T+A.ntri_smooth*N;for(P=T;P<Ca;P+=N)y(P);return Ca-T})(la);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes,Ca=T+A.nquad_flat*N;for(P=T;P<Ca;P+=
 N)t(P);return Ca-T})(Ya);(function(T){var P,N=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,Ca=T+A.nquad_smooth*N;for(P=T;P<Ca;P+=N)B(P);return Ca-T})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,
-c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var p=d[k*3],o=d[k*3+1];k=d[k*3+2];var u=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(u,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,p,o){j=b.materials[j];var u=d[m*3],y=d[m*3+1];m=d[m*3+2];var t=d[p*3],B=d[p*3+1];p=d[p*3+2];var F=d[o*3],H=d[o*3+1];o=d[o*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
-3],d[k*3+1],d[k*3+2]),new THREE.Vector3(u,y,m),new THREE.Vector3(t,B,p),new THREE.Vector3(F,H,o)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var p=[];p.push(new THREE.UV(d,c));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,m));b.push(p)}};THREE.SceneLoader=function(){};
+c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var p=d[k*3],o=d[k*3+1];k=d[k*3+2];var v=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(v,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,p,o){j=b.materials[j];var v=d[m*3],y=d[m*3+1];m=d[m*3+2];var t=d[p*3],B=d[p*3+1];p=d[p*3+2];var F=d[o*3],H=d[o*3+1];o=d[o*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
+3],d[k*3+1],d[k*3+2]),new THREE.Vector3(v,y,m),new THREE.Vector3(t,B,p),new THREE.Vector3(F,H,o)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var p=[];p.push(new THREE.UV(d,c));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,m));b.push(p)}};THREE.SceneLoader=function(){};
 THREE.SceneLoader.prototype={load:function(b,d,c,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(ga,aa){return aa=="relativeToHTML"?ga:h+"/"+ga}function m(){for(t in ca.objects)if(!Z.objects[t]){X=ca.objects[t];if(R=Z.geometries[X.geometry]){va=[];for(sa=0;sa<X.materials.length;sa++)va[sa]=Z.materials[X.materials[sa]];A=X.position;r=X.rotation;q=X.quaternion;s=X.scale;q=0;va.length==0&&(va[0]=new THREE.MeshFaceMaterial);object=
 new THREE.Mesh(R,va);object.position.set(A[0],A[1],A[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=X.visible;Z.scene.addObject(object);Z.objects[t]=object;if(X.meshCollider){var ga=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(ga)}}}}function p(ga){return function(aa){Z.geometries[ga]=aa;m();ea-=1;o()}}function o(){f({total_models:Ba,total_textures:Fa,
-loaded_models:Ba-ea,loaded_textures:Fa-ya},Z);ea==0&&ya==0&&c(Z)}var u,y,t,B,F,H,G,X,A,M,Q,R,Da,ma,va,ca,e,ea,ya,Ba,Fa,Z;ca=j.data;j=new THREE.BinaryLoader;e=new THREE.JSONLoader;ya=ea=0;Z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(ca.transform){var oa=ca.transform.position;M=ca.transform.rotation;var pa=ca.transform.scale;oa&&Z.scene.position.set(oa[0],oa[1],oa[2]);M&&Z.scene.rotation.set(M[0],M[1],M[2]);pa&&Z.scene.scale.set(pa[0],pa[1],
+loaded_models:Ba-ea,loaded_textures:Fa-ya},Z);ea==0&&ya==0&&c(Z)}var v,y,t,B,F,H,G,X,A,M,Q,R,Da,ma,va,ca,e,ea,ya,Ba,Fa,Z;ca=j.data;j=new THREE.BinaryLoader;e=new THREE.JSONLoader;ya=ea=0;Z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(ca.transform){var oa=ca.transform.position;M=ca.transform.rotation;var pa=ca.transform.scale;oa&&Z.scene.position.set(oa[0],oa[1],oa[2]);M&&Z.scene.rotation.set(M[0],M[1],M[2]);pa&&Z.scene.scale.set(pa[0],pa[1],
 pa[2]);(oa||M||pa)&&Z.scene.updateMatrix()}oa=function(){ya-=1;o()};for(F in ca.cameras){M=ca.cameras[F];if(M.type=="perspective")Da=new THREE.Camera(M.fov,M.aspect,M.near,M.far);else if(M.type=="ortho"){Da=new THREE.Camera;Da.projectionMatrix=THREE.Matrix4.makeOrtho(M.left,M.right,M.top,M.bottom,M.near,M.far)}A=M.position;M=M.target;Da.position.set(A[0],A[1],A[2]);Da.target.position.set(M[0],M[1],M[2]);Z.cameras[F]=Da}for(B in ca.lights){F=ca.lights[B];Da=F.color!==undefined?F.color:16777215;M=F.intensity!==
 undefined?F.intensity:1;if(F.type=="directional"){A=F.direction;light=new THREE.DirectionalLight(Da,M);light.position.set(A[0],A[1],A[2]);light.position.normalize()}else if(F.type=="point"){A=F.position;light=new THREE.PointLight(Da,M);light.position.set(A[0],A[1],A[2])}Z.scene.addLight(light);Z.lights[B]=light}for(H in ca.fogs){B=ca.fogs[H];if(B.type=="linear")ma=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(ma=new THREE.FogExp2(0,B.density));M=B.color;ma.color.setRGB(M[0],M[1],M[2]);Z.fogs[H]=
-ma}if(Z.cameras&&ca.defaults.camera)Z.currentCamera=Z.cameras[ca.defaults.camera];if(Z.fogs&&ca.defaults.fog)Z.scene.fog=Z.fogs[ca.defaults.fog];M=ca.defaults.bgcolor;Z.bgColor=new THREE.Color;Z.bgColor.setRGB(M[0],M[1],M[2]);Z.bgColorAlpha=ca.defaults.bgalpha;for(u in ca.geometries){H=ca.geometries[u];if(H.type=="bin_mesh"||H.type=="ascii_mesh")ea+=1}Ba=ea;for(u in ca.geometries){H=ca.geometries[u];if(H.type=="cube"){R=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,
-null,H.flipped,H.sides);Z.geometries[u]=R}else if(H.type=="plane"){R=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);Z.geometries[u]=R}else if(H.type=="sphere"){R=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);Z.geometries[u]=R}else if(H.type=="cylinder"){R=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);Z.geometries[u]=R}else if(H.type=="torus"){R=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);Z.geometries[u]=R}else if(H.type==
-"icosahedron"){R=new THREE.Icosahedron(H.subdivisions);Z.geometries[u]=R}else if(H.type=="bin_mesh")j.load({model:k(H.url,ca.urlBaseType),callback:p(u)});else H.type=="ascii_mesh"&&e.load({model:k(H.url,ca.urlBaseType),callback:p(u)})}for(G in ca.textures){u=ca.textures[G];ya+=u.url instanceof Array?u.url.length:1}Fa=ya;for(G in ca.textures){u=ca.textures[G];if(u.mapping!=undefined&&THREE[u.mapping]!=undefined)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){H=[];for(var sa=0;sa<u.url.length;sa++)H[sa]=
-k(u.url[sa],ca.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,u.mapping,oa)}else{H=THREE.ImageUtils.loadTexture(k(u.url,ca.urlBaseType),u.mapping,oa);if(THREE[u.minFilter]!=undefined)H.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=undefined)H.magFilter=THREE[u.magFilter]}Z.textures[G]=H}for(y in ca.materials){G=ca.materials[y];for(Q in G.parameters)if(Q=="envMap"||Q=="map"||Q=="lightMap")G.parameters[Q]=Z.textures[G.parameters[Q]];else if(Q=="shading")G.parameters[Q]=G.parameters[Q]=="flat"?
+ma}if(Z.cameras&&ca.defaults.camera)Z.currentCamera=Z.cameras[ca.defaults.camera];if(Z.fogs&&ca.defaults.fog)Z.scene.fog=Z.fogs[ca.defaults.fog];M=ca.defaults.bgcolor;Z.bgColor=new THREE.Color;Z.bgColor.setRGB(M[0],M[1],M[2]);Z.bgColorAlpha=ca.defaults.bgalpha;for(v in ca.geometries){H=ca.geometries[v];if(H.type=="bin_mesh"||H.type=="ascii_mesh")ea+=1}Ba=ea;for(v in ca.geometries){H=ca.geometries[v];if(H.type=="cube"){R=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,
+null,H.flipped,H.sides);Z.geometries[v]=R}else if(H.type=="plane"){R=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);Z.geometries[v]=R}else if(H.type=="sphere"){R=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);Z.geometries[v]=R}else if(H.type=="cylinder"){R=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);Z.geometries[v]=R}else if(H.type=="torus"){R=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);Z.geometries[v]=R}else if(H.type==
+"icosahedron"){R=new THREE.Icosahedron(H.subdivisions);Z.geometries[v]=R}else if(H.type=="bin_mesh")j.load({model:k(H.url,ca.urlBaseType),callback:p(v)});else H.type=="ascii_mesh"&&e.load({model:k(H.url,ca.urlBaseType),callback:p(v)})}for(G in ca.textures){v=ca.textures[G];ya+=v.url instanceof Array?v.url.length:1}Fa=ya;for(G in ca.textures){v=ca.textures[G];if(v.mapping!=undefined&&THREE[v.mapping]!=undefined)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){H=[];for(var sa=0;sa<v.url.length;sa++)H[sa]=
+k(v.url[sa],ca.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,v.mapping,oa)}else{H=THREE.ImageUtils.loadTexture(k(v.url,ca.urlBaseType),v.mapping,oa);if(THREE[v.minFilter]!=undefined)H.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=undefined)H.magFilter=THREE[v.magFilter]}Z.textures[G]=H}for(y in ca.materials){G=ca.materials[y];for(Q in G.parameters)if(Q=="envMap"||Q=="map"||Q=="lightMap")G.parameters[Q]=Z.textures[G.parameters[Q]];else if(Q=="shading")G.parameters[Q]=G.parameters[Q]=="flat"?
 THREE.FlatShading:THREE.SmoothShading;else if(Q=="blending")G.parameters[Q]=THREE[G.parameters[Q]]?THREE[G.parameters[Q]]:THREE.NormalBlending;else Q=="combine"&&(G.parameters[Q]=G.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);G=new THREE[G.type](G.parameters);Z.materials[y]=G}m();d(Z)}}};
 THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=p;g[h]=this.lerp(o[c],o[c+3],j);g[h+1]=this.lerp(o[c+1],o[c+4],j);g[h+2]=this.lerp(o[c+2],o[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
-2]=p;f=c+this.yd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=p+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,p=h+this.yd,o=h+this.zd,u=m+this.yd,y=m+this.zd,t=h+this.yd+this.zd,B=m+this.yd+this.zd,F=0,H=this.field[h],G=this.field[m],X=this.field[p],A=this.field[u],M=this.field[o],Q=this.field[y],R=this.field[t],Da=this.field[B];H<j&&(F|=1);G<j&&(F|=2);X<j&&(F|=8);A<j&&(F|=4);M<j&&(F|=16);Q<j&&(F|=32);R<j&&(F|=128);Da<j&&(F|=64);var ma=THREE.edgeTable[F];if(ma==0)return 0;
-var va=this.delta,ca=c+va,e=f+va;va=g+va;if(ma&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,G)}if(ma&2){this.compNorm(m);this.compNorm(u);this.VIntY(m*3,this.vlist,this.nlist,3,j,ca,f,g,G,A)}if(ma&4){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,e,g,X,A)}if(ma&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,X)}if(ma&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,p,o,v){j=(j-o)/(v-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=p;g[h]=this.lerp(o[c],o[c+3],j);g[h+1]=this.lerp(o[c+1],o[c+4],j);g[h+2]=this.lerp(o[c+2],o[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,p,o,v){j=(j-o)/(v-o);o=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
+2]=p;f=c+this.yd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,p,o,v){j=(j-o)/(v-o);o=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=p+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
+this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,p=h+this.yd,o=h+this.zd,v=m+this.yd,y=m+this.zd,t=h+this.yd+this.zd,B=m+this.yd+this.zd,F=0,H=this.field[h],G=this.field[m],X=this.field[p],A=this.field[v],M=this.field[o],Q=this.field[y],R=this.field[t],Da=this.field[B];H<j&&(F|=1);G<j&&(F|=2);X<j&&(F|=8);A<j&&(F|=4);M<j&&(F|=16);Q<j&&(F|=32);R<j&&(F|=128);Da<j&&(F|=64);var ma=THREE.edgeTable[F];if(ma==0)return 0;
+var va=this.delta,ca=c+va,e=f+va;va=g+va;if(ma&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,G)}if(ma&2){this.compNorm(m);this.compNorm(v);this.VIntY(m*3,this.vlist,this.nlist,3,j,ca,f,g,G,A)}if(ma&4){this.compNorm(p);this.compNorm(v);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,e,g,X,A)}if(ma&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,X)}if(ma&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
 12,j,c,f,va,M,Q)}if(ma&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,ca,f,va,Q,Da)}if(ma&64){this.compNorm(t);this.compNorm(B);this.VIntX(t*3,this.vlist,this.nlist,18,j,c,e,va,R,Da)}if(ma&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,j,c,f,va,M,R)}if(ma&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,H,M)}if(ma&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,ca,
-f,g,G,Q)}if(ma&1024){this.compNorm(u);this.compNorm(B);this.VIntZ(u*3,this.vlist,this.nlist,30,j,ca,e,g,A,Da)}if(ma&2048){this.compNorm(p);this.compNorm(t);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,e,g,X,R)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+1]=c[g+
+f,g,G,Q)}if(ma&1024){this.compNorm(v);this.compNorm(B);this.VIntZ(v*3,this.vlist,this.nlist,30,j,ca,e,g,A,Da)}if(ma&2048){this.compNorm(p);this.compNorm(t);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,e,g,X,R)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+1]=c[g+
 1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
-this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,p=f*this.size,o=c*this.size,u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
-this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,H,G,X,A;u<m;u++){o=this.size2*u;F=u/this.size-g;X=F*F;for(F=y;F<p;F++){H=o+this.size*F;B=F/this.size-f;A=B*B;for(B=t;B<k;B++){G=B/this.size-c;G=h/(1.0E-6+G*G+A+X)-j;G>0&&(this.field[H+B]+=G)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,p=this.size,o=this.yd,u=this.zd,y=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g<t;g++){h=g/p;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){m=g+h*o;for(j=
-0;j<p;j++)y[u*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,p,o=this.size,u=this.yd,y=this.zd,t=this.field,B=o*Math.sqrt(c/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*u;for(g=0;g<o;g++){p=m+g;for(j=0;j<o;j++)t[y*j+p]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){p=m+h*yd;
-for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,m,p,o,u,y=this.size-2;for(j=1;j<y;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=u+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,m,p,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
-g=[];this.render(function(h){var j,k,m,p,o,u,y,t;for(j=0;j<h.count;j++){y=j*3;o=y+1;t=y+2;k=h.positionArray[y];m=h.positionArray[o];p=h.positionArray[t];u=new THREE.Vector3(k,m,p);k=h.normalArray[y];m=h.normalArray[o];p=h.normalArray[t];y=new THREE.Vector3(k,m,p);y.normalize();o=new THREE.Vertex(u);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;o=y+1;t=y+2;u=g[y];k=g[o];m=g[t];y=new THREE.Face3(y,o,t,[u,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
+this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,p=f*this.size,o=c*this.size,v=Math.floor(m-k);v<1&&(v=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
+this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,H,G,X,A;v<m;v++){o=this.size2*v;F=v/this.size-g;X=F*F;for(F=y;F<p;F++){H=o+this.size*F;B=F/this.size-f;A=B*B;for(B=t;B<k;B++){G=B/this.size-c;G=h/(1.0E-6+G*G+A+X)-j;G>0&&(this.field[H+B]+=G)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,p=this.size,o=this.yd,v=this.zd,y=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g<t;g++){h=g/p;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){m=g+h*o;for(j=
+0;j<p;j++)y[v*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,p,o=this.size,v=this.yd,y=this.zd,t=this.field,B=o*Math.sqrt(c/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*v;for(g=0;g<o;g++){p=m+g;for(j=0;j<o;j++)t[y*j+p]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){p=m+h*yd;
+for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,m,p,o,v,y=this.size-2;for(j=1;j<y;j++){v=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=v+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,m,p,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
+g=[];this.render(function(h){var j,k,m,p,o,v,y,t;for(j=0;j<h.count;j++){y=j*3;o=y+1;t=y+2;k=h.positionArray[y];m=h.positionArray[o];p=h.positionArray[t];v=new THREE.Vector3(k,m,p);k=h.normalArray[y];m=h.normalArray[o];p=h.normalArray[t];y=new THREE.Vector3(k,m,p);y.normalize();o=new THREE.Vertex(v);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;o=y+1;t=y+2;v=g[y];k=g[o];m=g[t];y=new THREE.Face3(y,o,t,[v,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,k=d*e;this.w=f*h-k*c;this.x=f*c+k*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,h=a.x,f=a.y,k=a.z;a=a.w;this.x=b*a+e*h+c*k-d*f;this.y=c*a+e*f+d*h-b*k;this.z=d*a+e*k+b*f-c*h;this.w=e*a-b*h-c*f-d*k;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,k=this.z,g=this.w,i=g*c+f*e-k*d,j=g*d+k*c-h*e,o=g*e+h*d-f*c;c=-h*c-f*d-k*e;b.x=i*g+c*-h+j*-k-o*-f;b.y=j*g+c*-f+o*-h-i*-k;b.z=o*g+c*-k+i*-f-j*-h;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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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,h){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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];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={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

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,j=d*e;this.w=f*h-j*c;this.x=f*c+j*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,h=a.x,f=a.y,j=a.z;a=a.w;this.x=b*a+e*h+c*j-d*f;this.y=c*a+e*f+d*h-b*j;this.z=d*a+e*j+b*f-c*h;this.w=e*a-b*h-c*f-d*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,j=this.z,g=this.w,i=g*c+f*e-j*d,l=g*d+j*c-h*e,k=g*e+h*d-f*c;c=-h*c-f*d-j*e;b.x=i*g+c*-h+l*-j-k*-f;b.y=l*g+c*-f+k*-h-i*-j;b.z=k*g+c*-j+i*-f-l*-h;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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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,h){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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];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={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

@@ -33,7 +33,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,e,c,f=2*Math.ceil(a*3)+1;f>25&&(f=25);c=(f-1)*0.5;b=Array(f);for(d=e=0;d<f;++d){b[d]=Math.exp(-((d-c)*(d-c))/(2*a*a));e+=b[d]}for(d=0;d<f;++d)b[d]/=e;return b}};
-THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,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;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=
+THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,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;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=
 a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.constrainVertical!==undefined)this.constrainVertical=
 a.constrainVertical;if(a.verticalMin!==undefined)this.verticalMin=a.verticalMin;if(a.verticalMax!==undefined)this.verticalMax=a.verticalMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!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=
@@ -44,14 +44,14 @@ this.verticalMin)/3.14+this.verticalMin;e=this.target.position;c=this.position;e
 d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(a,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
 THREE.PathCamera=function(a){function d(l,k,m,p){var o={name:m,fps:0.6,length:p,hierarchy:[]},x,w=k.getControlPointsArray(),u=k.getLength(),B=w.length,z=0;x=B-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<B-1;x++){z=p*u.chunks[x]/u.total;k.keys[x]={time:z,pos:w[x]}}o.hierarchy[0]=k;THREE.AnimationHandler.add(o);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
 p,o=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){p=m/(l.points.length*k);p=l.getPoint(p);o.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return o}function e(l,k){var m=b(k,10),p=b(k,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,o);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);p=new Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}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.lookVertical=
+16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}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.lookVertical=
 !0;this.lookHorizontal=!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!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)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 c=Math.PI*2,f=Math.PI/180;this.update=function(l,k,m){var p,o;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)*f;this.theta=this.lon*f;p=this.phi%c;this.phi=p>=0?p:p+c;p=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,m)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
 d(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(l,k){return function(){k.apply(l,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 d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.tdiff=0;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==
+THREE.FlyCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.tdiff=0;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==
 undefined)this.autoForward=a.autoForward;if(a.domElement!==undefined)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=(new Date).getTime();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=
@@ -71,7 +71,7 @@ e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.
 THREE.Icosahedron=function(a){function d(m,p,o){var x=Math.sqrt(m*m+p*p+o*o);return c.vertices.push(new THREE.Vertex(new THREE.Vector3(m/x,p/x,o/x)))-1}function b(m,p,o,x){x.faces.push(new THREE.Face3(m,p,o))}function e(m,p){var o=c.vertices[m].position,x=c.vertices[p].position;return d((o.x+x.x)/2,(o.y+x.y)/2,(o.z+x.z)/2)}var c=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var j=e(f.faces[h].a,f.faces[h].b),l=e(f.faces[h].b,f.faces[h].c),k=e(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,g);b(f.faces[h].b,l,j,g);b(f.faces[h].c,
 k,l,g);b(j,l,k,g)}f.faces=g.faces}c.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.0010;j+=d){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=f;j==0&&(f=e);
+THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.001;j+=d){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=f;j==0&&(f=e);
 for(h=0;h<e.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,h/a.length),new THREE.UV(1-j/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,h/a.length)])}e=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(a,d,b,e){THREE.Geometry.call(this);var c,f=a/2,g=d/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var l=d/e;for(c=0;c<j;c++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-f,-(c*l-g),0)));for(c=0;c<e;c++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*c,d+h*(c+1),d+1+h*(c+1),d+1+h*c));this.faceVertexUvs[0].push([new THREE.UV(d/b,c/e),new THREE.UV(d/b,(c+1)/e),new THREE.UV((d+1)/b,(c+1)/e),new THREE.UV((d+1)/b,c/e)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;

+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,i=d*e;this.w=f*h-i*c;this.x=f*c+i*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,h=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+e*h+c*i-d*f;this.y=c*a+e*f+d*h-b*i;this.z=d*a+e*i+b*f-c*h;this.w=e*a-b*h-c*f-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,i=this.z,g=this.w,j=g*c+f*e-i*d,k=g*d+i*c-h*e,m=g*e+h*d-f*c;c=-h*c-f*d-i*e;b.x=j*g+c*-h+k*-i-m*-f;b.y=k*g+c*-f+m*-h-j*-i;b.z=m*g+c*-i+j*-f-k*-h;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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/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,h){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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];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={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};

+ 67 - 67
build/custom/ThreeWebGL.js

@@ -48,7 +48,7 @@ d,e)}};THREE.Quaternion=function(b,d,e,g){this.set(b||0,d||0,e||0,g!==undefined?
 THREE.Quaternion.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;this.w=g;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,g=b.y*d,h=b.z*d;b=Math.cos(g);g=Math.sin(g);d=Math.cos(-h);h=Math.sin(-h);var o=Math.cos(e);e=Math.sin(e);var n=b*d,p=g*h;this.w=n*o-p*e;this.x=n*e+p*o;this.y=g*d*o+b*h*e;this.z=b*h*o-g*d*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);if(b==0)this.w=this.z=this.y=this.x=0;else{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,g=this.z,h=this.w,o=b.x,n=b.y,p=b.z;b=b.w;this.x=d*b+h*o+e*p-g*n;this.y=e*b+h*n+g*o-d*p;this.z=g*b+h*p+d*n-e*o;this.w=h*b-d*o-e*n-g*p;return this},
 multiplyVector3:function(b,d){d||(d=b);var e=b.x,g=b.y,h=b.z,o=this.x,n=this.y,p=this.z,q=this.w,v=q*e+n*h-p*g,E=q*g+p*e-o*h,F=q*h+o*g-n*e;e=-o*e-n*g-p*h;d.x=v*q+e*-o+E*-p-F*-n;d.y=E*q+e*-n+F*-o-v*-p;d.z=F*q+e*-p+v*-n-E*-o;return d}};
-THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.0010){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);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.001){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);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,g,h,o){this.a=b;this.b=d;this.c=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=o instanceof Array?o:[o];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,g,h,o,n){this.a=b;this.b=d;this.c=e;this.d=g;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=o instanceof THREE.Color?o:new THREE.Color;this.vertexColors=o instanceof Array?o:[];this.vertexTangents=[];this.materials=n instanceof Array?n:[n];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -169,80 +169,80 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(f,s,j){var k,m,w,x=f.vertices,u=x.length,A=f.colors,t=A.length,y=f.__vertexArray,z=f.__colorArray,D=f.__sortArray,B=f.__dirtyVertices,O=f.__dirtyColors;if(j.sortParticles){Pa.multiplySelf(j.matrixWorld);for(k=0;k<u;k++){m=x[k].position;Ua.copy(m);Pa.multiplyVector3(Ua);D[k]=[Ua.z,k]}D.sort(function(W,P){return P[0]-W[0]});for(k=0;k<u;k++){m=x[D[k][1]].position;w=k*3;y[w]=m.x;y[w+1]=m.y;y[w+2]=m.z}for(k=0;k<t;k++){w=k*3;color=A[D[k][1]];z[w]=color.r;z[w+1]=
-color.g;z[w+2]=color.b}}else{if(B)for(k=0;k<u;k++){m=x[k].position;w=k*3;y[w]=m.x;y[w+1]=m.y;y[w+2]=m.z}if(O)for(k=0;k<t;k++){color=A[k];w=k*3;z[w]=color.r;z[w+1]=color.g;z[w+2]=color.b}}if(B||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}if(O||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,s)}}function e(f,s,j,k,m){k.program||aa.initMaterial(k,s,j,m);var w=k.program,x=w.uniforms,u=k.uniforms;
+THREE.WebGLRenderer=function(b){function d(f,r,j){var k,m,w,x=f.vertices,u=x.length,A=f.colors,t=A.length,y=f.__vertexArray,z=f.__colorArray,D=f.__sortArray,B=f.__dirtyVertices,O=f.__dirtyColors;if(j.sortParticles){Pa.multiplySelf(j.matrixWorld);for(k=0;k<u;k++){m=x[k].position;Ua.copy(m);Pa.multiplyVector3(Ua);D[k]=[Ua.z,k]}D.sort(function(W,P){return P[0]-W[0]});for(k=0;k<u;k++){m=x[D[k][1]].position;w=k*3;y[w]=m.x;y[w+1]=m.y;y[w+2]=m.z}for(k=0;k<t;k++){w=k*3;color=A[D[k][1]];z[w]=color.r;z[w+1]=
+color.g;z[w+2]=color.b}}else{if(B)for(k=0;k<u;k++){m=x[k].position;w=k*3;y[w]=m.x;y[w+1]=m.y;y[w+2]=m.z}if(O)for(k=0;k<t;k++){color=A[k];w=k*3;z[w]=color.r;z[w+1]=color.g;z[w+2]=color.b}}if(B||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,r)}if(O||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,r)}}function e(f,r,j,k,m){k.program||aa.initMaterial(k,r,j,m);var w=k.program,x=w.uniforms,u=k.uniforms;
 if(w!=ra){c.useProgram(w);ra=w}c.uniformMatrix4fv(x.projectionMatrix,!1,Ta);if(j&&(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial||k instanceof THREE.LineBasicMaterial||k instanceof THREE.ParticleBasicMaterial||k.fog)){u.fogColor.value=j.color;if(j instanceof THREE.Fog){u.fogNear.value=j.near;u.fogFar.value=j.far}else if(j instanceof THREE.FogExp2)u.fogDensity.value=j.density}if(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial||
-k.lights){var A,t,y=0,z=0,D=0,B,O,W,P,X=Sa,Ga=X.directional.colors,T=X.directional.positions,Q=X.point.colors,U=X.point.positions,ua=X.point.distances,r=0,G=0;j=t=P=0;for(A=s.length;j<A;j++){t=s[j];B=t.color;O=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){y+=B.r;z+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){P=r*3;Ga[P]=B.r*W;Ga[P+1]=B.g*W;Ga[P+2]=B.b*W;T[P]=O.x;T[P+1]=O.y;T[P+2]=O.z;r+=1}else if(t instanceof THREE.PointLight){t=G*3;Q[t]=B.r*W;Q[t+1]=B.g*W;
-Q[t+2]=B.b*W;U[t]=O.x;U[t+1]=O.y;U[t+2]=O.z;ua[G]=P;G+=1}}for(j=r*3;j<Ga.length;j++)Ga[j]=0;for(j=G*3;j<Q.length;j++)Q[j]=0;X.point.length=G;X.directional.length=r;X.ambient[0]=y;X.ambient[1]=z;X.ambient[2]=D;j=Sa;u.enableLighting.value=j.directional.length+j.point.length;u.ambientLightColor.value=j.ambient;u.directionalLightColor.value=j.directional.colors;u.directionalLightDirection.value=j.directional.positions;u.pointLightColor.value=j.point.colors;u.pointLightPosition.value=j.point.positions;
+k.lights){var A,t,y=0,z=0,D=0,B,O,W,P,X=Sa,Ga=X.directional.colors,T=X.directional.positions,Q=X.point.colors,U=X.point.positions,ua=X.point.distances,s=0,G=0;j=t=P=0;for(A=r.length;j<A;j++){t=r[j];B=t.color;O=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){y+=B.r;z+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){P=s*3;Ga[P]=B.r*W;Ga[P+1]=B.g*W;Ga[P+2]=B.b*W;T[P]=O.x;T[P+1]=O.y;T[P+2]=O.z;s+=1}else if(t instanceof THREE.PointLight){t=G*3;Q[t]=B.r*W;Q[t+1]=B.g*W;
+Q[t+2]=B.b*W;U[t]=O.x;U[t+1]=O.y;U[t+2]=O.z;ua[G]=P;G+=1}}for(j=s*3;j<Ga.length;j++)Ga[j]=0;for(j=G*3;j<Q.length;j++)Q[j]=0;X.point.length=G;X.directional.length=s;X.ambient[0]=y;X.ambient[1]=z;X.ambient[2]=D;j=Sa;u.enableLighting.value=j.directional.length+j.point.length;u.ambientLightColor.value=j.ambient;u.directionalLightColor.value=j.directional.colors;u.directionalLightDirection.value=j.directional.positions;u.pointLightColor.value=j.point.colors;u.pointLightPosition.value=j.point.positions;
 u.pointLightDistance.value=j.point.distances}if(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial){u.diffuse.value=k.color;u.opacity.value=k.opacity;u.map.texture=k.map;u.lightMap.texture=k.lightMap;u.envMap.texture=k.envMap;u.reflectivity.value=k.reflectivity;u.refractionRatio.value=k.refractionRatio;u.combine.value=k.combine;u.useRefract.value=k.envMap&&k.envMap.mapping instanceof THREE.CubeRefractionMapping}if(k instanceof THREE.LineBasicMaterial){u.diffuse.value=
 k.color;u.opacity.value=k.opacity}else if(k instanceof THREE.ParticleBasicMaterial){u.psColor.value=k.color;u.opacity.value=k.opacity;u.size.value=k.size;u.scale.value=S.height/2;u.map.texture=k.map}else if(k instanceof THREE.MeshPhongMaterial){u.ambient.value=k.ambient;u.specular.value=k.specular;u.shininess.value=k.shininess}else if(k instanceof THREE.MeshDepthMaterial){u.mNear.value=f.near;u.mFar.value=f.far;u.opacity.value=k.opacity}else if(k instanceof THREE.MeshNormalMaterial)u.opacity.value=
 k.opacity;for(var i in u)if(z=w.uniforms[i]){A=u[i];y=A.type;j=A.value;if(y=="i")c.uniform1i(z,j);else if(y=="f")c.uniform1f(z,j);else if(y=="fv1")c.uniform1fv(z,j);else if(y=="fv")c.uniform3fv(z,j);else if(y=="v2")c.uniform2f(z,j.x,j.y);else if(y=="v3")c.uniform3f(z,j.x,j.y,j.z);else if(y=="v4")c.uniform4f(z,j.x,j.y,j.z,j.w);else if(y=="c")c.uniform3f(z,j.r,j.g,j.b);else if(y=="t"){c.uniform1i(z,j);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
 A.image.__webglTextureCube);for(y=0;y<6;++y)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,0,0,c.RGBA,c.UNSIGNED_BYTE,A.image[y])}else{A.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(y=0;y<6;++y)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,A.image[y]);A.__webglInit=!0}Z(c.TEXTURE_CUBE_MAP,A,A.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_CUBE_MAP,
 A.image.__webglTextureCube)}}else K(A,j)}}c.uniformMatrix4fv(x.modelViewMatrix,!1,m._modelViewMatrixArray);c.uniformMatrix3fv(x.normalMatrix,!1,m._normalMatrixArray);(k instanceof THREE.MeshShaderMaterial||k instanceof THREE.MeshPhongMaterial||k.envMap)&&c.uniform3f(x.cameraPosition,f.position.x,f.position.y,f.position.z);(k instanceof THREE.MeshShaderMaterial||k.envMap||k.skinning)&&c.uniformMatrix4fv(x.objectMatrix,!1,m._objectMatrixArray);(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial||
-k instanceof THREE.MeshShaderMaterial||k.skinning)&&c.uniformMatrix4fv(x.viewMatrix,!1,Xa);if(k instanceof THREE.ShadowVolumeDynamicMaterial){f=u.directionalLightDirection.value;f[0]=-s[1].position.x;f[1]=-s[1].position.y;f[2]=-s[1].position.z;c.uniform3fv(x.directionalLightDirection,f);c.uniformMatrix4fv(x.objectMatrix,!1,m._objectMatrixArray);c.uniformMatrix4fv(x.viewMatrix,!1,Xa)}if(k.skinning){c.uniformMatrix4fv(x.cameraInverseMatrix,!1,Xa);c.uniformMatrix4fv(x.boneGlobalMatrices,!1,m.boneMatrices)}return w}
-function g(f,s,j,k,m,w){if(k.opacity!=0){var x;f=e(f,s,j,k,w).attributes;if(k.morphTargets){s=k.program.attributes;w.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[w.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(s.position,3,c.FLOAT,!1,0,0);if(w.morphTargetForcedOrder.length){j=0;for(var u=w.morphTargetForcedOrder,A=w.morphTargetInfluences;j<k.numSupportedMorphTargets&&j<u.length;){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[u[j]]);
-c.vertexAttribPointer(s["morphTarget"+j],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[j]=A[u[j]];j++}}else{u=[];var t=-1,y=0;A=w.morphTargetInfluences;var z,D=A.length;j=0;for(w.morphTargetBase!==-1&&(u[w.morphTargetBase]=!0);j<k.numSupportedMorphTargets;){for(z=0;z<D;z++)if(!u[z]&&A[z]>t){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(s["morphTarget"+j],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[j]=t;u[y]=1;t=-1;j++}}c.uniform1fv(k.program.uniforms.morphTargetInfluences,
-w.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(m.__webglCustomAttributes)for(x in m.__webglCustomAttributes)if(f[x]>=0){s=m.__webglCustomAttributes[x];c.bindBuffer(c.ARRAY_BUFFER,s.buffer);c.vertexAttribPointer(f[x],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);
+k instanceof THREE.MeshShaderMaterial||k.skinning)&&c.uniformMatrix4fv(x.viewMatrix,!1,Xa);if(k instanceof THREE.ShadowVolumeDynamicMaterial){f=u.directionalLightDirection.value;f[0]=-r[1].position.x;f[1]=-r[1].position.y;f[2]=-r[1].position.z;c.uniform3fv(x.directionalLightDirection,f);c.uniformMatrix4fv(x.objectMatrix,!1,m._objectMatrixArray);c.uniformMatrix4fv(x.viewMatrix,!1,Xa)}if(k.skinning){c.uniformMatrix4fv(x.cameraInverseMatrix,!1,Xa);c.uniformMatrix4fv(x.boneGlobalMatrices,!1,m.boneMatrices)}return w}
+function g(f,r,j,k,m,w){if(k.opacity!=0){var x;f=e(f,r,j,k,w).attributes;if(k.morphTargets){r=k.program.attributes;w.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[w.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(r.position,3,c.FLOAT,!1,0,0);if(w.morphTargetForcedOrder.length){j=0;for(var u=w.morphTargetForcedOrder,A=w.morphTargetInfluences;j<k.numSupportedMorphTargets&&j<u.length;){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[u[j]]);
+c.vertexAttribPointer(r["morphTarget"+j],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[j]=A[u[j]];j++}}else{u=[];var t=-1,y=0;A=w.morphTargetInfluences;var z,D=A.length;j=0;for(w.morphTargetBase!==-1&&(u[w.morphTargetBase]=!0);j<k.numSupportedMorphTargets;){for(z=0;z<D;z++)if(!u[z]&&A[z]>t){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(r["morphTarget"+j],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[j]=t;u[y]=1;t=-1;j++}}c.uniform1fv(k.program.uniforms.morphTargetInfluences,
+w.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(m.__webglCustomAttributes)for(x in m.__webglCustomAttributes)if(f[x]>=0){r=m.__webglCustomAttributes[x];c.bindBuffer(c.ARRAY_BUFFER,r.buffer);c.vertexAttribPointer(f[x],r.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);
 c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(m.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(m.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
 if(k.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
 4,c.FLOAT,!1,0,0)}if(w instanceof THREE.Mesh)if(k.wireframe){c.lineWidth(k.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.drawElements(c.LINES,m.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.drawElements(c.TRIANGLES,m.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(k.linewidth);c.drawArrays(w,0,m.__webglLineCount)}else if(w instanceof
-THREE.ParticleSystem)c.drawArrays(c.POINTS,0,m.__webglParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,m.__webglVertexCount)}}function h(f,s,j){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,
-3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(j==THREE.FlatShading){var k,m,w,x,u,A,t,y,z,D,B=f.count*3;for(D=0;D<B;D+=9){j=f.normalArray;k=j[D];m=j[D+1];w=j[D+2];x=j[D+3];A=j[D+4];y=j[D+5];u=j[D+6];t=j[D+7];z=j[D+8];k=(k+x+u)/3;m=(m+A+t)/3;w=(w+y+z)/3;j[D]=k;j[D+1]=m;j[D+2]=w;j[D+3]=k;j[D+4]=m;j[D+5]=w;j[D+6]=k;j[D+7]=m;j[D+8]=w}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,
+THREE.ParticleSystem)c.drawArrays(c.POINTS,0,m.__webglParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,m.__webglVertexCount)}}function h(f,r,j){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(r.attributes.position);c.vertexAttribPointer(r.attributes.position,
+3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(j==THREE.FlatShading){var k,m,w,x,u,A,t,y,z,D,B=f.count*3;for(D=0;D<B;D+=9){j=f.normalArray;k=j[D];m=j[D+1];w=j[D+2];x=j[D+3];A=j[D+4];y=j[D+5];u=j[D+6];t=j[D+7];z=j[D+8];k=(k+x+u)/3;m=(m+A+t)/3;w=(w+y+z)/3;j[D]=k;j[D+1]=m;j[D+2]=w;j[D+3]=k;j[D+4]=m;j[D+5]=w;j[D+6]=k;j[D+7]=m;j[D+8]=w}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(r.attributes.normal);c.vertexAttribPointer(r.attributes.normal,
 3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function o(f){if(ma!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ma=f.doubleSided}if(na!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);na=f.flipSided}}function n(f){if(Y!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Y=f}}function p(f){$[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);$[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);$[2].set(f.n41+f.n21,f.n42+f.n22,
-f.n43+f.n23,f.n44+f.n24);$[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);$[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);$[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=$[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function q(f){for(var s=f.matrixWorld,j=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),k=0;k<6;k++){f=$[k].x*s.n14+$[k].y*s.n24+$[k].z*s.n34+$[k].w;if(f<=j)return!1}return!0}function v(f,
-s){f.list[f.count]=s;f.count+=1}function E(f){var s,j,k=f.object,m=f.opaque,w=f.transparent;w.count=0;f=m.count=0;for(s=k.materials.length;f<s;f++){j=k.materials[f];j.transparent?v(w,j):v(m,j)}}function F(f){var s,j,k,m,w=f.object,x=f.buffer,u=f.opaque,A=f.transparent;A.count=0;f=u.count=0;for(k=w.materials.length;f<k;f++){s=w.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(j=x.materials.length;s<j;s++)(m=x.materials[s])&&(m.transparent?v(A,m):v(u,m))}else(m=s)&&(m.transparent?v(A,m):
-v(u,m))}}function H(f,s){return s.z-f.z}function I(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,j=f.lights.length,k,m=f.lights,w=[],x,u,A,t,y,z=f.__webglShadowVolumes.length;for(s=0;s<j;s++){k=f.lights[s];if(k instanceof THREE.DirectionalLight){w[0]=-k.position.x;
+f.n43+f.n23,f.n44+f.n24);$[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);$[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);$[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var r;for(f=0;f<6;f++){r=$[f];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}}function q(f){for(var r=f.matrixWorld,j=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),k=0;k<6;k++){f=$[k].x*r.n14+$[k].y*r.n24+$[k].z*r.n34+$[k].w;if(f<=j)return!1}return!0}function v(f,
+r){f.list[f.count]=r;f.count+=1}function E(f){var r,j,k=f.object,m=f.opaque,w=f.transparent;w.count=0;f=m.count=0;for(r=k.materials.length;f<r;f++){j=k.materials[f];j.transparent?v(w,j):v(m,j)}}function F(f){var r,j,k,m,w=f.object,x=f.buffer,u=f.opaque,A=f.transparent;A.count=0;f=u.count=0;for(k=w.materials.length;f<k;f++){r=w.materials[f];if(r instanceof THREE.MeshFaceMaterial){r=0;for(j=x.materials.length;r<j;r++)(m=x.materials[r])&&(m.transparent?v(A,m):v(u,m))}else(m=r)&&(m.transparent?v(A,m):
+v(u,m))}}function H(f,r){return r.z-f.z}function I(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var r,j=f.lights.length,k,m=f.lights,w=[],x,u,A,t,y,z=f.__webglShadowVolumes.length;for(r=0;r<j;r++){k=f.lights[r];if(k instanceof THREE.DirectionalLight){w[0]=-k.position.x;
 w[1]=-k.position.y;w[2]=-k.position.z;for(y=0;y<z;y++){k=f.__webglShadowVolumes[y].object;x=f.__webglShadowVolumes[y].buffer;u=k.materials[0];u.program||aa.initMaterial(u,m,undefined,k);u=u.program;A=u.uniforms;t=u.attributes;if(ra!==u){c.useProgram(u);ra=u;c.uniformMatrix4fv(A.projectionMatrix,!1,Ta);c.uniformMatrix4fv(A.viewMatrix,!1,Xa);c.uniform3fv(A.directionalLightDirection,w)}k.matrixWorld.flattenToArray(k._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,k._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,
 x.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,x.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,x.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,x.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,
 c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);ga="";ra=R.program;c.useProgram(R.program);c.uniformMatrix4fv(R.projectionLocation,!1,Ta);c.uniform1f(R.darknessLocation,R.darkness);c.bindBuffer(c.ARRAY_BUFFER,R.vertexBuffer);c.vertexAttribPointer(R.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(R.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,R.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);
-c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,s){var j,k,m;j=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,u,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";if(!ob){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);ob=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(j.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,
-2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.useScreenCoordinates)m.z=-m.position.z;else{m._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);m.z=-m._modelViewMatrix.n34}}f.__webglSprites.sort(H);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.material===
+c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,r){var j,k,m;j=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,u,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";if(!ob){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);ob=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(j.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,
+2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.useScreenCoordinates)m.z=-m.position.z;else{m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);m.z=-m._modelViewMatrix.n34}}f.__webglSprites.sort(H);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.material===
 undefined&&m.map&&m.map.image&&m.map.image.width){if(m.useScreenCoordinates){c.uniform1i(w.useScreenCoordinates,1);c.uniform3f(w.screenPosition,(m.position.x-t)/t,(y-m.position.y)/y,Math.max(0,Math.min(1,m.position.z)))}else{c.uniform1i(w.useScreenCoordinates,0);c.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0);c.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)}u=m.map.image.width/(m.affectedByDistance?1:za);A[0]=u*x*m.scale.x;A[1]=u*m.scale.y;c.uniform2f(w.uvScale,m.uvScale.x,
-m.uvScale.y);c.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y);c.uniform2f(w.alignment,m.alignment.x,m.alignment.y);c.uniform1f(w.opacity,m.opacity);c.uniform1f(w.rotation,m.rotation);c.uniform2fv(w.scale,A);if(m.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!m.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}oa(m.blending);K(m.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function N(f,s){var j,k,m=f.__webglLensFlares.length,
+m.uvScale.y);c.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y);c.uniform2f(w.alignment,m.alignment.x,m.alignment.y);c.uniform1f(w.opacity,m.opacity);c.uniform1f(w.rotation,m.rotation);c.uniform2fv(w.scale,A);if(m.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!m.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}oa(m.blending);K(m.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function N(f,r){var j,k,m=f.__webglLensFlares.length,
 w,x,u,A=new THREE.Vector3,t=za/ya,y=ya*0.5,z=za*0.5,D=16/za,B=[D*t,D],O=[1,1,0],W=[1,1],P=J.uniforms;j=J.attributes;c.useProgram(J.program);ra=J.program;ga="";if(!pb){c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);pb=!0}c.uniform1i(P.occlusionMap,0);c.uniform1i(P.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(j.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);
-c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<m;k++){j=f.__webglLensFlares[k].object;A.set(j.matrixWorld.n14,j.matrixWorld.n24,j.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);O[0]=A.x;O[1]=A.y;O[2]=A.z;W[0]=O[0]*y+y;W[1]=O[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
+c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<m;k++){j=f.__webglLensFlares[k].object;A.set(j.matrixWorld.n14,j.matrixWorld.n24,j.matrixWorld.n34);r.matrixWorldInverse.multiplyVector3(A);r.projectionMatrix.multiplyVector3(A);O[0]=A.x;O[1]=A.y;O[2]=A.z;W[0]=O[0]*y+y;W[1]=O[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
 0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,0);c.uniform2fv(P.scale,B);c.uniform3fv(P.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,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);j.positionScreen.x=O[0];j.positionScreen.y=
-O[1];j.positionScreen.z=O[2];j.customUpdateCallback?j.customUpdateCallback(j):j.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);w=0;for(x=j.lensFlares.length;w<x;w++){u=j.lensFlares[w];if(u.opacity>0.0010&&u.scale>0.0010){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
-0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var s,j,k,m,w;if(f instanceof THREE.Mesh){j=f.geometry;for(s in j.geometryGroups){k=j.geometryGroups[s];w=!1;for(m in k.__webglCustomAttributes)if(k.__webglCustomAttributes[m].needsUpdate){w=!0;break}if(j.__dirtyVertices||
-j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,T=void 0,Q=void 0,U=void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,G=void 0;z=void 0;r=void 0;G=void 0;var i=void 0,Ka=void 0;r=void 0;G=void 0;i=void 0;Ka=void 0;r=void 0;G=void 0;i=void 0;Ka=void 0;r=void 0;
-G=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;G=void 0;i=void 0;var Va=void 0,va=0,Aa=0,Za=0,$a=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;G=r=0;var Ca=k.__vertexArray,fb=k.__uvArray,gb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Da=k.__colorArray,ia=k.__skinVertexAArray,ja=k.__skinVertexBArray,ka=k.__skinIndexArray,la=k.__skinWeightArray,hb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,qb=k.__needsSmoothNormals;W=k.__vertexColorType;
+O[1];j.positionScreen.z=O[2];j.customUpdateCallback?j.customUpdateCallback(j):j.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);w=0;for(x=j.lensFlares.length;w<x;w++){u=j.lensFlares[w];if(u.opacity>0.001&&u.scale>0.001){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
+0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,r){f._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var r,j,k,m,w;if(f instanceof THREE.Mesh){j=f.geometry;for(r in j.geometryGroups){k=j.geometryGroups[r];w=!1;for(m in k.__webglCustomAttributes)if(k.__webglCustomAttributes[m].needsUpdate){w=!0;break}if(j.__dirtyVertices||
+j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,T=void 0,Q=void 0,U=void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var s=void 0,G=void 0;z=void 0;s=void 0;G=void 0;var i=void 0,Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;
+G=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;s=void 0;G=void 0;i=void 0;var Va=void 0,va=0,Aa=0,Za=0,$a=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;G=s=0;var Ca=k.__vertexArray,fb=k.__uvArray,gb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Da=k.__colorArray,ia=k.__skinVertexAArray,ja=k.__skinVertexBArray,ka=k.__skinIndexArray,la=k.__skinWeightArray,hb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,qb=k.__needsSmoothNormals;W=k.__vertexColorType;
 O=k.__uvType;P=k.__normalType;var Ha=f.geometry,ib=Ha.__dirtyVertices,jb=Ha.__dirtyElements,eb=Ha.__dirtyUvs,kb=Ha.__dirtyNormals,lb=Ha.__dirtyTangents,mb=Ha.__dirtyColors,nb=Ha.__dirtyMorphTargets,ab=Ha.vertices,rb=k.faces,ub=Ha.faces,sb=Ha.faceVertexUvs[0],tb=Ha.faceVertexUvs[1],bb=Ha.skinVerticesA,cb=Ha.skinVerticesB,db=Ha.skinIndices,Wa=Ha.skinWeights,Ya=f instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Va in Ra){Ra[Va].offset=0;Ra[Va].offsetSrc=0}x=
-0;for(u=rb.length;x<u;x++){A=rb[x];t=ub[A];sb&&(X=sb[A]);tb&&(Ga=tb[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;Ca[Aa]=T.x;Ca[Aa+1]=T.y;Ca[Aa+2]=T.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=U.x;Ca[Aa+7]=U.y;Ca[Aa+8]=U.z;Aa+=9}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){r=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+
-0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[G];i.array[r+1]=i.value[G];i.array[r+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[G+0];i.array[r+1]=i.value[G+1];i.array[r+2]=i.value[G+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=i.value[t.a];Q=i.value[t.b];U=i.value[t.c]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];i.offsetSrc++}else if(i.boundTo===
-"faceVertices"){T=i.value[G+0];Q=i.value[G+1];U=i.value[G+2];i.offsetSrc+=3}if(i.size===2){i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=U.x;i.array[r+5]=U.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[r+0]=T.r;i.array[r+1]=T.g;i.array[r+2]=T.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=U.r;i.array[r+7]=U.g;i.array[r+8]=U.b}else{i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=T.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;
-i.array[r+6]=U.x;i.array[r+7]=U.y;i.array[r+8]=U.z}i.offset+=9}else{i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=T.z;i.array[r+3]=T.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=U.x;i.array[r+9]=U.y;i.array[r+10]=U.z;i.array[r+11]=U.w;i.offset+=12}}}}if(nb){r=0;for(G=morphTargets.length;r<G;r++){T=morphTargets[r].vertices[t.a].position;Q=morphTargets[r].vertices[t.b].position;U=morphTargets[r].vertices[t.c].position;i=hb[r];i[Ba+0]=T.x;i[Ba+1]=T.y;i[Ba+2]=T.z;
-i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=U.x;i[Ba+7]=U.y;i[Ba+8]=U.z}Ba+=9}if(Wa.length){r=Wa[t.a];G=Wa[t.b];i=Wa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;r=db[t.a];G=db[t.b];i=db[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=G.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;r=bb[t.a];G=bb[t.b];i=bb[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;
-ia[C+3]=1;ia[C+4]=G.x;ia[C+5]=G.y;ia[C+6]=G.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;r=cb[t.a];G=cb[t.b];i=cb[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(mb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];r=z[1];G=z[2]}else G=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=G.r;Da[xa+7]=G.g;Da[xa+8]=G.b;xa+=9}if(lb&&Ha.hasTangents){z=
+0;for(u=rb.length;x<u;x++){A=rb[x];t=ub[A];sb&&(X=sb[A]);tb&&(Ga=tb[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;Ca[Aa]=T.x;Ca[Aa+1]=T.y;Ca[Aa+2]=T.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=U.x;Ca[Aa+7]=U.y;Ca[Aa+8]=U.z;Aa+=9}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[s+
+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=i.value[t.a];Q=i.value[t.b];U=i.value[t.c]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];i.offsetSrc++}else if(i.boundTo===
+"faceVertices"){T=i.value[G+0];Q=i.value[G+1];U=i.value[G+2];i.offsetSrc+=3}if(i.size===2){i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=U.x;i.array[s+5]=U.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[s+0]=T.r;i.array[s+1]=T.g;i.array[s+2]=T.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=U.r;i.array[s+7]=U.g;i.array[s+8]=U.b}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;
+i.array[s+6]=U.x;i.array[s+7]=U.y;i.array[s+8]=U.z}i.offset+=9}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=T.w;i.array[s+4]=Q.x;i.array[s+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=U.x;i.array[s+9]=U.y;i.array[s+10]=U.z;i.array[s+11]=U.w;i.offset+=12}}}}if(nb){s=0;for(G=morphTargets.length;s<G;s++){T=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;U=morphTargets[s].vertices[t.c].position;i=hb[s];i[Ba+0]=T.x;i[Ba+1]=T.y;i[Ba+2]=T.z;
+i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=U.x;i[Ba+7]=U.y;i[Ba+8]=U.z}Ba+=9}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];la[C]=s.x;la[C+1]=s.y;la[C+2]=s.z;la[C+3]=s.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;s=db[t.a];G=db[t.b];i=db[t.c];ka[C]=s.x;ka[C+1]=s.y;ka[C+2]=s.z;ka[C+3]=s.w;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=G.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;s=bb[t.a];G=bb[t.b];i=bb[t.c];ia[C]=s.x;ia[C+1]=s.y;ia[C+2]=s.z;
+ia[C+3]=1;ia[C+4]=G.x;ia[C+5]=G.y;ia[C+6]=G.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;s=cb[t.a];G=cb[t.b];i=cb[t.c];ja[C]=s.x;ja[C+1]=s.y;ja[C+2]=s.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(mb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];s=z[1];G=z[2]}else G=s=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=s.r;Da[xa+4]=s.g;Da[xa+5]=s.b;Da[xa+6]=G.r;Da[xa+7]=G.g;Da[xa+8]=G.b;xa+=9}if(lb&&Ha.hasTangents){z=
 B[0];D=B[1];t=B[2];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ea+=12}if(kb&&P)if(A.length==3&&qb)for(B=0;B<3;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<3;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(eb&&X!==undefined&&O)for(B=0;B<3;B++){A=X[B];fb[Za]=A.u;fb[Za+1]=A.v;Za+=2}if(eb&&Ga!==undefined&&O)for(B=0;B<3;B++){A=Ga[B];gb[$a]=A.u;gb[$a+1]=A.v;$a+=2}if(jb){Na[Ja]=
-va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;ua=ab[t.d].position;Ca[Aa]=T.x;Ca[Aa+1]=T.y;Ca[Aa+2]=T.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=U.x;Ca[Aa+7]=U.y;Ca[Aa+8]=U.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){r=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===
-undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c];i.array[r+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[G];i.array[r+1]=i.value[G];i.array[r+2]=i.value[G];i.array[r+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[G+0];i.array[r+1]=i.value[G+1];i.array[r+2]=i.value[G+2];i.array[r+2]=i.value[G+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=
-i.value[t.a];Q=i.value[t.b];U=i.value[t.c];ua=i.value[t.d]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];ua=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){T=i.value[G+0];Q=i.value[G+1];U=i.value[G+2];ua=i.value[G+3];i.offsetSrc+=4}if(i.size===2){i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=U.x;i.array[r+5]=U.y;i.array[r+6]=ua.x;i.array[r+7]=ua.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[r+0]=T.r;i.array[r+1]=T.g;
-i.array[r+2]=T.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=U.r;i.array[r+7]=U.g;i.array[r+8]=U.b;i.array[r+9]=ua.r;i.array[r+10]=ua.g;i.array[r+11]=ua.b}else{i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=T.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=U.x;i.array[r+7]=U.y;i.array[r+8]=U.z;i.array[r+9]=ua.x;i.array[r+10]=ua.y;i.array[r+11]=ua.z}i.offset+=12}else{i.array[r+0]=T.x;i.array[r+1]=T.y;i.array[r+2]=T.z;i.array[r+3]=T.w;i.array[r+4]=Q.x;i.array[r+
-5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=U.x;i.array[r+9]=U.y;i.array[r+10]=U.z;i.array[r+11]=U.w;i.array[r+12]=ua.x;i.array[r+13]=ua.y;i.array[r+14]=ua.z;i.array[r+15]=ua.w;i.offset+=16}}}}if(nb){r=0;for(G=morphTargets.length;r<G;r++){T=morphTargets[r].vertices[t.a].position;Q=morphTargets[r].vertices[t.b].position;U=morphTargets[r].vertices[t.c].position;ua=morphTargets[r].vertices[t.d].position;i=hb[r];i[Ba+0]=T.x;i[Ba+1]=T.y;i[Ba+2]=T.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=
-U.x;i[Ba+7]=U.y;i[Ba+8]=U.z;i[Ba+9]=ua.x;i[Ba+10]=ua.y;i[Ba+11]=ua.z}Ba+=12}if(Wa.length){r=Wa[t.a];G=Wa[t.b];i=Wa[t.c];Ka=Wa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=db[t.a];G=db[t.b];i=db[t.c];Ka=db[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=G.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;
-ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=bb[t.a];G=bb[t.b];i=bb[t.c];Ka=bb[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=G.x;ia[C+5]=G.y;ia[C+6]=G.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=cb[t.a];G=cb[t.b];i=cb[t.c];t=cb[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=
-t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(mb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];r=z[1];G=z[2];z=z[3]}else z=G=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=G.r;Da[xa+7]=G.g;Da[xa+8]=G.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(lb&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+
+va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;ua=ab[t.d].position;Ca[Aa]=T.x;Ca[Aa+1]=T.y;Ca[Aa+2]=T.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=U.x;Ca[Aa+7]=U.y;Ca[Aa+8]=U.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===
+undefined||i.boundTo==="vertices"){i.array[s+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c];i.array[s+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];i.array[s+2]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.array[s+2]=i.value[G+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=
+i.value[t.a];Q=i.value[t.b];U=i.value[t.c];ua=i.value[t.d]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];ua=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){T=i.value[G+0];Q=i.value[G+1];U=i.value[G+2];ua=i.value[G+3];i.offsetSrc+=4}if(i.size===2){i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=U.x;i.array[s+5]=U.y;i.array[s+6]=ua.x;i.array[s+7]=ua.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[s+0]=T.r;i.array[s+1]=T.g;
+i.array[s+2]=T.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=U.r;i.array[s+7]=U.g;i.array[s+8]=U.b;i.array[s+9]=ua.r;i.array[s+10]=ua.g;i.array[s+11]=ua.b}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;i.array[s+6]=U.x;i.array[s+7]=U.y;i.array[s+8]=U.z;i.array[s+9]=ua.x;i.array[s+10]=ua.y;i.array[s+11]=ua.z}i.offset+=12}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=T.w;i.array[s+4]=Q.x;i.array[s+
+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=U.x;i.array[s+9]=U.y;i.array[s+10]=U.z;i.array[s+11]=U.w;i.array[s+12]=ua.x;i.array[s+13]=ua.y;i.array[s+14]=ua.z;i.array[s+15]=ua.w;i.offset+=16}}}}if(nb){s=0;for(G=morphTargets.length;s<G;s++){T=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;U=morphTargets[s].vertices[t.c].position;ua=morphTargets[s].vertices[t.d].position;i=hb[s];i[Ba+0]=T.x;i[Ba+1]=T.y;i[Ba+2]=T.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=
+U.x;i[Ba+7]=U.y;i[Ba+8]=U.z;i[Ba+9]=ua.x;i[Ba+10]=ua.y;i[Ba+11]=ua.z}Ba+=12}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];Ka=Wa[t.d];la[C]=s.x;la[C+1]=s.y;la[C+2]=s.z;la[C+3]=s.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;s=db[t.a];G=db[t.b];i=db[t.c];Ka=db[t.d];ka[C]=s.x;ka[C+1]=s.y;ka[C+2]=s.z;ka[C+3]=s.w;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=G.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;
+ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;s=bb[t.a];G=bb[t.b];i=bb[t.c];Ka=bb[t.d];ia[C]=s.x;ia[C+1]=s.y;ia[C+2]=s.z;ia[C+3]=1;ia[C+4]=G.x;ia[C+5]=G.y;ia[C+6]=G.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;s=cb[t.a];G=cb[t.b];i=cb[t.c];t=cb[t.d];ja[C]=s.x;ja[C+1]=s.y;ja[C+2]=s.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=
+t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(mb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];s=z[1];G=z[2];z=z[3]}else z=G=s=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=s.r;Da[xa+4]=s.g;Da[xa+5]=s.b;Da[xa+6]=G.r;Da[xa+7]=G.g;Da[xa+8]=G.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(lb&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+
 12]=B.x;ha[ea+13]=B.y;ha[ea+14]=B.z;ha[ea+15]=B.w;ea+=16}if(kb&&P)if(A.length==4&&qb)for(B=0;B<4;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<4;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(eb&&X!==undefined&&O)for(B=0;B<4;B++){A=X[B];fb[Za]=A.u;fb[Za+1]=A.v;Za+=2}if(eb&&Ga!==undefined&&O)for(B=0;B<4;B++){A=Ga[B];gb[$a]=A.u;gb[$a+1]=A.v;$a+=2}if(jb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+3;Na[Ja+3]=va+1;Na[Ja+4]=va+2;Na[Ja+5]=va+3;Ja+=6;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=
-va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if(Ya){x=0;for(u=Ya.length;x<u;x++){Na[Ja]=Ya[x].a;Na[Ja+1]=Ya[x].b;Na[Ja+2]=Ya[x].c;Na[Ja+3]=Ya[x].a;Na[Ja+4]=Ya[x].c;Na[Ja+5]=Ya[x].d;Ja+=6}}if(ib){c.bindBuffer(c.ARRAY_BUFFER,k.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,w);i.needsUpdate=!1}}if(nb){r=0;for(G=morphTargets.length;r<
-G;r++){c.bindBuffer(c.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,hb[r],w)}}if(mb&&xa>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(kb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(lb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(eb&&Za>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,fb,w)}if(eb&&
+va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if(Ya){x=0;for(u=Ya.length;x<u;x++){Na[Ja]=Ya[x].a;Na[Ja+1]=Ya[x].b;Na[Ja+2]=Ya[x].c;Na[Ja+3]=Ya[x].a;Na[Ja+4]=Ya[x].c;Na[Ja+5]=Ya[x].d;Ja+=6}}if(ib){c.bindBuffer(c.ARRAY_BUFFER,k.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,w);i.needsUpdate=!1}}if(nb){s=0;for(G=morphTargets.length;s<
+G;s++){c.bindBuffer(c.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[s]);c.bufferData(c.ARRAY_BUFFER,hb[s],w)}}if(mb&&xa>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(kb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(lb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(eb&&Za>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,fb,w)}if(eb&&
 $a>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,gb,w)}if(jb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,
-k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,w)}}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){j=f.geometry;if(j.__dirtyVertices||j.__dirtyColors){f=j;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;P=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;
-if(f.__dirtyVertices){for(u=0;u<P;u++){O=W[u].position;m=u*3;X[m]=O.x;X[m+1]=O.y;X[m+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];m=u*3;x[m]=color.r;x[m+1]=color.g;x[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(f instanceof THREE.Line){j=f.geometry;if(j.__dirtyVertices||j.__dirtyColors){f=j;s=c.DYNAMIC_DRAW;W=f.vertices;
-k=f.colors;P=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<P;u++){O=W[u].position;m=u*3;X[m]=O.x;X[m+1]=O.y;X[m+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];m=u*3;x[m]=color.r;x[m+1]=color.g;x[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){j=
-f.geometry;(j.__dirtyVertices||j.__dirtyColors||f.sortParticles)&&d(j,c.DYNAMIC_DRAW,f);j.__dirtyVertices=!1;j.__dirtyColors=!1}}function sa(f){function s(D){var B=[];j=0;for(k=D.length;j<k;j++)D[j]==undefined?B.push("undefined"):B.push(D[j].id);return B.join("_")}var j,k,m,w,x,u,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};m=0;for(w=f.faces.length;m<w;m++){x=f.faces[m];u=x.materials;A=s(u);y[A]==undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;
-f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(m);f.geometryGroups[t].vertices+=x}}function da(f,s,j){f.push({buffer:s,object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=
-ga){switch(f){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)}ga=f}}function Z(f,s,j){if((j.width&j.width-1)==0&&(j.height&
-j.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,
-f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===
+k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,w)}}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){j=f.geometry;if(j.__dirtyVertices||j.__dirtyColors){f=j;r=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;P=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;
+if(f.__dirtyVertices){for(u=0;u<P;u++){O=W[u].position;m=u*3;X[m]=O.x;X[m+1]=O.y;X[m+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,r)}if(Ga){for(u=0;u<w;u++){color=k[u];m=u*3;x[m]=color.r;x[m+1]=color.g;x[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,r)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(f instanceof THREE.Line){j=f.geometry;if(j.__dirtyVertices||j.__dirtyColors){f=j;r=c.DYNAMIC_DRAW;W=f.vertices;
+k=f.colors;P=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<P;u++){O=W[u].position;m=u*3;X[m]=O.x;X[m+1]=O.y;X[m+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,r)}if(Ga){for(u=0;u<w;u++){color=k[u];m=u*3;x[m]=color.r;x[m+1]=color.g;x[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,r)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){j=
+f.geometry;(j.__dirtyVertices||j.__dirtyColors||f.sortParticles)&&d(j,c.DYNAMIC_DRAW,f);j.__dirtyVertices=!1;j.__dirtyColors=!1}}function sa(f){function r(D){var B=[];j=0;for(k=D.length;j<k;j++)D[j]==undefined?B.push("undefined"):B.push(D[j].id);return B.join("_")}var j,k,m,w,x,u,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};m=0;for(w=f.faces.length;m<w;m++){x=f.faces[m];u=x.materials;A=r(u);y[A]==undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;
+f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(m);f.geometryGroups[t].vertices+=x}}function da(f,r,j){f.push({buffer:r,object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=
+ga){switch(f){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)}ga=f}}function Z(f,r,j){if((j.width&j.width-1)==0&&(j.height&
+j.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(r.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(r.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(r.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(r.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(r.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(r.minFilter))}}function K(f,r){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,
+f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+r);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===
 undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,
 0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,
-c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,j;if(f){s=f.__webglFramebuffer;j=f.width;f=f.height}else{s=null;j=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,j,f);Fa=s}}function ca(f,s){var j;if(f=="fragment")j=
-c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(j=c.createShader(c.VERTEX_SHADER));c.shaderSource(j,s);c.compileShader(j);if(!c.getShaderParameter(j,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(j));console.error(s);return null}return j}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;
+c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var r,j;if(f){r=f.__webglFramebuffer;j=f.width;f=f.height}else{r=null;j=ya;f=za}if(r!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,r);c.viewport(wa,qa,j,f);Fa=r}}function ca(f,r){var j;if(f=="fragment")j=
+c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(j=c.createShader(c.VERTEX_SHADER));c.shaderSource(j,r);c.compileShader(j);if(!c.getShaderParameter(j,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(j));console.error(r);return null}return j}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){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 c,S=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=
 0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Xa=new Float32Array(16),Ua=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):
-new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.maxMorphTargets=8;this.domElement=S;this.autoClear=!0;this.sortObjects=!0;(function(f,s,j,k){try{if(!(c=S.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(m){console.error(m)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);
-c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,j)})(antialias,clearColor,clearAlpha,stencil);this.context=c;if(stencil){var R={};R.vertices=new Float32Array(12);R.faces=new Uint16Array(6);R.darkness=0.5;R.vertices[0]=-20;R.vertices[1]=-20;R.vertices[2]=-1;R.vertices[3]=20;R.vertices[4]=-20;R.vertices[5]=-1;R.vertices[6]=
+new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.maxMorphTargets=8;this.domElement=S;this.autoClear=!0;this.sortObjects=!0;(function(f,r,j,k){try{if(!(c=S.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(m){console.error(m)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);
+c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(r.r,r.g,r.b,j)})(antialias,clearColor,clearAlpha,stencil);this.context=c;if(stencil){var R={};R.vertices=new Float32Array(12);R.faces=new Uint16Array(6);R.darkness=0.5;R.vertices[0]=-20;R.vertices[1]=-20;R.vertices[2]=-1;R.vertices[3]=20;R.vertices[4]=-20;R.vertices[5]=-1;R.vertices[6]=
 20;R.vertices[7]=20;R.vertices[8]=-1;R.vertices[9]=-20;R.vertices[10]=20;R.vertices[11]=-1;R.faces[0]=0;R.faces[1]=1;R.faces[2]=2;R.faces[3]=0;R.faces[4]=2;R.faces[5]=3;R.vertexBuffer=c.createBuffer();R.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,R.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,R.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,R.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,R.faces,c.STATIC_DRAW);R.program=c.createProgram();c.attachShader(R.program,ca("fragment",
 THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(R.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(R.program);R.vertexLocation=c.getAttribLocation(R.program,"position");R.projectionLocation=c.getUniformLocation(R.program,"projectionMatrix");R.darknessLocation=c.getUniformLocation(R.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=
 1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,
@@ -254,33 +254,33 @@ b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_s
 _sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));
 c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");
 _sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=
-c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var ob=!1;this.setSize=function(f,s){S.width=f;S.height=s;this.setViewport(0,0,S.width,S.height)};this.setViewport=function(f,s,j,k){wa=f;qa=s;ya=j;za=k;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,j,k){c.scissor(f,s,j,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=
-f;c.depthMask(f)};this.setClearColorHex=function(f,s){var j=new THREE.Color(f);c.clearColor(j.r,j.g,j.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){R.darkness=f};this.initMaterial=function(f,s,j,k){var m,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof
-THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=THREE.UniformsUtils.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,y;A=y=u=0;for(t=s.length;A<
-t;A++){w=s[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+y<=4)s=y;else{s=Math.ceil(4*y/(u+y));u=4-s}w={directional:s,point:u};y=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)y=k.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;j={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:j,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,
+c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var ob=!1;this.setSize=function(f,r){S.width=f;S.height=r;this.setViewport(0,0,S.width,S.height)};this.setViewport=function(f,r,j,k){wa=f;qa=r;ya=j;za=k;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,r,j,k){c.scissor(f,r,j,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=
+f;c.depthMask(f)};this.setClearColorHex=function(f,r){var j=new THREE.Color(f);c.clearColor(j.r,j.g,j.b,r)};this.setClearColor=function(f,r){c.clearColor(f.r,f.g,f.b,r)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){R.darkness=f};this.initMaterial=function(f,r,j,k){var m,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof
+THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=THREE.UniformsUtils.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,y;A=y=u=0;for(t=r.length;A<
+t;A++){w=r[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+y<=4)r=y;else{r=Math.ceil(4*y/(u+y));u=4-r}w={directional:r,point:u};y=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)y=k.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;r=f.attributes;j={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:j,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,
 maxDirLights:w.directional,maxPointLights:w.point,maxBones:y};var D;w=[];if(x)w.push(x);else{w.push(A);w.push(t)}for(D in j){w.push(D);w.push(j[D])}x=w.join();D=0;for(w=pa.length;D<w;D++)if(pa[D].code==x){z=pa[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+j.maxDirLights,"#define MAX_POINT_LIGHTS "+j.maxPointLights,j.fog?"#define USE_FOG":"",j.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",j.map?"#define USE_MAP":
 "",j.envMap?"#define USE_ENVMAP":"",j.lightMap?"#define USE_LIGHTMAP":"",j.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+j.maxDirLights,"#define MAX_POINT_LIGHTS "+j.maxPointLights,"#define MAX_BONES "+j.maxBones,j.map?"#define USE_MAP":"",j.envMap?"#define USE_ENVMAP":"",j.lightMap?"#define USE_LIGHTMAP":"",j.vertexColors?
 "#define USE_COLOR":"",j.skinning?"#define USE_SKINNING":"",j.morphTargets?"#define USE_MORPHTARGETS":"",j.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 c.attachShader(D,ca("fragment",prefix_fragment+A));c.attachShader(D,ca("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B);
-B=A;u=0;for(A=B.length;u<A;u++){t=B[u];D.uniforms[t]=c.getUniformLocation(D,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<j.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in s)A.push(z);z=A;B=0;for(s=z.length;B<s;B++){j=z[B];D.attributes[j]=c.getAttribLocation(D,j)}pa.push({program:D,code:x});z=D}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
+B=A;u=0;for(A=B.length;u<A;u++){t=B[u];D.uniforms[t]=c.getUniformLocation(D,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<j.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in r)A.push(z);z=A;B=0;for(r=z.length;B<r;B++){j=z[B];D.attributes[j]=c.getAttribLocation(D,j)}pa.push({program:D,code:x});z=D}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
 0&&c.enableVertexAttribArray(z.normal);z.tangent>=0&&c.enableVertexAttribArray(z.tangent);if(f.skinning&&z.skinVertexA>=0&&z.skinVertexB>=0&&z.skinIndex>=0&&z.skinWeight>=0){c.enableVertexAttribArray(z.skinVertexA);c.enableVertexAttribArray(z.skinVertexB);c.enableVertexAttribArray(z.skinIndex);c.enableVertexAttribArray(z.skinWeight)}for(m in f.attributes)z[m]>=0&&c.enableVertexAttribArray(z[m]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(z.morphTarget0>=0){c.enableVertexAttribArray(z.morphTarget0);
 f.numSupportedMorphTargets++}if(z.morphTarget1>=0){c.enableVertexAttribArray(z.morphTarget1);f.numSupportedMorphTargets++}if(z.morphTarget2>=0){c.enableVertexAttribArray(z.morphTarget2);f.numSupportedMorphTargets++}if(z.morphTarget3>=0){c.enableVertexAttribArray(z.morphTarget3);f.numSupportedMorphTargets++}if(z.morphTarget4>=0){c.enableVertexAttribArray(z.morphTarget4);f.numSupportedMorphTargets++}if(z.morphTarget5>=0){c.enableVertexAttribArray(z.morphTarget5);f.numSupportedMorphTargets++}if(z.morphTarget6>=
-0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(m=this.maxMorphTargets;f<m;f++)k.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,j,k){var m,w,x,u,A,t,y,z,D=f.lights,B=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Xa);s.projectionMatrix.flattenToArray(Ta);
-Pa.multiply(s.projectionMatrix,s.matrixWorldInverse);p(Pa);this.initWebGLObjects(f);Ia(j);(this.autoClear||k)&&this.clear();A=f.__webglObjects.length;for(k=0;k<A;k++){m=f.__webglObjects[k];y=m.object;if(y.visible)if(!(y instanceof THREE.Mesh)||q(y)){y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,s);F(m);m.render=!0;if(this.sortObjects){Ua.copy(y.position);Pa.multiplyVector3(Ua);m.z=Ua.z}}else m.render=!1;else m.render=!1}this.sortObjects&&f.__webglObjects.sort(H);t=f.__webglObjectsImmediate.length;
-for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,s);E(m)}}oa(THREE.NormalBlending);for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){y=m.object;z=m.buffer;x=m.opaque;o(y);for(m=0;m<x.count;m++){u=x.list[m];n(u.depthTest);g(s,D,B,u,z,y)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){x=m.opaque;o(y);for(m=0;m<x.count;m++){u=x.list[m];n(u.depthTest);w=e(s,D,B,u,y);y.render(function(O){h(O,
-w,u.shading)})}}}for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){y=m.object;z=m.buffer;x=m.transparent;o(y);for(m=0;m<x.count;m++){u=x.list[m];oa(u.blending);n(u.depthTest);g(s,D,B,u,z,y)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){x=m.transparent;o(y);for(m=0;m<x.count;m++){u=x.list[m];oa(u.blending);n(u.depthTest);w=e(s,D,B,u,y);y.render(function(O){h(O,w,u.shading)})}}}f.__webglSprites.length&&M(f,s);stencil&&f.__webglShadowVolumes.length&&f.lights.length&&I(f);
-f.__webglLensFlares.length&&N(f,s);if(j&&j.minFilter!==THREE.NearestFilter&&j.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,j.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],j=f,k=void 0,m=void 0,w=void 0;if(s._modelViewMatrix==
-undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){m=s.geometry;m.geometryGroups==undefined&&sa(m);for(k in m.geometryGroups){w=m.geometryGroups[k];if(!w.__webglVertexBuffer){var x=w;x.__webglVertexBuffer=c.createBuffer();x.__webglNormalBuffer=c.createBuffer();x.__webglTangentBuffer=c.createBuffer();
+0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(m=this.maxMorphTargets;f<m;f++)k.__webglMorphTargetInfluences[f]=0}};this.render=function(f,r,j,k){var m,w,x,u,A,t,y,z,D=f.lights,B=f.fog;r.matrixAutoUpdate&&r.updateMatrix();f.update(undefined,!1,r);r.matrixWorldInverse.flattenToArray(Xa);r.projectionMatrix.flattenToArray(Ta);
+Pa.multiply(r.projectionMatrix,r.matrixWorldInverse);p(Pa);this.initWebGLObjects(f);Ia(j);(this.autoClear||k)&&this.clear();A=f.__webglObjects.length;for(k=0;k<A;k++){m=f.__webglObjects[k];y=m.object;if(y.visible)if(!(y instanceof THREE.Mesh)||q(y)){y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,r);F(m);m.render=!0;if(this.sortObjects){Ua.copy(y.position);Pa.multiplyVector3(Ua);m.z=Ua.z}}else m.render=!1;else m.render=!1}this.sortObjects&&f.__webglObjects.sort(H);t=f.__webglObjectsImmediate.length;
+for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,r);E(m)}}oa(THREE.NormalBlending);for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){y=m.object;z=m.buffer;x=m.opaque;o(y);for(m=0;m<x.count;m++){u=x.list[m];n(u.depthTest);g(r,D,B,u,z,y)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){x=m.opaque;o(y);for(m=0;m<x.count;m++){u=x.list[m];n(u.depthTest);w=e(r,D,B,u,y);y.render(function(O){h(O,
+w,u.shading)})}}}for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){y=m.object;z=m.buffer;x=m.transparent;o(y);for(m=0;m<x.count;m++){u=x.list[m];oa(u.blending);n(u.depthTest);g(r,D,B,u,z,y)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];y=m.object;if(y.visible){x=m.transparent;o(y);for(m=0;m<x.count;m++){u=x.list[m];oa(u.blending);n(u.depthTest);w=e(r,D,B,u,y);y.render(function(O){h(O,w,u.shading)})}}}f.__webglSprites.length&&M(f,r);stencil&&f.__webglShadowVolumes.length&&f.lights.length&&I(f);
+f.__webglLensFlares.length&&N(f,r);if(j&&j.minFilter!==THREE.NearestFilter&&j.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,j.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var r=f.__objectsAdded[0],j=f,k=void 0,m=void 0,w=void 0;if(r._modelViewMatrix==
+undefined){r._modelViewMatrix=new THREE.Matrix4;r._normalMatrixArray=new Float32Array(9);r._modelViewMatrixArray=new Float32Array(16);r._objectMatrixArray=new Float32Array(16);r.matrixWorld.flattenToArray(r._objectMatrixArray)}if(r instanceof THREE.Mesh){m=r.geometry;m.geometryGroups==undefined&&sa(m);for(k in m.geometryGroups){w=m.geometryGroups[k];if(!w.__webglVertexBuffer){var x=w;x.__webglVertexBuffer=c.createBuffer();x.__webglNormalBuffer=c.createBuffer();x.__webglTangentBuffer=c.createBuffer();
 x.__webglColorBuffer=c.createBuffer();x.__webglUVBuffer=c.createBuffer();x.__webglUV2Buffer=c.createBuffer();x.__webglSkinVertexABuffer=c.createBuffer();x.__webglSkinVertexBBuffer=c.createBuffer();x.__webglSkinIndicesBuffer=c.createBuffer();x.__webglSkinWeightsBuffer=c.createBuffer();x.__webglFaceBuffer=c.createBuffer();x.__webglLineBuffer=c.createBuffer();if(x.numMorphTargets){var u=void 0,A=void 0;x.__webglMorphTargetsBuffers=[];u=0;for(A=x.numMorphTargets;u<A;u++)x.__webglMorphTargetsBuffers.push(c.createBuffer())}x=
-w;u=s;var t=void 0,y=void 0,z=void 0;z=void 0;var D=void 0,B=void 0,O=void 0,W=O=A=0;y=void 0;z=void 0;var P=void 0;t=void 0;y=void 0;D=u.geometry;P=D.faces;B=x.faces;t=0;for(y=B.length;t<y;t++){z=B[t];z=P[z];if(z instanceof THREE.Face3){A+=3;O+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;O+=2;W+=4}}t=x;y=u;P=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];P=0;for(B=y.materials.length;P<B;P++){X=y.materials[P];if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=
+w;u=r;var t=void 0,y=void 0,z=void 0;z=void 0;var D=void 0,B=void 0,O=void 0,W=O=A=0;y=void 0;z=void 0;var P=void 0;t=void 0;y=void 0;D=u.geometry;P=D.faces;B=x.faces;t=0;for(y=B.length;t<y;t++){z=B[t];z=P[z];if(z instanceof THREE.Face3){A+=3;O+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;O+=2;W+=4}}t=x;y=u;P=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];P=0;for(B=y.materials.length;P<B;P++){X=y.materials[P];if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=
 t.materials[X])&&z.push(Ga)}else(Ga=X)&&z.push(Ga)}t=z;a:{y=void 0;P=void 0;B=t.length;for(y=0;y<B;y++){P=t[y];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){y=!0;break a}}y=!1}a:{P=void 0;B=void 0;z=t.length;for(P=0;P<z;P++){B=t[P];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){P=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{B=void 0;z=void 0;X=t.length;for(B=0;B<X;B++){z=
 t[B];if(z.vertexColors){z=z.vertexColors;break a}}z=!1}x.__vertexArray=new Float32Array(A*3);if(P)x.__normalArray=new Float32Array(A*3);if(D.hasTangents)x.__tangentArray=new Float32Array(A*4);if(z)x.__colorArray=new Float32Array(A*3);if(y){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)x.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)x.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){x.__skinVertexAArray=new Float32Array(A*
 4);x.__skinVertexBArray=new Float32Array(A*4);x.__skinIndexArray=new Float32Array(A*4);x.__skinWeightArray=new Float32Array(A*4)}x.__faceArray=new Uint16Array(O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));x.__lineArray=new Uint16Array(W*2);if(x.numMorphTargets){x.__morphTargetsArrays=[];D=0;for(B=x.numMorphTargets;D<B;D++)x.__morphTargetsArrays.push(new Float32Array(A*3))}x.__needsSmoothNormals=P==THREE.SmoothShading;x.__uvType=y;x.__vertexColorType=z;x.__normalType=P;x.__webglFaceCount=
 O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0);x.__webglLineCount=W*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){x.__webglCustomAttributes={};for(a in t[D].attributes){y=t[D].attributes[a];O=1;if(y.type==="v2")O=2;else if(y.type==="v3")O=3;else if(y.type==="v4")O=4;else y.type==="c"&&(O=3);y.size=O;y.needsUpdate=!0;y.array=new Float32Array(A*O);y.buffer=c.createBuffer();x.__webglCustomAttributes[a]=y}}m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=
-!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}s instanceof THREE.ShadowVolume?da(j.__webglShadowVolumes,w,s):da(j.__webglObjects,w,s)}}else if(s instanceof THREE.LensFlare)da(j.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){m=s.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__webglVertexCount=
-w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,s)}else if(s instanceof THREE.Line){m=s.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__webglLineCount=w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,s)}else if(s instanceof THREE.ParticleSystem){m=s.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=
-c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__sortArray=[];k.__webglParticleCount=w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,s)}else if(THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes)j.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});else s instanceof THREE.Sprite&&j.__webglSprites.push(s);f.__objectsAdded.splice(0,
-1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];j=f;m=void 0;k=void 0;for(m=j.__webglObjects.length-1;m>=0;m--){k=j.__webglObjects[m].object;if(s==k){j.__webglObjects.splice(m,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(j=f.__webglObjects.length;s<j;s++)L(f.__webglObjects[s].object,f);s=0;for(j=f.__webglShadowVolumes.length;s<j;s++)L(f.__webglShadowVolumes[s].object,f);s=0;for(j=f.__webglLensFlares.length;s<j;s++)L(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,
-s){if(f){!s||s=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}r instanceof THREE.ShadowVolume?da(j.__webglShadowVolumes,w,r):da(j.__webglObjects,w,r)}}else if(r instanceof THREE.LensFlare)da(j.__webglLensFlares,undefined,r);else if(r instanceof THREE.Ribbon){m=r.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__webglVertexCount=
+w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,r)}else if(r instanceof THREE.Line){m=r.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__webglLineCount=w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,r)}else if(r instanceof THREE.ParticleSystem){m=r.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=
+c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;w=k.vertices.length;k.__vertexArray=new Float32Array(w*3);k.__colorArray=new Float32Array(w*3);k.__sortArray=[];k.__webglParticleCount=w;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,r)}else if(THREE.MarchingCubes!==undefined&&r instanceof THREE.MarchingCubes)j.__webglObjectsImmediate.push({object:r,opaque:{list:[],count:0},transparent:{list:[],count:0}});else r instanceof THREE.Sprite&&j.__webglSprites.push(r);f.__objectsAdded.splice(0,
+1)}for(;f.__objectsRemoved.length;){r=f.__objectsRemoved[0];j=f;m=void 0;k=void 0;if(r instanceof THREE.Mesh)for(m=j.__webglObjects.length-1;m>=0;m--){k=j.__webglObjects[m].object;if(r==k){j.__webglObjects.splice(m,1);break}}else if(r instanceof THREE.Sprite)for(m=j.__webglSprites.length-1;m>=0;m--){k=j.__webglSprites[m];if(r==k){j.__webglSprites.splice(m,1);break}}f.__objectsRemoved.splice(0,1)}r=0;for(j=f.__webglObjects.length;r<j;r++)L(f.__webglObjects[r].object,f);r=0;for(j=f.__webglShadowVolumes.length;r<
+j;r++)L(f.__webglShadowVolumes[r].object,f);r=0;for(j=f.__webglLensFlares.length;r<j;r++)L(f.__webglLensFlares[r].object,f)};this.setFaceCulling=function(f,r){if(f){!r||r=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBAFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==
 undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};

+ 0 - 2
examples/webgl_sprites.html

@@ -94,8 +94,6 @@
 				sprite.opacity = 1;
 				scene.addChild( sprite );
 
-
-
 				// renderer
 
 				renderer = new THREE.WebGLRenderer();

+ 77 - 58
src/renderers/WebGLRenderer.js

@@ -3133,11 +3133,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 		}
 
 		// render 2d
-		
+
 		if ( scene.__webglSprites.length ) {
-			
+
 			renderSprites( scene, camera );
-			
+
 		}
 
 		// render stencil shadows
@@ -3324,23 +3324,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 		var halfViewportWidth = _viewportWidth * 0.5;
 		var halfViewportHeight = _viewportHeight * 0.5;
 		var mergeWith3D = true;
-		
 
 		// setup gl
-		
+
 		_gl.useProgram( _sprite.program );
 		_currentProgram = _sprite.program;
 		_oldBlending = "";
 
 		if ( !_spriteAttributesEnabled ) {
-	
+
 			_gl.enableVertexAttribArray( _sprite.attributes.position );
 			_gl.enableVertexAttribArray( _sprite.attributes.uv );
-			
+
 			_spriteAttributesEnabled = true;
 
 		}
-		
+
 		_gl.disable( _gl.CULL_FACE );
 		_gl.enable( _gl.BLEND );
 		_gl.depthMask( true );
@@ -3350,65 +3349,64 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 2 * 8, 8 );
 
 		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _sprite.elementBuffer );
-		
+
 		_gl.uniformMatrix4fv( uniforms.projectionMatrix, false, _projectionMatrixArray );
 
 		_gl.activeTexture( _gl.TEXTURE0 );
 		_gl.uniform1i( uniforms.map, 0 );
-		
+
 		// update positions and sort
-		
+
 		for( o = 0, ol = scene.__webglSprites.length; o < ol; o++ ) {
-			
+
 			object = scene.__webglSprites[ o ];
-			
+
 			if( !object.useScreenCoordinates ) {
-			
+
 				object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 				object.z = -object._modelViewMatrix.n34;
-			
+
 			} else {
-				
+
 				object.z = -object.position.z;
-				
+
 			}
-		
+
 		}
 
 		scene.__webglSprites.sort( painterSort );
-		
 
 		// render all non-custom shader sprites
-				
-		for( o = 0, ol = scene.__webglSprites.length; o < ol; o++ ) {
+
+		for ( o = 0, ol = scene.__webglSprites.length; o < ol; o++ ) {
 
 			object = scene.__webglSprites[ o ];
 
-			if( object.material === undefined ) {
+			if ( object.material === undefined ) {
+
+				if ( object.map && object.map.image && object.map.image.width ) {
+
+					if ( object.useScreenCoordinates ) {
 
-				if( object.map && object.map.image && object.map.image.width ) {
-	
-					if( object.useScreenCoordinates ) {
-						
 						_gl.uniform1i( uniforms.useScreenCoordinates, 1 );
 						_gl.uniform3f( uniforms.screenPosition, ( object.position.x - halfViewportWidth  ) / halfViewportWidth, 
 														        ( halfViewportHeight - object.position.y ) / halfViewportHeight,
 														          Math.max( 0, Math.min( 1, object.position.z )));
-						
+
 					} else {
 
-						
+
 
 						_gl.uniform1i( uniforms.useScreenCoordinates, 0 );
 						_gl.uniform1i( uniforms.affectedByDistance, object.affectedByDistance ? 1 : 0 );
 						_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
-						
+
 					}
-				
+
 					size = object.map.image.width / ( object.affectedByDistance ? 1 : _viewportHeight );
 					scale[ 0 ] = size * invAspect * object.scale.x;
 					scale[ 1 ] = size * object.scale.y;
-				
+
 					_gl.uniform2f( uniforms.uvScale, object.uvScale.x, object.uvScale.y );
 					_gl.uniform2f( uniforms.uvOffset, object.uvOffset.x, object.uvOffset.y );
 					_gl.uniform2f( uniforms.alignment, object.alignment.x, object.alignment.y );
@@ -3416,39 +3414,40 @@ THREE.WebGLRenderer = function ( parameters ) {
 					_gl.uniform1f( uniforms.rotation, object.rotation );
 					_gl.uniform2fv( uniforms.scale, scale );
 
-					if( object.mergeWith3D && !mergeWith3D ) {
-						
+					if ( object.mergeWith3D && !mergeWith3D ) {
+
 						_gl.enable( _gl.DEPTH_TEST );
 						mergeWith3D = true;
-						
-					} else if( !object.mergeWith3D && mergeWith3D ) {
-						
+
+					} else if ( !object.mergeWith3D && mergeWith3D ) {
+
 						_gl.disable( _gl.DEPTH_TEST );
 						mergeWith3D = false;
-						
+
 					}
-	
+
 					setBlending( object.blending );
 					setTexture( object.map, 0 );
-			
+
 					_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
 				}
-				
+
 			} else {
-				
+
 				anyCustom = true;
-				
+
 			}
-			
+
 		}
 
 
 		// loop through all custom
 
-/*		if( anyCustom ) {
-			
+		/*
+		if( anyCustom ) {
+
 		}
-*/
+		*/
 
 		// restore gl
 
@@ -3706,11 +3705,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-/*		for ( var o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
+		/*
+		for ( var o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
 
 			updateObject( scene.__webglSprites[ o ].object, scene );
 
-		}*/
+		}
+		*/
 
 	};
 
@@ -3834,11 +3835,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 			addBufferImmediate( scene.__webglObjectsImmediate, object );
 
 		} else if ( object instanceof THREE.Sprite ) {
-			
+
 			scene.__webglSprites.push( object );
 		}
-		
-		
+
 		/*else if ( object instanceof THREE.Particle ) {
 
 		}*/
@@ -3942,20 +3942,39 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var o, ol, zobject;
 
-		for ( o = scene.__webglObjects.length - 1; o >= 0; o-- ) {
+		if ( object instanceof THREE.Mesh ) {
+
+			for ( o = scene.__webglObjects.length - 1; o >= 0; o -- ) {
+
+				zobject = scene.__webglObjects[ o ].object;
+
+				if ( object == zobject ) {
+
+					scene.__webglObjects.splice( o, 1 );
+					return;
 
-			zobject = scene.__webglObjects[ o ].object;
+				}
+
+			}
+
+		} else if ( object instanceof THREE.Sprite ) {
+
+			for ( o = scene.__webglSprites.length - 1; o >= 0; o -- ) {
 
-			if ( object == zobject ) {
+				zobject = scene.__webglSprites[ o ];
 
-				scene.__webglObjects.splice( o, 1 );
-				return;
+				if ( object == zobject ) {
+
+					scene.__webglSprites.splice( o, 1 );
+					return;
+
+				}
 
 			}
 
 		}
-		
-		// add shadwos/sprites etc.
+
+		// add shadows, etc
 
 	};