Browse Source

Merge branch 'master' of git://github.com/mrdoob/three.js

Mikael Emtinger 14 years ago
parent
commit
7816ffe1d1

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 .DS_Store
 *.swp
+.project

+ 297 - 291
build/Three.js

@@ -12,34 +12,34 @@ 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,J,W,B){B=B.clone().subSelf(J);W=W.clone().subSelf(J);var U=H.clone().subSelf(J);H=B.dot(B);J=B.dot(W);B=B.dot(U);var N=W.dot(W);W=W.dot(U);U=1/(H*N-J*J);N=(N*B-J*W)*U;H=(H*W-J*B)*U;return N>0&&H>0&&N+H<1}var c,f,g,h,j,k,m,o,p,t,
-z,u=b.geometry,A=u.vertices,E=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];t=this.origin.clone();z=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(A[g.a].position.clone());j=m.multiplyVector3(A[g.b].position.clone());k=m.multiplyVector3(A[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(A[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());p=z.dot(o);if(b.doubleSided||(b.flipSided?p>0:p<0)){o=o.dot((new THREE.Vector3).sub(h,t))/
-p;t=t.addSelf(z.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(t,h,j,k)){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};E.push(g)}}else if(g instanceof THREE.Face4&&(d(t,h,j,m)||d(t,j,k,m))){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};E.push(g)}}}return E}};
-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,o,p,t){k=!1;d=m;c=o;f=p;g=t;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
-this.add3Points=function(m,o,p,t,z,u){if(k){k=!1;d=m<p?m<z?m:z:p<z?p:z;c=o<t?o<u?o:u:t<u?t:u;f=m>p?m>z?m:z:p>z?p:z;g=o>t?o>u?o:u:t>u?t:u}else{d=m<p?m<z?m<d?m:d:z<d?z:d:p<z?p<d?p:d:z<d?z:d;c=o<t?o<u?o<c?o:c:u<c?u:c:t<u?t<c?t:c:u<c?u:c;f=m>p?m>z?m>f?m:f:z>f?z:f:p>z?p>f?p:f:z>f?z:f;g=o>t?o>u?o>g?o:g:u>g?u:g:t>u?t>g?t:g:u>g?u: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(Q,E,V,C){C=C.clone().subSelf(E);V=V.clone().subSelf(E);var X=Q.clone().subSelf(E);Q=C.dot(C);E=C.dot(V);C=C.dot(X);var R=V.dot(V);V=V.dot(X);X=1/(Q*R-E*E);R=(R*C-E*V)*X;Q=(Q*V-E*C)*X;return R>0&&Q>0&&R+Q<1}var c,f,g,h,j,k,m,p,o,t,
+y,u=b.geometry,B=u.vertices,A=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];t=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,t))/
+o;t=t.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(d(t,h,j,k)){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};A.push(g)}}else if(g instanceof THREE.Face4&&(d(t,h,j,m)||d(t,j,k,m))){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};A.push(g)}}}return A}};
+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,t){k=!1;d=m;c=p;f=o;g=t;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,t,y,u){if(k){k=!1;d=m<o?m<y?m:y:o<y?o:y;c=p<t?p<u?p:u:t<u?t:u;f=m>o?m>y?m:y:o>y?o:y;g=p>t?p>u?p:u:t>u?t:u}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<t?p<u?p<c?p:c:u<c?u:c:t<u?t<c?t:c:u<c?u: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>t?p>u?p>g?p:g:u>g?u:g:t>u?t>g?t:g:u>g?u: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,o,p,t,z,u,A,E){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,p||1,t||0,z||0,u||0,A||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,p,t,z,u,A,E){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=o;this.n33=p;this.n34=t;this.n41=z;this.n42=u;this.n43=A;this.n44=E;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,t,y,u,B,A){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,t||0,y||0,u||0,B||0,A||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,t,y,u,B,A){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=t;this.n41=y;this.n42=u;this.n43=B;this.n44=A;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,o=b.n24,p=b.n31,t=b.n32,z=b.n33,u=b.n34,A=b.n41,E=b.n42,H=b.n43,J=b.n44,W=d.n11,B=d.n12,U=d.n13,N=d.n14,O=d.n21,ua=d.n22,
-la=d.n23,pa=d.n24,ga=d.n31,ha=d.n32,e=d.n33,oa=d.n34;this.n11=c*W+f*O+g*ga;this.n12=c*B+f*ua+g*ha;this.n13=c*U+f*la+g*e;this.n14=c*N+f*pa+g*oa+h;this.n21=j*W+k*O+m*ga;this.n22=j*B+k*ua+m*ha;this.n23=j*U+k*la+m*e;this.n24=j*N+k*pa+m*oa+o;this.n31=p*W+t*O+z*ga;this.n32=p*B+t*ua+z*ha;this.n33=p*U+t*la+z*e;this.n34=p*N+t*pa+z*oa+u;this.n41=A*W+E*O+H*ga;this.n42=A*B+E*ua+H*ha;this.n43=A*U+E*la+H*e;this.n44=A*N+E*pa+H*oa+J;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,t=b.n32,y=b.n33,u=b.n34,B=b.n41,A=b.n42,Q=b.n43,E=b.n44,V=d.n11,C=d.n12,X=d.n13,R=d.n14,P=d.n21,ya=d.n22,
+la=d.n23,ca=d.n24,Ba=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*V+f*P+g*Ba;this.n12=c*C+f*ya+g*ea;this.n13=c*X+f*la+g*e;this.n14=c*R+f*ca+g*oa+h;this.n21=j*V+k*P+m*Ba;this.n22=j*C+k*ya+m*ea;this.n23=j*X+k*la+m*e;this.n24=j*R+k*ca+m*oa+p;this.n31=o*V+t*P+y*Ba;this.n32=o*C+t*ya+y*ea;this.n33=o*X+t*la+y*e;this.n34=o*R+t*ca+y*oa+u;this.n41=B*V+A*P+Q*Ba;this.n42=B*C+A*ya+Q*ea;this.n43=B*X+A*la+Q*e;this.n44=B*R+A*ca+Q*oa+E;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,o=this.n32,p=this.n33,t=this.n34,z=this.n41,u=this.n42,A=this.n43,E=this.n44;return f*j*o*z-c*k*o*z-f*h*p*z+d*k*p*z+c*h*t*z-d*j*t*z-f*j*m*u+c*k*m*u+f*g*p*u-b*k*p*u-c*g*t*u+b*j*t*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*t*A-b*h*t*A-c*h*m*E+d*j*m*E+c*g*o*E-b*j*o*E-d*g*p*E+b*h*p*E},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,t=this.n34,y=this.n41,u=this.n42,B=this.n43,A=this.n44;return f*j*p*y-c*k*p*y-f*h*o*y+d*k*o*y+c*h*t*y-d*j*t*y-f*j*m*u+c*k*m*u+f*g*o*u-b*k*o*u-c*g*t*u+b*j*t*u+f*h*m*B-d*k*m*B-f*g*p*B+b*k*p*B+d*g*t*B-b*h*t*B-c*h*m*A+d*j*m*A+c*g*p*A-b*j*p*A-d*g*o*A+b*h*o*A},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,
 0,1);return this},setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g=
-1-c,h=b.x,j=b.y,k=b.z,m=g*h,o=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,o*j+c,o*k-f*h,0,m*k-f*j,o*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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=
+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=
 new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,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 o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+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+o);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},
+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,o=b.n24,p=b.n31,t=b.n32,z=b.n33,u=b.n34,A=b.n41,E=b.n42,H=b.n43,J=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*E-o*z*E+o*t*H-k*u*H-m*t*J+k*z*J;d.n12=h*z*E-g*u*E-h*t*H+f*u*H+g*t*J-f*z*J;d.n13=g*o*E-h*m*E+h*k*H-f*o*H-g*k*J+f*m*J;d.n14=h*m*t-g*o*t-h*k*z+f*o*z+g*k*u-f*m*u;d.n21=o*z*A-m*u*A-o*p*H+j*u*H+m*p*J-j*z*J;d.n22=g*u*A-h*z*A+h*p*H-c*u*H-g*p*J+c*z*J;d.n23=h*m*A-g*o*A-h*j*H+c*o*H+g*j*J-c*m*J;
-d.n24=g*o*p-h*m*p+h*j*z-c*o*z-g*j*u+c*m*u;d.n31=k*u*A-o*t*A+o*p*E-j*u*E-k*p*J+j*t*J;d.n32=h*t*A-f*u*A-h*p*E+c*u*E+f*p*J-c*t*J;d.n33=g*o*A-h*k*A+h*j*E-c*o*E-f*j*J+c*k*J;d.n34=h*k*p-f*o*p-h*j*t+c*o*t+f*j*u-c*k*u;d.n41=m*t*A-k*z*A-m*p*E+j*z*E+k*p*H-j*t*H;d.n42=f*z*A-g*t*A+g*p*E-c*z*E-f*p*H+c*t*H;d.n43=g*k*A-f*m*A-g*j*E+c*m*E+f*j*H-c*k*H;d.n44=f*m*p-g*k*p+g*j*t-c*m*t-f*j*z+c*k*z;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,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;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*o;c[7]=b*p;c[8]=b*t;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,t=b.n32,y=b.n33,u=b.n34,B=b.n41,A=b.n42,Q=b.n43,E=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*A-p*y*A+p*t*Q-k*u*Q-m*t*E+k*y*E;d.n12=h*y*A-g*u*A-h*t*Q+f*u*Q+g*t*E-f*y*E;d.n13=g*p*A-h*m*A+h*k*Q-f*p*Q-g*k*E+f*m*E;d.n14=h*m*t-g*p*t-h*k*y+f*p*y+g*k*u-f*m*u;d.n21=p*y*B-m*u*B-p*o*Q+j*u*Q+m*o*E-j*y*E;d.n22=g*u*B-h*y*B+h*o*Q-c*u*Q-g*o*E+c*y*E;d.n23=h*m*B-g*p*B-h*j*Q+c*p*Q+g*j*E-c*m*E;
+d.n24=g*p*o-h*m*o+h*j*y-c*p*y-g*j*u+c*m*u;d.n31=k*u*B-p*t*B+p*o*A-j*u*A-k*o*E+j*t*E;d.n32=h*t*B-f*u*B-h*o*A+c*u*A+f*o*E-c*t*E;d.n33=g*p*B-h*k*B+h*j*A-c*p*A-f*j*E+c*k*E;d.n34=h*k*o-f*p*o-h*j*t+c*p*t+f*j*u-c*k*u;d.n41=m*t*B-k*y*B-m*o*A+j*y*A+k*o*Q-j*t*Q;d.n42=f*y*B-g*t*B+g*o*A-c*y*A-f*o*Q+c*t*Q;d.n43=g*k*B-f*m*B-g*j*A+c*m*A+f*j*Q-c*k*Q;d.n44=f*m*o-g*k*o+g*j*t-c*m*t-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,t=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*t;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,o;j=new THREE.Matrix4;k=d-b;m=c-f;o=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/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,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=
 !0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
@@ -48,9 +48,9 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,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},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,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},setFromAxisAngle:function(b,d){var c=d/2,f=Math.sin(c);this.x=b.x*f;this.y=
 b.y*f;this.z=b.z*f;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var 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},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,p=
-m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-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};
+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},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var 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,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*m+c*-h+o*-k-t*-j;d.y=o*m+c*-j+t*-h-p*-k;d.z=t*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};
@@ -58,17 +58,17 @@ 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(fa,va,sa,wa,ca,ja,ma){k=fa.vertices[va].position;m=fa.vertices[sa].position;o=fa.vertices[wa].position;p=j[ca];t=j[ja];z=j[ma];u=m.x-k.x;A=o.x-k.x;E=m.y-k.y;H=o.y-k.y;J=m.z-k.z;W=o.z-k.z;B=t.u-p.u;U=z.u-p.u;N=t.v-p.v;O=z.v-p.v;ua=1/(B*
-O-U*N);ha.set((O*u-N*A)*ua,(O*E-N*H)*ua,(O*J-N*W)*ua);e.set((B*A-U*u)*ua,(B*H-U*E)*ua,(B*W-U*J)*ua);pa[va].addSelf(ha);pa[sa].addSelf(ha);pa[wa].addSelf(ha);ga[va].addSelf(e);ga[sa].addSelf(e);ga[wa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,z,u,A,E,H,J,W,B,U,N,O,ua,la,pa=[],ga=[],ha=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){pa[d]=new THREE.Vector3;ga[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 ka=["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++){Aa.copy(h.vertexNormals[f]);g=h[ka[f]];la=pa[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(ga[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
+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(ja,qa,pa,wa,fa,ka,ma){k=ja.vertices[qa].position;m=ja.vertices[pa].position;p=ja.vertices[wa].position;o=j[fa];t=j[ka];y=j[ma];u=m.x-k.x;B=p.x-k.x;A=m.y-k.y;Q=p.y-k.y;E=m.z-k.z;V=p.z-k.z;C=t.u-o.u;X=y.u-o.u;R=t.v-o.v;P=y.v-o.v;ya=1/(C*
+P-X*R);ea.set((P*u-R*B)*ya,(P*A-R*Q)*ya,(P*E-R*V)*ya);e.set((C*B-X*u)*ya,(C*Q-X*A)*ya,(C*V-X*E)*ya);ca[qa].addSelf(ea);ca[pa].addSelf(ea);ca[wa].addSelf(ea);Ba[qa].addSelf(e);Ba[pa].addSelf(e);Ba[wa].addSelf(e)}var d,c,f,g,h,j,k,m,p,o,t,y,u,B,A,Q,E,V,C,X,R,P,ya,la,ca=[],Ba=[],ea=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,da=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){ca[d]=new THREE.Vector3;Ba[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 va=["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++){da.copy(h.vertexNormals[f]);g=h[va[f]];la=ca[g];oa.copy(la);oa.subSelf(da.multiplyScalar(da.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(Ba[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
 oa.y,oa.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,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}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);
+{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(u,A,E,H,J,W,B){u=(E-u)*0.5;H=(H-A)*0.5;return(2*(A-E)+u+H)*B+(-3*(A-E)-2*u-H)*W+u*J+A}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,p,t,z;this.initFromArray=function(u){this.points=[];for(var A=0;A<u.length;A++)this.points[A]={x:u[A][0],y:u[A][1],z:u[A][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;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;o=this.points[c[0]];p=this.points[c[1]];
-t=this.points[c[2]];z=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,p.x,t.x,z.x,j,k,m);f.y=d(o.y,p.y,t.y,z.y,j,k,m);f.z=d(o.z,p.z,t.z,z.z,j,k,m);return f};this.getControlPointsArray=function(){var u,A,E=this.points.length,H=[];for(u=0;u<E;u++){A=this.points[u];H[u]=[A.x,A.y,A.z]}return H};this.getLength=function(u){var A,E,H=A=A=0,J=new THREE.Vector3,W=new THREE.Vector3,B=[],U=0;B[0]=0;u||(u=100);E=this.points.length*u;J.copy(this.points[0]);for(u=1;u<E;u++){A=u/E;position=this.getPoint(A);W.copy(position);
-U+=W.distanceTo(J);J.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=H){B[A]=U;H=A}}B[B.length]=U;return{chunks:B,total:U}};this.reparametrizeByArcLength=function(u){var A,E,H,J,W,B,U=[],N=new THREE.Vector3,O=this.getLength();U.push(N.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){E=O.chunks[A]-O.chunks[A-1];B=Math.ceil(u*E/O.total);J=(A-1)/(this.points.length-1);W=A/(this.points.length-1);for(E=1;E<B-1;E++){H=J+E*(1/B)*(W-J);position=this.getPoint(H);U.push(N.copy(position).clone())}U.push(N.copy(this.points[A]).clone())}this.points=
-U}};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.Spline=function(b){function d(u,B,A,Q,E,V,C){u=(A-u)*0.5;Q=(Q-B)*0.5;return(2*(B-A)+u+Q)*C+(-3*(B-A)-2*u-Q)*V+u*E+B}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,p,o,t,y;this.initFromArray=function(u){this.points=[];for(var B=0;B<u.length;B++)this.points[B]={x:u[B][0],y:u[B][1],z:u[B][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;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]];
+t=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(p.x,o.x,t.x,y.x,j,k,m);f.y=d(p.y,o.y,t.y,y.y,j,k,m);f.z=d(p.z,o.z,t.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,B,A=this.points.length,Q=[];for(u=0;u<A;u++){B=this.points[u];Q[u]=[B.x,B.y,B.z]}return Q};this.getLength=function(u){var B,A,Q=B=B=0,E=new THREE.Vector3,V=new THREE.Vector3,C=[],X=0;C[0]=0;u||(u=100);A=this.points.length*u;E.copy(this.points[0]);for(u=1;u<A;u++){B=u/A;position=this.getPoint(B);V.copy(position);
+X+=V.distanceTo(E);E.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=Q){C[B]=X;Q=B}}C[C.length]=X;return{chunks:C,total:X}};this.reparametrizeByArcLength=function(u){var B,A,Q,E,V,C,X=[],R=new THREE.Vector3,P=this.getLength();X.push(R.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){A=P.chunks[B]-P.chunks[B-1];C=Math.ceil(u*A/P.total);E=(B-1)/(this.points.length-1);V=B/(this.points.length-1);for(A=1;A<C-1;A++){Q=E+A*(1/C)*(V-E);position=this.getPoint(Q);X.push(R.copy(position).clone())}X.push(R.copy(this.points[B]).clone())}this.points=
+X}};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.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -122,73 +122,73 @@ 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,o,p,t,z,u,A=new THREE.Geometry;A.vertices=this.geometry.vertices;f=A.faces=this.geometry.faces;var E=A.egdes=this.geometry.edges,H=A.edgeFaces=[];g=0;var J=[];b=0;for(d=f.length;b<d;b++){c=f[b];J.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=E.length;b<d;b++){k=E[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";p=J[g]+0}else if(c.b===j){m="b";p=J[g]+1}else if(c.c===j){m="c";p=J[g]+2}else if(c.d===j){m="d";p=J[g]+3}if(c.a===k){m+="a";t=J[g]+0}else if(c.b===k){m+="b";t=J[g]+1}else if(c.c===k){m+="c";t=J[g]+2}else if(c.d===k){m+="d";t=J[g]+3}if(f.a===j){o="a";z=J[h]+0}else if(f.b===j){o="b";z=J[h]+1}else if(f.c===j){o="c";z=J[h]+2}else if(f.d===
-j){o="d";z=J[h]+3}if(f.a===k){o+="a";u=J[h]+0}else if(f.b===k){o+="b";u=J[h]+1}else if(f.c===k){o+="c";u=J[h]+2}else if(f.d===k){o+="d";u=J[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(p>t){c=p;p=t;t=c}}else if(p<t){c=p;p=t;t=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(z>u){c=z;z=u;u=c}}else if(z<u){c=z;z=u;u=c}c=new THREE.Face4(p,t,z,u);c.normal.set(1,0,0);H.push(c)}this.geometry=A}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,o,p,t=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
-for(k=0;k<o;k++){p=b[j[t[k]]];d.push(new THREE.Vertex(p.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,o,p,t,z,u,A,E,H=0,J=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=d[J[A]];k=b[h];for(E=0;E<g;E++){j=c[J[E]];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){o=k;p=m;t=h;z=j;u=J[A]}if(H===2){u+=J[A];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[o,p,m,k],indices:[t,
-z,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,p],indices:[t,h,j,z],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,t,y,u,B=new THREE.Geometry;B.vertices=this.geometry.vertices;f=B.faces=this.geometry.faces;var A=B.egdes=this.geometry.edges,Q=B.edgeFaces=[];g=0;var E=[];b=0;for(d=f.length;b<d;b++){c=f[b];E.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=A.length;b<d;b++){k=A[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=E[g]+0}else if(c.b===j){m="b";o=E[g]+1}else if(c.c===j){m="c";o=E[g]+2}else if(c.d===j){m="d";o=E[g]+3}if(c.a===k){m+="a";t=E[g]+0}else if(c.b===k){m+="b";t=E[g]+1}else if(c.c===k){m+="c";t=E[g]+2}else if(c.d===k){m+="d";t=E[g]+3}if(f.a===j){p="a";y=E[h]+0}else if(f.b===j){p="b";y=E[h]+1}else if(f.c===j){p="c";y=E[h]+2}else if(f.d===
+j){p="d";y=E[h]+3}if(f.a===k){p+="a";u=E[h]+0}else if(f.b===k){p+="b";u=E[h]+1}else if(f.c===k){p+="c";u=E[h]+2}else if(f.d===k){p+="d";u=E[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(o>t){c=o;o=t;t=c}}else if(o<t){c=o;o=t;t=c}if(p==="ac"||p==="ad"||p==="ca"||p==="da"){if(y>u){c=y;y=u;u=c}}else if(y<u){c=y;y=u;u=c}c=new THREE.Face4(o,t,y,u);c.normal.set(1,0,0);Q.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,t=["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[t[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,t,y,u,B,A,Q=0,E=["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[E[B]];k=b[h];for(A=0;A<g;A++){j=c[E[A]];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){Q++;if(Q===1){p=k;o=m;t=h;y=j;u=E[B]}if(Q===2){u+=E[B];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[p,o,m,k],indices:[t,
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,m,o],indices:[t,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);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else 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 ha=m[k]=m[k]||new THREE.RenderableVertex;k++;return ha}function d(ha,e){return e.z-ha.z}function c(ha,e){var oa=0,Da=1,Aa=ha.z+ha.w,ka=e.z+e.w,fa=-ha.z+ha.w,va=-e.z+e.w;if(Aa>=0&&ka>=0&&fa>=0&&va>=0)return!0;else if(Aa<0&&ka<0||fa<0&&va<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-ka));else ka<0&&(Da=Math.min(Da,Aa/(Aa-ka)));if(fa<0)oa=Math.max(oa,fa/(fa-va));else va<0&&(Da=Math.min(Da,fa/(fa-va)));if(Da<oa)return!1;else{ha.lerpSelf(e,oa);e.lerpSelf(ha,
-1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,p,t=[],z,u=[],A,E,H=[],J,W,B=[],U=new THREE.Vector4,N=new THREE.Vector4,O=new THREE.Matrix4,ua=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ha,e){O.multiply(e.projectionMatrix,e.matrixWorldInverse);O.multiplyVector3(ha);return ha};this.unprojectVector=function(ha,e){O.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
-O.multiplyVector3(ha);return ha};this.projectObjects=function(ha,e,oa){e=[];var Da,Aa,ka;g=0;Aa=ha.objects;ha=0;for(Da=Aa.length;ha<Da;ha++){ka=Aa[ha];var fa;if(!(fa=!ka.visible))if(fa=ka instanceof THREE.Mesh){a:{fa=void 0;for(var va=ka.matrixWorld,sa=-ka.geometry.boundingSphere.radius*Math.max(ka.scale.x,Math.max(ka.scale.y,ka.scale.z)),wa=0;wa<6;wa++){fa=la[wa].x*va.n14+la[wa].y*va.n24+la[wa].z*va.n34+la[wa].w;if(fa<=sa){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
-g++;f=fa;U.copy(ka.position);O.multiplyVector3(U);f.object=ka;f.z=U.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ha,e,oa){var Da=[],Aa=e.near,ka=e.far,fa,va,sa,wa,ca,ja,ma,Fa,ia,da,Ja,Xa,Za,Ta,R,S,P;W=E=z=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ha.update(undefined,!1,e);O.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);la[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);la[2].set(O.n41+O.n21,O.n42+O.n22,
-O.n43+O.n23,O.n44+O.n24);la[3].set(O.n41-O.n21,O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);la[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);la[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(fa=0;fa<6;fa++){ia=la[fa];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}ia=this.projectObjects(ha,e,!0);ha=0;for(fa=ia.length;ha<fa;ha++){da=ia[ha].object;if(da.visible){Ja=da.matrixWorld;Xa=da.matrixRotationWorld;Za=da.materials;Ta=da.overdraw;k=0;if(da instanceof THREE.Mesh){R=da.geometry;
-wa=R.vertices;S=R.faces;R=R.faceVertexUvs;va=0;for(sa=wa.length;va<sa;va++){j=b();j.positionWorld.copy(wa[va].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);O.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<ka}wa=0;for(va=S.length;wa<va;wa++){sa=S[wa];if(sa instanceof THREE.Face3){ca=m[sa.a];ja=m[sa.b];ma=m[sa.c];if(ca.visible&&ja.visible&&ma.visible&&
-(da.doubleSided||da.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0)){Fa=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ja);o.v3.copy(ma)}else continue}else if(sa instanceof THREE.Face4){ca=m[sa.a];ja=m[sa.b];ma=m[sa.c];Fa=m[sa.d];if(ca.visible&&ja.visible&&ma.visible&&Fa.visible&&(da.doubleSided||da.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
-(ja.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0||(ja.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ja.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){P=u[z]=u[z]||new THREE.RenderableFace4;z++;o=P;o.v1.copy(ca);o.v2.copy(ja);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(sa.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(sa.centroid);
-Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);O.multiplyVector3(o.centroidScreen);ma=sa.vertexNormals;ca=0;for(ja=ma.length;ca<ja;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ja=R.length;ca<ja;ca++)if(P=R[ca][wa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=sa.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(da instanceof THREE.Line){ua.multiply(O,Ja);wa=da.geometry.vertices;
-ca=b();ca.positionScreen.copy(wa[0].position);ua.multiplyVector4(ca.positionScreen);va=1;for(sa=wa.length;va<sa;va++){ca=b();ca.positionScreen.copy(wa[va].position);ua.multiplyVector4(ca.positionScreen);ja=m[k-2];pa.copy(ca.positionScreen);ga.copy(ja.positionScreen);if(c(pa,ga)){pa.multiplyScalar(1/pa.w);ga.multiplyScalar(1/ga.w);Ja=H[E]=H[E]||new THREE.RenderableLine;E++;A=Ja;A.v1.positionScreen.copy(pa);A.v2.positionScreen.copy(ga);A.z=Math.max(pa.z,ga.z);A.materials=da.materials;Da.push(A)}}}else if(da instanceof
-THREE.Particle){N.set(da.position.x,da.position.y,da.position.z,1);O.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){Ja=B[W]=B[W]||new THREE.RenderableParticle;W++;J=Ja;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=da.rotation.z;J.scale.x=da.scale.x*Math.abs(J.x-(N.x+e.projectionMatrix.n11)/(N.w+e.projectionMatrix.n14));J.scale.y=da.scale.y*Math.abs(J.y-(N.y+e.projectionMatrix.n22)/(N.w+e.projectionMatrix.n24));J.materials=da.materials;Da.push(J)}}}}oa&&Da.sort(d);return Da}};
-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,o,p,t,z,u,A,E;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){z=b[m];if(z instanceof THREE.RenderableParticle){A=z.x*g+g;E=z.y*h+h;p=0;for(t=z.material.length;p<t;p++){u=z.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=E+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(E!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}E=Ga}}function c(Ga){if(H!=Ga)t.strokeStyle=H=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),z=new THREE.Color(0),u=0,A=
-1,E=0,H=null,J=null,W=null,B=null,U=null,N,O,ua,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ka,fa,va,sa,wa,ca,ja,ma=new THREE.Color,Fa=new THREE.Color,ia=new THREE.Color,da=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,C,x=new THREE.Rectangle,w=new THREE.Rectangle,y=new THREE.Rectangle,Q=!1,K=new THREE.Color,F=new THREE.Color,T=new THREE.Color,G=new THREE.Color,I=new THREE.Vector3,L,Z,Y,qa,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
-2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);qa=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;E=0;U=B=W=J=H=null};this.setClearColor=function(Ga,xa){z=Ga;u=xa};
-this.setClearColorHex=function(Ga,xa){z.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!w.isEmpty()){w.inflate(1);w.minSelf(x);if(z.hex==0&&u==0)t.clearRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+u+")";t.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight())}w.empty()}};this.render=function(Ga,xa){function Ea(V){var na,ea,$,ta=V.lights;F.setRGB(0,
-0,0);T.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=ta.length;V<na;V++){ea=ta[V];$=ea.color;if(ea instanceof THREE.AmbientLight){F.r+=$.r;F.g+=$.g;F.b+=$.b}else if(ea instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ea instanceof THREE.PointLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}}}function za(V,na,ea,$){var ta,ra,ya,X,Ia=V.lights;V=0;for(ta=Ia.length;V<ta;V++){ra=Ia[V];ya=ra.color;if(ra instanceof THREE.DirectionalLight){X=ea.dot(ra.position);if(!(X<=0)){X*=ra.intensity;$.r+=ya.r*X;$.g+=
-ya.g*X;$.b+=ya.b*X}}else if(ra instanceof THREE.PointLight){X=ea.dot(I.sub(ra.position,na).normalize());if(!(X<=0)){X*=ra.distance==0?1:1-Math.min(na.distanceTo(ra.position)/ra.distance,1);if(X!=0){X*=ra.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(V,na,ea){b(ea.opacity);d(ea.blending);var $,ta,ra,ya,X,Ia;if(ea instanceof THREE.ParticleBasicMaterial){if(ea.map){ya=ea.map.image;X=ya.width>>1;Ia=ya.height>>1;ea=na.scale.x*o;ra=na.scale.y*p;$=ea*X;ta=ra*Ia;y.set(V.x-$,V.y-ta,V.x+$,V.y+
-ta);if(x.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-ra);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ta=na.scale.y*p;y.set(V.x-$,V.y-ta,V.x+$,V.y+ta);if(x.instersects(y)){c(ea.color.__styleString);ra=ea.color.__styleString;if(J!=ra)t.fillStyle=J=ra;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ta);ea.program(t);t.restore()}}}function D(V,na,ea,$){b($.opacity);d($.blending);
-t.beginPath();t.moveTo(V.positionScreen.x,V.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;V=$.linewidth;if(W!=V)t.lineWidth=W=V;V=$.linecap;if(B!=V)t.lineCap=B=V;V=$.linejoin;if(U!=V)t.lineJoin=U=V;c(ma.__styleString);t.stroke();y.inflate($.linewidth*2)}}function aa(V,na,ea,$,ta,ra,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ha=V.positionScreen.x;e=V.positionScreen.y;
-oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ea.positionScreen.x;ka=ea.positionScreen.y;ab(ha,e,oa,Da,Aa,ka);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ha,e,oa,Da,Aa,ka,X.map.image,R[$].u,R[$].v,R[ta].u,R[ta].v,R[ra].u,R[ra].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){V=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;P=-(I.x*V.n21+I.y*V.n22+
-I.z*V.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;La=-(I.x*V.n21+I.y*V.n22+I.z*V.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*V.n11+I.y*V.n12+I.z*V.n13)*0.5+0.5;C=-(I.x*V.n21+I.y*V.n22+I.z*V.n23)*0.5+0.5;cb(ha,e,oa,Da,Aa,ka,X.envMap.image,S,P,Ba,La,n,C)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
-THREE.UVMapping){R=ya.uvs[0];cb(ha,e,oa,Da,Aa,ka,X.map.image,R[$].u,R[$].v,R[ta].u,R[ta].v,R[ra].u,R[ra].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ia.r=da.r=F.r;Fa.g=ia.g=da.g=F.g;Fa.b=ia.b=da.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ia);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],da);Ja.r=(ia.r+da.r)*0.5;Ja.g=(ia.g+da.g)*0.5;Ja.b=(ia.b+da.b)*
-0.5;Ta=hb(Fa,ia,da,Ja);cb(ha,e,oa,Da,Aa,ka,Ta,0,0,1,0,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
-xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(V.positionScreen.z,Xa,Za);ia.r=ia.g=ia.b=1-Wa(na.positionScreen.z,Xa,Za);da.r=da.g=da.b=1-Wa(ea.positionScreen.z,Xa,Za);Ja.r=(ia.r+da.r)*0.5;Ja.g=(ia.g+da.g)*0.5;Ja.b=(ia.b+da.b)*0.5;Ta=hb(Fa,ia,da,Ja);cb(ha,e,oa,Da,Aa,ka,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
-Qa(ma.__styleString)}}function v(V,na,ea,$,ta,ra,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(V,na,$,0,1,3,ya,X,Ia);aa(ta,ea,ra,1,2,3,ya,X,Ia)}else{ha=V.positionScreen.x;e=V.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ea.positionScreen.x;ka=ea.positionScreen.y;fa=$.positionScreen.x;va=$.positionScreen.y;sa=ta.positionScreen.x;wa=ta.positionScreen.y;ca=ra.positionScreen.x;ja=ra.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ha,
-e,oa,Da,Aa,ka,fa,va);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ia.r=da.r=Ja.r=F.r;Fa.g=ia.g=da.g=Ja.g=F.g;Fa.b=ia.b=da.b=Ja.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ia);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
-da);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ia,da,Ja);ab(ha,e,oa,Da,fa,va);cb(ha,e,oa,Da,fa,va,Ta,0,0,1,0,0,1);ab(sa,wa,Aa,ka,ca,ja);cb(sa,wa,Aa,ka,ca,ja,Ta,1,0,1,1,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ha,e,oa,Da,Aa,ka,fa,va);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ha,e,oa,
-Da,Aa,ka,fa,va);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ha,e,oa,Da,Aa,ka,fa,va);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
-Fa.g=Fa.b=1-Wa(V.positionScreen.z,Xa,Za);ia.r=ia.g=ia.b=1-Wa(na.positionScreen.z,Xa,Za);da.r=da.g=da.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ea.positionScreen.z,Xa,Za);Ta=hb(Fa,ia,da,Ja);ab(ha,e,oa,Da,fa,va);cb(ha,e,oa,Da,fa,va,Ta,0,0,1,0,0,1);ab(sa,wa,Aa,ka,ca,ja);cb(sa,wa,Aa,ka,ca,ja,Ta,1,0,1,1,0,1)}}}function ab(V,na,ea,$,ta,ra){t.beginPath();t.moveTo(V,na);t.lineTo(ea,$);t.lineTo(ta,ra);t.lineTo(V,na);t.closePath()}function fb(V,na,ea,$,ta,ra,ya,X){t.beginPath();t.moveTo(V,na);t.lineTo(ea,
-$);t.lineTo(ta,ra);t.lineTo(ya,X);t.lineTo(V,na);t.closePath()}function Oa(V,na,ea,$){if(W!=na)t.lineWidth=W=na;if(B!=ea)t.lineCap=B=ea;if(U!=$)t.lineJoin=U=$;c(V);t.stroke();y.inflate(na*2)}function Qa(V){if(J!=V)t.fillStyle=J=V;t.fill()}function cb(V,na,ea,$,ta,ra,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ea-=V;$-=na;ta-=V;ra-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ea-eb*ta)*db;eb=(kb*$-eb*ra)*db;ea=(Ya*ta-
-Sa*ea)*db;$=(Ya*ra-Sa*$)*db;V=V-gb*X-ea*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ea,$,V,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(V,na,ea,$){var ta=~~(V.r*255),ra=~~(V.g*255);V=~~(V.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ea.r*255),Ya=~~(ea.g*255);ea=~~(ea.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);qa[0]=ta<0?0:ta>255?255:ta;qa[1]=ra<0?0:ra>255?255:ra;qa[2]=V<0?0:V>255?255:V;qa[4]=ya<0?0:ya>255?255:ya;qa[5]=X<0?0:X>255?255:X;qa[6]=na<0?
-0:na>255?255:na;qa[8]=Ia<0?0:Ia>255?255:Ia;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=ea<0?0:ea>255?255:ea;qa[12]=eb<0?0:eb>255?255:eb;qa[13]=Sa<0?0:Sa>255?255:Sa;qa[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(V,na,ea){V=(V-na)/(ea-na);return V*V*(3-2*V)}function $a(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Ma(V,na){var ea=na.x-V.x,$=na.y-V.y,ta=1/Math.sqrt(ea*ea+$*$);ea*=ta;$*=ta;na.x+=ea;na.y+=$;V.x-=ea;V.y-=$}var bb,Va,M,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
-t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){M=g[bb];y.empty();if(M instanceof THREE.RenderableParticle){N=M;N.x*=o;N.y*=p;Na=0;for(Ra=M.materials.length;Na<Ra;){Pa=M.materials[Na++];Pa.opacity!=0&&Ua(N,M,Pa,Ga)}}else if(M instanceof THREE.RenderableLine){N=M.v1;O=M.v2;N.positionScreen.x*=o;N.positionScreen.y*=p;O.positionScreen.x*=o;O.positionScreen.y*=p;y.addPoint(N.positionScreen.x,
-N.positionScreen.y);y.addPoint(O.positionScreen.x,O.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.materials.length;Na<Ra;){Pa=M.materials[Na++];Pa.opacity!=0&&D(N,O,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace3){N=M.v1;O=M.v2;ua=M.v3;N.positionScreen.x*=o;N.positionScreen.y*=p;O.positionScreen.x*=o;O.positionScreen.y*=p;ua.positionScreen.x*=o;ua.positionScreen.y*=p;if(M.overdraw){Ma(N.positionScreen,O.positionScreen);Ma(O.positionScreen,ua.positionScreen);Ma(ua.positionScreen,N.positionScreen)}y.add3Points(N.positionScreen.x,
-N.positionScreen.y,O.positionScreen.x,O.positionScreen.y,ua.positionScreen.x,ua.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}else Pa.opacity!=0&&aa(N,O,ua,0,1,2,M,Pa,Ga)}}}else if(M instanceof THREE.RenderableFace4){N=M.v1;O=M.v2;ua=M.v3;la=M.v4;N.positionScreen.x*=o;N.positionScreen.y*=
-p;O.positionScreen.x*=o;O.positionScreen.y*=p;ua.positionScreen.x*=o;ua.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;pa.positionScreen.copy(O.positionScreen);ga.positionScreen.copy(la.positionScreen);if(M.overdraw){Ma(N.positionScreen,O.positionScreen);Ma(O.positionScreen,la.positionScreen);Ma(la.positionScreen,N.positionScreen);Ma(ua.positionScreen,pa.positionScreen);Ma(ua.positionScreen,ga.positionScreen)}y.addPoint(N.positionScreen.x,N.positionScreen.y);y.addPoint(O.positionScreen.x,
-O.positionScreen.y);y.addPoint(ua.positionScreen.x,ua.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(y)){Na=0;for(Ra=M.meshMaterials.length;Na<Ra;){Pa=M.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=M.faceMaterials.length;ib<jb;)(Pa=M.faceMaterials[ib++])&&Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}else Pa.opacity!=0&&v(N,O,ua,la,pa,ga,M,Pa,Ga)}}}w.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(fa,va,sa){var wa,ca,ja,ma;wa=0;for(ca=fa.lights.length;wa<ca;wa++){ja=fa.lights[wa];if(ja instanceof THREE.DirectionalLight){ma=va.normalWorld.dot(ja.position)*ja.intensity;if(ma>0){sa.r+=ja.color.r*ma;sa.g+=ja.color.g*ma;sa.b+=ja.color.b*ma}}else if(ja instanceof THREE.PointLight){ga.sub(ja.position,va.centroidWorld);ga.normalize();ma=va.normalWorld.dot(ga)*ja.intensity;if(ma>0){sa.r+=ja.color.r*ma;sa.g+=ja.color.g*ma;sa.b+=ja.color.b*ma}}}}function d(fa,va,
-sa,wa,ca,ja){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+va.positionScreen.x+" "+va.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)U.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(B){N.r=O.r;N.g=O.g;N.b=O.b;b(ja,wa,N);U.r=ca.color.r*N.r;U.g=ca.color.g*N.g;U.b=ca.color.b*N.b;U.updateStyleString()}else U.__styleString=
-ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){pa=1-ca.__2near/(ca.__farPlusNear-wa.z*ca.__farMinusNear);U.setRGB(pa,pa,pa)}else ca instanceof THREE.MeshNormalMaterial&&U.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+U.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
-"fill: "+U.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,va,sa,wa,ca,ja,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+va.positionScreen.x+" "+va.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(ja instanceof THREE.MeshBasicMaterial)U.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshLambertMaterial)if(B){N.r=
-O.r;N.g=O.g;N.b=O.b;b(ma,ca,N);U.r=ja.color.r*N.r;U.g=ja.color.g*N.g;U.b=ja.color.b*N.b;U.updateStyleString()}else U.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshDepthMaterial){pa=1-ja.__2near/(ja.__farPlusNear-ca.z*ja.__farMinusNear);U.setRGB(pa,pa,pa)}else ja instanceof THREE.MeshNormalMaterial&&U.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ja.wireframe?oa.setAttribute("style","fill: none; stroke: "+U.__styleString+"; stroke-width: "+ja.wireframeLinewidth+
-"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.wireframeLinecap+"; stroke-linejoin: "+ja.wireframeLinejoin):oa.setAttribute("style","fill: "+U.__styleString+"; fill-opacity: "+ja.opacity);m.appendChild(oa)}function f(fa){if(ha[fa]==null){ha[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&ha[fa].setAttribute("shape-rendering","crispEdges")}return ha[fa]}function g(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
-m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,z,u,A,E,H,J=new THREE.Rectangle,W=new THREE.Rectangle,B=!1,U=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),ua=new THREE.Color(0),la=new THREE.Color(0),pa,ga=new THREE.Vector3,ha=[],e=[],oa,Da,Aa,ka=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(fa){switch(fa){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(fa,
-va){o=fa;p=va;t=o/2;z=p/2;m.setAttribute("viewBox",-t+" "+-z+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);J.set(-t,-z,t,z)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,va){var sa,wa,ca,ja,ma,Fa,ia,da;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,va,this.sortElements);Aa=Da=0;if(B=fa.lights.length>0){ia=fa.lights;O.setRGB(0,0,0);ua.setRGB(0,0,0);la.setRGB(0,0,0);sa=0;for(wa=ia.length;sa<
-wa;sa++){ca=ia[sa];ja=ca.color;if(ca instanceof THREE.AmbientLight){O.r+=ja.r;O.g+=ja.g;O.b+=ja.b}else if(ca instanceof THREE.DirectionalLight){ua.r+=ja.r;ua.g+=ja.g;ua.b+=ja.b}else if(ca instanceof THREE.PointLight){la.r+=ja.r;la.g+=ja.g;la.b+=ja.b}}}sa=0;for(wa=j.length;sa<wa;sa++){ia=j[sa];W.empty();if(ia instanceof THREE.RenderableParticle){u=ia;u.x*=t;u.y*=-z;ca=0;for(ja=ia.materials.length;ca<ja;)ca++}else if(ia instanceof THREE.RenderableLine){u=ia.v1;A=ia.v2;u.positionScreen.x*=t;u.positionScreen.y*=
--z;A.positionScreen.x*=t;A.positionScreen.y*=-z;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);if(J.instersects(W)){ca=0;for(ja=ia.materials.length;ca<ja;)if((da=ia.materials[ca++])&&da.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");ka==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
-oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(da instanceof THREE.LineBasicMaterial){U.__styleString=da.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+U.__styleString+"; stroke-width: "+da.linewidth+"; stroke-opacity: "+da.opacity+"; stroke-linecap: "+da.linecap+"; stroke-linejoin: "+da.linejoin);m.appendChild(oa)}}}}else if(ia instanceof THREE.RenderableFace3){u=ia.v1;A=ia.v2;E=ia.v3;u.positionScreen.x*=t;u.positionScreen.y*=-z;A.positionScreen.x*=
-t;A.positionScreen.y*=-z;E.positionScreen.x*=t;E.positionScreen.y*=-z;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(E.positionScreen.x,E.positionScreen.y);if(J.instersects(W)){ca=0;for(ja=ia.meshMaterials.length;ca<ja;){da=ia.meshMaterials[ca++];if(da instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ia.faceMaterials.length;ma<Fa;)(da=ia.faceMaterials[ma++])&&da.opacity!=0&&d(u,A,E,ia,da,fa)}else da&&da.opacity!=0&&d(u,A,E,ia,da,fa)}}}else if(ia instanceof
-THREE.RenderableFace4){u=ia.v1;A=ia.v2;E=ia.v3;H=ia.v4;u.positionScreen.x*=t;u.positionScreen.y*=-z;A.positionScreen.x*=t;A.positionScreen.y*=-z;E.positionScreen.x*=t;E.positionScreen.y*=-z;H.positionScreen.x*=t;H.positionScreen.y*=-z;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(E.positionScreen.x,E.positionScreen.y);W.addPoint(H.positionScreen.x,H.positionScreen.y);if(J.instersects(W)){ca=0;for(ja=ia.meshMaterials.length;ca<ja;){da=
-ia.meshMaterials[ca++];if(da instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ia.faceMaterials.length;ma<Fa;)(da=ia.faceMaterials[ma++])&&da.opacity!=0&&c(u,A,E,H,ia,da,fa)}else da&&da.opacity!=0&&c(u,A,E,H,ia,da,fa)}}}}}};
+THREE.Projector=function(){function b(){var ea=m[k]=m[k]||new THREE.RenderableVertex;k++;return ea}function d(ea,e){return e.z-ea.z}function c(ea,e){var oa=0,Da=1,da=ea.z+ea.w,va=e.z+e.w,ja=-ea.z+ea.w,qa=-e.z+e.w;if(da>=0&&va>=0&&ja>=0&&qa>=0)return!0;else if(da<0&&va<0||ja<0&&qa<0)return!1;else{if(da<0)oa=Math.max(oa,da/(da-va));else va<0&&(Da=Math.min(Da,da/(da-va)));if(ja<0)oa=Math.max(oa,ja/(ja-qa));else qa<0&&(Da=Math.min(Da,ja/(ja-qa)));if(Da<oa)return!1;else{ea.lerpSelf(e,oa);e.lerpSelf(ea,
+1-Da);return!0}}}var f,g,h=[],j,k,m=[],p,o,t=[],y,u=[],B,A,Q=[],E,V,C=[],X=new THREE.Vector4,R=new THREE.Vector4,P=new THREE.Matrix4,ya=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ca=new THREE.Vector4,Ba=new THREE.Vector4;this.projectVector=function(ea,e){P.multiply(e.projectionMatrix,e.matrixWorldInverse);P.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){P.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
+P.multiplyVector3(ea);return ea};this.projectObjects=function(ea,e,oa){e=[];var Da,da,va;g=0;da=ea.objects;ea=0;for(Da=da.length;ea<Da;ea++){va=da[ea];var ja;if(!(ja=!va.visible))if(ja=va instanceof THREE.Mesh){a:{ja=void 0;for(var qa=va.matrixWorld,pa=-va.geometry.boundingSphere.radius*Math.max(va.scale.x,Math.max(va.scale.y,va.scale.z)),wa=0;wa<6;wa++){ja=la[wa].x*qa.n14+la[wa].y*qa.n24+la[wa].z*qa.n34+la[wa].w;if(ja<=pa){ja=!1;break a}}ja=!0}ja=!ja}if(!ja){ja=h[g]=h[g]||new THREE.RenderableObject;
+g++;f=ja;X.copy(va.position);P.multiplyVector3(X);f.object=va;f.z=X.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ea,e,oa){var Da=[],da=e.near,va=e.far,ja,qa,pa,wa,fa,ka,ma,Fa,ia,ga,Ja,Xa,Za,Ta,O,S,M;V=A=y=o=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);P.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(P.n41-P.n11,P.n42-P.n12,P.n43-P.n13,P.n44-P.n14);la[1].set(P.n41+P.n11,P.n42+P.n12,P.n43+P.n13,P.n44+P.n14);la[2].set(P.n41+P.n21,P.n42+P.n22,
+P.n43+P.n23,P.n44+P.n24);la[3].set(P.n41-P.n21,P.n42-P.n22,P.n43-P.n23,P.n44-P.n24);la[4].set(P.n41-P.n31,P.n42-P.n32,P.n43-P.n33,P.n44-P.n34);la[5].set(P.n41+P.n31,P.n42+P.n32,P.n43+P.n33,P.n44+P.n34);for(ja=0;ja<6;ja++){ia=la[ja];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}ia=this.projectObjects(ea,e,!0);ea=0;for(ja=ia.length;ea<ja;ea++){ga=ia[ea].object;if(ga.visible){Ja=ga.matrixWorld;Xa=ga.matrixRotationWorld;Za=ga.materials;Ta=ga.overdraw;k=0;if(ga instanceof THREE.Mesh){O=ga.geometry;
+wa=O.vertices;S=O.faces;O=O.faceVertexUvs;qa=0;for(pa=wa.length;qa<pa;qa++){j=b();j.positionWorld.copy(wa[qa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);P.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>da&&j.positionScreen.z<va}wa=0;for(qa=S.length;wa<qa;wa++){pa=S[wa];if(pa instanceof THREE.Face3){fa=m[pa.a];ka=m[pa.b];ma=m[pa.c];if(fa.visible&&ka.visible&&ma.visible&&
+(ga.doubleSided||ga.flipSided!=(ma.positionScreen.x-fa.positionScreen.x)*(ka.positionScreen.y-fa.positionScreen.y)-(ma.positionScreen.y-fa.positionScreen.y)*(ka.positionScreen.x-fa.positionScreen.x)<0)){Fa=t[o]=t[o]||new THREE.RenderableFace3;o++;p=Fa;p.v1.copy(fa);p.v2.copy(ka);p.v3.copy(ma)}else continue}else if(pa instanceof THREE.Face4){fa=m[pa.a];ka=m[pa.b];ma=m[pa.c];Fa=m[pa.d];if(fa.visible&&ka.visible&&ma.visible&&Fa.visible&&(ga.doubleSided||ga.flipSided!=((Fa.positionScreen.x-fa.positionScreen.x)*
+(ka.positionScreen.y-fa.positionScreen.y)-(Fa.positionScreen.y-fa.positionScreen.y)*(ka.positionScreen.x-fa.positionScreen.x)<0||(ka.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ka.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){M=u[y]=u[y]||new THREE.RenderableFace4;y++;p=M;p.v1.copy(fa);p.v2.copy(ka);p.v3.copy(ma);p.v4.copy(Fa)}else continue}p.normalWorld.copy(pa.normal);Xa.multiplyVector3(p.normalWorld);p.centroidWorld.copy(pa.centroid);
+Ja.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);P.multiplyVector3(p.centroidScreen);ma=pa.vertexNormals;fa=0;for(ka=ma.length;fa<ka;fa++){Fa=p.vertexNormalsWorld[fa];Fa.copy(ma[fa]);Xa.multiplyVector3(Fa)}fa=0;for(ka=O.length;fa<ka;fa++)if(M=O[fa][wa]){ma=0;for(Fa=M.length;ma<Fa;ma++)p.uvs[fa][ma]=M[ma]}p.meshMaterials=Za;p.faceMaterials=pa.materials;p.overdraw=Ta;p.z=p.centroidScreen.z;Da.push(p)}}else if(ga instanceof THREE.Line){ya.multiply(P,Ja);wa=ga.geometry.vertices;
+fa=b();fa.positionScreen.copy(wa[0].position);ya.multiplyVector4(fa.positionScreen);qa=1;for(pa=wa.length;qa<pa;qa++){fa=b();fa.positionScreen.copy(wa[qa].position);ya.multiplyVector4(fa.positionScreen);ka=m[k-2];ca.copy(fa.positionScreen);Ba.copy(ka.positionScreen);if(c(ca,Ba)){ca.multiplyScalar(1/ca.w);Ba.multiplyScalar(1/Ba.w);Ja=Q[A]=Q[A]||new THREE.RenderableLine;A++;B=Ja;B.v1.positionScreen.copy(ca);B.v2.positionScreen.copy(Ba);B.z=Math.max(ca.z,Ba.z);B.materials=ga.materials;Da.push(B)}}}else if(ga instanceof
+THREE.Particle){R.set(ga.position.x,ga.position.y,ga.position.z,1);P.multiplyVector4(R);R.z/=R.w;if(R.z>0&&R.z<1){Ja=C[V]=C[V]||new THREE.RenderableParticle;V++;E=Ja;E.x=R.x/R.w;E.y=R.y/R.w;E.z=R.z;E.rotation=ga.rotation.z;E.scale.x=ga.scale.x*Math.abs(E.x-(R.x+e.projectionMatrix.n11)/(R.w+e.projectionMatrix.n14));E.scale.y=ga.scale.y*Math.abs(E.y-(R.y+e.projectionMatrix.n22)/(R.w+e.projectionMatrix.n24));E.materials=ga.materials;Da.push(E)}}}}oa&&Da.sort(d);return Da}};
+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,t,y,u,B,A;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;A=y.y*h+h;o=0;for(t=y.material.length;o<t;o++){u=y.material[o];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=B+"px";u.style.top=A+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(Ga){if(B!=Ga)t.globalAlpha=B=Ga}function d(Ga){if(A!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}A=Ga}}function c(Ga){if(Q!=Ga)t.strokeStyle=Q=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,p,o,t=j.getContext("2d"),y=new THREE.Color(0),u=0,B=
+1,A=0,Q=null,E=null,V=null,C=null,X=null,R,P,ya,la,ca=new THREE.RenderableVertex,Ba=new THREE.RenderableVertex,ea,e,oa,Da,da,va,ja,qa,pa,wa,fa,ka,ma=new THREE.Color,Fa=new THREE.Color,ia=new THREE.Color,ga=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,O,S,M,Aa,La,n,D,x=new THREE.Rectangle,w=new THREE.Rectangle,z=new THREE.Rectangle,N=!1,J=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,K,Z,Y,ra,Ka,Ca,Ha=16;K=document.createElement("canvas");K.width=K.height=
+2;Z=K.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,ua){k=Ga;m=ua;p=k/2;o=m/2;j.width=k;j.height=m;x.set(-p,-o,p,o);B=1;A=0;X=C=V=E=Q=null};this.setClearColor=function(Ga,ua){y=Ga;u=ua};
+this.setClearColorHex=function(Ga,ua){y.setHex(Ga);u=ua};this.clear=function(){t.setTransform(1,0,0,-1,p,o);if(!w.isEmpty()){w.inflate(1);w.minSelf(x);if(y.hex==0&&u==0)t.clearRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight())}w.empty()}};this.render=function(Ga,ua){function Ea(U){var na,ha,$,ta=U.lights;G.setRGB(0,
+0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);U=0;for(na=ta.length;U<na;U++){ha=ta[U];$=ha.color;if(ha instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ha instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ha instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(U,na,ha,$){var ta,sa,xa,W,Ia=U.lights;U=0;for(ta=Ia.length;U<ta;U++){sa=Ia[U];xa=sa.color;if(sa instanceof THREE.DirectionalLight){W=ha.dot(sa.position);if(!(W<=0)){W*=sa.intensity;$.r+=xa.r*W;$.g+=
+xa.g*W;$.b+=xa.b*W}}else if(sa instanceof THREE.PointLight){W=ha.dot(I.sub(sa.position,na).normalize());if(!(W<=0)){W*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(W!=0){W*=sa.intensity;$.r+=xa.r*W;$.g+=xa.g*W;$.b+=xa.b*W}}}}}function Ua(U,na,ha){b(ha.opacity);d(ha.blending);var $,ta,sa,xa,W,Ia;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){xa=ha.map.image;W=xa.width>>1;Ia=xa.height>>1;ha=na.scale.x*p;sa=na.scale.y*o;$=ha*W;ta=sa*Ia;z.set(U.x-$,U.y-ta,U.x+$,U.y+
+ta);if(x.instersects(z)){t.save();t.translate(U.x,U.y);t.rotate(-na.rotation);t.scale(ha,-sa);t.translate(-W,-Ia);t.drawImage(xa,0,0);t.restore()}}}else if(ha instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*p;ta=na.scale.y*o;z.set(U.x-$,U.y-ta,U.x+$,U.y+ta);if(x.instersects(z)){c(ha.color.__styleString);sa=ha.color.__styleString;if(E!=sa)t.fillStyle=E=sa;t.save();t.translate(U.x,U.y);t.rotate(-na.rotation);t.scale($,ta);ha.program(t);t.restore()}}}function F(U,na,ha,$){b($.opacity);d($.blending);
+t.beginPath();t.moveTo(U.positionScreen.x,U.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;U=$.linewidth;if(V!=U)t.lineWidth=V=U;U=$.linecap;if(C!=U)t.lineCap=C=U;U=$.linejoin;if(X!=U)t.lineJoin=X=U;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(U,na,ha,$,ta,sa,xa,W,Ia){f.data.vertices+=3;f.data.faces++;b(W.opacity);d(W.blending);ea=U.positionScreen.x;e=U.positionScreen.y;
+oa=na.positionScreen.x;Da=na.positionScreen.y;da=ha.positionScreen.x;va=ha.positionScreen.y;ab(ea,e,oa,Da,da,va);if(W instanceof THREE.MeshBasicMaterial)if(W.map){if(W.map.mapping instanceof THREE.UVMapping){O=xa.uvs[0];cb(ea,e,oa,Da,da,va,W.map.image,O[$].u,O[$].v,O[ta].u,O[ta].v,O[sa].u,O[sa].v)}}else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping){U=ua.matrixWorldInverse;I.copy(xa.vertexNormalsWorld[0]);S=(I.x*U.n11+I.y*U.n12+I.z*U.n13)*0.5+0.5;M=-(I.x*U.n21+I.y*U.n22+
+I.z*U.n23)*0.5+0.5;I.copy(xa.vertexNormalsWorld[1]);Aa=(I.x*U.n11+I.y*U.n12+I.z*U.n13)*0.5+0.5;La=-(I.x*U.n21+I.y*U.n22+I.z*U.n23)*0.5+0.5;I.copy(xa.vertexNormalsWorld[2]);n=(I.x*U.n11+I.y*U.n12+I.z*U.n13)*0.5+0.5;D=-(I.x*U.n21+I.y*U.n22+I.z*U.n23)*0.5+0.5;cb(ea,e,oa,Da,da,va,W.envMap.image,S,M,Aa,La,n,D)}}else W.wireframe?Oa(W.color.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(W.color.__styleString);else if(W instanceof THREE.MeshLambertMaterial){if(W.map&&!W.wireframe){if(W.map.mapping instanceof
+THREE.UVMapping){O=xa.uvs[0];cb(ea,e,oa,Da,da,va,W.map.image,O[$].u,O[$].v,O[ta].u,O[ta].v,O[sa].u,O[sa].v)}d(THREE.SubtractiveBlending)}if(N)if(!W.wireframe&&W.shading==THREE.SmoothShading&&xa.vertexNormalsWorld.length==3){Fa.r=ia.r=ga.r=G.r;Fa.g=ia.g=ga.g=G.g;Fa.b=ia.b=ga.b=G.b;za(Ia,xa.v1.positionWorld,xa.vertexNormalsWorld[0],Fa);za(Ia,xa.v2.positionWorld,xa.vertexNormalsWorld[1],ia);za(Ia,xa.v3.positionWorld,xa.vertexNormalsWorld[2],ga);Ja.r=(ia.r+ga.r)*0.5;Ja.g=(ia.g+ga.g)*0.5;Ja.b=(ia.b+ga.b)*
+0.5;Ta=hb(Fa,ia,ga,Ja);cb(ea,e,oa,Da,da,va,Ta,0,0,1,0,0,1)}else{J.r=G.r;J.g=G.g;J.b=G.b;za(Ia,xa.centroidWorld,xa.normalWorld,J);ma.r=W.color.r*J.r;ma.g=W.color.g*J.g;ma.b=W.color.b*J.b;ma.updateStyleString();W.wireframe?Oa(ma.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(ma.__styleString)}else W.wireframe?Oa(W.color.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(W.color.__styleString)}else if(W instanceof THREE.MeshDepthMaterial){Xa=
+ua.near;Za=ua.far;Fa.r=Fa.g=Fa.b=1-Wa(U.positionScreen.z,Xa,Za);ia.r=ia.g=ia.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa(ha.positionScreen.z,Xa,Za);Ja.r=(ia.r+ga.r)*0.5;Ja.g=(ia.g+ga.g)*0.5;Ja.b=(ia.b+ga.b)*0.5;Ta=hb(Fa,ia,ga,Ja);cb(ea,e,oa,Da,da,va,Ta,0,0,1,0,0,1)}else if(W instanceof THREE.MeshNormalMaterial){ma.r=$a(xa.normalWorld.x);ma.g=$a(xa.normalWorld.y);ma.b=$a(xa.normalWorld.z);ma.updateStyleString();W.wireframe?Oa(ma.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):
+Qa(ma.__styleString)}}function v(U,na,ha,$,ta,sa,xa,W,Ia){f.data.vertices+=4;f.data.faces++;b(W.opacity);d(W.blending);if(W.map||W.envMap){aa(U,na,$,0,1,3,xa,W,Ia);aa(ta,ha,sa,1,2,3,xa,W,Ia)}else{ea=U.positionScreen.x;e=U.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;da=ha.positionScreen.x;va=ha.positionScreen.y;ja=$.positionScreen.x;qa=$.positionScreen.y;pa=ta.positionScreen.x;wa=ta.positionScreen.y;fa=sa.positionScreen.x;ka=sa.positionScreen.y;if(W instanceof THREE.MeshBasicMaterial){fb(ea,
+e,oa,Da,da,va,ja,qa);W.wireframe?Oa(W.color.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(W.color.__styleString)}else if(W instanceof THREE.MeshLambertMaterial)if(N)if(!W.wireframe&&W.shading==THREE.SmoothShading&&xa.vertexNormalsWorld.length==4){Fa.r=ia.r=ga.r=Ja.r=G.r;Fa.g=ia.g=ga.g=Ja.g=G.g;Fa.b=ia.b=ga.b=Ja.b=G.b;za(Ia,xa.v1.positionWorld,xa.vertexNormalsWorld[0],Fa);za(Ia,xa.v2.positionWorld,xa.vertexNormalsWorld[1],ia);za(Ia,xa.v4.positionWorld,xa.vertexNormalsWorld[3],
+ga);za(Ia,xa.v3.positionWorld,xa.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ia,ga,Ja);ab(ea,e,oa,Da,ja,qa);cb(ea,e,oa,Da,ja,qa,Ta,0,0,1,0,0,1);ab(pa,wa,da,va,fa,ka);cb(pa,wa,da,va,fa,ka,Ta,1,0,1,1,0,1)}else{J.r=G.r;J.g=G.g;J.b=G.b;za(Ia,xa.centroidWorld,xa.normalWorld,J);ma.r=W.color.r*J.r;ma.g=W.color.g*J.g;ma.b=W.color.b*J.b;ma.updateStyleString();fb(ea,e,oa,Da,da,va,ja,qa);W.wireframe?Oa(ma.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
+Da,da,va,ja,qa);W.wireframe?Oa(W.color.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(W.color.__styleString)}else if(W instanceof THREE.MeshNormalMaterial){ma.r=$a(xa.normalWorld.x);ma.g=$a(xa.normalWorld.y);ma.b=$a(xa.normalWorld.z);ma.updateStyleString();fb(ea,e,oa,Da,da,va,ja,qa);W.wireframe?Oa(ma.__styleString,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Qa(ma.__styleString)}else if(W instanceof THREE.MeshDepthMaterial){Xa=ua.near;Za=ua.far;Fa.r=
+Fa.g=Fa.b=1-Wa(U.positionScreen.z,Xa,Za);ia.r=ia.g=ia.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ha.positionScreen.z,Xa,Za);Ta=hb(Fa,ia,ga,Ja);ab(ea,e,oa,Da,ja,qa);cb(ea,e,oa,Da,ja,qa,Ta,0,0,1,0,0,1);ab(pa,wa,da,va,fa,ka);cb(pa,wa,da,va,fa,ka,Ta,1,0,1,1,0,1)}}}function ab(U,na,ha,$,ta,sa){t.beginPath();t.moveTo(U,na);t.lineTo(ha,$);t.lineTo(ta,sa);t.lineTo(U,na);t.closePath()}function fb(U,na,ha,$,ta,sa,xa,W){t.beginPath();t.moveTo(U,na);t.lineTo(ha,
+$);t.lineTo(ta,sa);t.lineTo(xa,W);t.lineTo(U,na);t.closePath()}function Oa(U,na,ha,$){if(V!=na)t.lineWidth=V=na;if(C!=ha)t.lineCap=C=ha;if(X!=$)t.lineJoin=X=$;c(U);t.stroke();z.inflate(na*2)}function Qa(U){if(E!=U)t.fillStyle=E=U;t.fill()}function cb(U,na,ha,$,ta,sa,xa,W,Ia,Ya,eb,Sa,kb){var gb,db;gb=xa.width-1;db=xa.height-1;W*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ha-=U;$-=na;ta-=U;sa-=na;Ya-=W;eb-=Ia;Sa-=W;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ha-eb*ta)*db;eb=(kb*$-eb*sa)*db;ha=(Ya*ta-
+Sa*ha)*db;$=(Ya*sa-Sa*$)*db;U=U-gb*W-ha*Ia;na=na-eb*W-$*Ia;t.save();t.transform(gb,eb,ha,$,U,na);t.clip();t.drawImage(xa,0,0);t.restore()}}function hb(U,na,ha,$){var ta=~~(U.r*255),sa=~~(U.g*255);U=~~(U.b*255);var xa=~~(na.r*255),W=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ha.r*255),Ya=~~(ha.g*255);ha=~~(ha.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ta<0?0:ta>255?255:ta;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=U<0?0:U>255?255:U;ra[4]=xa<0?0:xa>255?255:xa;ra[5]=W<0?0:W>255?255:W;ra[6]=na<0?
+0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ha<0?0:ha>255?255:ha;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(K,0,0);return Ka}function Wa(U,na,ha){U=(U-na)/(ha-na);return U*U*(3-2*U)}function $a(U){U=(U+1)*0.5;return U<0?0:U>1?1:U}function Ma(U,na){var ha=na.x-U.x,$=na.y-U.y,ta=1/Math.sqrt(ha*ha+$*$);ha*=ta;$*=ta;na.x+=ha;na.y+=$;U.x-=ha;U.y-=$}var bb,Va,L,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
+t.setTransform(1,0,0,-1,p,o);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,ua,this.sortElements);(N=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){L=g[bb];z.empty();if(L instanceof THREE.RenderableParticle){R=L;R.x*=p;R.y*=o;Na=0;for(Ra=L.materials.length;Na<Ra;){Pa=L.materials[Na++];Pa.opacity!=0&&Ua(R,L,Pa,Ga)}}else if(L instanceof THREE.RenderableLine){R=L.v1;P=L.v2;R.positionScreen.x*=p;R.positionScreen.y*=o;P.positionScreen.x*=p;P.positionScreen.y*=o;z.addPoint(R.positionScreen.x,
+R.positionScreen.y);z.addPoint(P.positionScreen.x,P.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=L.materials.length;Na<Ra;){Pa=L.materials[Na++];Pa.opacity!=0&&F(R,P,L,Pa,Ga)}}}else if(L instanceof THREE.RenderableFace3){R=L.v1;P=L.v2;ya=L.v3;R.positionScreen.x*=p;R.positionScreen.y*=o;P.positionScreen.x*=p;P.positionScreen.y*=o;ya.positionScreen.x*=p;ya.positionScreen.y*=o;if(L.overdraw){Ma(R.positionScreen,P.positionScreen);Ma(P.positionScreen,ya.positionScreen);Ma(ya.positionScreen,R.positionScreen)}z.add3Points(R.positionScreen.x,
+R.positionScreen.y,P.positionScreen.x,P.positionScreen.y,ya.positionScreen.x,ya.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=L.meshMaterials.length;Na<Ra;){Pa=L.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=L.faceMaterials.length;ib<jb;)(Pa=L.faceMaterials[ib++])&&Pa.opacity!=0&&aa(R,P,ya,0,1,2,L,Pa,Ga)}else Pa.opacity!=0&&aa(R,P,ya,0,1,2,L,Pa,Ga)}}}else if(L instanceof THREE.RenderableFace4){R=L.v1;P=L.v2;ya=L.v3;la=L.v4;R.positionScreen.x*=p;R.positionScreen.y*=
+o;P.positionScreen.x*=p;P.positionScreen.y*=o;ya.positionScreen.x*=p;ya.positionScreen.y*=o;la.positionScreen.x*=p;la.positionScreen.y*=o;ca.positionScreen.copy(P.positionScreen);Ba.positionScreen.copy(la.positionScreen);if(L.overdraw){Ma(R.positionScreen,P.positionScreen);Ma(P.positionScreen,la.positionScreen);Ma(la.positionScreen,R.positionScreen);Ma(ya.positionScreen,ca.positionScreen);Ma(ya.positionScreen,Ba.positionScreen)}z.addPoint(R.positionScreen.x,R.positionScreen.y);z.addPoint(P.positionScreen.x,
+P.positionScreen.y);z.addPoint(ya.positionScreen.x,ya.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=L.meshMaterials.length;Na<Ra;){Pa=L.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=L.faceMaterials.length;ib<jb;)(Pa=L.faceMaterials[ib++])&&Pa.opacity!=0&&v(R,P,ya,la,ca,Ba,L,Pa,Ga)}else Pa.opacity!=0&&v(R,P,ya,la,ca,Ba,L,Pa,Ga)}}}w.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(ja,qa,pa){var wa,fa,ka,ma;wa=0;for(fa=ja.lights.length;wa<fa;wa++){ka=ja.lights[wa];if(ka instanceof THREE.DirectionalLight){ma=qa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){pa.r+=ka.color.r*ma;pa.g+=ka.color.g*ma;pa.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){Ba.sub(ka.position,qa.centroidWorld);Ba.normalize();ma=qa.normalWorld.dot(Ba)*ka.intensity;if(ma>0){pa.r+=ka.color.r*ma;pa.g+=ka.color.g*ma;pa.b+=ka.color.b*ma}}}}function d(ja,qa,
+pa,wa,fa,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(fa instanceof THREE.MeshBasicMaterial)X.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshLambertMaterial)if(C){R.r=P.r;R.g=P.g;R.b=P.b;b(ka,wa,R);X.r=fa.color.r*R.r;X.g=fa.color.g*R.g;X.b=fa.color.b*R.b;X.updateStyleString()}else X.__styleString=
+fa.color.__styleString;else if(fa instanceof THREE.MeshDepthMaterial){ca=1-fa.__2near/(fa.__farPlusNear-wa.z*fa.__farMinusNear);X.setRGB(ca,ca,ca)}else fa instanceof THREE.MeshNormalMaterial&&X.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));fa.wireframe?oa.setAttribute("style","fill: none; stroke: "+X.__styleString+"; stroke-width: "+fa.wireframeLinewidth+"; stroke-opacity: "+fa.opacity+"; stroke-linecap: "+fa.wireframeLinecap+"; stroke-linejoin: "+fa.wireframeLinejoin):oa.setAttribute("style",
+"fill: "+X.__styleString+"; fill-opacity: "+fa.opacity);m.appendChild(oa)}function c(ja,qa,pa,wa,fa,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)X.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){R.r=
+P.r;R.g=P.g;R.b=P.b;b(ma,fa,R);X.r=ka.color.r*R.r;X.g=ka.color.g*R.g;X.b=ka.color.b*R.b;X.updateStyleString()}else X.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ca=1-ka.__2near/(ka.__farPlusNear-fa.z*ka.__farMinusNear);X.setRGB(ca,ca,ca)}else ka instanceof THREE.MeshNormalMaterial&&X.setRGB(g(fa.normalWorld.x),g(fa.normalWorld.y),g(fa.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+X.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+X.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(ja){if(ea[ja]==null){ea[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");va==0&&ea[ja].setAttribute("shape-rendering","crispEdges")}return ea[ja]}function g(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
+m=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,o,t,y,u,B,A,Q,E=new THREE.Rectangle,V=new THREE.Rectangle,C=!1,X=new THREE.Color(16777215),R=new THREE.Color(16777215),P=new THREE.Color(0),ya=new THREE.Color(0),la=new THREE.Color(0),ca,Ba=new THREE.Vector3,ea=[],e=[],oa,Da,da,va=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(ja){switch(ja){case "high":va=1;break;case "low":va=0}};this.setSize=function(ja,
+qa){p=ja;o=qa;t=p/2;y=o/2;m.setAttribute("viewBox",-t+" "+-y+" "+p+" "+o);m.setAttribute("width",p);m.setAttribute("height",o);E.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(ja,qa){var pa,wa,fa,ka,ma,Fa,ia,ga;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(ja,qa,this.sortElements);da=Da=0;if(C=ja.lights.length>0){ia=ja.lights;P.setRGB(0,0,0);ya.setRGB(0,0,0);la.setRGB(0,0,0);pa=0;for(wa=ia.length;pa<
+wa;pa++){fa=ia[pa];ka=fa.color;if(fa instanceof THREE.AmbientLight){P.r+=ka.r;P.g+=ka.g;P.b+=ka.b}else if(fa instanceof THREE.DirectionalLight){ya.r+=ka.r;ya.g+=ka.g;ya.b+=ka.b}else if(fa instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}pa=0;for(wa=j.length;pa<wa;pa++){ia=j[pa];V.empty();if(ia instanceof THREE.RenderableParticle){u=ia;u.x*=t;u.y*=-y;fa=0;for(ka=ia.materials.length;fa<ka;)fa++}else if(ia instanceof THREE.RenderableLine){u=ia.v1;B=ia.v2;u.positionScreen.x*=t;u.positionScreen.y*=
+-y;B.positionScreen.x*=t;B.positionScreen.y*=-y;V.addPoint(u.positionScreen.x,u.positionScreen.y);V.addPoint(B.positionScreen.x,B.positionScreen.y);if(E.instersects(V)){fa=0;for(ka=ia.materials.length;fa<ka;)if((ga=ia.materials[fa++])&&ga.opacity!=0){ma=u;Fa=B;var Ja=da++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");va==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
+oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ga instanceof THREE.LineBasicMaterial){X.__styleString=ga.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+X.__styleString+"; stroke-width: "+ga.linewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.linecap+"; stroke-linejoin: "+ga.linejoin);m.appendChild(oa)}}}}else if(ia instanceof THREE.RenderableFace3){u=ia.v1;B=ia.v2;A=ia.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;B.positionScreen.x*=
+t;B.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;V.addPoint(u.positionScreen.x,u.positionScreen.y);V.addPoint(B.positionScreen.x,B.positionScreen.y);V.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(V)){fa=0;for(ka=ia.meshMaterials.length;fa<ka;){ga=ia.meshMaterials[fa++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ia.faceMaterials.length;ma<Fa;)(ga=ia.faceMaterials[ma++])&&ga.opacity!=0&&d(u,B,A,ia,ga,ja)}else ga&&ga.opacity!=0&&d(u,B,A,ia,ga,ja)}}}else if(ia instanceof
+THREE.RenderableFace4){u=ia.v1;B=ia.v2;A=ia.v3;Q=ia.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;B.positionScreen.x*=t;B.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;Q.positionScreen.x*=t;Q.positionScreen.y*=-y;V.addPoint(u.positionScreen.x,u.positionScreen.y);V.addPoint(B.positionScreen.x,B.positionScreen.y);V.addPoint(A.positionScreen.x,A.positionScreen.y);V.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(E.instersects(V)){fa=0;for(ka=ia.meshMaterials.length;fa<ka;){ga=
+ia.meshMaterials[fa++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ia.faceMaterials.length;ma<Fa;)(ga=ia.faceMaterials[ma++])&&ga.opacity!=0&&c(u,B,A,Q,ia,ga,ja)}else ga&&ga.opacity!=0&&c(u,B,A,Q,ia,ga,ja)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -219,120 +219,120 @@ 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,x){var w,y,Q,K=n.vertices,F=K.length,T=n.colors,G=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,qa=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(w=0;w<F;w++){y=K[w].position;Ta.copy(y);Ja.multiplyVector3(Ta);Z[w]=[Ta.z,w]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(w=0;w<F;w++){y=K[Z[w][1]].position;Q=w*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}for(w=0;w<G;w++){Q=w*3;color=T[Z[w][1]];L[Q]=color.r;
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(w=0;w<F;w++){y=K[w].position;Q=w*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}if(qa)for(w=0;w<G;w++){color=T[w];Q=w*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}if(qa||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,x,w,y){w.program||ha.initMaterial(w,C,x,y);var Q=w.program,K=Q.uniforms,F=w.uniforms;
-if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){F.fogColor.value=x.color;if(x instanceof THREE.Fog){F.fogNear.value=x.near;F.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)F.fogDensity.value=x.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||
-w.lights){var T,G,I=0,L=0,Z=0,Y,qa,Ka,Ca,Ha=R,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,D=0,aa=0;x=G=Ca=0;for(T=C.length;x<T;x++){G=C[x];Y=G.color;qa=G.position;Ka=G.intensity;Ca=G.distance;if(G instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(G instanceof THREE.DirectionalLight){Ca=D*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=qa.x;xa[Ca+1]=qa.y;xa[Ca+2]=qa.z;D+=1}else if(G instanceof THREE.PointLight){G=
-aa*3;Ea[G]=Y.r*Ka;Ea[G+1]=Y.g*Ka;Ea[G+2]=Y.b*Ka;za[G]=qa.x;za[G+1]=qa.y;za[G+2]=qa.z;Ua[aa]=Ca;aa+=1}}for(x=D*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=D;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;F.enableLighting.value=x.directional.length+x.point.length;F.ambientLightColor.value=x.ambient;F.directionalLightColor.value=x.directional.colors;F.directionalLightDirection.value=x.directional.positions;F.pointLightColor.value=x.point.colors;
-F.pointLightPosition.value=x.point.positions;F.pointLightDistance.value=x.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){F.diffuse.value=w.color;F.opacity.value=w.opacity;F.map.texture=w.map;F.lightMap.texture=w.lightMap;F.envMap.texture=w.envMap;F.reflectivity.value=w.reflectivity;F.refractionRatio.value=w.refractionRatio;F.combine.value=w.combine;F.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof
-THREE.LineBasicMaterial){F.diffuse.value=w.color;F.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){F.psColor.value=w.color;F.opacity.value=w.opacity;F.size.value=w.size;F.scale.value=oa.height/2;F.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){F.ambient.value=w.ambient;F.specular.value=w.specular;F.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=w.opacity}else if(w instanceof
-THREE.MeshNormalMaterial)F.opacity.value=w.opacity;for(var v in F)if(L=Q.uniforms[v]){T=F[v];I=T.type;x=T.value;if(I=="i")e.uniform1i(L,x);else if(I=="f")e.uniform1f(L,x);else if(I=="fv1")e.uniform1fv(L,x);else if(I=="fv")e.uniform3fv(L,x);else if(I=="v2")e.uniform2f(L,x.x,x.y);else if(I=="v3")e.uniform3f(L,x.x,x.y,x.z);else if(I=="v4")e.uniform4f(L,x.x,x.y,x.z,x.w);else if(I=="c")e.uniform3f(L,x.r,x.g,x.b);else if(I=="t"){e.uniform1i(L,x);if(T=T.texture)if(T.image instanceof Array&&T.image.length==
-6){if(T.image.length==6){if(T.needsUpdate){if(T.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,e.RGBA,e.UNSIGNED_BYTE,T.image[I])}else{T.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,T.image[I]);T.__webglInit=!0}N(e.TEXTURE_CUBE_MAP,T,T.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
-null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else O(T,x)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,y._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,y._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=F.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,y._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(w.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
-!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,y.boneMatrices)}return Q}function f(n,C,x,w,y,Q){if(w.opacity!=0){var K;n=c(n,C,x,w,Q).attributes;if(w.morphTargets){C=w.program.attributes;Q.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[Q.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(Q.morphTargetForcedOrder.length){x=0;for(var F=Q.morphTargetForcedOrder,T=Q.morphTargetInfluences;x<w.numSupportedMorphTargets&&
-x<F.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[F[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[x]=T[F[x]];x++}}else{F=[];var G=-1,I=0;T=Q.morphTargetInfluences;var L,Z=T.length;x=0;for(Q.morphTargetBase!==-1&&(F[Q.morphTargetBase]=!0);x<w.numSupportedMorphTargets;){for(L=0;L<Z;L++)if(!F[L]&&T[L]>G){I=L;G=T[I]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[I]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);
-Q.__webglMorphTargetInfluences[x]=G;F[I]=1;G=-1;x++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,Q.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(K in y.__webglCustomAttributes)if(n[K]>=0){C=y.__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,y.__webglColorBuffer);
-e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(y.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__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(y.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,
-y.__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,y.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(Q instanceof THREE.Mesh){if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglLineBuffer);e.drawElements(e.LINES,y.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);e.drawElements(e.TRIANGLES,y.__webglFaceCount,e.UNSIGNED_SHORT,0)}ha.data.vertices+=y.__webglFaceCount;ha.data.faces+=
-y.__webglFaceCount/3}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(Q,0,y.__webglLineCount)}else if(Q instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else Q instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function g(n,C,x){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(x==THREE.FlatShading){var w,y,Q,K,F,T,G,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;w=x[Z];y=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];F=x[Z+6];G=x[Z+7];L=x[Z+8];w=(w+K+F)/3;y=(y+T+G)/3;Q=(Q+I+L)/3;x[Z]=w;x[Z+1]=y;x[Z+2]=Q;x[Z+3]=
-w;x[Z+4]=y;x[Z+5]=Q;x[Z+6]=w;x[Z+7]=y;x[Z+8]=Q}}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(va!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);va=n.doubleSided}if(sa!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);sa=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):
-e.disable(e.DEPTH_TEST);ca=n}}function k(n){da[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);da[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);da[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);da[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);da[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);da[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=da[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,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),w=0;w<6;w++){n=da[w].x*C.n14+da[w].y*C.n24+da[w].z*C.n34+da[w].w;if(n<=x)return!1}return!0}function o(n,C){n.list[n.count]=C;n.count+=1}function p(n){var C,x,w=n.object,y=n.opaque,Q=n.transparent;Q.count=0;n=y.count=0;for(C=w.materials.length;n<C;n++){x=w.materials[n];x.transparent?o(Q,x):o(y,x)}}function t(n){var C,x,w,y,Q=n.object,K=n.buffer,F=n.opaque,T=n.transparent;T.count=0;n=F.count=0;for(w=
-Q.materials.length;n<w;n++){C=Q.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=K.materials.length;C<x;C++)(y=K.materials[C])&&(y.transparent?o(T,y):o(F,y))}else(y=C)&&(y.transparent?o(T,y):o(F,y))}}function z(n,C){return C.z-n.z}function u(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,x=n.lights.length,w,y=n.lights,Q=[],K,F,T,G,I,L=n.__webglShadowVolumes.length;for(C=0;C<x;C++){w=n.lights[C];if(w instanceof THREE.DirectionalLight&&w.castShadow){Q[0]=-w.position.x;Q[1]=-w.position.y;Q[2]=-w.position.z;for(I=0;I<L;I++){w=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;F=w.materials[0];F.program||ha.initMaterial(F,y,undefined,w);F=F.program;T=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(T.projectionMatrix,
-!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(G.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(G.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);wa="";Aa=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,
-0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,C){var x,w,y;x=_sprite.attributes;var Q=_sprite.uniforms,K=ia/Fa,F,T=[],G=Fa*0.5,I=ia*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;wa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);
-e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);x=0;for(w=n.__webglSprites.length;x<w;x++){y=n.__webglSprites[x];if(y.useScreenCoordinates)y.z=
--y.position.z;else{y._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,y.matrixWorld,y._modelViewMatrixArray);y.z=-y._modelViewMatrix.n34}}n.__webglSprites.sort(z);x=0;for(w=n.__webglSprites.length;x<w;x++){y=n.__webglSprites[x];if(y.material===undefined&&y.map&&y.map.image&&y.map.image.width){if(y.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(y.position.x-G)/G,(I-y.position.y)/I,Math.max(0,Math.min(1,y.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,
-0);e.uniform1i(Q.affectedByDistance,y.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,y._modelViewMatrixArray)}F=y.map.image.width/(y.affectedByDistance?1:ia);T[0]=F*K*y.scale.x;T[1]=F*y.scale.y;e.uniform2f(Q.uvScale,y.uvScale.x,y.uvScale.y);e.uniform2f(Q.uvOffset,y.uvOffset.x,y.uvOffset.y);e.uniform2f(Q.alignment,y.alignment.x,y.alignment.y);e.uniform1f(Q.opacity,y.opacity);e.uniform1f(Q.rotation,y.rotation);e.uniform2fv(Q.scale,T);if(y.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!y.mergeWith3D&&
-L){e.disable(e.DEPTH_TEST);L=!1}U(y.blending);O(y.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function E(n,C){var x,w,y=n.__webglLensFlares.length,Q,K,F,T=new THREE.Vector3,G=ia/Fa,I=Fa*0.5,L=ia*0.5,Z=16/ia,Y=[Z*G,Z],qa=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;wa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,
-0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(w=0;w<y;w++){x=n.__webglLensFlares[w].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(T);
-C.projectionMatrix.multiplyVector3(T);qa[0]=T.x;qa[1]=T.y;qa[2]=T.z;Ka[0]=qa[0]*I+I;Ka[1]=qa[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ia){e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,qa);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,
-0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=qa[0];x.positionScreen.y=qa[1];x.positionScreen.z=qa[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){F=x.lensFlares[Q];if(F.opacity>0.0010&&F.scale>0.0010){qa[0]=F.x;qa[1]=F.y;qa[2]=F.z;Z=F.size*
-F.scale/ia;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,qa);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);O(F.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function J(n){var C,
-x,w,y,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(C in x.geometryGroups){w=x.geometryGroups[C];Q=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){Q=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,F=void 0,T=void 0,G=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,qa=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,
-za=void 0,Ua=void 0;L=void 0;Z=void 0;G=void 0;Y=void 0;G=void 0;var D=void 0,aa=void 0;L=void 0;D=void 0;aa=void 0;var v=void 0,ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;ab=void 0;D=void 0;aa=void 0;v=void 0;G=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;D=void 0;aa=void 0;v=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,M=0,Na=0;aa=D=0;var Ra=w.__vertexArray,ib=w.__uvArray,jb=w.__uv2Array,Pa=w.__normalArray,V=w.__tangentArray,na=w.__colorArray,
-ea=w.__skinVertexAArray,$=w.__skinVertexBArray,ta=w.__skinIndexArray,ra=w.__skinWeightArray,ya=w.__morphTargetsArrays,X=w.__webglCustomAttributes;v=void 0;var Ia=w.__faceArray,Ya=w.__lineArray,eb=w.__needsSmoothNormals;Ka=w.__vertexColorType;qa=w.__uvType;Ca=w.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=w.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],
-xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=0;X[fb].offsetSrc=0}K=0;for(F=vb.length;K<F;K++){T=vb[K];G=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=G.vertexNormals;I=G.normal;L=G.vertexColors;Z=G.color;Y=G.vertexTangents;if(G instanceof THREE.Face3){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ra[Qa]=xa.x;Ra[Qa+
-1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+
-0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.offsetSrc+=3}v.offset+=3}else{if(v.boundTo===undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];za=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];v.offsetSrc+=3}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.offset+=
-6}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+7]=za.g;v.array[D+8]=za.b}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z}v.offset+=9}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+
-6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;v.array[D+10]=za.z;v.array[D+11]=za.w;v.offset+=12}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z}Na+=9}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];ra[M]=D.x;ra[M+1]=D.y;ra[M+2]=D.z;ra[M+
-3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[M]=D.x;$[M+
-1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;$[M+11]=1;M+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2]}else aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=
-G.z;V[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&qa)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(G instanceof
-THREE.Face4){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ua=nb[G.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){D=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[D+0]=v.value[G.a];v.array[D+1]=v.value[G.b];v.array[D+2]=v.value[G.c];v.array[D+2]=
-v.value[G.d]}else if(v.boundTo==="faces"){v.array[D+0]=v.value[aa];v.array[D+1]=v.value[aa];v.array[D+2]=v.value[aa];v.array[D+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[D+0]=v.value[aa+0];v.array[D+1]=v.value[aa+1];v.array[D+2]=v.value[aa+2];v.array[D+2]=v.value[aa+3];v.offsetSrc+=4}v.offset+=4}else{if(v.boundTo===undefined||v.boundTo==="vertices"){xa=v.value[G.a];Ea=v.value[G.b];za=v.value[G.c];Ua=v.value[G.d]}else if(v.boundTo==="faces"){xa=v.value[aa];Ea=v.value[aa];
-za=v.value[aa];Ua=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){xa=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];Ua=v.value[aa+3];v.offsetSrc+=4}if(v.size===2){v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=Ea.x;v.array[D+3]=Ea.y;v.array[D+4]=za.x;v.array[D+5]=za.y;v.array[D+6]=Ua.x;v.array[D+7]=Ua.y;v.offset+=8}else if(v.size===3){if(v.type==="c"){v.array[D+0]=xa.r;v.array[D+1]=xa.g;v.array[D+2]=xa.b;v.array[D+3]=Ea.r;v.array[D+4]=Ea.g;v.array[D+5]=Ea.b;v.array[D+6]=za.r;v.array[D+
-7]=za.g;v.array[D+8]=za.b;v.array[D+9]=Ua.r;v.array[D+10]=Ua.g;v.array[D+11]=Ua.b}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=Ea.x;v.array[D+4]=Ea.y;v.array[D+5]=Ea.z;v.array[D+6]=za.x;v.array[D+7]=za.y;v.array[D+8]=za.z;v.array[D+9]=Ua.x;v.array[D+10]=Ua.y;v.array[D+11]=Ua.z}v.offset+=12}else{v.array[D+0]=xa.x;v.array[D+1]=xa.y;v.array[D+2]=xa.z;v.array[D+3]=xa.w;v.array[D+4]=Ea.x;v.array[D+5]=Ea.y;v.array[D+6]=Ea.z;v.array[D+7]=Ea.w;v.array[D+8]=za.x;v.array[D+9]=za.y;
-v.array[D+10]=za.z;v.array[D+11]=za.w;v.array[D+12]=Ua.x;v.array[D+13]=Ua.y;v.array[D+14]=Ua.z;v.array[D+15]=Ua.w;v.offset+=16}}}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){xa=morphTargets[D].vertices[G.a].position;Ea=morphTargets[D].vertices[G.b].position;za=morphTargets[D].vertices[G.c].position;Ua=morphTargets[D].vertices[G.d].position;v=ya[D];v[Na+0]=xa.x;v[Na+1]=xa.y;v[Na+2]=xa.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z;v[Na+9]=Ua.x;v[Na+10]=Ua.y;v[Na+
-11]=Ua.z}Na+=12}if(lb.length){D=lb[G.a];aa=lb[G.b];v=lb[G.c];ab=lb[G.d];ra[M]=D.x;ra[M+1]=D.y;ra[M+2]=D.z;ra[M+3]=D.w;ra[M+4]=aa.x;ra[M+5]=aa.y;ra[M+6]=aa.z;ra[M+7]=aa.w;ra[M+8]=v.x;ra[M+9]=v.y;ra[M+10]=v.z;ra[M+11]=v.w;ra[M+12]=ab.x;ra[M+13]=ab.y;ra[M+14]=ab.z;ra[M+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ta[M]=D.x;ta[M+1]=D.y;ta[M+2]=D.z;ta[M+3]=D.w;ta[M+4]=aa.x;ta[M+5]=aa.y;ta[M+6]=aa.z;ta[M+7]=aa.w;ta[M+8]=v.x;ta[M+9]=v.y;ta[M+10]=v.z;ta[M+11]=v.w;ta[M+12]=ab.x;ta[M+13]=ab.y;ta[M+14]=
-ab.z;ta[M+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[M]=D.x;ea[M+1]=D.y;ea[M+2]=D.z;ea[M+3]=1;ea[M+4]=aa.x;ea[M+5]=aa.y;ea[M+6]=aa.z;ea[M+7]=1;ea[M+8]=v.x;ea[M+9]=v.y;ea[M+10]=v.z;ea[M+11]=1;ea[M+12]=ab.x;ea[M+13]=ab.y;ea[M+14]=ab.z;ea[M+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[M]=D.x;$[M+1]=D.y;$[M+2]=D.z;$[M+3]=1;$[M+4]=aa.x;$[M+5]=aa.y;$[M+6]=aa.z;$[M+7]=1;$[M+8]=v.x;$[M+9]=v.y;$[M+10]=v.z;$[M+11]=1;$[M+12]=G.x;$[M+13]=G.y;$[M+14]=G.z;$[M+15]=1;M+=16}if(tb&&Ka){if(L.length==
-4&&Ka==THREE.VertexColors){G=L[0];D=L[1];aa=L[2];L=L[3]}else L=aa=D=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=D.r;na[Va+4]=D.g;na[Va+5]=D.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];G=Y[2];Y=Y[3];V[Ma]=L.x;V[Ma+1]=L.y;V[Ma+2]=L.z;V[Ma+3]=L.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;V[Ma+12]=Y.x;V[Ma+13]=Y.y;V[Ma+14]=Y.z;V[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==
-4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&qa)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&qa)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=
-8;Oa+=4}}}if(mb){K=0;for(F=mb.length;K<F;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){v=X[fb];if(v.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,v.buffer);e.bufferData(e.ARRAY_BUFFER,v.array,Q);v.needsUpdate=!1}}if(ub){D=0;for(aa=morphTargets.length;D<aa;D++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,
-ya[D],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,V,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(M>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ta,Q);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
-ra,Q)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;Q=w.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){qa=Ka[F].position;y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=qa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);
-e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=w[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;Q=w.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){qa=Ka[F].position;
-y=F*3;Ha[y]=qa.x;Ha[y+1]=qa.y;Ha[y+2]=qa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=w[F];y=F*3;K[y]=color.r;K[y+1]=color.g;K[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=
-!1}}function W(n){function C(Z){var Y=[];x=0;for(w=Z.length;x<w;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,w,y,Q,K,F,T,G,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};y=0;for(Q=n.faces.length;y<Q;y++){K=n.faces[y];F=K.materials;T=C(F);I[T]==undefined&&(I[T]={hash:T,counter:0});G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?
-3:4;if(n.geometryGroups[G].vertices+K>65535){I[T].counter+=1;G=I[T].hash+"_"+I[T].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:L})}n.geometryGroups[G].faces.push(y);n.geometryGroups[G].vertices+=K}}function B(n,C,x){n.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function U(n){if(n!=wa){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)}wa=n}}function N(n,C,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(C.magFilter));
-e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(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,pa(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,pa(C.minFilter))}}function O(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}N(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 ua(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,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
+THREE.WebGLRenderer=function(b){function d(n,D,x){var w,z,N,J=n.vertices,G=J.length,T=n.colors,H=T.length,I=n.__vertexArray,K=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(w=0;w<G;w++){z=J[w].position;Ta.copy(z);Ja.multiplyVector3(Ta);Z[w]=[Ta.z,w]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(w=0;w<G;w++){z=J[Z[w][1]].position;N=w*3;I[N]=z.x;I[N+1]=z.y;I[N+2]=z.z}for(w=0;w<H;w++){N=w*3;color=T[Z[w][1]];K[N]=color.r;
+K[N+1]=color.g;K[N+2]=color.b}}else{if(Y)for(w=0;w<G;w++){z=J[w].position;N=w*3;I[N]=z.x;I[N+1]=z.y;I[N+2]=z.z}if(ra)for(w=0;w<H;w++){color=T[w];N=w*3;K[N]=color.r;K[N+1]=color.g;K[N+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}function c(n,D,x,w,z){w.program||ea.initMaterial(w,D,x,z);var N=w.program,J=N.uniforms,G=w.uniforms;
+if(N!=da){e.useProgram(N);da=N}e.uniformMatrix4fv(J.projectionMatrix,!1,Xa);if(x&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){G.fogColor.value=x.color;if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||
+w.lights){var T,H,I=0,K=0,Z=0,Y,ra,Ka,Ca,Ha=O,Ga=Ha.directional.colors,ua=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,F=0,aa=0;x=H=Ca=0;for(T=D.length;x<T;x++){H=D[x];Y=H.color;ra=H.position;Ka=H.intensity;Ca=H.distance;if(H instanceof THREE.AmbientLight){I+=Y.r;K+=Y.g;Z+=Y.b}else if(H instanceof THREE.DirectionalLight){Ca=F*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;ua[Ca]=ra.x;ua[Ca+1]=ra.y;ua[Ca+2]=ra.z;F+=1}else if(H instanceof THREE.PointLight){H=
+aa*3;Ea[H]=Y.r*Ka;Ea[H+1]=Y.g*Ka;Ea[H+2]=Y.b*Ka;za[H]=ra.x;za[H+1]=ra.y;za[H+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(x=F*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=F;Ha.ambient[0]=I;Ha.ambient[1]=K;Ha.ambient[2]=Z;x=O;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=x.directional.colors;G.directionalLightDirection.value=x.directional.positions;G.pointLightColor.value=x.point.colors;
+G.pointLightPosition.value=x.point.positions;G.pointLightDistance.value=x.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){G.diffuse.value=w.color;G.opacity.value=w.opacity;G.map.texture=w.map;G.lightMap.texture=w.lightMap;G.envMap.texture=w.envMap;G.reflectivity.value=w.reflectivity;G.refractionRatio.value=w.refractionRatio;G.combine.value=w.combine;G.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof
+THREE.LineBasicMaterial){G.diffuse.value=w.color;G.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){G.psColor.value=w.color;G.opacity.value=w.opacity;G.size.value=w.size;G.scale.value=oa.height/2;G.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){G.ambient.value=w.ambient;G.specular.value=w.specular;G.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){G.mNear.value=n.near;G.mFar.value=n.far;G.opacity.value=w.opacity}else if(w instanceof
+THREE.MeshNormalMaterial)G.opacity.value=w.opacity;for(var v in G)if(K=N.uniforms[v]){T=G[v];I=T.type;x=T.value;if(I=="i")e.uniform1i(K,x);else if(I=="f")e.uniform1f(K,x);else if(I=="fv1")e.uniform1fv(K,x);else if(I=="fv")e.uniform3fv(K,x);else if(I=="v2")e.uniform2f(K,x.x,x.y);else if(I=="v3")e.uniform3f(K,x.x,x.y,x.z);else if(I=="v4")e.uniform4f(K,x.x,x.y,x.z,x.w);else if(I=="c")e.uniform3f(K,x.r,x.g,x.b);else if(I=="t"){e.uniform1i(K,x);if(T=T.texture)if(T.image instanceof Array&&T.image.length==
+6){if(T.image.length==6){if(T.needsUpdate){if(T.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,e.RGBA,e.UNSIGNED_BYTE,T.image[I])}else{T.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,T.image[I]);T.__webglInit=!0}R(e.TEXTURE_CUBE_MAP,T,T.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
+null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else P(T,x)}}e.uniformMatrix4fv(J.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(J.normalMatrix,!1,z._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(J.cameraPosition,n.position.x,n.position.y,n.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(J.objectMatrix,
+!1,z._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(J.viewMatrix,!1,Za);if(w instanceof THREE.ShadowVolumeDynamicMaterial){n=G.directionalLightDirection.value;n[0]=-D[1].position.x;n[1]=-D[1].position.y;n[2]=-D[1].position.z;e.uniform3fv(J.directionalLightDirection,n);e.uniformMatrix4fv(J.objectMatrix,!1,z._objectMatrixArray);e.uniformMatrix4fv(J.viewMatrix,!1,Za)}if(w.skinning){e.uniformMatrix4fv(J.cameraInverseMatrix,
+!1,Za);e.uniformMatrix4fv(J.boneGlobalMatrices,!1,z.boneMatrices)}return N}function f(n,D,x,w,z,N){if(w.opacity!=0){var J;n=c(n,D,x,w,N).attributes;if(w.morphTargets){D=w.program.attributes;N.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[N.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0);if(N.morphTargetForcedOrder.length){x=0;for(var G=N.morphTargetForcedOrder,T=N.morphTargetInfluences;x<w.numSupportedMorphTargets&&
+x<G.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[G[x]]);e.vertexAttribPointer(D["morphTarget"+x],3,e.FLOAT,!1,0,0);N.__webglMorphTargetInfluences[x]=T[G[x]];x++}}else{G=[];var H=-1,I=0;T=N.morphTargetInfluences;var K,Z=T.length;x=0;for(N.morphTargetBase!==-1&&(G[N.morphTargetBase]=!0);x<w.numSupportedMorphTargets;){for(K=0;K<Z;K++)if(!G[K]&&T[K]>H){I=K;H=T[I]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[I]);e.vertexAttribPointer(D["morphTarget"+x],3,e.FLOAT,!1,0,0);
+N.__webglMorphTargetInfluences[x]=H;G[I]=1;H=-1;x++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,N.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(J in z.__webglCustomAttributes)if(n[J]>=0){D=z.__webglCustomAttributes[J];e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[J],D.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(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(N 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)}ea.data.vertices+=z.__webglFaceCount;ea.data.faces+=
+z.__webglFaceCount/3}else if(N instanceof THREE.Line){N=N.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(N,0,z.__webglLineCount)}else if(N instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else N instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,D,x){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(D.attributes.position);e.vertexAttribPointer(D.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(x==THREE.FlatShading){var w,z,N,J,G,T,H,I,K,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;w=x[Z];z=x[Z+1];N=x[Z+2];J=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];K=x[Z+8];w=(w+J+G)/3;z=(z+T+H)/3;N=(N+I+K)/3;x[Z]=w;x[Z+1]=z;x[Z+2]=N;x[Z+3]=
+w;x[Z+4]=z;x[Z+5]=N;x[Z+6]=w;x[Z+7]=z;x[Z+8]=N}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(qa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);qa=n.doubleSided}if(pa!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);pa=n.flipSided}}function j(n){if(fa!=n){n?e.enable(e.DEPTH_TEST):
+e.disable(e.DEPTH_TEST);fa=n}}function k(n){ga[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ga[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ga[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ga[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ga[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ga[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=ga[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=
+n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),w=0;w<6;w++){n=ga[w].x*D.n14+ga[w].y*D.n24+ga[w].z*D.n34+ga[w].w;if(n<=x)return!1}return!0}function p(n,D){n.list[n.count]=D;n.count+=1}function o(n){var D,x,w=n.object,z=n.opaque,N=n.transparent;N.count=0;n=z.count=0;for(D=w.materials.length;n<D;n++){x=w.materials[n];x.transparent?p(N,x):p(z,x)}}function t(n){var D,x,w,z,N=n.object,J=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(w=
+N.materials.length;n<w;n++){D=N.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=J.materials.length;D<x;D++)(z=J.materials[D])&&(z.transparent?p(T,z):p(G,z))}else(z=D)&&(z.transparent?p(T,z):p(G,z))}}function y(n,D){return D.z-n.z}function u(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 D,x=n.lights.length,w,z=n.lights,N=[],J,G,T,H,I,K=n.__webglShadowVolumes.length;for(D=0;D<x;D++){w=n.lights[D];if(w instanceof THREE.DirectionalLight&&w.castShadow){N[0]=-w.position.x;N[1]=-w.position.y;N[2]=-w.position.z;for(I=0;I<K;I++){w=n.__webglShadowVolumes[I].object;J=n.__webglShadowVolumes[I].buffer;G=w.materials[0];G.program||ea.initMaterial(G,z,undefined,w);G=G.program;T=G.uniforms;H=G.attributes;if(da!==G){e.useProgram(G);da=G;e.uniformMatrix4fv(T.projectionMatrix,
+!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,N)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,J.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,J.__webglNormalBuffer);e.vertexAttribPointer(H.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,J.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,
+J.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,J.__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);wa="";da=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,
+0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(ja)}function B(n,D){var x,w,z;x=_sprite.attributes;var N=_sprite.uniforms,J=ia/Fa,G,T=[],H=Fa*0.5,I=ia*0.5,K=!0;e.useProgram(_sprite.program);da=_sprite.program;wa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);
+e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(N.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(N.map,0);x=0;for(w=n.__webglSprites.length;x<w;x++){z=n.__webglSprites[x];if(z.useScreenCoordinates)z.z=
+-z.position.z;else{z._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);x=0;for(w=n.__webglSprites.length;x<w;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(N.useScreenCoordinates,1);e.uniform3f(N.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(N.useScreenCoordinates,
+0);e.uniform1i(N.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(N.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ia);T[0]=G*J*z.scale.x;T[1]=G*z.scale.y;e.uniform2f(N.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(N.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(N.alignment,z.alignment.x,z.alignment.y);e.uniform1f(N.opacity,z.opacity);e.uniform1f(N.rotation,z.rotation);e.uniform2fv(N.scale,T);if(z.mergeWith3D&&!K){e.enable(e.DEPTH_TEST);K=!0}else if(!z.mergeWith3D&&
+K){e.disable(e.DEPTH_TEST);K=!1}X(z.blending);P(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ja)}function A(n,D){var x,w,z=n.__webglLensFlares.length,N,J,G,T=new THREE.Vector3,H=ia/Fa,I=Fa*0.5,K=ia*0.5,Z=16/ia,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=M.uniforms;x=M.attributes;e.useProgram(M.program);da=M.program;wa="";if(!Aa){e.enableVertexAttribArray(M.attributes.vertex);e.enableVertexAttribArray(M.attributes.uv);Aa=!0}e.uniform1i(Ca.occlusionMap,
+0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,M.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,M.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,M.occlusionTexture);e.activeTexture(e.TEXTURE1);for(w=0;w<z;w++){x=n.__webglLensFlares[w].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);
+D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*K+K;if(M.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ia){e.bindTexture(e.TEXTURE_2D,M.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,M.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,
+0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,M.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);N=0;for(J=x.lensFlares.length;N<J;N++){G=x.lensFlares[N];if(G.opacity>0.001&&G.scale>0.001){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*
+G.scale/ia;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);X(G.blending);P(G.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ja)}function Q(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function E(n){var D,
+x,w,z,N;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){w=x.geometryGroups[D];N=!1;for(z in w.__webglCustomAttributes)if(w.__webglCustomAttributes[z].needsUpdate){N=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||N){N=e.DYNAMIC_DRAW;var J=void 0,G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,K=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,ua=void 0,Ea=void 0,
+za=void 0,Ua=void 0;K=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var F=void 0,aa=void 0;K=void 0;F=void 0;aa=void 0;var v=void 0,ab=void 0;F=void 0;aa=void 0;v=void 0;ab=void 0;F=void 0;aa=void 0;v=void 0;ab=void 0;F=void 0;aa=void 0;v=void 0;H=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;F=void 0;aa=void 0;v=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,L=0,Na=0;aa=F=0;var Ra=w.__vertexArray,ib=w.__uvArray,jb=w.__uv2Array,Pa=w.__normalArray,U=w.__tangentArray,na=w.__colorArray,
+ha=w.__skinVertexAArray,$=w.__skinVertexBArray,ta=w.__skinIndexArray,sa=w.__skinWeightArray,xa=w.__morphTargetsArrays,W=w.__webglCustomAttributes;v=void 0;var Ia=w.__faceArray,Ya=w.__lineArray,eb=w.__needsSmoothNormals;Ka=w.__vertexColorType;ra=w.__uvType;Ca=w.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=w.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],
+xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(W)for(fb in W){W[fb].offset=0;W[fb].offsetSrc=0}J=0;for(G=vb.length;J<G;J++){T=vb[J];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;K=H.vertexColors;Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){ua=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ra[Qa]=ua.x;Ra[Qa+
+1]=ua.y;Ra[Qa+2]=ua.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(W)for(fb in W){v=W[fb];if(v.needsUpdate){F=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[F+0]=v.value[H.a];v.array[F+1]=v.value[H.b];v.array[F+2]=v.value[H.c]}else if(v.boundTo==="faces"){v.array[F+0]=v.value[aa];v.array[F+1]=v.value[aa];v.array[F+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[F+0]=v.value[aa+
+0];v.array[F+1]=v.value[aa+1];v.array[F+2]=v.value[aa+2];v.offsetSrc+=3}v.offset+=3}else{if(v.boundTo===undefined||v.boundTo==="vertices"){ua=v.value[H.a];Ea=v.value[H.b];za=v.value[H.c]}else if(v.boundTo==="faces"){ua=v.value[aa];Ea=v.value[aa];za=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){ua=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];v.offsetSrc+=3}if(v.size===2){v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=Ea.x;v.array[F+3]=Ea.y;v.array[F+4]=za.x;v.array[F+5]=za.y;v.offset+=
+6}else if(v.size===3){if(v.type==="c"){v.array[F+0]=ua.r;v.array[F+1]=ua.g;v.array[F+2]=ua.b;v.array[F+3]=Ea.r;v.array[F+4]=Ea.g;v.array[F+5]=Ea.b;v.array[F+6]=za.r;v.array[F+7]=za.g;v.array[F+8]=za.b}else{v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=ua.z;v.array[F+3]=Ea.x;v.array[F+4]=Ea.y;v.array[F+5]=Ea.z;v.array[F+6]=za.x;v.array[F+7]=za.y;v.array[F+8]=za.z}v.offset+=9}else{v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=ua.z;v.array[F+3]=ua.w;v.array[F+4]=Ea.x;v.array[F+5]=Ea.y;v.array[F+
+6]=Ea.z;v.array[F+7]=Ea.w;v.array[F+8]=za.x;v.array[F+9]=za.y;v.array[F+10]=za.z;v.array[F+11]=za.w;v.offset+=12}}}}if(ub){F=0;for(aa=morphTargets.length;F<aa;F++){ua=morphTargets[F].vertices[H.a].position;Ea=morphTargets[F].vertices[H.b].position;za=morphTargets[F].vertices[H.c].position;v=xa[F];v[Na+0]=ua.x;v[Na+1]=ua.y;v[Na+2]=ua.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z}Na+=9}if(lb.length){F=lb[H.a];aa=lb[H.b];v=lb[H.c];sa[L]=F.x;sa[L+1]=F.y;sa[L+2]=F.z;sa[L+
+3]=F.w;sa[L+4]=aa.x;sa[L+5]=aa.y;sa[L+6]=aa.z;sa[L+7]=aa.w;sa[L+8]=v.x;sa[L+9]=v.y;sa[L+10]=v.z;sa[L+11]=v.w;F=qb[H.a];aa=qb[H.b];v=qb[H.c];ta[L]=F.x;ta[L+1]=F.y;ta[L+2]=F.z;ta[L+3]=F.w;ta[L+4]=aa.x;ta[L+5]=aa.y;ta[L+6]=aa.z;ta[L+7]=aa.w;ta[L+8]=v.x;ta[L+9]=v.y;ta[L+10]=v.z;ta[L+11]=v.w;F=ob[H.a];aa=ob[H.b];v=ob[H.c];ha[L]=F.x;ha[L+1]=F.y;ha[L+2]=F.z;ha[L+3]=1;ha[L+4]=aa.x;ha[L+5]=aa.y;ha[L+6]=aa.z;ha[L+7]=1;ha[L+8]=v.x;ha[L+9]=v.y;ha[L+10]=v.z;ha[L+11]=1;F=pb[H.a];aa=pb[H.b];v=pb[H.c];$[L]=F.x;$[L+
+1]=F.y;$[L+2]=F.z;$[L+3]=1;$[L+4]=aa.x;$[L+5]=aa.y;$[L+6]=aa.z;$[L+7]=1;$[L+8]=v.x;$[L+9]=v.y;$[L+10]=v.z;$[L+11]=1;L+=12}if(tb&&Ka){if(K.length==3&&Ka==THREE.VertexColors){H=K[0];F=K[1];aa=K[2]}else aa=F=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=F.r;na[Va+4]=F.g;na[Va+5]=F.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){K=Y[0];Z=Y[1];H=Y[2];U[Ma]=K.x;U[Ma+1]=K.y;U[Ma+2]=K.z;U[Ma+3]=K.w;U[Ma+4]=Z.x;U[Ma+5]=Z.y;U[Ma+6]=Z.z;U[Ma+7]=Z.w;U[Ma+8]=H.x;U[Ma+9]=H.y;U[Ma+10]=
+H.z;U[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(H instanceof
+THREE.Face4){if(kb){ua=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.d].position;Ra[Qa]=ua.x;Ra[Qa+1]=ua.y;Ra[Qa+2]=ua.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(W)for(fb in W){v=W[fb];if(v.needsUpdate){F=v.offset;aa=v.offsetSrc;if(v.size===1){if(v.boundTo===undefined||v.boundTo==="vertices"){v.array[F+0]=v.value[H.a];v.array[F+1]=v.value[H.b];v.array[F+2]=v.value[H.c];v.array[F+2]=
+v.value[H.d]}else if(v.boundTo==="faces"){v.array[F+0]=v.value[aa];v.array[F+1]=v.value[aa];v.array[F+2]=v.value[aa];v.array[F+2]=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){v.array[F+0]=v.value[aa+0];v.array[F+1]=v.value[aa+1];v.array[F+2]=v.value[aa+2];v.array[F+2]=v.value[aa+3];v.offsetSrc+=4}v.offset+=4}else{if(v.boundTo===undefined||v.boundTo==="vertices"){ua=v.value[H.a];Ea=v.value[H.b];za=v.value[H.c];Ua=v.value[H.d]}else if(v.boundTo==="faces"){ua=v.value[aa];Ea=v.value[aa];
+za=v.value[aa];Ua=v.value[aa];v.offsetSrc++}else if(v.boundTo==="faceVertices"){ua=v.value[aa+0];Ea=v.value[aa+1];za=v.value[aa+2];Ua=v.value[aa+3];v.offsetSrc+=4}if(v.size===2){v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=Ea.x;v.array[F+3]=Ea.y;v.array[F+4]=za.x;v.array[F+5]=za.y;v.array[F+6]=Ua.x;v.array[F+7]=Ua.y;v.offset+=8}else if(v.size===3){if(v.type==="c"){v.array[F+0]=ua.r;v.array[F+1]=ua.g;v.array[F+2]=ua.b;v.array[F+3]=Ea.r;v.array[F+4]=Ea.g;v.array[F+5]=Ea.b;v.array[F+6]=za.r;v.array[F+
+7]=za.g;v.array[F+8]=za.b;v.array[F+9]=Ua.r;v.array[F+10]=Ua.g;v.array[F+11]=Ua.b}else{v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=ua.z;v.array[F+3]=Ea.x;v.array[F+4]=Ea.y;v.array[F+5]=Ea.z;v.array[F+6]=za.x;v.array[F+7]=za.y;v.array[F+8]=za.z;v.array[F+9]=Ua.x;v.array[F+10]=Ua.y;v.array[F+11]=Ua.z}v.offset+=12}else{v.array[F+0]=ua.x;v.array[F+1]=ua.y;v.array[F+2]=ua.z;v.array[F+3]=ua.w;v.array[F+4]=Ea.x;v.array[F+5]=Ea.y;v.array[F+6]=Ea.z;v.array[F+7]=Ea.w;v.array[F+8]=za.x;v.array[F+9]=za.y;
+v.array[F+10]=za.z;v.array[F+11]=za.w;v.array[F+12]=Ua.x;v.array[F+13]=Ua.y;v.array[F+14]=Ua.z;v.array[F+15]=Ua.w;v.offset+=16}}}}if(ub){F=0;for(aa=morphTargets.length;F<aa;F++){ua=morphTargets[F].vertices[H.a].position;Ea=morphTargets[F].vertices[H.b].position;za=morphTargets[F].vertices[H.c].position;Ua=morphTargets[F].vertices[H.d].position;v=xa[F];v[Na+0]=ua.x;v[Na+1]=ua.y;v[Na+2]=ua.z;v[Na+3]=Ea.x;v[Na+4]=Ea.y;v[Na+5]=Ea.z;v[Na+6]=za.x;v[Na+7]=za.y;v[Na+8]=za.z;v[Na+9]=Ua.x;v[Na+10]=Ua.y;v[Na+
+11]=Ua.z}Na+=12}if(lb.length){F=lb[H.a];aa=lb[H.b];v=lb[H.c];ab=lb[H.d];sa[L]=F.x;sa[L+1]=F.y;sa[L+2]=F.z;sa[L+3]=F.w;sa[L+4]=aa.x;sa[L+5]=aa.y;sa[L+6]=aa.z;sa[L+7]=aa.w;sa[L+8]=v.x;sa[L+9]=v.y;sa[L+10]=v.z;sa[L+11]=v.w;sa[L+12]=ab.x;sa[L+13]=ab.y;sa[L+14]=ab.z;sa[L+15]=ab.w;F=qb[H.a];aa=qb[H.b];v=qb[H.c];ab=qb[H.d];ta[L]=F.x;ta[L+1]=F.y;ta[L+2]=F.z;ta[L+3]=F.w;ta[L+4]=aa.x;ta[L+5]=aa.y;ta[L+6]=aa.z;ta[L+7]=aa.w;ta[L+8]=v.x;ta[L+9]=v.y;ta[L+10]=v.z;ta[L+11]=v.w;ta[L+12]=ab.x;ta[L+13]=ab.y;ta[L+14]=
+ab.z;ta[L+15]=ab.w;F=ob[H.a];aa=ob[H.b];v=ob[H.c];ab=ob[H.d];ha[L]=F.x;ha[L+1]=F.y;ha[L+2]=F.z;ha[L+3]=1;ha[L+4]=aa.x;ha[L+5]=aa.y;ha[L+6]=aa.z;ha[L+7]=1;ha[L+8]=v.x;ha[L+9]=v.y;ha[L+10]=v.z;ha[L+11]=1;ha[L+12]=ab.x;ha[L+13]=ab.y;ha[L+14]=ab.z;ha[L+15]=1;F=pb[H.a];aa=pb[H.b];v=pb[H.c];H=pb[H.d];$[L]=F.x;$[L+1]=F.y;$[L+2]=F.z;$[L+3]=1;$[L+4]=aa.x;$[L+5]=aa.y;$[L+6]=aa.z;$[L+7]=1;$[L+8]=v.x;$[L+9]=v.y;$[L+10]=v.z;$[L+11]=1;$[L+12]=H.x;$[L+13]=H.y;$[L+14]=H.z;$[L+15]=1;L+=16}if(tb&&Ka){if(K.length==
+4&&Ka==THREE.VertexColors){H=K[0];F=K[1];aa=K[2];K=K[3]}else K=aa=F=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=F.r;na[Va+4]=F.g;na[Va+5]=F.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=K.r;na[Va+10]=K.g;na[Va+11]=K.b;Va+=12}if(sb&&Sa.hasTangents){K=Y[0];Z=Y[1];H=Y[2];Y=Y[3];U[Ma]=K.x;U[Ma+1]=K.y;U[Ma+2]=K.z;U[Ma+3]=K.w;U[Ma+4]=Z.x;U[Ma+5]=Z.y;U[Ma+6]=Z.z;U[Ma+7]=Z.w;U[Ma+8]=H.x;U[Ma+9]=H.y;U[Ma+10]=H.z;U[Ma+11]=H.w;U[Ma+12]=Y.x;U[Ma+13]=Y.y;U[Ma+14]=Y.z;U[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==
+4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=
+8;Oa+=4}}}if(mb){J=0;for(G=mb.length;J<G;J++){Ia[Wa]=mb[J].a;Ia[Wa+1]=mb[J].b;Ia[Wa+2]=mb[J].c;Ia[Wa+3]=mb[J].a;Ia[Wa+4]=mb[J].c;Ia[Wa+5]=mb[J].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,N)}if(W)for(fb in W){v=W[fb];if(v.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,v.buffer);e.bufferData(e.ARRAY_BUFFER,v.array,N);v.needsUpdate=!1}}if(ub){F=0;for(aa=morphTargets.length;F<aa;F++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[F]);e.bufferData(e.ARRAY_BUFFER,
+xa[F],N)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,N)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,N)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,U,N)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,N)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,N)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,N);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,N)}if(L>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ha,N);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,N);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ta,N);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
+sa,N)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;N=w.length;Ha=n.__vertexArray;J=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);
+e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<N;G++){color=w[G];z=G*3;J[z]=color.r;J[z+1]=color.g;J[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;w=n.colors;Ca=Ka.length;N=w.length;Ha=n.__vertexArray;J=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;
+z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<N;G++){color=w[G];z=G*3;J[z]=color.r;J[z+1]=color.g;J[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=
+!1}}function V(n){function D(Z){var Y=[];x=0;for(w=Z.length;x<w;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,w,z,N,J,G,T,H,I={},K=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(N=n.faces.length;z<N;z++){J=n.faces[z];G=J.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:K});J=J instanceof THREE.Face3?
+3:4;if(n.geometryGroups[H].vertices+J>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:K})}n.geometryGroups[H].faces.push(z);n.geometryGroups[H].vertices+=J}}function C(n,D,x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function X(n){if(n!=wa){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)}wa=n}}function R(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,Ba(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,Ba(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,Ba(D.magFilter));
+e.texParameteri(n,e.TEXTURE_MIN_FILTER,Ba(D.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,ca(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ca(D.minFilter))}}function P(n,D){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}R(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function ya(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,Ba(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,Ba(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Ba(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Ba(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,Ba(n.format),n.width,n.height,0,Ba(n.format),Ba(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,x;if(n){C=n.__webglFramebuffer;x=n.width;n=n.height}else{C=null;x=Fa;n=ia}if(C!=ka){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ja,ma,x,n);ka=C}}function la(n,C){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,
-C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function pa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ga(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;
+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 D,x;if(n){D=n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ia}if(D!=va){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);va=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,
+D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function ca(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Ba(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 ha=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,ka=null,fa=!0,va=null,sa=null,wa=null,ca=null,ja=0,ma=0,Fa=0,ia=0,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={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.data={vertices:0,
-faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,x,w){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:w})))throw"Error creating WebGL context.";}catch(y){console.error(y)}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,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=
+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 ea=this,e,oa=document.createElement("canvas"),Da=[],da=null,va=null,ja=!0,qa=null,pa=null,wa=null,fa=null,ka=0,ma=0,Fa=0,ia=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,O={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.data={vertices:0,
+faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,w){try{if(!(e=oa.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(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=
 -20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
-e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=
-0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();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);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.texImage2D(e.TEXTURE_2D,
-0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){P.hasVertexTexture=!1;P.program=e.createProgram();e.attachShader(P.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(P.program,
-la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{P.hasVertexTexture=!0;P.program=e.createProgram();e.attachShader(P.program,la("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(P.program,la("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(P.program);P.attributes={};P.uniforms={};P.attributes.vertex=e.getAttribLocation(P.program,"position");P.attributes.uv=e.getAttribLocation(P.program,"UV");P.uniforms.renderType=e.getUniformLocation(P.program,
-"renderType");P.uniforms.map=e.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=e.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=e.getUniformLocation(P.program,"opacity");P.uniforms.scale=e.getUniformLocation(P.program,"scale");P.uniforms.rotation=e.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=e.getUniformLocation(P.program,"screenPosition");var Ba=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=
+e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var M={};M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);b=0;M.vertices[b++]=-1;M.vertices[b++]=-1;M.vertices[b++]=0;M.vertices[b++]=0;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=
+0;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=1;M.vertices[b++]=-1;M.vertices[b++]=1;M.vertices[b++]=0;M.vertices[b++]=1;b=0;M.faces[b++]=0;M.faces[b++]=1;M.faces[b++]=2;M.faces[b++]=0;M.faces[b++]=2;M.faces[b++]=3;M.vertexBuffer=e.createBuffer();M.elementBuffer=e.createBuffer();M.tempTexture=e.createTexture();M.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,M.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,M.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+M.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,M.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,M.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,M.occlusionTexture);e.texImage2D(e.TEXTURE_2D,
+0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){M.hasVertexTexture=!1;M.program=e.createProgram();e.attachShader(M.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(M.program,
+la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{M.hasVertexTexture=!0;M.program=e.createProgram();e.attachShader(M.program,la("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(M.program,la("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.vertex=e.getAttribLocation(M.program,"position");M.attributes.uv=e.getAttribLocation(M.program,"UV");M.uniforms.renderType=e.getUniformLocation(M.program,
+"renderType");M.uniforms.map=e.getUniformLocation(M.program,"map");M.uniforms.occlusionMap=e.getUniformLocation(M.program,"occlusionMap");M.uniforms.opacity=e.getUniformLocation(M.program,"opacity");M.uniforms.scale=e.getUniformLocation(M.program,"scale");M.uniforms.rotation=e.getUniformLocation(M.program,"rotation");M.uniforms.screenPosition=e.getUniformLocation(M.program,"screenPosition");var Aa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=
 -1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=
 e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("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 La=!1;this.setSize=function(n,C){oa.width=n;oa.height=C;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,C,x,w){ja=n;ma=C;Fa=x;ia=w;e.viewport(ja,ma,Fa,ia)};this.setScissor=function(n,C,x,w){e.scissor(n,C,x,w)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=
-n;e.depthMask(n)};this.setClearColorHex=function(n,C){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.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){S.darkness=n};this.getContext=function(){return e};this.initMaterial=function(n,C,x,w){var y,Q,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 F=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(F.uniforms);n.vertexShader=F.vertexShader;n.fragmentShader=F.fragmentShader}var T,
-G,I;T=I=F=0;for(G=C.length;T<G;T++){Q=C[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&F++}if(F+I<=4)C=I;else{C=Math.ceil(4*I/(F+I));F=4-C}Q={directional:C,point:F};I=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)I=w.bones.length;var L;a:{T=n.fragmentShader;G=n.vertexShader;F=n.uniforms;C=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,
-maxMorphTargets:this.maxMorphTargets,maxDirLights:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(G)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
+e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,D){oa.width=n;oa.height=D;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,D,x,w){ka=n;ma=D;Fa=x;ia=w;e.viewport(ka,ma,Fa,ia)};this.setScissor=function(n,D,x,w){e.scissor(n,D,x,w)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){ja=
+n;e.depthMask(n)};this.setClearColorHex=function(n,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=n};this.getContext=function(){return e};this.initMaterial=function(n,D,x,w){var z,N,J;if(n instanceof THREE.MeshDepthMaterial)J="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)J=
+"shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)J="normal";else if(n instanceof THREE.MeshBasicMaterial)J="basic";else if(n instanceof THREE.MeshLambertMaterial)J="lambert";else if(n instanceof THREE.MeshPhongMaterial)J="phong";else if(n instanceof THREE.LineBasicMaterial)J="basic";else n instanceof THREE.ParticleBasicMaterial&&(J="particle_basic");if(J){var G=THREE.ShaderLib[J];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var T,
+H,I;T=I=G=0;for(H=D.length;T<H;T++){N=D[T];N instanceof THREE.DirectionalLight&&I++;N instanceof THREE.PointLight&&G++}if(G+I<=4)D=I;else{D=Math.ceil(4*I/(G+I));G=4-D}N={directional:D,point:G};I=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)I=w.bones.length;var K;a:{T=n.fragmentShader;H=n.vertexShader;G=n.uniforms;D=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,
+maxMorphTargets:this.maxMorphTargets,maxDirLights:N.directional,maxPointLights:N.point,maxBones:I};var Z;N=[];if(J)N.push(J);else{N.push(T);N.push(H)}for(Z in x){N.push(Z);N.push(x[Z])}J=N.join();Z=0;for(N=Da.length;Z<N;Z++)if(Da[Z].code==J){K=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
 "",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.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 "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":
 "",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.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(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",prefix_vertex+G));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in F)T.push(Y);
-Y=T;F=0;for(T=Y.length;F<T;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in C)T.push(L);L=T;Y=0;for(C=L.length;Y<C;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}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(y in n.attributes)L[y]>=0&&e.enableVertexAttribArray(L[y]);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++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(y=this.maxMorphTargets;n<y;n++)w.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,x,w){var y,Q,K,F,T,G,I,L,Z=n.lights,Y=n.fog;ha.data.vertices=0;ha.data.faces=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);
-C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);ua(x);(this.autoClear||w)&&this.clear();T=n.__webglObjects.length;for(w=0;w<T;w++){y=n.__webglObjects[w];I=y.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);t(y);y.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);y.z=Ta.z}}else y.render=!1;else y.render=!1}this.sortObjects&&n.__webglObjects.sort(z);
-G=n.__webglObjectsImmediate.length;for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);p(y)}}U(THREE.NormalBlending);for(w=0;w<T;w++){y=n.__webglObjects[w];if(y.render){I=y.object;L=y.buffer;K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){K=y.opaque;h(I);for(y=0;y<K.count;y++){F=K.list[y];j(F.depthTest);
-Q=c(C,Z,Y,F,I);I.render(function(qa){g(qa,Q,F.shading)})}}}for(w=0;w<T;w++){y=n.__webglObjects[w];if(y.render){I=y.object;L=y.buffer;K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);f(C,Z,Y,F,L,I)}}}for(w=0;w<G;w++){y=n.__webglObjectsImmediate[w];I=y.object;if(I.visible){K=y.transparent;h(I);for(y=0;y<K.count;y++){F=K.list[y];U(F.blending);j(F.depthTest);Q=c(C,Z,Y,F,I);I.render(function(qa){g(qa,Q,F.shading)})}}}n.__webglSprites.length&&A(n,C);stencil&&n.__webglShadowVolumes.length&&
-n.lights.length&&u(n);n.__webglLensFlares.length&&E(n,C);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__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],x=n,w=void 0,y=void 0,Q=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){y=C.geometry;y.geometryGroups==undefined&&W(y);for(w in y.geometryGroups){Q=y.geometryGroups[w];if(!Q.__webglVertexBuffer){var K=Q;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 F=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];F=0;for(T=K.numMorphTargets;F<T;F++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=
-Q;F=C;var G=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,qa=void 0,Ka=qa=T=0;I=void 0;L=void 0;var Ca=void 0;G=void 0;I=void 0;Z=F.geometry;Ca=Z.faces;Y=K.faces;G=0;for(I=Y.length;G<I;G++){L=Y[G];L=Ca[L];if(L instanceof THREE.Face3){T+=3;qa+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;qa+=2;Ka+=4}}G=K;I=F;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=G.materials.length;Ha<
-l;Ha++)(Ga=G.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}G=L;a:{I=void 0;Ca=void 0;Y=G.length;for(I=0;I<Y;I++){Ca=G[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=G;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=
-G.length;for(Y=0;Y<Ha;Y++){L=G[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=
-new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(qa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(T*3))}K.__needsSmoothNormals=Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=
-Ca;K.__webglFaceCount=qa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=G.length;Z<Y;Z++)if(G[Z].attributes){K.__webglCustomAttributes={};for(a in G[Z].attributes){I=G[Z].attributes[a];qa=1;if(I.type==="v2")qa=2;else if(I.type==="v3")qa=3;else if(I.type==="v4")qa=4;else I.type==="c"&&(qa=3);I.size=qa;I.needsUpdate=!0;I.array=new Float32Array(T*qa);I.buffer=e.createBuffer();K.__webglCustomAttributes[a]=I}}y.__dirtyVertices=!0;y.__dirtyMorphTargets=!0;y.__dirtyElements=
-!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}C instanceof THREE.ShadowVolume?B(x.__webglShadowVolumes,Q,C):B(x.__webglObjects,Q,C)}}else if(C instanceof THREE.LensFlare)B(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__webglVertexCount=
-Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(C instanceof THREE.Line){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__webglLineCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(C instanceof THREE.ParticleSystem){y=C.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=
-e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;Q=w.vertices.length;w.__vertexArray=new Float32Array(Q*3);w.__colorArray=new Float32Array(Q*3);w.__sortArray=[];w.__webglParticleCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(x.__webglObjects,y,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&x.__webglSprites.push(C);n.__objectsAdded.splice(0,
-1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];x=n;y=void 0;w=void 0;if(C instanceof THREE.Mesh)for(y=x.__webglObjects.length-1;y>=0;y--){w=x.__webglObjects[y].object;if(C==w){x.__webglObjects.splice(y,1);break}}else if(C instanceof THREE.Sprite)for(y=x.__webglSprites.length-1;y>=0;y--){w=x.__webglSprites[y];if(C==w){x.__webglSprites.splice(y,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(x=n.__webglObjects.length;C<x;C++)J(n.__webglObjects[C].object,n);C=0;for(x=n.__webglShadowVolumes.length;C<
-x;C++)J(n.__webglShadowVolumes[C].object,n);C=0;for(x=n.__webglLensFlares.length;C<x;C++)J(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}};
+e.attachShader(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",prefix_vertex+H));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in G)T.push(Y);
+Y=T;G=0;for(T=Y.length;G<T;G++){H=Y[G];Z.uniforms[H]=e.getUniformLocation(Z,H)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(K in D)T.push(K);K=T;Y=0;for(D=K.length;Y<D;Y++){x=K[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:J});K=Z}n.program=K;K=n.program.attributes;e.enableVertexAttribArray(K.position);K.color>=0&&e.enableVertexAttribArray(K.color);K.normal>=
+0&&e.enableVertexAttribArray(K.normal);K.tangent>=0&&e.enableVertexAttribArray(K.tangent);if(n.skinning&&K.skinVertexA>=0&&K.skinVertexB>=0&&K.skinIndex>=0&&K.skinWeight>=0){e.enableVertexAttribArray(K.skinVertexA);e.enableVertexAttribArray(K.skinVertexB);e.enableVertexAttribArray(K.skinIndex);e.enableVertexAttribArray(K.skinWeight)}for(z in n.attributes)K[z]>=0&&e.enableVertexAttribArray(K[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(K.morphTarget0>=0){e.enableVertexAttribArray(K.morphTarget0);
+n.numSupportedMorphTargets++}if(K.morphTarget1>=0){e.enableVertexAttribArray(K.morphTarget1);n.numSupportedMorphTargets++}if(K.morphTarget2>=0){e.enableVertexAttribArray(K.morphTarget2);n.numSupportedMorphTargets++}if(K.morphTarget3>=0){e.enableVertexAttribArray(K.morphTarget3);n.numSupportedMorphTargets++}if(K.morphTarget4>=0){e.enableVertexAttribArray(K.morphTarget4);n.numSupportedMorphTargets++}if(K.morphTarget5>=0){e.enableVertexAttribArray(K.morphTarget5);n.numSupportedMorphTargets++}if(K.morphTarget6>=
+0){e.enableVertexAttribArray(K.morphTarget6);n.numSupportedMorphTargets++}if(K.morphTarget7>=0){e.enableVertexAttribArray(K.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,D,x,w){var z,N,J,G,T,H,I,K,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(Za);
+D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);ya(x);(this.autoClear||w)&&this.clear();T=n.__webglObjects.length;for(w=0;w<T;w++){z=n.__webglObjects[w];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);Q(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);
+H=n.__webglObjectsImmediate.length;for(w=0;w<H;w++){z=n.__webglObjectsImmediate[w];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);Q(I,D);o(z)}}X(THREE.NormalBlending);for(w=0;w<T;w++){z=n.__webglObjects[w];if(z.render){I=z.object;K=z.buffer;J=z.opaque;h(I);for(z=0;z<J.count;z++){G=J.list[z];j(G.depthTest);f(D,Z,Y,G,K,I)}}}for(w=0;w<H;w++){z=n.__webglObjectsImmediate[w];I=z.object;if(I.visible){J=z.opaque;h(I);for(z=0;z<J.count;z++){G=J.list[z];j(G.depthTest);
+N=c(D,Z,Y,G,I);I.render(function(ra){g(ra,N,G.shading)})}}}for(w=0;w<T;w++){z=n.__webglObjects[w];if(z.render){I=z.object;K=z.buffer;J=z.transparent;h(I);for(z=0;z<J.count;z++){G=J.list[z];X(G.blending);j(G.depthTest);f(D,Z,Y,G,K,I)}}}for(w=0;w<H;w++){z=n.__webglObjectsImmediate[w];I=z.object;if(I.visible){J=z.transparent;h(I);for(z=0;z<J.count;z++){G=J.list[z];X(G.blending);j(G.depthTest);N=c(D,Z,Y,G,I);I.render(function(ra){g(ra,N,G.shading)})}}}n.__webglSprites.length&&B(n,D);stencil&&n.__webglShadowVolumes.length&&
+n.lights.length&&u(n);n.__webglLensFlares.length&&A(n,D);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__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 D=n.__objectsAdded[0],x=n,w=void 0,z=void 0,N=void 0;
+if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&V(z);for(w in z.geometryGroups){N=z.geometryGroups[w];if(!N.__webglVertexBuffer){var J=N;J.__webglVertexBuffer=e.createBuffer();J.__webglNormalBuffer=e.createBuffer();J.__webglTangentBuffer=
+e.createBuffer();J.__webglColorBuffer=e.createBuffer();J.__webglUVBuffer=e.createBuffer();J.__webglUV2Buffer=e.createBuffer();J.__webglSkinVertexABuffer=e.createBuffer();J.__webglSkinVertexBBuffer=e.createBuffer();J.__webglSkinIndicesBuffer=e.createBuffer();J.__webglSkinWeightsBuffer=e.createBuffer();J.__webglFaceBuffer=e.createBuffer();J.__webglLineBuffer=e.createBuffer();if(J.numMorphTargets){var G=void 0,T=void 0;J.__webglMorphTargetsBuffers=[];G=0;for(T=J.numMorphTargets;G<T;G++)J.__webglMorphTargetsBuffers.push(e.createBuffer())}J=
+N;G=D;var H=void 0,I=void 0,K=void 0;K=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;K=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=J.faces;H=0;for(I=Y.length;H<I;H++){K=Y[H];K=Ca[K];if(K instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(K instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=J;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;K=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<
+l;Ha++)(Ga=H.materials[Ha])&&K.push(Ga)}else(Ga=Ha)&&K.push(Ga)}H=K;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;K=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){K=Ca[Y];if(!(K instanceof THREE.MeshBasicMaterial&&!K.envMap||K instanceof THREE.MeshDepthMaterial)){Ca=K&&K.shading!=undefined&&K.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;K=void 0;Ha=
+H.length;for(Y=0;Y<Ha;Y++){K=H[Y];if(K.vertexColors){K=K.vertexColors;break a}}K=!1}J.__vertexArray=new Float32Array(T*3);if(Ca)J.__normalArray=new Float32Array(T*3);if(Z.hasTangents)J.__tangentArray=new Float32Array(T*4);if(K)J.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)J.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)J.__uv2Array=new Float32Array(T*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){J.__skinVertexAArray=
+new Float32Array(T*4);J.__skinVertexBArray=new Float32Array(T*4);J.__skinIndexArray=new Float32Array(T*4);J.__skinWeightArray=new Float32Array(T*4)}J.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));J.__lineArray=new Uint16Array(Ka*2);if(J.numMorphTargets){J.__morphTargetsArrays=[];Z=0;for(Y=J.numMorphTargets;Z<Y;Z++)J.__morphTargetsArrays.push(new Float32Array(T*3))}J.__needsSmoothNormals=Ca==THREE.SmoothShading;J.__uvType=I;J.__vertexColorType=K;J.__normalType=
+Ca;J.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);J.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){J.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();J.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=
+!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,N,D):C(x.__webglObjects,N,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;N=w.vertices.length;w.__vertexArray=new Float32Array(N*3);w.__colorArray=new Float32Array(N*3);w.__webglVertexCount=
+N;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;N=w.vertices.length;w.__vertexArray=new Float32Array(N*3);w.__colorArray=new Float32Array(N*3);w.__webglLineCount=N;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=
+e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;N=w.vertices.length;w.__vertexArray=new Float32Array(N*3);w.__colorArray=new Float32Array(N*3);w.__sortArray=[];w.__webglParticleCount=N;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,
+1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;w=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){w=x.__webglObjects[z].object;if(D==w){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){w=x.__webglSprites[z];if(D==w){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=n.__webglObjects.length;D<x;D++)E(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<
+x;D++)E(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)E(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="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)}}}};
@@ -341,26 +341,26 @@ THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.AnimationHandler=function(){var b=[],d={},c={};c.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};c.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};c.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};c.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<
-0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++){var o=g.hierarchy[h].keys[j].morphTargets[m];k[o]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var p=
-{};for(o in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===o){p[o]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(p[o]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=p}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
+0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++){var p=g.hierarchy[h].keys[j].morphTargets[m];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
+{};for(p in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
 g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};c.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};c.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(b,d,c,f){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var c,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
 g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[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,o,p=this.data.JIT.hierarchy,t,z;this.currentTime+=b*this.timeScale;z=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,A=this.hierarchy.length;u<A;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&p[u][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=p[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=p[u][o];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 E=0;E<3;E++){c=d[E];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=z){if(t<z)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<t;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
+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,t,y;this.currentTime+=b*this.timeScale;y=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,B=this.hierarchy.length;u<B;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&o[u][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[u][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=o[u][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 A=0;A<3;A++){c=d[A];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(t<y)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<t;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
 t)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-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 "+u);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",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,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&&p[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var c=[],f=[],g,h,j,k,m,o;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]];o=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],m[0],o[0],g,c,j);f[1]=this.interpolate(h[1],k[1],m[1],o[1],g,c,j);f[2]=this.interpolate(h[2],k[2],m[2],o[2],g,c,j);return f};
+"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(u=0;u<this.hierarchy.length;u++)o[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,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,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var p=0,t=j.length;p<t;p++){var z=new THREE.Vertex(j[p].position.clone());c&&d.matrix.multiplyVector3(z.position);h.push(z)}p=0;for(t=m.length;p<t;p++){j=m[p];var u,A,E=j.vertexNormals;z=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=E.length;c<h;c++){A=E[c];u.vertexNormals.push(A.clone())}u.color.copy(j.color);c=0;for(h=z.length;c<h;c++){A=z[c];u.vertexColors.push(A.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}p=0;for(t=g.length;p<t;p++){f=g[p];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.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,t=j.length;o<t;o++){var y=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(t=m.length;o<t;o++){j=m[o];var u,B,A=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=A.length;c<h;c++){B=A[c];u.vertexNormals.push(B.clone())}u.color.copy(j.color);c=0;for(h=y.length;c<h;c++){B=y[c];u.vertexColors.push(B.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}o=0;for(t=g.length;o<t;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,o){d=new THREE.Mesh(d,o);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);
+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),
 new THREE.MeshFaceMaterial);b.addObject(d);return d},addPanoramaCubePlanes:function(b,d,c){var f=d/2;d=new THREE.Plane(d,d);var g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));THREE.SceneUtils.addMesh(b,d,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));THREE.SceneUtils.addMesh(b,d,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));THREE.SceneUtils.addMesh(b,d,1,0,f,0,h,
 0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));THREE.SceneUtils.addMesh(b,d,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(b,d){THREE.SceneUtils.traverseHierarchy(b,function(c){c.visible=d})},traverseHierarchy:function(b,d){var c,f,g=b.children.length;for(f=0;f<g;f++){c=b.children[f];d(c);THREE.SceneUtils.traverseHierarchy(c,d)}}};
@@ -374,7 +374,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;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
+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;this.lastUpdate=(new Date).getTime();this.tdiff=0;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=
@@ -384,103 +384,109 @@ this.activeLook||(f=0);this.lon+=this.mouseX*f;this.lookVertical&&(this.lat-=thi
 (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;c=this.target.position;g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.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(o,p,t,z){var u={name:t,fps:0.6,length:z,hierarchy:[]},A,E=p.getControlPointsArray(),H=p.getLength(),J=E.length,W=0;A=J-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:z,pos:E[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<J-1;A++){W=z*H.chunks[A]/H.total;p.keys[A]={time:W,pos:E[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
-z,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){z=t/(o.points.length*p);z=o.getPoint(z);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return u}function f(o,p){var t=c(p,10),z=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);z=new Sphere(1,
-16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(z,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}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,t,y){var u={name:t,fps:0.6,length:y,hierarchy:[]},B,A=o.getControlPointsArray(),Q=o.getLength(),E=A.length,V=0;B=E-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:A[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:A[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<E-1;B++){V=y*Q.chunks[B]/Q.total;o.keys[B]={time:V,pos:A[B]}}u.hierarchy[0]=o;THREE.AnimationHandler.add(u);return new THREE.Animation(p,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var t,
+y,u=new THREE.Geometry;for(t=0;t<p.points.length*o;t++){y=t/(p.points.length*o);y=p.getPoint(y);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(p,o){var t=c(o,10),y=c(o,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);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 THREE.Sphere(1,
+16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(o.points[i]);t.updateMatrix();p.addChild(t)}}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(o,p,t){var z,u;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;z=this.phi%g;this.phi=z>=0?z:z+g;z=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-z[0])*(u[1]-u[0])/(z[1]-z[0])+u[0];z=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(u[1]-u[0])/(z[1]-z[0])+u[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,p,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.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,t){var y,u;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;u=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[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,t)};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(o,p){return function(){p.apply(o,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.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!==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.tdiff=0;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=
+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.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=-1;this.tdiff=0;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=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
 case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(c){c.preventDefault();c.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(c){if(!this.dragToLook||this.mouseStatus>0){var f=this.getContainerDimensions(),g=f.size[0]/2,h=f.size[1]/2;this.moveState.yawLeft=-(c.clientX-f.offset[0]-g)/g;this.moveState.pitchDown=(c.clientY-
-f.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(c){c.preventDefault();c.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var c=(new Date).getTime();this.tdiff=(c-this.lastUpdate)/1E3;this.lastUpdate=c;c=this.tdiff*this.movementSpeed;var f=this.tdiff*this.rollSpeed;this.translateX(this.moveVector.x*
-c);this.translateY(this.moveVector.y*c);this.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*f,this.rotationVector.y*f,this.rotationVector.z*f,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var c=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=
--this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],
-offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",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.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.useTarget=!1;this.matrixAutoUpdate=!1;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4;this.update=function(){if(this.forward.y>0.9){this.forward.y=0.9;this.forward.normalize()}else if(this.forward.y<-0.9){this.forward.y=-0.9;this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=
-g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(m){this.position.x+=
-this.matrix.n11*m;this.position.y+=this.matrix.n21*m;this.position.z+=this.matrix.n31*m};this.translateY=function(m){this.position.x+=this.matrix.n12*m;this.position.y+=this.matrix.n22*m;this.position.z+=this.matrix.n32*m};this.translateZ=function(m){this.position.x-=this.matrix.n13*m;this.position.y-=this.matrix.n23*m;this.position.z-=this.matrix.n33*m};this.rotateHorizontally=function(m){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(m);this.forward.subSelf(g);this.forward.normalize()};
-this.rotateVertically=function(m){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(m);this.forward.addSelf(h);this.forward.normalize()}};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,J,W,B,U,N,O,ua){var la,pa,ga=f||1,ha=g||1,e=U/2,oa=N/2,Da=p.vertices.length;if(H=="x"&&J=="y"||H=="y"&&J=="x")la="z";else if(H=="x"&&J=="z"||H=="z"&&J=="x"){la="y";ha=h||1}else if(H=="z"&&J=="y"||H=="y"&&J=="z"){la="x";ga=h||1}var Aa=ga+1,ka=ha+1;U/=ga;var fa=N/ha;for(pa=0;pa<ka;pa++)for(N=0;N<Aa;N++){var va=new THREE.Vector3;va[H]=(N*U-e)*W;va[J]=(pa*fa-oa)*B;va[la]=O;p.vertices.push(new THREE.Vertex(va))}for(pa=0;pa<ha;pa++)for(N=0;N<ga;N++){p.faces.push(new THREE.Face4(N+
-Aa*pa+Da,N+Aa*(pa+1)+Da,N+1+Aa*(pa+1)+Da,N+1+Aa*pa+Da,null,null,ua));p.faceVertexUvs[0].push([new THREE.UV(N/ga,pa/ha),new THREE.UV(N/ga,(pa+1)/ha),new THREE.UV((N+1)/ga,(pa+1)/ha),new THREE.UV((N+1)/ga,pa/ha)])}}THREE.Geometry.call(this);var p=this,t=b/2,z=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)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 E in m)this.sides[E]!=
-undefined&&(this.sides[E]=m[E]);this.sides.px&&o("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,t,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,z,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-z,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var H=[],J=[],W=0,B=p.vertices.length;W<B;W++){for(var U=p.vertices[W],N=!1,O=0,ua=H.length;O<ua;O++){var la=
-H[O];if(U.position.x==la.position.x&&U.position.y==la.position.y&&U.position.z==la.position.z){J[W]=O;N=!0;break}}if(!N){J[W]=H.length;H.push(new THREE.Vertex(U.position.clone()))}}W=0;for(B=p.faces.length;W<B;W++){U=p.faces[W];U.a=J[U.a];U.b=J[U.b];U.c=J[U.c];U.d=J[U.d]}p.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(z,u,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(z,u,A)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);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,-p-(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,p+(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];p=this.vertices[c.c];var t=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
-f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.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(t,z,u){var A=Math.sqrt(t*t+z*z+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,z/A,u/A)))-1}function c(t,z,u,A){A.faces.push(new THREE.Face3(t,z,u))}function f(t,z){var u=g.vertices[t].position,A=g.vertices[z].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.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),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
-p,o,j);c(m,o,p,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);
+f.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(c){c.preventDefault();c.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var c=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=c;this.tdiff=(c-this.lastUpdate)/1E3;this.lastUpdate=c;c=this.tdiff*this.movementSpeed;var f=this.tdiff*
+this.rollSpeed;this.translateX(this.moveVector.x*c);this.translateY(this.moveVector.y*c);this.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*f,this.rotationVector.y*f,this.rotationVector.z*f,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var c=this.moveState.forward||
+this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
+document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",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.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,p=1,o=0,t=0,y=0,u=0,B=0,A=window.innerWidth/2,Q=window.innerHeight/2;this.update=
+function(){var E=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=E;this.delta=(E-this.lastUpdate)/1E3;this.lastUpdate=E;if(this.mouseLook){E=this.delta*this.lookSpeed;this.rotateHorizontally(E*u);this.rotateVertically(E*B)}E=this.delta*this.movementSpeed;this.translateZ(E*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(E*t);this.translateY(E*y);m&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
+this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
+this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(E){this.position.x+=this.matrix.n11*E;this.position.y+=this.matrix.n21*E;this.position.z+=this.matrix.n31*E};this.translateY=function(E){this.position.x+=this.matrix.n12*E;this.position.y+=this.matrix.n22*E;this.position.z+=this.matrix.n32*E};this.translateZ=function(E){this.position.x-=this.matrix.n13*E;this.position.y-=
+this.matrix.n23*E;this.position.z-=this.matrix.n33*E};this.rotateHorizontally=function(E){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(E);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(E){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(E);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(E){E.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(E){u=(E.clientX-A)/window.innerWidth;B=(E.clientY-Q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(E){E.preventDefault();E.stopPropagation();switch(E.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(E){E.preventDefault();E.stopPropagation();switch(E.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(E){switch(E.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:m=!0;p=1;break;case 69:m=!0;p=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(E){switch(E.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
+THREE.Cube=function(b,d,c,f,g,h,j,k,m){function p(Q,E,V,C,X,R,P,ya){var la,ca,Ba=f||1,ea=g||1,e=X/2,oa=R/2,Da=o.vertices.length;if(Q=="x"&&E=="y"||Q=="y"&&E=="x")la="z";else if(Q=="x"&&E=="z"||Q=="z"&&E=="x"){la="y";ea=h||1}else if(Q=="z"&&E=="y"||Q=="y"&&E=="z"){la="x";Ba=h||1}var da=Ba+1,va=ea+1;X/=Ba;var ja=R/ea;for(ca=0;ca<va;ca++)for(R=0;R<da;R++){var qa=new THREE.Vector3;qa[Q]=(R*X-e)*V;qa[E]=(ca*ja-oa)*C;qa[la]=P;o.vertices.push(new THREE.Vertex(qa))}for(ca=0;ca<ea;ca++)for(R=0;R<Ba;R++){o.faces.push(new THREE.Face4(R+
+da*ca+Da,R+da*(ca+1)+Da,R+1+da*(ca+1)+Da,R+1+da*ca+Da,null,null,ya));o.faceVertexUvs[0].push([new THREE.UV(R/Ba,ca/ea),new THREE.UV(R/Ba,(ca+1)/ea),new THREE.UV((R+1)/Ba,(ca+1)/ea),new THREE.UV((R+1)/Ba,ca/ea)])}}THREE.Geometry.call(this);var o=this,t=b/2,y=d/2,u=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 A in m)this.sides[A]!=
+undefined&&(this.sides[A]=m[A]);this.sides.px&&p("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,t,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,u,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var Q=[],E=[],V=0,C=o.vertices.length;V<C;V++){for(var X=o.vertices[V],R=!1,P=0,ya=Q.length;P<ya;P++){var la=
+Q[P];if(X.position.x==la.position.x&&X.position.y==la.position.y&&X.position.z==la.position.z){E[V]=P;R=!0;break}}if(!R){E[V]=Q.length;Q.push(new THREE.Vertex(X.position.clone()))}}V=0;for(C=o.faces.length;V<C;V++){X=o.faces[V];X.a=E[X.a];X.b=E[X.b];X.c=E[X.c];X.d=E[X.d]}o.vertices=Q})();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,u,B){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,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 t=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(t.position.x,t.position.y)/p,0.5+t.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(t,y,u){var B=Math.sqrt(t*t+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/B,y/B,u/B)))-1}function c(t,y,u,B){B.faces.push(new THREE.Face3(t,y,u))}function f(t,y){var u=g.vertices[t].position,B=g.vertices[y].position;return d((u.x+B.x)/2,(u.y+B.y)/2,(u.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.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 o=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*o-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=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),o=[],p=0;for(f=0;f<h;f++){var t=2*f/h,z=m*Math.sin(t*g);t=m*Math.cos(t*g);(c==0||c==j)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,z)))-1);o.push(p)}d.push(o)}var u,A,E;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
-1][o?0:f+1];z=c/(g-1);u=(c-1)/(g-1);A=(f+1)/h;t=f/h;p=new THREE.UV(1-A,z);z=new THREE.UV(1-t,z);t=new THREE.UV(1-t,u);var H=new THREE.UV(1-A,u);if(c<d.length-1){u=this.vertices[j].position.clone();A=this.vertices[k].position.clone();E=this.vertices[m].position.clone();u.normalize();A.normalize();E.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([p,z,t])}if(c>1){u=this.vertices[j].position.clone();
-A=this.vertices[m].position.clone();E=this.vertices[o].position.clone();u.normalize();A.normalize();E.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([p,t,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 t=2*f/h,y=m*Math.sin(t*g);t=m*Math.cos(t*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,y)))-1);p.push(o)}d.push(p)}var u,B,A;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);u=(c-1)/(g-1);B=(f+1)/h;t=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-t,y);t=new THREE.UV(1-t,u);var Q=new THREE.UV(1-B,u);if(c<d.length-1){u=this.vertices[j].position.clone();B=this.vertices[k].position.clone();A=this.vertices[m].position.clone();u.normalize();B.normalize();A.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(A.x,A.y,A.z)]));this.faceVertexUvs[0].push([o,y,t])}if(c>1){u=this.vertices[j].position.clone();
+B=this.vertices[m].position.clone();A=this.vertices[p].position.clone();u.normalize();B.normalize();A.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(A.x,A.y,A.z)]));this.faceVertexUvs[0].push([o,t,Q])}}}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(t,z,u,A,E,H){z=u/A*t;u=Math.cos(z);return new THREE.Vector3(E*(2+u)*0.5*Math.cos(t),E*(2+u)*Math.sin(t)*0.5,H*E*Math.sin(z)*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(t,y,u,B,A,Q){y=u/B*t;u=Math.cos(y);return new THREE.Vector3(A*(2+u)*0.5*Math.cos(t),A*(2+u)*Math.sin(t)*0.5,Q*A*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 o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),p=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,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+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 o=new Image;o.onload=function(){if(!c(this.width)||!c(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=p;k.image.height=t;k.image.getContext("2d").drawImage(this,0,0,p,t)}else k.image=this;k.needsUpdate=!0};o.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;
+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)),t=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=t;k.image.getContext("2d").drawImage(this,0,0,o,t)}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||b.opacity<1)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,o,p,t,z,u,A,E,H,J,W,B=b.faces;u=b.vertices;var U=b.normals,N=b.colors;o=b.scale!==undefined?b.scale:1;var O=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&O++;for(g=0;g<O;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=u.length;k<m;){p=new THREE.Vertex;p.position.x=u[k++]/
-o;p.position.y=u[k++]/o;p.position.z=u[k++]/o;f.vertices.push(p)}k=0;for(m=B.length;k<m;){u=B[k++];o=u&1;j=u&2;g=u&4;h=u&8;t=u&16;p=u&32;A=u&64;u&=128;if(o){E=new THREE.Face4;E.a=B[k++];E.b=B[k++];E.c=B[k++];E.d=B[k++];o=4}else{E=new THREE.Face3;E.a=B[k++];E.b=B[k++];E.c=B[k++];o=3}if(j){j=B[k++];E.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<O;g++){H=b.uvs[g];z=B[k++];W=H[z*2];z=H[z*2+1];f.faceUvs[g][j]=new THREE.UV(W,z)}if(h)for(g=0;g<O;g++){H=b.uvs[g];J=[];for(h=0;h<o;h++){z=B[k++];
-W=H[z*2];z=H[z*2+1];J[h]=new THREE.UV(W,z)}f.faceVertexUvs[g][j]=J}if(t){t=B[k++]*3;h=new THREE.Vector3;h.x=U[t++];h.y=U[t++];h.z=U[t];E.normal=h}if(p)for(g=0;g<o;g++){t=B[k++]*3;h=new THREE.Vector3;h.x=U[t++];h.y=U[t++];h.z=U[t];E.vertexNormals.push(h)}if(A){p=B[k++];p=new THREE.Color(N[p]);E.color=p}if(u)for(g=0;g<o;g++){p=B[k++];p=new THREE.Color(N[p]);E.vertexColors.push(p)}f.faces.push(E)}}})();(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,o;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;o=b.morphTargets[g].vertices;
-j=0;for(k=o.length;j<k;j+=3)m.push(new THREE.Vertex(new THREE.Vector3(o[j],o[j+1],o[j+2])))}}if(b.morphColors!==undefined){var p,t;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=[];o=f.morphColors[g].colors;p=b.morphColors[g].colors;k=0;for(m=p.length;k<m;k+=3){t=new THREE.Color(16755200);t.setRGB(p[j],p[j+1],p[j+2]);o.push(t)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[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,t,y,u,B,A,Q,E,V,C=b.faces;u=b.vertices;var X=b.normals,R=b.colors;p=b.scale!==undefined?b.scale:1;var P=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&P++;for(g=0;g<P;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=u.length;k<m;){o=new THREE.Vertex;o.position.x=u[k++]/
+p;o.position.y=u[k++]/p;o.position.z=u[k++]/p;f.vertices.push(o)}k=0;for(m=C.length;k<m;){u=C[k++];p=u&1;j=u&2;g=u&4;h=u&8;t=u&16;o=u&32;B=u&64;u&=128;if(p){A=new THREE.Face4;A.a=C[k++];A.b=C[k++];A.c=C[k++];A.d=C[k++];p=4}else{A=new THREE.Face3;A.a=C[k++];A.b=C[k++];A.c=C[k++];p=3}if(j){j=C[k++];A.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<P;g++){Q=b.uvs[g];y=C[k++];V=Q[y*2];y=Q[y*2+1];f.faceUvs[g][j]=new THREE.UV(V,y)}if(h)for(g=0;g<P;g++){Q=b.uvs[g];E=[];for(h=0;h<p;h++){y=C[k++];
+V=Q[y*2];y=Q[y*2+1];E[h]=new THREE.UV(V,y)}f.faceVertexUvs[g][j]=E}if(t){t=C[k++]*3;h=new THREE.Vector3;h.x=X[t++];h.y=X[t++];h.z=X[t];A.normal=h}if(o)for(g=0;g<p;g++){t=C[k++]*3;h=new THREE.Vector3;h.x=X[t++];h.y=X[t++];h.z=X[t];A.vertexNormals.push(h)}if(B){o=C[k++];o=new THREE.Color(R[o]);A.color=o}if(u)for(g=0;g<p;g++){o=C[k++];o=new THREE.Color(R[o]);A.vertexColors.push(o)}f.faces.push(A)}}})();(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,t;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){t=new THREE.Color(16755200);t.setRGB(o[j],o[j+1],o[j+2]);p.push(t)}}}})();(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(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),C=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&C==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,C)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
-S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+O);Ba=k(b,R+ua);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(J,S,P,Ba,R)}function z(R){var S,P,Ba,La,n,C;S=k(b,R);P=k(b,R+O);Ba=k(b,R+ua);La=m(b,R+la);n=k(b,R+pa);C=k(b,R+ga);R=k(b,R+ha);THREE.BinaryLoader.prototype.f3n(J,U,S,P,Ba,La,n,C,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(J,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,C,x,w;S=k(b,R);P=k(b,R+e);
-Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);C=k(b,R+ka);x=k(b,R+fa);w=k(b,R+va);R=k(b,R+sa);THREE.BinaryLoader.prototype.f4n(J,U,S,P,Ba,La,n,C,x,w,R)}function E(R){var S,P;S=k(b,R);P=k(b,R+wa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[R*2],N[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ja);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[S*2],N[S*2+1],N[P*2],N[P*2+1],N[Ba*2],N[Ba*2+1],N[R*2],N[R*2+1])}var J=this,
-W=0,B,U=[],N=[],O,ua,la,pa,ga,ha,e,oa,Da,Aa,ka,fa,va,sa,wa,ca,ja,ma,Fa,ia,da,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,f,h);B={signature:b.substr(W,8),header_bytes:p(b,W+8),vertex_coordinate_bytes:p(b,W+9),normal_coordinate_bytes:p(b,W+10),uv_coordinate_bytes:p(b,W+11),vertex_index_bytes:p(b,W+12),normal_index_bytes:p(b,W+13),uv_index_bytes:p(b,W+14),material_index_bytes:p(b,W+15),nvertices:k(b,W+16),nnormals:k(b,W+16+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),
-ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=B.header_bytes;O=B.vertex_index_bytes;ua=B.vertex_index_bytes*2;la=B.vertex_index_bytes*3;pa=B.vertex_index_bytes*3+B.material_index_bytes;ga=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;ha=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;e=B.vertex_index_bytes;oa=B.vertex_index_bytes*
-2;Da=B.vertex_index_bytes*3;Aa=B.vertex_index_bytes*4;ka=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;va=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;sa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;wa=B.uv_index_bytes;ca=B.uv_index_bytes*2;ja=B.uv_index_bytes;ma=B.uv_index_bytes*2;Fa=B.uv_index_bytes*3;h=B.vertex_index_bytes*3+B.material_index_bytes;Ta=B.vertex_index_bytes*4+B.material_index_bytes;
-ia=B.ntri_flat*h;da=B.ntri_smooth*(h+B.normal_index_bytes*3);Ja=B.ntri_flat_uv*(h+B.uv_index_bytes*3);Xa=B.ntri_smooth_uv*(h+B.normal_index_bytes*3+B.uv_index_bytes*3);Za=B.nquad_flat*Ta;h=B.nquad_smooth*(Ta+B.normal_index_bytes*4);Ta=B.nquad_flat_uv*(Ta+B.uv_index_bytes*4);W+=function(R){for(var S,P,Ba,La=B.vertex_coordinate_bytes*3,n=R+B.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+B.vertex_coordinate_bytes);Ba=j(b,R+B.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(J,S,P,Ba)}return B.nvertices*
-La}(W);W+=function(R){for(var S,P,Ba,La=B.normal_coordinate_bytes*3,n=R+B.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+B.normal_coordinate_bytes);Ba=o(b,R+B.normal_coordinate_bytes*2);U.push(S/127,P/127,Ba/127)}return B.nnormals*La}(W);W+=function(R){for(var S,P,Ba=B.uv_coordinate_bytes*2,La=R+B.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+B.uv_coordinate_bytes);N.push(S,P)}return B.nuvs*Ba}(W);ia=W+ia;da=ia+da;Ja=da+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(R){var S,P=B.vertex_index_bytes*3+B.material_index_bytes,
-Ba=P+B.uv_index_bytes*3,La=R+B.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);E(S+P)}return La-R})(da);(function(R){var S,P=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,Ba=P+B.uv_index_bytes*3,La=R+B.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){z(S);E(S+P)}return La-R})(Ja);(function(R){var S,P=B.vertex_index_bytes*4+B.material_index_bytes,Ba=P+B.uv_index_bytes*4,La=R+B.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);H(S+P)}return La-R})(h);(function(R){var S,P=B.vertex_index_bytes*4+B.material_index_bytes+
-B.normal_index_bytes*4,Ba=P+B.uv_index_bytes*4,La=R+B.nquad_smooth_uv*Ba;for(S=R;S<La;S+=Ba){A(S);H(S+P)}return La-R})(Ta);(function(R){var S,P=B.vertex_index_bytes*3+B.material_index_bytes,Ba=R+B.ntri_flat*P;for(S=R;S<Ba;S+=P)t(S);return Ba-R})(W);(function(R){var S,P=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,Ba=R+B.ntri_smooth*P;for(S=R;S<Ba;S+=P)z(S);return Ba-R})(ia);(function(R){var S,P=B.vertex_index_bytes*4+B.material_index_bytes,Ba=R+B.nquad_flat*P;for(S=R;S<Ba;S+=
-P)u(S);return Ba-R})(Xa);(function(R){var S,P=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,Ba=R+B.nquad_smooth*P;for(S=R;S<Ba;S+=P)A(S);return Ba-R})(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 o=d[k*3],p=d[k*3+1];k=d[k*3+2];var t=d[m*3],z=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(o,p,k),new THREE.Vector3(t,z,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var t=d[m*3],z=d[m*3+1];m=d[m*3+2];var u=d[o*3],A=d[o*3+1];o=d[o*3+2];var E=d[p*3],H=d[p*3+1];p=d[p*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(t,z,m),new THREE.Vector3(u,A,o),new THREE.Vector3(E,H,p)],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 o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};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(wa,ca){return ca=="relativeToHTML"?wa:h+"/"+wa}function m(){for(u in ga.objects)if(!ka.objects[u]){W=ga.objects[u];if(O=ka.geometries[W.geometry]){pa=[];for(sa=0;sa<W.materials.length;sa++)pa[sa]=ka.materials[W.materials[sa]];B=W.position;r=W.rotation;q=W.quaternion;s=W.scale;q=0;pa.length==0&&(pa[0]=new THREE.MeshFaceMaterial);
-pa.length>1&&(pa=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,pa);object.name=u;object.position.set(B[0],B[1],B[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=W.visible;ka.scene.addObject(object);ka.objects[u]=object;if(W.meshCollider){var wa=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(wa)}}}}function o(wa){return function(ca){ka.geometries[wa]=
-ca;m();e-=1;p()}}function p(){f({total_models:Da,total_textures:Aa,loaded_models:Da-e,loaded_textures:Aa-oa},ka);e==0&&oa==0&&c(ka)}var t,z,u,A,E,H,J,W,B,U,N,O,ua,la,pa,ga,ha,e,oa,Da,Aa,ka;ga=j.data;j=new THREE.BinaryLoader;ha=new THREE.JSONLoader;oa=e=0;ka={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(ga.transform){var fa=ga.transform.position;U=ga.transform.rotation;var va=ga.transform.scale;fa&&ka.scene.position.set(fa[0],fa[1],fa[2]);
-U&&ka.scene.rotation.set(U[0],U[1],U[2]);va&&ka.scene.scale.set(va[0],va[1],va[2]);(fa||U||va)&&ka.scene.updateMatrix()}fa=function(){oa-=1;p()};for(E in ga.cameras){U=ga.cameras[E];if(U.type=="perspective")ua=new THREE.Camera(U.fov,U.aspect,U.near,U.far);else if(U.type=="ortho"){ua=new THREE.Camera;ua.projectionMatrix=THREE.Matrix4.makeOrtho(U.left,U.right,U.top,U.bottom,U.near,U.far)}B=U.position;U=U.target;ua.position.set(B[0],B[1],B[2]);ua.target.position.set(U[0],U[1],U[2]);ka.cameras[E]=ua}for(A in ga.lights){E=
-ga.lights[A];ua=E.color!==undefined?E.color:16777215;U=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){B=E.direction;light=new THREE.DirectionalLight(ua,U);light.position.set(B[0],B[1],B[2]);light.position.normalize()}else if(E.type=="point"){B=E.position;light=new THREE.PointLight(ua,U);light.position.set(B[0],B[1],B[2])}ka.scene.addLight(light);ka.lights[A]=light}for(H in ga.fogs){A=ga.fogs[H];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,
-A.density));U=A.color;la.color.setRGB(U[0],U[1],U[2]);ka.fogs[H]=la}if(ka.cameras&&ga.defaults.camera)ka.currentCamera=ka.cameras[ga.defaults.camera];if(ka.fogs&&ga.defaults.fog)ka.scene.fog=ka.fogs[ga.defaults.fog];U=ga.defaults.bgcolor;ka.bgColor=new THREE.Color;ka.bgColor.setRGB(U[0],U[1],U[2]);ka.bgColorAlpha=ga.defaults.bgalpha;for(t in ga.geometries){H=ga.geometries[t];if(H.type=="bin_mesh"||H.type=="ascii_mesh")e+=1}Da=e;for(t in ga.geometries){H=ga.geometries[t];if(H.type=="cube"){O=new THREE.Cube(H.width,
-H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides);ka.geometries[t]=O}else if(H.type=="plane"){O=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);ka.geometries[t]=O}else if(H.type=="sphere"){O=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);ka.geometries[t]=O}else if(H.type=="cylinder"){O=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);ka.geometries[t]=O}else if(H.type=="torus"){O=new THREE.Torus(H.radius,
-H.tube,H.segmentsR,H.segmentsT);ka.geometries[t]=O}else if(H.type=="icosahedron"){O=new THREE.Icosahedron(H.subdivisions);ka.geometries[t]=O}else if(H.type=="bin_mesh")j.load({model:k(H.url,ga.urlBaseType),callback:o(t)});else H.type=="ascii_mesh"&&ha.load({model:k(H.url,ga.urlBaseType),callback:o(t)})}for(J in ga.textures){t=ga.textures[J];oa+=t.url instanceof Array?t.url.length:1}Aa=oa;for(J in ga.textures){t=ga.textures[J];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];
-if(t.url instanceof Array){H=[];for(var sa=0;sa<t.url.length;sa++)H[sa]=k(t.url[sa],ga.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,t.mapping,fa)}else{H=THREE.ImageUtils.loadTexture(k(t.url,ga.urlBaseType),t.mapping,fa);if(THREE[t.minFilter]!=undefined)H.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)H.magFilter=THREE[t.magFilter]}ka.textures[J]=H}for(z in ga.materials){J=ga.materials[z];for(N in J.parameters)if(N=="envMap"||N=="map"||N=="lightMap")J.parameters[N]=ka.textures[J.parameters[N]];
-else if(N=="shading")J.parameters[N]=J.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")J.parameters[N]=THREE[J.parameters[N]]?THREE[J.parameters[N]]:THREE.NormalBlending;else if(N=="combine")J.parameters[N]=J.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(J.parameters[N]=="face")J.parameters[N]=THREE.FaceColors;else if(J.parameters[N])J.parameters[N]=THREE.VertexColors;J=new THREE[J.type](J.parameters);ka.materials[z]=
-J}m();d(ka)}}};
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(O,S){var M=o(O,S),Aa=o(O,S+1),La=o(O,S+2),n=o(O,S+3),D=(n<<1&255|La>>7)-127;M|=(La&127)<<16|Aa<<8;if(M==0&&D==-127)return 0;return(1-2*(n>>7))*(1+M*Math.pow(2,-23))*Math.pow(2,D)}function k(O,S){var M=o(O,S),Aa=o(O,S+1),La=o(O,S+2);return(o(O,S+3)<<24)+(La<<16)+(Aa<<8)+M}function m(O,S){var M=o(O,S);return(o(O,S+1)<<8)+M}function p(O,S){var M=o(O,S);return M>127?M-256:M}function o(O,
+S){return O.charCodeAt(S)&255}function t(O){var S,M,Aa;S=k(b,O);M=k(b,O+P);Aa=k(b,O+ya);O=m(b,O+la);THREE.BinaryLoader.prototype.f3(E,S,M,Aa,O)}function y(O){var S,M,Aa,La,n,D;S=k(b,O);M=k(b,O+P);Aa=k(b,O+ya);La=m(b,O+la);n=k(b,O+ca);D=k(b,O+Ba);O=k(b,O+ea);THREE.BinaryLoader.prototype.f3n(E,X,S,M,Aa,La,n,D,O)}function u(O){var S,M,Aa,La;S=k(b,O);M=k(b,O+e);Aa=k(b,O+oa);La=k(b,O+Da);O=m(b,O+da);THREE.BinaryLoader.prototype.f4(E,S,M,Aa,La,O)}function B(O){var S,M,Aa,La,n,D,x,w;S=k(b,O);M=k(b,O+e);
+Aa=k(b,O+oa);La=k(b,O+Da);n=m(b,O+da);D=k(b,O+va);x=k(b,O+ja);w=k(b,O+qa);O=k(b,O+pa);THREE.BinaryLoader.prototype.f4n(E,X,S,M,Aa,La,n,D,x,w,O)}function A(O){var S,M;S=k(b,O);M=k(b,O+wa);O=k(b,O+fa);THREE.BinaryLoader.prototype.uv3(E.faceVertexUvs[0],R[S*2],R[S*2+1],R[M*2],R[M*2+1],R[O*2],R[O*2+1])}function Q(O){var S,M,Aa;S=k(b,O);M=k(b,O+ka);Aa=k(b,O+ma);O=k(b,O+Fa);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],R[S*2],R[S*2+1],R[M*2],R[M*2+1],R[Aa*2],R[Aa*2+1],R[O*2],R[O*2+1])}var E=this,
+V=0,C,X=[],R=[],P,ya,la,ca,Ba,ea,e,oa,Da,da,va,ja,qa,pa,wa,fa,ka,ma,Fa,ia,ga,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,h);C={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15),nvertices:k(b,V+16),nnormals:k(b,V+16+4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),
+ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=C.header_bytes;P=C.vertex_index_bytes;ya=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;ca=C.vertex_index_bytes*3+C.material_index_bytes;Ba=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ea=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
+2;Da=C.vertex_index_bytes*3;da=C.vertex_index_bytes*4;va=C.vertex_index_bytes*4+C.material_index_bytes;ja=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;qa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;pa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;wa=C.uv_index_bytes;fa=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
+ia=C.ntri_flat*h;ga=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);V+=function(O){for(var S,M,Aa,La=C.vertex_coordinate_bytes*3,n=O+C.nvertices*La;O<n;O+=La){S=j(b,O);M=j(b,O+C.vertex_coordinate_bytes);Aa=j(b,O+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,S,M,Aa)}return C.nvertices*
+La}(V);V+=function(O){for(var S,M,Aa,La=C.normal_coordinate_bytes*3,n=O+C.nnormals*La;O<n;O+=La){S=p(b,O);M=p(b,O+C.normal_coordinate_bytes);Aa=p(b,O+C.normal_coordinate_bytes*2);X.push(S/127,M/127,Aa/127)}return C.nnormals*La}(V);V+=function(O){for(var S,M,Aa=C.uv_coordinate_bytes*2,La=O+C.nuvs*Aa;O<La;O+=Aa){S=j(b,O);M=j(b,O+C.uv_coordinate_bytes);R.push(S,M)}return C.nuvs*Aa}(V);ia=V+ia;ga=ia+ga;Ja=ga+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(O){var S,M=C.vertex_index_bytes*3+C.material_index_bytes,
+Aa=M+C.uv_index_bytes*3,La=O+C.ntri_flat_uv*Aa;for(S=O;S<La;S+=Aa){t(S);A(S+M)}return La-O})(ga);(function(O){var S,M=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Aa=M+C.uv_index_bytes*3,La=O+C.ntri_smooth_uv*Aa;for(S=O;S<La;S+=Aa){y(S);A(S+M)}return La-O})(Ja);(function(O){var S,M=C.vertex_index_bytes*4+C.material_index_bytes,Aa=M+C.uv_index_bytes*4,La=O+C.nquad_flat_uv*Aa;for(S=O;S<La;S+=Aa){u(S);Q(S+M)}return La-O})(h);(function(O){var S,M=C.vertex_index_bytes*4+C.material_index_bytes+
+C.normal_index_bytes*4,Aa=M+C.uv_index_bytes*4,La=O+C.nquad_smooth_uv*Aa;for(S=O;S<La;S+=Aa){B(S);Q(S+M)}return La-O})(Ta);(function(O){var S,M=C.vertex_index_bytes*3+C.material_index_bytes,Aa=O+C.ntri_flat*M;for(S=O;S<Aa;S+=M)t(S);return Aa-O})(V);(function(O){var S,M=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Aa=O+C.ntri_smooth*M;for(S=O;S<Aa;S+=M)y(S);return Aa-O})(ia);(function(O){var S,M=C.vertex_index_bytes*4+C.material_index_bytes,Aa=O+C.nquad_flat*M;for(S=O;S<Aa;S+=
+M)u(S);return Aa-O})(Xa);(function(O){var S,M=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,Aa=O+C.nquad_smooth*M;for(S=O;S<Aa;S+=M)B(S);return Aa-O})(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 t=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(t,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,p,o){j=b.materials[j];var t=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[p*3],B=d[p*3+1];p=d[p*3+2];var A=d[o*3],Q=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(t,y,m),new THREE.Vector3(u,B,p),new THREE.Vector3(A,Q,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(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,wa){return wa=="relativeToHTML"?pa:g+"/"+pa}function k(){for(y in ca.objects)if(!da.objects[y]){E=ca.objects[y];if(R=da.geometries[E.geometry]){la=[];for(qa=0;qa<E.materials.length;qa++)la[qa]=da.materials[E.materials[qa]];V=E.position;r=E.rotation;q=E.quaternion;s=E.scale;q=0;la.length==0&&(la[0]=new THREE.MeshFaceMaterial);
+la.length>1&&(la=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(R,la);object.name=y;object.position.set(V[0],V[1],V[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=E.visible;da.scene.addObject(object);da.objects[y]=object;if(E.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(E.castsShadow){pa=new THREE.ShadowVolume(R);
+da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}}}}function m(pa){return function(wa){da.geometries[pa]=wa;k();ea-=1;c.onLoadComplete();p()}}function p(){c.callbackProgress({totalModels:oa,totalTextures:Da,loadedModels:oa-ea,loadedTextures:Da-e},da);c.onLoadProgress();ea==0&&e==0&&d(da)}var o,t,y,u,B,A,Q,E,V,C,X,R,P,ya,la,ca,Ba,ea,e,oa,Da,da;ca=h.data;h=new THREE.BinaryLoader;Ba=new THREE.JSONLoader;e=ea=0;da={scene:new THREE.Scene,geometries:{},
+materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};var va=!1;for(y in ca.objects){E=ca.objects[y];if(E.meshCollider){va=!0;break}}if(va)da.scene.collisions=new THREE.CollisionSystem;if(ca.transform){va=ca.transform.position;C=ca.transform.rotation;var ja=ca.transform.scale;va&&da.scene.position.set(va[0],va[1],va[2]);C&&da.scene.rotation.set(C[0],C[1],C[2]);ja&&da.scene.scale.set(ja[0],ja[1],ja[2]);(va||C||ja)&&da.scene.updateMatrix()}va=function(){e-=1;p();c.onLoadComplete()};for(B in ca.cameras){C=
+ca.cameras[B];if(C.type=="perspective")P=new THREE.Camera(C.fov,C.aspect,C.near,C.far);else if(C.type=="ortho"){P=new THREE.Camera;P.projectionMatrix=THREE.Matrix4.makeOrtho(C.left,C.right,C.top,C.bottom,C.near,C.far)}V=C.position;C=C.target;P.position.set(V[0],V[1],V[2]);P.target.position.set(C[0],C[1],C[2]);da.cameras[B]=P}for(u in ca.lights){B=ca.lights[u];P=B.color!==undefined?B.color:16777215;C=B.intensity!==undefined?B.intensity:1;if(B.type=="directional"){V=B.direction;light=new THREE.DirectionalLight(P,
+C);light.position.set(V[0],V[1],V[2]);light.position.normalize()}else if(B.type=="point"){V=B.position;light=new THREE.PointLight(P,C);light.position.set(V[0],V[1],V[2])}da.scene.addLight(light);da.lights[u]=light}for(A in ca.fogs){u=ca.fogs[A];if(u.type=="linear")ya=new THREE.Fog(0,u.near,u.far);else u.type=="exp2"&&(ya=new THREE.FogExp2(0,u.density));C=u.color;ya.color.setRGB(C[0],C[1],C[2]);da.fogs[A]=ya}if(da.cameras&&ca.defaults.camera)da.currentCamera=da.cameras[ca.defaults.camera];if(da.fogs&&
+ca.defaults.fog)da.scene.fog=da.fogs[ca.defaults.fog];C=ca.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(C[0],C[1],C[2]);da.bgColorAlpha=ca.defaults.bgalpha;for(o in ca.geometries){A=ca.geometries[o];if(A.type=="bin_mesh"||A.type=="ascii_mesh"){ea+=1;c.onLoadStart()}}oa=ea;for(o in ca.geometries){A=ca.geometries[o];if(A.type=="cube"){R=new THREE.Cube(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides);da.geometries[o]=R}else if(A.type==
+"plane"){R=new THREE.Plane(A.width,A.height,A.segmentsWidth,A.segmentsHeight);da.geometries[o]=R}else if(A.type=="sphere"){R=new THREE.Sphere(A.radius,A.segmentsWidth,A.segmentsHeight);da.geometries[o]=R}else if(A.type=="cylinder"){R=new THREE.Cylinder(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset);da.geometries[o]=R}else if(A.type=="torus"){R=new THREE.Torus(A.radius,A.tube,A.segmentsR,A.segmentsT);da.geometries[o]=R}else if(A.type=="icosahedron"){R=new THREE.Icosahedron(A.subdivisions);
+da.geometries[o]=R}else if(A.type=="bin_mesh")h.load({model:j(A.url,ca.urlBaseType),callback:m(o)});else A.type=="ascii_mesh"&&Ba.load({model:j(A.url,ca.urlBaseType),callback:m(o)})}for(Q in ca.textures){o=ca.textures[Q];if(o.url instanceof Array){e+=o.url.length;for(A=0;A<o.url.length;A++)c.onLoadStart()}else{e+=1;c.onLoadStart()}}Da=e;for(Q in ca.textures){o=ca.textures[Q];if(o.mapping!=undefined&&THREE[o.mapping]!=undefined)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){A=[];for(var qa=
+0;qa<o.url.length;qa++)A[qa]=j(o.url[qa],ca.urlBaseType);A=THREE.ImageUtils.loadTextureCube(A,o.mapping,va)}else{A=THREE.ImageUtils.loadTexture(j(o.url,ca.urlBaseType),o.mapping,va);if(THREE[o.minFilter]!=undefined)A.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=undefined)A.magFilter=THREE[o.magFilter]}da.textures[Q]=A}for(t in ca.materials){Q=ca.materials[t];for(X in Q.parameters)if(X=="envMap"||X=="map"||X=="lightMap")Q.parameters[X]=da.textures[Q.parameters[X]];else if(X=="shading")Q.parameters[X]=
+Q.parameters[X]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(X=="blending")Q.parameters[X]=THREE[Q.parameters[X]]?THREE[Q.parameters[X]]:THREE.NormalBlending;else if(X=="combine")Q.parameters[X]=Q.parameters[X]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(X=="vertexColors")if(Q.parameters[X]=="face")Q.parameters[X]=THREE.FaceColors;else if(Q.parameters[X])Q.parameters[X]=THREE.VertexColors;if(Q.parameters.opacity!==undefined&&Q.parameters.opacity<1)Q.parameters.transparent=
+!0;Q=new THREE[Q.type](Q.parameters);da.materials[t]=Q}k();c.callbackSync(da)}}};
 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,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
-2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[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,o=h+this.yd,p=h+this.zd,t=m+this.yd,z=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,E=0,H=this.field[h],J=this.field[m],W=this.field[o],B=this.field[t],U=this.field[p],N=this.field[z],O=this.field[u],ua=this.field[A];H<j&&(E|=1);J<j&&(E|=2);W<j&&(E|=8);B<j&&(E|=4);U<j&&(E|=16);N<j&&(E|=32);O<j&&(E|=128);ua<j&&(E|=64);var la=THREE.edgeTable[E];if(la==0)return 0;
-var pa=this.delta,ga=c+pa,ha=f+pa;pa=g+pa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,J)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,J,B)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ha,g,W,B)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,W)}if(la&16){this.compNorm(p);this.compNorm(z);this.VIntX(p*3,this.vlist,this.nlist,
-12,j,c,f,pa,U,N)}if(la&32){this.compNorm(z);this.compNorm(A);this.VIntY(z*3,this.vlist,this.nlist,15,j,ga,f,pa,N,ua)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ha,pa,O,ua)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,pa,U,O)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,H,U)}if(la&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
-ga,f,g,J,N)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,ga,ha,g,B,ua)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ha,g,W,O)}E<<=4;for(j=h=0;THREE.triTable[E+j]!=-1;){c=E+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+
+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,t){j=(j-o)/(t-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,t){j=(j-o)/(t-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,t){j=(j-o)/(t-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,t=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,B=m+this.yd+this.zd,A=0,Q=this.field[h],E=this.field[m],V=this.field[p],C=this.field[t],X=this.field[o],R=this.field[y],P=this.field[u],ya=this.field[B];Q<j&&(A|=1);E<j&&(A|=2);V<j&&(A|=8);C<j&&(A|=4);X<j&&(A|=16);R<j&&(A|=32);P<j&&(A|=128);ya<j&&(A|=64);var la=THREE.edgeTable[A];if(la==0)return 0;
+var ca=this.delta,Ba=c+ca,ea=f+ca;ca=g+ca;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,Q,E)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,Ba,f,g,E,C)}if(la&4){this.compNorm(p);this.compNorm(t);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,ea,g,V,C)}if(la&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,Q,V)}if(la&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
+12,j,c,f,ca,X,R)}if(la&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,Ba,f,ca,R,ya)}if(la&64){this.compNorm(u);this.compNorm(B);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,ca,P,ya)}if(la&128){this.compNorm(o);this.compNorm(u);this.VIntY(o*3,this.vlist,this.nlist,21,j,c,f,ca,X,P)}if(la&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,Q,X)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
+Ba,f,g,E,R)}if(la&1024){this.compNorm(t);this.compNorm(B);this.VIntZ(t*3,this.vlist,this.nlist,30,j,Ba,ea,g,C,ya)}if(la&2048){this.compNorm(p);this.compNorm(u);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,ea,g,V,P)}A<<=4;for(j=h=0;THREE.triTable[A+j]!=-1;){c=A+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,o=f*this.size,p=c*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(o-k);z<1&&(z=1);o=Math.floor(o+k);o>this.size-1&&
-(o=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,E,H,J,W,B;t<m;t++){p=this.size2*t;E=t/this.size-g;W=E*E;for(E=z;E<o;E++){H=p+this.size*E;A=E/this.size-f;B=A*A;for(A=u;A<k;A++){J=A/this.size-c;J=h/(1.0E-6+J*J+B+W)-j;J>0&&(this.field[H+A]+=J)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,t=this.zd,z=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*p;for(j=
-0;j<o;j++)z[t*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,p=this.size,t=this.yd,z=this.zd,u=this.field,A=p*Math.sqrt(c/f);A>p&&(A=p);for(h=0;h<A;h++){g=h/p;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*t;for(g=0;g<p;g++){o=m+g;for(j=0;j<p;j++)u[z*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;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++){o=m+h*yd;
-for(g=0;g<size;g++)field[o+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,o,p,t,z=this.size-2;for(j=1;j<z;j++){t=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<z;h++){p=t+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<z;g++){k=(g-this.halfsize)/this.halfsize;f=p+g;this.polygonize(k,m,o,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,o,p,t,z,u;for(j=0;j<h.count;j++){z=j*3;p=z+1;u=z+2;k=h.positionArray[z];m=h.positionArray[p];o=h.positionArray[u];t=new THREE.Vector3(k,m,o);k=h.normalArray[z];m=h.normalArray[p];o=h.normalArray[u];z=new THREE.Vector3(k,m,o);z.normalize();p=new THREE.Vertex(t);f.vertices.push(p);g.push(z)}nfaces=h.count/3;for(j=0;j<nfaces;j++){z=(c+j)*3;p=z+1;u=z+2;t=g[z];k=g[p];m=g[u];z=new THREE.Face3(z,p,u,[t,k,m]);f.faces.push(z)}c+=nfaces;h.count=0});return f};this.init(b)};
+!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,t=Math.floor(m-k);t<1&&(t=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 u=Math.floor(o-k);u<1&&(u=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,A,Q,E,V,C;t<m;t++){o=this.size2*t;A=t/this.size-g;V=A*A;for(A=y;A<p;A++){Q=o+this.size*A;B=A/this.size-f;C=B*B;for(B=u;B<k;B++){E=B/this.size-c;E=h/(1.0E-6+E*E+C+V)-j;E>0&&(this.field[Q+B]+=E)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,p=this.size,o=this.yd,t=this.zd,y=this.field,u=p*Math.sqrt(c/f);u>p&&(u=p);for(g=0;g<u;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[t*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,p,o=this.size,t=this.yd,y=this.zd,u=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*t;for(g=0;g<o;g++){p=m+g;for(j=0;j<o;j++)u[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,t,y=this.size-2;for(j=1;j<y;j++){t=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=t+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,t,y,u;for(j=0;j<h.count;j++){y=j*3;o=y+1;u=y+2;k=h.positionArray[y];m=h.positionArray[o];p=h.positionArray[u];t=new THREE.Vector3(k,m,p);k=h.normalArray[y];m=h.normalArray[o];p=h.normalArray[u];y=new THREE.Vector3(k,m,p);y.normalize();o=new THREE.Vertex(t);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;o=y+1;u=y+2;t=g[y];k=g[o];m=g[u];y=new THREE.Face3(y,o,u,[t,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,
@@ -505,18 +511,18 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(b,d){this.point=b;this.normal=d};THREE.SphereCollider=function(b,d){this.center=b;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(b,d){this.min=b;this.max=d;this.dynamic=!0};
-THREE.MeshCollider=function(b,d,c,f){this.vertices=b;this.faces=d;this.normals=c;this.box=f;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
+2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(b,d){this.point=b;this.normal=d};THREE.SphereCollider=function(b,d){this.center=b;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(b,d){this.min=b;this.max=d;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(b,d,c,f){this.vertices=b;this.faces=d;this.normals=c;this.box=f;this.numFaces=this.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var d,c,f,g,h=0;d=0;for(c=this.colliders.length;d<c;d++){g=this.colliders[d];f=this.rayCast(b,g);if(f<Number.MAX_VALUE){g.distance=f;f>h?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var d=this.rayCastAll(b);if(d.length==0)return null;for(var c=0;d[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,d[c]);if(f<Number.MAX_VALUE){d[c].distance=f;break}c++}if(c>d.length)return null;return d[c]};
 THREE.CollisionSystem.prototype.rayCast=function(b,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(b,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(b,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(b,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(b,d.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g=0;g<d.numFaces/3;g++){var h=g*3;f=Math.min(f,this.rayTriangle(c,d.vertices[d.faces[h+0]],d.vertices[d.faces[h+1]],d.vertices[d.faces[h+2]],d.normals[d.faces[g]],f))}return f};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,d,c,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;j.sub(c,d);k.sub(f,c);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(d)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-d.y;g=c.y-d.y;h=f.y-d.y;
-k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}d=g*f-c*h;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-k*h)*d;if(!(f>=0))return Number.MAX_VALUE;d*=g*k-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;return j};
-THREE.CollisionSystem.prototype.makeRayLocal=function(b,d){var c=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(d.matrixWorld);f.multiplyVector3(c.origin);f.rotateAxis(c.direction);c.direction.normalize();return c};
-THREE.CollisionSystem.prototype.rayBox=function(b,d){var c;c=d.dynamic&&d.mesh&&d.mesh.matrixWorld?this.makeRayLocal(b,d.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,m=0,o=!0;if(c.origin.x<d.min.x){f=d.min.x-c.origin.x;f/=c.direction.x;o=!1;j=-1}else if(c.origin.x>d.max.x){f=d.max.x-c.origin.x;f/=c.direction.x;o=!1;j=1}if(c.origin.y<d.min.y){g=d.min.y-c.origin.y;g/=c.direction.y;o=!1;k=-1}else if(c.origin.y>d.max.y){g=d.max.y-c.origin.y;g/=c.direction.y;o=!1;k=
-1}if(c.origin.z<d.min.z){h=d.min.z-c.origin.z;h/=c.direction.z;o=!1;m=-1}else if(c.origin.z>d.max.z){h=d.max.z-c.origin.z;h/=c.direction.z;o=!1;m=1}if(o)return-1;o=0;if(g>f){o=1;f=g}if(h>f){o=2;f=h}switch(o){case 0:k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(j,0,0);break;case 1:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;c=c.origin.z+
-c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,k,0);break;case 2:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,d){var c=b.direction.dot(d.normal),f=d.point.dot(d.normal);if(c<0)c=(f-b.origin.dot(d.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(b,d){var c=d.center.clone().subSelf(b.origin);if(c.lengthSq<d.radiusSq)return-1;var f=c.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;c=d.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={};
-THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var d=b.geometry.boundingBox,c=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);c=new THREE.BoxCollider(c,d);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var d=THREE.CollisionUtils.MeshOBB(b);d.min.addSelf(b.position);d.max.addSelf(b.position);d.dynamic=!1;return d};
+THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g=0;g<d.numFaces/3;g++){var h=g*3;h=this.rayTriangle(c,d.vertices[d.faces[h+0]],d.vertices[d.faces[h+1]],d.vertices[d.faces[h+2]],f,this.collisionNormal);if(h<f){f=h;d.normal.copy(this.collisionNormal);d.normal.normalize()}}return f};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,d,c,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,d);k.sub(f,c);h.cross(j,k);k=h.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=h.dot(d)-h.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*g))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(h.x)>Math.abs(h.y))if(Math.abs(h.x)>Math.abs(h.z)){b=k.y-d.y;h=c.y-
+d.y;g=f.y-d.y;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(h.y)>Math.abs(h.z)){b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}d=h*f-c*g;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-k*g)*d;if(!(f>=0))return Number.MAX_VALUE;d*=h*k-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;return j};
+THREE.CollisionSystem.prototype.makeRayLocal=function(b,d){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(d.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
+THREE.CollisionSystem.prototype.rayBox=function(b,d){var c;if(d.dynamic&&d.mesh&&d.mesh.matrixWorld)c=this.makeRayLocal(b,d.mesh);else{c=THREE.CollisionSystem.__r;c.origin.copy(b.origin);c.direction.copy(b.direction)}var f=0,g=0,h=0,j=0,k=0,m=0,p=!0;if(c.origin.x<d.min.x){f=d.min.x-c.origin.x;f/=c.direction.x;p=!1;j=-1}else if(c.origin.x>d.max.x){f=d.max.x-c.origin.x;f/=c.direction.x;p=!1;j=1}if(c.origin.y<d.min.y){g=d.min.y-c.origin.y;g/=c.direction.y;p=!1;k=-1}else if(c.origin.y>d.max.y){g=d.max.y-
+c.origin.y;g/=c.direction.y;p=!1;k=1}if(c.origin.z<d.min.z){h=d.min.z-c.origin.z;h/=c.direction.z;p=!1;m=-1}else if(c.origin.z>d.max.z){h=d.max.z-c.origin.z;h/=c.direction.z;p=!1;m=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal.set(j,0,0);break;case 1:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;
+c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal.set(0,k,0);break;case 2:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;d.normal.set(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,d){var c=b.direction.dot(d.normal),f=d.point.dot(d.normal);if(c<0)c=(f-b.origin.dot(d.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(b,d){var c=d.center.clone().subSelf(b.origin);if(c.lengthSq<d.radiusSq)return-1;var f=c.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;c=d.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var d=b.geometry.boundingBox,c=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);c=new THREE.BoxCollider(c,d);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var d=THREE.CollisionUtils.MeshOBB(b);d.min.addSelf(b.position);d.max.addSelf(b.position);d.dynamic=!1;return d};
 THREE.CollisionUtils.MeshColliderWBox=function(b){for(var d=b.geometry.vertices,c=d.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],m=0;m<c;m++)h.push(new THREE.Vector3(d[m].position.x,d[m].position.y,d[m].position.z));for(m=0;m<g;m++){j.push(f[m].a,f[m].b,f[m].c);k.push(new THREE.Vector3(f[m].normal.x,f[m].normal.y,f[m].normal.z))}d=new THREE.MeshCollider(h,j,k,THREE.CollisionUtils.MeshOBB(b));d.mesh=b;return d};

+ 13 - 12
build/custom/ThreeCanvas.js

@@ -31,20 +31,21 @@ this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,k=a.z,g=e*h,i=e*f;this.set(g*
-h+c,g*f-d*k,g*k+d*f,0,g*f+d*k,i*f+c,i*k-d*h,0,g*k-d*f,i*k+d*h,e*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,k=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,k=d+d;a=b*h;var g=b*f;b*=k;var i=c*f;c*=k;d*=k;h*=e;f*=e;e*=k;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+h+c,g*f-d*k,g*k+d*f,0,g*f+d*k,i*f+c,i*k-d*h,0,g*k-d*f,i*k+d*h,e*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,k=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,k=d+d;a=b*h;var g=b*f;b*=k;var i=c*f;c*=k;d*=k;h*=e;f*=e;e*=k;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,k=a.n22,g=a.n23,i=a.n24,n=a.n31,j=a.n32,p=a.n33,r=a.n34,y=a.n41,A=a.n42,D=a.n43,z=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*r*A-i*p*A+i*j*D-k*r*D-g*j*z+k*p*z;b.n12=h*p*A-e*r*A-h*j*D+d*r*D+e*j*z-d*p*z;b.n13=e*i*A-h*g*A+h*k*D-d*i*D-e*k*z+d*g*z;b.n14=h*g*j-e*i*j-h*k*p+d*i*p+e*k*r-d*g*r;b.n21=i*p*y-g*r*y-i*n*D+f*r*D+g*n*z-f*p*z;b.n22=e*r*y-h*p*y+h*n*D-c*r*D-e*n*z+c*p*z;b.n23=h*g*y-e*i*y-h*f*D+c*i*D+e*f*z-c*g*z;
 b.n24=e*i*n-h*g*n+h*f*p-c*i*p-e*f*r+c*g*r;b.n31=k*r*y-i*j*y+i*n*A-f*r*A-k*n*z+f*j*z;b.n32=h*j*y-d*r*y-h*n*A+c*r*A+d*n*z-c*j*z;b.n33=e*i*y-h*k*y+h*f*A-c*i*A-d*f*z+c*k*z;b.n34=h*k*n-d*i*n-h*f*j+c*i*j+d*f*r-c*k*r;b.n41=g*j*y-k*p*y-g*n*A+f*p*A+k*n*D-f*j*D;b.n42=d*p*y-e*j*y+e*n*A-c*p*A-d*n*D+c*j*D;b.n43=e*k*y-d*g*y-e*f*A+c*g*A+d*f*D-c*k*D;b.n44=d*g*n-e*k*n+e*f*j-c*g*j-d*f*p+c*k*p;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*k;c[5]=a*g;c[6]=a*i;c[7]=a*n;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+e)/(h-e);f.n34=-2*h*e/(h-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,h){var f,k,g,i;f=new THREE.Matrix4;k=b-a;g=c-d;i=h-e;f.n11=2/k;f.n12=0;f.n13=0;f.n14=-((b+a)/k);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((h+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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=
-!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
+-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
+this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);
+this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);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},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);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},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,k=this.z,g=this.w,i=g*c+f*e-k*d,n=
@@ -67,9 +68,9 @@ this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];h=f.vertexIndice
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
-THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0;this.castShadow=d!==undefined?d:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};
+THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;
+THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==undefined?a.linewidth:1;this.linecap=a.linecap!==undefined?a.linecap:"round";this.linejoin=a.linejoin!==undefined?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
 a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
@@ -98,7 +99,7 @@ THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.is
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;

+ 10 - 9
build/custom/ThreeDOM.js

@@ -31,20 +31,21 @@ this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,j=a.z,g=e*h,i=e*f;this.set(g*
-h+c,g*f-d*j,g*j+d*f,0,g*f+d*j,i*f+c,i*j-d*h,0,g*j-d*f,i*j+d*h,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,j=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=j*h+a*d;this.n22=-j*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,j=d+d;a=b*h;var g=b*f;b*=j;var i=c*f;c*=j;d*=j;h*=e;f*=e;e*=j;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+h+c,g*f-d*j,g*j+d*f,0,g*f+d*j,i*f+c,i*j-d*h,0,g*j-d*f,i*j+d*h,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,j=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=j*h+a*d;this.n22=-j*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,j=d+d;a=b*h;var g=b*f;b*=j;var i=c*f;c*=j;d*=j;h*=e;f*=e;e*=j;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,j=a.n22,g=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*n*q-i*m*q+i*k*t-j*n*t-g*k*r+j*m*r;b.n12=h*m*q-e*n*q-h*k*t+d*n*t+e*k*r-d*m*r;b.n13=e*i*q-h*g*q+h*j*t-d*i*t-e*j*r+d*g*r;b.n14=h*g*k-e*i*k-h*j*m+d*i*m+e*j*n-d*g*n;b.n21=i*m*p-g*n*p-i*l*t+f*n*t+g*l*r-f*m*r;b.n22=e*n*p-h*m*p+h*l*t-c*n*t-e*l*r+c*m*r;b.n23=h*g*p-e*i*p-h*f*t+c*i*t+e*f*r-c*g*r;
 b.n24=e*i*l-h*g*l+h*f*m-c*i*m-e*f*n+c*g*n;b.n31=j*n*p-i*k*p+i*l*q-f*n*q-j*l*r+f*k*r;b.n32=h*k*p-d*n*p-h*l*q+c*n*q+d*l*r-c*k*r;b.n33=e*i*p-h*j*p+h*f*q-c*i*q-d*f*r+c*j*r;b.n34=h*j*l-d*i*l-h*f*k+c*i*k+d*f*n-c*j*n;b.n41=g*k*p-j*m*p-g*l*q+f*m*q+j*l*t-f*k*t;b.n42=d*m*p-e*k*p+e*l*q-c*m*q-d*l*t+c*k*t;b.n43=e*j*p-d*g*p-e*f*q+c*g*q+d*f*t-c*j*t;b.n44=d*g*l-e*j*l+e*f*k-c*g*k-d*f*m+c*j*m;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*j;c[5]=a*g;c[6]=a*i;c[7]=a*l;c[8]=a*k;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+e)/(h-e);f.n34=-2*h*e/(h-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,h){var f,j,g,i;f=new THREE.Matrix4;j=b-a;g=c-d;i=h-e;f.n11=2/j;f.n12=0;f.n13=0;f.n14=-((b+a)/j);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((h+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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=
-!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
+-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
+this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);
+this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);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},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);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},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,j=this.z,g=this.w,i=g*c+f*e-j*d,l=
@@ -64,7 +65,7 @@ THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.is
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;

+ 138 - 133
build/custom/ThreeExtras.js

@@ -1,28 +1,28 @@
 // ThreeExtras.js r39 - http://github.com/mrdoob/three.js
-THREE.AnimationHandler=function(){var a=[],d={},b={};b.update=function(c){for(var f=0;f<a.length;f++)a[f].update(c)};b.addToUpdate=function(c){a.indexOf(c)===-1&&a.push(c)};b.removeFromUpdate=function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)};b.add=function(c){d[c.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+c.name+" already exists in library. Overwriting.");d[c.name]=c;if(c.initialized!==!0){for(var f=0;f<c.hierarchy.length;f++){for(var g=0;g<c.hierarchy[f].keys.length;g++){if(c.hierarchy[f].keys[g].time<
-0)c.hierarchy[f].keys[g].time=0;if(c.hierarchy[f].keys[g].rot!==undefined&&!(c.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var h=c.hierarchy[f].keys[g].rot;c.hierarchy[f].keys[g].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(c.hierarchy[f].keys[0].morphTargets!==undefined){h={};for(g=0;g<c.hierarchy[f].keys.length;g++)for(var j=0;j<c.hierarchy[f].keys[g].morphTargets.length;j++){var l=c.hierarchy[f].keys[g].morphTargets[j];h[l]=-1}c.hierarchy[f].usedMorphTargets=h;for(g=0;g<c.hierarchy[f].keys.length;g++){var k=
-{};for(l in h){for(j=0;j<c.hierarchy[f].keys[g].morphTargets.length;j++)if(c.hierarchy[f].keys[g].morphTargets[j]===l){k[l]=c.hierarchy[f].keys[g].morphTargetsInfluences[j];break}j===c.hierarchy[f].keys[g].morphTargets.length&&(k[l]=0)}c.hierarchy[f].keys[g].morphTargetsInfluences=k}}for(g=1;g<c.hierarchy[f].keys.length;g++)if(c.hierarchy[f].keys[g].time===c.hierarchy[f].keys[g-1].time){c.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<c.hierarchy[f].keys.length;g++)c.hierarchy[f].keys[g].index=g}g=parseInt(c.length*
-c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(f=0;f<c.hierarchy.length;f++)c.JIT.hierarchy.push(Array(g));c.initialized=!0}};b.get=function(c){if(typeof c==="string")if(d[c])return d[c];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+c);return null}};b.parse=function(c){var f=[];if(c instanceof THREE.SkinnedMesh)for(var g=0;g<c.bones.length;g++)f.push(c.bones[g]);else e(c,f);return f};var e=function(c,f){f.push(c);for(var g=0;g<c.children.length;g++)e(c.children[g],f)};b.LINEAR=
-0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,d,b,e){this.root=a;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=d!==undefined?d:0;var b,e=this.hierarchy.length,c;for(b=0;b<e;b++){c=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)c.useQuaternion=!0;c.matrixAutoUpdate=!0;if(c.animationCache===undefined){c.animationCache={};c.animationCache.prevKey={pos:0,rot:0,scl:0};c.animationCache.nextKey={pos:0,rot:0,scl:0};c.animationCache.originalMatrix=
-c instanceof THREE.Bone?c.skinMatrix:c.matrix}var f=c.animationCache.prevKey;c=c.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];c.pos=this.getNextKeyWith("pos",b,1);c.rot=this.getNextKeyWith("rot",b,1);c.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};b.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};b.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};b.add=function(d){c[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");c[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var h=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){h={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var k=0;k<d.hierarchy[f].keys[g].morphTargets.length;k++){var l=d.hierarchy[f].keys[g].morphTargets[k];h[l]=-1}d.hierarchy[f].usedMorphTargets=h;for(g=0;g<d.hierarchy[f].keys.length;g++){var j=
+{};for(l in h){for(k=0;k<d.hierarchy[f].keys[g].morphTargets.length;k++)if(d.hierarchy[f].keys[g].morphTargets[k]===l){j[l]=d.hierarchy[f].keys[g].morphTargetsInfluences[k];break}k===d.hierarchy[f].keys[g].morphTargets.length&&(j[l]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=j}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};b.get=function(d){if(typeof d==="string")if(c[d])return c[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};b.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};b.LINEAR=
+0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,d;for(b=0;b<e;b++){d=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
+d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];d.pos=this.getNextKeyWith("pos",b,1);d.rot=this.getNextKeyWith("rot",b,1);d.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var d=["pos","rot","scl"],b,e,c,f,g,h,j,l,k=this.data.JIT.hierarchy,m,p;this.currentTime+=a*this.timeScale;p=this.currentTime;m=this.currentTime%=this.data.length;l=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,x=this.hierarchy.length;o<x;o++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&k[o][l]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=k[o][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=k[o][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=d[w];g=j.prevKey[b];h=j.nextKey[b];if(h.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(b,o,1);h.time<m;){g=h;h=this.getNextKeyWith(b,o,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(b,o,h.index+1)}while(h.time<
-m)}j.prevKey[b]=g;j.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(h.time-g.time);c=g[b];f=h[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=c[0]+(f[0]-c[0])*e;b.y=c[1]+(f[1]-c[1])*e;b.z=c[2]+(f[2]-c[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=c;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos;e=e*0.33+0.33;c=this.interpolateCatmullRom(this.points,e);b.x=c[0];b.y=c[1];b.z=c[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(c,f,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=c[0]+(f[0]-c[0])*e;b.y=c[1]+(f[1]-c[1])*e;b.z=c[2]+(f[2]-c[2])*e}}}}if(this.JITCompile&&k[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,d){var b=[],e=[],c,f,g,h,j,l;c=(a.length-1)*d;f=Math.floor(c);c-=f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];j=a[b[2]];l=a[b[3]];b=c*c;g=c*b;e[0]=this.interpolate(f[0],h[0],j[0],l[0],c,b,g);e[1]=this.interpolate(f[1],h[1],j[1],l[1],c,b,g);e[2]=this.interpolate(f[2],h[2],j[2],l[2],c,b,g);return e};
-THREE.Animation.prototype.interpolate=function(a,d,b,e,c,f,g){a=(b-a)*0.5;e=(e-d)*0.5;return(2*(d-b)+a+e)*g+(-3*(d-b)-2*a-e)*f+a*c+d};THREE.Animation.prototype.getNextKeyWith=function(a,d,b){var e=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[d].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,d,b){var e=this.data.hierarchy[d].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[d].keys[e.length-1]};
-var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,e=a.vertices.length,c=b?d.geometry:d,f=a.vertices,g=c.vertices,h=a.faces,j=c.faces,l=a.faceVertexUvs[0];c=c.faceVertexUvs[0];b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,m=g.length;k<m;k++){var p=new THREE.Vertex(g[k].position.clone());b&&d.matrix.multiplyVector3(p.position);f.push(p)}k=0;for(m=j.length;k<m;k++){g=j[k];var o,x,w=g.vertexNormals;p=g.vertexColors;if(g instanceof THREE.Face3)o=new THREE.Face3(g.a+e,g.b+e,g.c+
-e);else g instanceof THREE.Face4&&(o=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));o.normal.copy(g.normal);b=0;for(f=w.length;b<f;b++){x=w[b];o.vertexNormals.push(x.clone())}o.color.copy(g.color);b=0;for(f=p.length;b<f;b++){x=p[b];o.vertexColors.push(x.clone())}o.materials=g.materials.slice();o.centroid.copy(g.centroid);h.push(o)}k=0;for(m=c.length;k<m;k++){e=c[k];h=[];b=0;for(f=e.length;b<f;b++)h.push(new THREE.UV(e[b].u,e[b].v));l.push(h)}}};
-THREE.ImageUtils={loadTexture:function(a,d,b){var e=new Image,c=new THREE.Texture(e,d);e.onload=function(){c.needsUpdate=!0;b&&b(this)};e.src=a;return c},loadTextureCube:function(a,d,b){var e,c=[],f=new THREE.Texture(c,d);d=c.loadCount=0;for(e=a.length;d<e;++d){c[d]=new Image;c[d].onload=function(){c.loadCount+=1;if(c.loadCount==6)f.needsUpdate=!0;b&&b(this)};c[d].src=a[d]}return f}};
-THREE.SceneUtils={addMesh:function(a,d,b,e,c,f,g,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=e;d.position.y=c;d.position.z=f;d.rotation.x=g;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),b);a.addObject(d);
-return d},addPanoramaCube:function(a,d,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,e,!0),
-new THREE.MeshFaceMaterial);a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var e=d/2;d=new THREE.Plane(d,d);var c=Math.PI,f=Math.PI/2;THREE.SceneUtils.addMesh(a,d,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));THREE.SceneUtils.addMesh(a,d,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));THREE.SceneUtils.addMesh(a,d,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));THREE.SceneUtils.addMesh(a,d,1,0,e,0,f,
-0,c,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));THREE.SceneUtils.addMesh(a,d,1,0,-e,0,-f,0,c,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,d){THREE.SceneUtils.traverseHierarchy(a,function(b){b.visible=d})},traverseHierarchy:function(a,d){var b,e,c=a.children.length;for(e=0;e<c;e++){b=a.children[e];d(b);THREE.SceneUtils.traverseHierarchy(b,d)}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,d,f,g,h,k,l,j=this.data.JIT.hierarchy,t,o;this.currentTime+=a*this.timeScale;o=this.currentTime;t=this.currentTime%=this.data.length;l=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,w=this.hierarchy.length;n<w;n++){a=this.hierarchy[n];k=a.animationCache;if(this.JITCompile&&j[n][l]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=j[n][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=j[n][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];g=k.prevKey[b];h=k.nextKey[b];if(h.time<=o){if(t<o)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<t;){g=h;h=this.getNextKeyWith(b,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(b,n,h.index+1)}while(h.time<
+t)}k.prevKey[b]=g;k.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-g.time)/(h.time-g.time);d=g[b];f=h[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+n);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=d[0]+(f[0]-d[0])*e;b.y=d[1]+(f[1]-d[1])*e;b.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);b.x=d[0];b.y=d[1];b.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=d[0]+(f[0]-d[0])*e;b.y=d[1]+(f[1]-d[1])*e;b.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&j[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)j[n][l]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],d,f,g,h,k,l;d=(a.length-1)*c;f=Math.floor(d);d-=f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];k=a[b[2]];l=a[b[3]];b=d*d;g=d*b;e[0]=this.interpolate(f[0],h[0],k[0],l[0],d,b,g);e[1]=this.interpolate(f[1],h[1],k[1],l[1],d,b,g);e[2]=this.interpolate(f[2],h[2],k[2],l[2],d,b,g);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,d,f,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*f+a*d+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,d=b?c.geometry:c,f=a.vertices,g=d.vertices,h=a.faces,k=d.faces,l=a.faceVertexUvs[0];d=d.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var j=0,t=g.length;j<t;j++){var o=new THREE.Vertex(g[j].position.clone());b&&c.matrix.multiplyVector3(o.position);f.push(o)}j=0;for(t=k.length;j<t;j++){g=k[j];var n,w,p=g.vertexNormals;o=g.vertexColors;if(g instanceof THREE.Face3)n=new THREE.Face3(g.a+e,g.b+e,g.c+
+e);else g instanceof THREE.Face4&&(n=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));n.normal.copy(g.normal);b=0;for(f=p.length;b<f;b++){w=p[b];n.vertexNormals.push(w.clone())}n.color.copy(g.color);b=0;for(f=o.length;b<f;b++){w=o[b];n.vertexColors.push(w.clone())}n.materials=g.materials.slice();n.centroid.copy(g.centroid);h.push(n)}j=0;for(t=d.length;j<t;j++){e=d[j];h=[];b=0;for(f=e.length;b<f;b++)h.push(new THREE.UV(e[b].u,e[b].v));l.push(h)}}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,d=new THREE.Texture(e,c);e.onload=function(){d.needsUpdate=!0;b&&b(this)};e.src=a;return d},loadTextureCube:function(a,c,b){var e,d=[],f=new THREE.Texture(d,c);c=d.loadCount=0;for(e=a.length;c<e;++c){d[c]=new Image;d[c].onload=function(){d.loadCount+=1;if(d.loadCount==6)f.needsUpdate=!0;b&&b(this)};d[c].src=a[c]}return f}};
+THREE.SceneUtils={addMesh:function(a,c,b,e,d,f,g,h,k,l){c=new THREE.Mesh(c,l);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=d;c.position.z=f;c.rotation.x=g;c.rotation.y=h;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
+return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,e,!0),
+new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new THREE.Plane(c,c);var d=Math.PI,f=Math.PI/2;THREE.SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));THREE.SceneUtils.addMesh(a,c,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));THREE.SceneUtils.addMesh(a,c,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));THREE.SceneUtils.addMesh(a,c,1,0,e,0,f,
+0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));THREE.SceneUtils.addMesh(a,c,1,0,-e,0,-f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,d=a.children.length;for(e=0;e<d;e++){b=a.children[e];c(b);THREE.SceneUtils.traverseHierarchy(b,c)}}};
 THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
@@ -32,113 +32,118 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 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.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(c=e=0;c<f;++c){b[c]=Math.exp(-((c-d)*(c-d))/(2*a*a));e+=b[c]}for(c=0;c<f;++c)b[c]/=e;return b}};
+THREE.QuakeCamera=function(a){function c(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;this.lastUpdate=(new Date).getTime();this.tdiff=0;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=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/
 1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var e=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(e+this.autoSpeedFactor));this.moveBackward&&this.translateZ(e);this.moveLeft&&this.translateX(-e);this.moveRight&&this.translateX(e);e=this.tdiff*this.lookSpeed;
-this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
-(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",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(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(),A=w.length,z=0;x=A-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<A-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.005;this.lookVertical=
+this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
+(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,
+this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
+THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
+THREE.PathCamera=function(a){function c(l,j,t,o){var n={name:t,fps:0.6,length:o,hierarchy:[]},w,p=j.getControlPointsArray(),z=j.getLength(),v=p.length,y=0;w=v-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:p[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[w]={time:o,pos:p[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w<v-1;w++){y=o*z.chunks[w]/z.total;j.keys[w]={time:y,pos:p[w]}}n.hierarchy[0]=j;THREE.AnimationHandler.add(n);return new THREE.Animation(l,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,j){var t,
+o,n=new THREE.Geometry;for(t=0;t<l.points.length*j;t++){o=t/(l.points.length*j);o=l.getPoint(o);n.vertices[t]=new THREE.Vertex(new THREE.Vector3(o.x,o.y,o.z))}return n}function e(l,j){var t=b(j,10),o=b(j,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,n);particleObj=new THREE.ParticleSystem(o,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);o=new THREE.Sphere(1,
+16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){t=new THREE.Mesh(o,n);t.position.copy(j.points[i]);t.updateMatrix();l.addChild(t)}}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.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.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(l,j,t){var o,n;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;o=this.phi%d;this.phi=o>=0?o:o+d;o=this.verticalAngleMap.srcRange;n=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-o[0])*(n[1]-n[0])/(o[1]-o[0])+n[0];o=this.horizontalAngleMap.srcRange;n=this.horizontalAngleMap.dstRange;this.theta=(this.theta-o[0])*(n[1]-n[0])/(o[1]-o[0])+n[0];o=this.target.position;o.x=100*Math.sin(this.phi)*Math.cos(this.theta);o.y=100*Math.cos(this.phi);o.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,j,t)};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),k=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(k,g);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+c(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,j){return function(){j.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 c(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.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=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),c=e.size[0]/2,f=e.size[1]/2;this.moveState.yawLeft=-(b.clientX-e.offset[0]-c)/c;this.moveState.pitchDown=(b.clientY-
-e.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;b=this.tdiff*this.movementSpeed;var e=this.tdiff*this.rollSpeed;this.translateX(this.moveVector.x*
-b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*e,this.rotationVector.y*e,this.rotationVector.z*e,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=
--this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],
-offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",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.RollCamera=function(a,d,b,e){THREE.Camera.call(this,a,d,b,e);this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.useTarget=!1;this.matrixAutoUpdate=!1;var c=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4;this.update=function(){if(this.forward.y>0.9){this.forward.y=0.9;this.forward.normalize()}else if(this.forward.y<-0.9){this.forward.y=-0.9;this.forward.normalize()}g.copy(this.forward);f.set(0,1,0);c.cross(f,g).normalize();f.cross(g,c).normalize();this.matrix.n11=
-c.x;this.matrix.n12=f.x;this.matrix.n13=g.x;this.matrix.n21=c.y;this.matrix.n22=f.y;this.matrix.n23=g.y;this.matrix.n31=c.z;this.matrix.n32=f.z;this.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(j){this.position.x+=
-this.matrix.n11*j;this.position.y+=this.matrix.n21*j;this.position.z+=this.matrix.n31*j};this.translateY=function(j){this.position.x+=this.matrix.n12*j;this.position.y+=this.matrix.n22*j;this.position.z+=this.matrix.n32*j};this.translateZ=function(j){this.position.x-=this.matrix.n13*j;this.position.y-=this.matrix.n23*j;this.position.z-=this.matrix.n33*j};this.rotateHorizontally=function(j){c.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);c.multiplyScalar(j);this.forward.subSelf(c);this.forward.normalize()};
-this.rotateVertically=function(j){f.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);f.multiplyScalar(j);this.forward.addSelf(f);this.forward.normalize()}};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(a,d,b,e,c,f,g,h,j){function l(u,A,z,n,y,B,G,K){var J,H,E=e||1,L=c||1,P=y/2,Q=B/2,R=k.vertices.length;if(u=="x"&&A=="y"||u=="y"&&A=="x")J="z";else if(u=="x"&&A=="z"||u=="z"&&A=="x"){J="y";L=f||1}else if(u=="z"&&A=="y"||u=="y"&&A=="z"){J="x";E=f||1}var M=E+1,F=L+1;y/=E;var N=B/L;for(H=0;H<F;H++)for(B=0;B<M;B++){var O=new THREE.Vector3;O[u]=(B*y-P)*z;O[A]=(H*N-Q)*n;O[J]=G;k.vertices.push(new THREE.Vertex(O))}for(H=0;H<L;H++)for(B=0;B<E;B++){k.faces.push(new THREE.Face4(B+M*H+R,B+
-M*(H+1)+R,B+1+M*(H+1)+R,B+1+M*H+R,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/E,H/L),new THREE.UV(B/E,(H+1)/L),new THREE.UV((B+1)/E,(H+1)/L),new THREE.UV((B+1)/E,H/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=d/2,o=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var w in j)this.sides[w]!=undefined&&(this.sides[w]=
-j[w]);this.sides.px&&l("z","y",1*h,-1,b,d,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,o,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-o,this.materials[5]);(function(){for(var u=[],A=[],z=0,n=k.vertices.length;z<n;z++){for(var y=k.vertices[z],B=!1,G=0,K=u.length;G<K;G++){var J=u[G];if(y.position.x==J.position.x&&
-y.position.y==J.position.y&&y.position.z==J.position.z){A[z]=G;B=!0;break}}if(!B){A[z]=u.length;u.push(new THREE.Vertex(y.position.clone()))}}z=0;for(n=k.faces.length;z<n;z++){y=k.faces[z];y.a=A[y.a];y.b=A[y.b];y.c=A[y.c];y.d=A[y.d]}k.vertices=u})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(a,d,b,e,c,f){function g(p,o,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(p,o,x)))}THREE.Geometry.call(this);var h=this,j,l=Math.PI*2,k=e/2;for(j=0;j<a;j++)g(Math.sin(l*j/a)*d,Math.cos(l*j/a)*d,-k);for(j=0;j<a;j++)g(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,k);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b>0){g(0,0,-k-(f||0));for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(d>0){g(0,0,k+(c||0));
-for(j=a+a/2;j<2*a;j++)h.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){d=[];b=this.faces[j];c=this.vertices[b.a];f=this.vertices[b.b];k=this.vertices[b.c];var m=this.vertices[b.d];d.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/l,0.5+c.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/l,0.5+k.position.z/
-e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/e));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-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.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()};
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),d=e.size[0]/2,f=e.size[1]/2;this.moveState.yawLeft=-(b.clientX-e.offset[0]-d)/d;this.moveState.pitchDown=(b.clientY-
+e.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;b=this.tdiff*this.movementSpeed;var e=this.tdiff*
+this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*e,this.rotationVector.y*e,this.rotationVector.z*e,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
+this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
+document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
+this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
+THREE.RollCamera=function(a,c,b,e){THREE.Camera.call(this,a,c,b,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,k=!1,l=1,j=0,t=0,o=0,n=0,w=0,p=window.innerWidth/2,z=window.innerHeight/2;this.update=
+function(){var v=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=v;this.delta=(v-this.lastUpdate)/1E3;this.lastUpdate=v;if(this.mouseLook){v=this.delta*this.lookSpeed;this.rotateHorizontally(v*n);this.rotateVertically(v*w)}v=this.delta*this.movementSpeed;this.translateZ(v*(j>0||this.autoForward&&!(j<0)?1:j));this.translateX(v*t);this.translateY(v*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
+this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}g.copy(this.forward);f.set(0,1,0);d.cross(f,g).normalize();f.cross(g,d).normalize();this.matrix.n11=d.x;this.matrix.n12=f.x;this.matrix.n13=g.x;this.matrix.n21=d.y;this.matrix.n22=f.y;this.matrix.n23=g.y;this.matrix.n31=d.z;this.matrix.n32=f.z;this.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);
+this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(v){this.position.x+=this.matrix.n11*v;this.position.y+=this.matrix.n21*v;this.position.z+=this.matrix.n31*v};this.translateY=function(v){this.position.x+=this.matrix.n12*v;this.position.y+=this.matrix.n22*v;this.position.z+=this.matrix.n32*v};this.translateZ=function(v){this.position.x-=this.matrix.n13*v;this.position.y-=
+this.matrix.n23*v;this.position.z-=this.matrix.n33*v};this.rotateHorizontally=function(v){d.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);d.multiplyScalar(v);this.forward.subSelf(d);this.forward.normalize()};this.rotateVertically=function(v){f.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);f.multiplyScalar(v);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(v){v.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(v){n=(v.clientX-p)/window.innerWidth;w=(v.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(v){v.preventDefault();v.stopPropagation();switch(v.button){case 0:j=1;break;case 2:j=-1}},!1);this.domElement.addEventListener("mouseup",function(v){v.preventDefault();v.stopPropagation();switch(v.button){case 0:j=0;break;case 2:j=0}},!1);this.domElement.addEventListener("keydown",function(v){switch(v.keyCode){case 38:case 87:j=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:j=-1;break;case 39:case 68:t=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:o=1;break;case 70:o=-1}},!1);this.domElement.addEventListener("keyup",function(v){switch(v.keyCode){case 38:case 87:j=0;break;case 37:case 65:t=0;break;case 40:case 83:j=0;break;case 39:case 68:t=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
+THREE.Cube=function(a,c,b,e,d,f,g,h,k){function l(z,v,y,m,D,C,I,L){var H,B,K=e||1,J=d||1,P=D/2,T=C/2,Q=j.vertices.length;if(z=="x"&&v=="y"||z=="y"&&v=="x")H="z";else if(z=="x"&&v=="z"||z=="z"&&v=="x"){H="y";J=f||1}else if(z=="z"&&v=="y"||z=="y"&&v=="z"){H="x";K=f||1}var F=K+1,N=J+1;D/=K;var S=C/J;for(B=0;B<N;B++)for(C=0;C<F;C++){var M=new THREE.Vector3;M[z]=(C*D-P)*y;M[v]=(B*S-T)*m;M[H]=I;j.vertices.push(new THREE.Vertex(M))}for(B=0;B<J;B++)for(C=0;C<K;C++){j.faces.push(new THREE.Face4(C+F*B+Q,C+
+F*(B+1)+Q,C+1+F*(B+1)+Q,C+1+F*B+Q,null,null,L));j.faceVertexUvs[0].push([new THREE.UV(C/K,B/J),new THREE.UV(C/K,(B+1)/J),new THREE.UV((C+1)/K,(B+1)/J),new THREE.UV((C+1)/K,B/J)])}}THREE.Geometry.call(this);var j=this,t=a/2,o=c/2,n=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var p in k)this.sides[p]!=undefined&&(this.sides[p]=
+k[p]);this.sides.px&&l("z","y",1*h,-1,b,c,-t,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,c,t,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,c,n,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,c,-n,this.materials[5]);(function(){for(var z=[],v=[],y=0,m=j.vertices.length;y<m;y++){for(var D=j.vertices[y],C=!1,I=0,L=z.length;I<L;I++){var H=z[I];if(D.position.x==H.position.x&&
+D.position.y==H.position.y&&D.position.z==H.position.z){v[y]=I;C=!0;break}}if(!C){v[y]=z.length;z.push(new THREE.Vertex(D.position.clone()))}}y=0;for(m=j.faces.length;y<m;y++){D=j.faces[y];D.a=v[D.a];D.b=v[D.b];D.c=v[D.c];D.d=v[D.d]}j.vertices=z})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(a,c,b,e,d,f){function g(o,n,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,w)))}THREE.Geometry.call(this);var h=this,k,l=Math.PI*2,j=e/2;for(k=0;k<a;k++)g(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,-j);for(k=0;k<a;k++)g(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,j);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b>0){g(0,0,-j-(f||0));for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c>0){g(0,0,j+(d||0));
+for(k=a+a/2;k<2*a;k++)h.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){c=[];b=this.faces[k];d=this.vertices[b.a];f=this.vertices[b.b];j=this.vertices[b.c];var t=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(d.position.x,d.position.y)/l,0.5+d.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/l,0.5+j.position.z/
+e));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/l,0.5+t.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Icosahedron=function(a){function c(t,o,n){var w=Math.sqrt(t*t+o*o+n*n);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(t/w,o/w,n/w)))-1}function b(t,o,n,w){w.faces.push(new THREE.Face3(t,o,n))}function e(t,o){var n=d.vertices[t].position,w=d.vertices[o].position;return c((n.x+w.x)/2,(n.y+w.y)/2,(n.z+w.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,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 k=e(f.faces[h].a,f.faces[h].b),l=e(f.faces[h].b,f.faces[h].c),j=e(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,k,j,g);b(f.faces[h].b,l,k,g);b(f.faces[h].c,
+j,l,g);b(k,l,j,g)}f.faces=g.faces}d.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,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;b=[];for(var e=[],d=[],f=[],g=(new THREE.Matrix4).setRotationZ(c),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 k=0;k<=this.angle+0.001;k+=c){for(h=0;h<b.length;h++)if(k<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));d[h]=this.vertices.length-1}else d=f;k==0&&(f=e);
+for(h=0;h<e.length-1;h++){this.faces.push(new THREE.Face4(d[h],d[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,h/a.length),new THREE.UV(1-k/this.angle,(h+1)/a.length),new THREE.UV(1-(k-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(k-c)/this.angle,h/a.length)])}e=d;d=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
+THREE.Plane=function(a,c,b,e){THREE.Geometry.call(this);var d,f=a/2,g=c/2;b=b||1;e=e||1;var h=b+1,k=e+1;a/=b;var l=c/e;for(d=0;d<k;d++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(d*l-g),0)));for(d=0;d<e;d++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+h*d,c+h*(d+1),c+1+h*(d+1),c+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(c/b,d/e),new THREE.UV(c/b,(d+1)/e),new THREE.UV((c+1)/b,(d+1)/e),new THREE.UV((c+1)/b,d/e)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(a,d,b){THREE.Geometry.call(this);var e,c=Math.PI,f=Math.max(3,d||8),g=Math.max(2,b||6);d=[];for(b=0;b<g+1;b++){e=b/g;var h=a*Math.cos(e*c),j=a*Math.sin(e*c),l=[],k=0;for(e=0;e<f;e++){var m=2*e/f,p=j*Math.sin(m*c);m=j*Math.cos(m*c);(b==0||b==g)&&e>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);l.push(k)}d.push(l)}var o,x,w;c=d.length;for(b=0;b<c;b++){f=d[b].length;if(b>0)for(e=0;e<f;e++){l=e==f-1;g=d[b][l?0:e+1];h=d[b][l?f-1:e];j=d[b-1][l?f-1:e];l=d[b-
-1][l?0:e+1];p=b/(c-1);o=(b-1)/(c-1);x=(e+1)/f;m=e/f;k=new THREE.UV(1-x,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,o);var u=new THREE.UV(1-x,o);if(b<d.length-1){o=this.vertices[g].position.clone();x=this.vertices[h].position.clone();w=this.vertices[j].position.clone();o.normalize();x.normalize();w.normalize();this.faces.push(new THREE.Face3(g,h,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)]));this.faceVertexUvs[0].push([k,p,m])}if(b>1){o=this.vertices[g].position.clone();
-x=this.vertices[j].position.clone();w=this.vertices[l].position.clone();o.normalize();x.normalize();w.normalize();this.faces.push(new THREE.Face3(g,j,l,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)]));this.faceVertexUvs[0].push([k,m,u])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
-THREE.Torus=function(a,d,b,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var c=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(c))*Math.cos(e),(this.radius+this.tube*Math.cos(c))*Math.sin(e),this.tube*Math.sin(c))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b=
-1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*d+b;c=(this.segmentsT+1)*d+b-1;var f=(this.segmentsT+1)*(d-1)+b-1,g=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(e,c,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(a,d,b,e,c,f,g){function h(m,p,o,x,w,u){p=o/x*m;o=Math.cos(p);return new THREE.Vector3(w*(2+o)*0.5*Math.cos(m),w*(2+o)*Math.sin(m)*0.5,u*w*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=d||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=c||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var j=
-a/this.segmentsR*2*this.p*Math.PI;g=d/this.segmentsT*2*Math.PI;c=h(j,g,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=j.x-c.x;b.y=j.y-c.y;b.z=j.z-c.z;e.x=j.x+c.x;e.y=j.y+c.y;e.z=j.z+c.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);c.x+=j*e.x+g*f.x;c.y+=j*e.y+g*f.y;c.z+=j*e.z+g*f.z;this.grid[a][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z)))-1}}for(a=0;a<this.segmentsR;++a)for(d=
-0;d<this.segmentsT;++d){e=(a+1)%this.segmentsR;f=(d+1)%this.segmentsT;c=this.grid[a][d];b=this.grid[e][d];e=this.grid[e][f];f=this.grid[a][f];g=new THREE.UV(a/this.segmentsR,d/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,d/this.segmentsT);var l=new THREE.UV((a+1)/this.segmentsR,(d+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,b,e,f));this.faceVertexUvs[0].push([g,j,l,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+THREE.Sphere=function(a,c,b){THREE.Geometry.call(this);var e,d=Math.PI,f=Math.max(3,c||8),g=Math.max(2,b||6);c=[];for(b=0;b<g+1;b++){e=b/g;var h=a*Math.cos(e*d),k=a*Math.sin(e*d),l=[],j=0;for(e=0;e<f;e++){var t=2*e/f,o=k*Math.sin(t*d);t=k*Math.cos(t*d);(b==0||b==g)&&e>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,h,o)))-1);l.push(j)}c.push(l)}var n,w,p;d=c.length;for(b=0;b<d;b++){f=c[b].length;if(b>0)for(e=0;e<f;e++){l=e==f-1;g=c[b][l?0:e+1];h=c[b][l?f-1:e];k=c[b-1][l?f-1:e];l=c[b-
+1][l?0:e+1];o=b/(d-1);n=(b-1)/(d-1);w=(e+1)/f;t=e/f;j=new THREE.UV(1-w,o);o=new THREE.UV(1-t,o);t=new THREE.UV(1-t,n);var z=new THREE.UV(1-w,n);if(b<c.length-1){n=this.vertices[g].position.clone();w=this.vertices[h].position.clone();p=this.vertices[k].position.clone();n.normalize();w.normalize();p.normalize();this.faces.push(new THREE.Face3(g,h,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(p.x,p.y,p.z)]));this.faceVertexUvs[0].push([j,o,t])}if(b>1){n=this.vertices[g].position.clone();
+w=this.vertices[k].position.clone();p=this.vertices[l].position.clone();n.normalize();w.normalize();p.normalize();this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(p.x,p.y,p.z)]));this.faceVertexUvs[0].push([j,t,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Torus=function(a,c,b,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var d=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(d))*Math.cos(e),(this.radius+this.tube*Math.cos(d))*Math.sin(e),this.tube*Math.sin(d))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
+1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;d=(this.segmentsT+1)*c+b-1;var f=(this.segmentsT+1)*(c-1)+b-1,g=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,d,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
+THREE.TorusKnot=function(a,c,b,e,d,f,g){function h(t,o,n,w,p,z){o=n/w*t;n=Math.cos(o);return new THREE.Vector3(p*(2+n)*0.5*Math.cos(t),p*(2+n)*Math.sin(t)*0.5,z*p*Math.sin(o)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=d||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
+a/this.segmentsR*2*this.p*Math.PI;g=c/this.segmentsT*2*Math.PI;d=h(k,g,this.q,this.p,this.radius,this.heightScale);k=h(k+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=k.x-d.x;b.y=k.y-d.y;b.z=k.z-d.z;e.x=k.x+d.x;e.y=k.y+d.y;e.z=k.z+d.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();k=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);d.x+=k*e.x+g*f.x;d.y+=k*e.y+g*f.y;d.z+=k*e.z+g*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){e=(a+1)%this.segmentsR;f=(c+1)%this.segmentsT;d=this.grid[a][c];b=this.grid[e][c];e=this.grid[e][f];f=this.grid[a][f];g=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(d,b,e,f));this.faceVertexUvs[0].push([g,k,l,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var d="Loaded ";d+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=d},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,d,b){a.materials=[];for(var e=0;e<d.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(d[e],b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};l.src=j}var c,f,g;c="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")c="MeshPhongMaterial";else a.shading=="Basic"&&(c="MeshBasicMaterial");if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending==
-"Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==undefined)f.transparent=a.transparent;if(a.depthTest!==undefined)f.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&d){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;e(f.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
-255<<8)+a.colorDiffuse[2]*255;f.color=g;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&d){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;e(f.lightMap,d+"/"+a.mapLightmap)}return new THREE[c](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a){var d=this,b=a.model,e=a.callback,c=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){d.createModel(f.data,e,c);d.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,d,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var c,f,g,h,j,l,k,m,p,o,x,w,u,A,z,n=a.faces;o=a.vertices;var y=a.normals,B=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){e.faceUvs[c]=[];e.faceVertexUvs[c]=[]}h=0;for(j=o.length;h<j;){k=new THREE.Vertex;k.position.x=o[h++]/
-l;k.position.y=o[h++]/l;k.position.z=o[h++]/l;e.vertices.push(k)}h=0;for(j=n.length;h<j;){o=n[h++];l=o&1;g=o&2;c=o&4;f=o&8;m=o&16;k=o&32;x=o&64;o&=128;if(l){w=new THREE.Face4;w.a=n[h++];w.b=n[h++];w.c=n[h++];w.d=n[h++];l=4}else{w=new THREE.Face3;w.a=n[h++];w.b=n[h++];w.c=n[h++];l=3}if(g){g=n[h++];w.materials=e.materials[g]}g=e.faces.length;if(c)for(c=0;c<G;c++){u=a.uvs[c];p=n[h++];z=u[p*2];p=u[p*2+1];e.faceUvs[c][g]=new THREE.UV(z,p)}if(f)for(c=0;c<G;c++){u=a.uvs[c];A=[];for(f=0;f<l;f++){p=n[h++];
-z=u[p*2];p=u[p*2+1];A[f]=new THREE.UV(z,p)}e.faceVertexUvs[c][g]=A}if(m){m=n[h++]*3;f=new THREE.Vector3;f.x=y[m++];f.y=y[m++];f.z=y[m];w.normal=f}if(k)for(c=0;c<l;c++){m=n[h++]*3;f=new THREE.Vector3;f.x=y[m++];f.y=y[m++];f.z=y[m];w.vertexNormals.push(f)}if(x){k=n[h++];k=new THREE.Color(B[k]);w.color=k}if(o)for(c=0;c<l;c++){k=n[h++];k=new THREE.Color(B[k]);w.vertexColors.push(k)}e.faces.push(w)}}})();(function(){var c,f,g,h;if(a.skinWeights){c=0;for(f=a.skinWeights.length;c<f;c+=2){g=a.skinWeights[c];
-h=a.skinWeights[c+1];e.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){c=0;for(f=a.skinIndices.length;c<f;c+=2){g=a.skinIndices[c];h=a.skinIndices[c+1];e.skinIndices.push(new THREE.Vector4(g,h,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var c,f,g,h,j,l;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];j=e.morphTargets[c].vertices;l=a.morphTargets[c].vertices;
-g=0;for(h=l.length;g<h;g+=3)j.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1],l[g+2])))}}if(a.morphColors!==undefined){var k,m;c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.morphColors[c].colors;k=a.morphColors[c].colors;h=0;for(j=k.length;h<j;h+=3){m=new THREE.Color(16755200);m.setRGB(k[g],k[g+1],k[g+2]);l.push(m)}}}})();(function(){if(a.edges!==undefined){var c,f,g;for(c=0;c<a.edges.length;c+=2){f=a.edges[c];
-g=a.edges[c+1];e.edges.push(new THREE.Edge(e.vertices[f],e.vertices[g],f,g))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();d(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var d=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d),c=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,c,e,f)};d.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
-d.postMessage(a)},loadAjaxBuffers:function(a,d,b,e,c,f){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,c,d):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(f){j==0&&(j=g.getResponseHeader("Content-Length"));f({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,d,b,e){var c=function(f){function g(t,v){var C=k(t,v),D=k(t,v+1),I=k(t,v+2),S=k(t,v+3),V=(S<<1&255|I>>7)-127;C|=(I&127)<<16|D<<8;if(C==0&&V==-127)return 0;return(1-2*(S>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,v){var C=k(t,v),D=k(t,v+1),I=k(t,v+2);return(k(t,v+3)<<24)+(I<<16)+(D<<8)+C}function j(t,v){var C=k(t,v);return(k(t,v+1)<<8)+C}function l(t,v){var C=k(t,v);return C>127?C-256:C}function k(t,
-v){return t.charCodeAt(v)&255}function m(t){var v,C,D;v=h(a,t);C=h(a,t+G);D=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(A,v,C,D,t)}function p(t){var v,C,D,I,S,V;v=h(a,t);C=h(a,t+G);D=h(a,t+K);I=j(a,t+J);S=h(a,t+H);V=h(a,t+E);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(A,y,v,C,D,I,S,V,t)}function o(t){var v,C,D,I;v=h(a,t);C=h(a,t+P);D=h(a,t+Q);I=h(a,t+R);t=j(a,t+M);THREE.BinaryLoader.prototype.f4(A,v,C,D,I,t)}function x(t){var v,C,D,I,S,V,ca,da;v=h(a,t);C=h(a,t+P);D=h(a,t+Q);I=h(a,t+R);S=j(a,
-t+M);V=h(a,t+F);ca=h(a,t+N);da=h(a,t+O);t=h(a,t+T);THREE.BinaryLoader.prototype.f4n(A,y,v,C,D,I,S,V,ca,da,t)}function w(t){var v,C;v=h(a,t);C=h(a,t+U);t=h(a,t+X);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function u(t){var v,C,D;v=h(a,t);C=h(a,t+ea);D=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[D*2],B[D*2+1],B[t*2],B[t*2+1])}var A=this,z=0,n,y=[],B=[],G,K,J,H,E,L,P,Q,R,M,F,N,O,
-T,U,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,e,f);n={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:h(a,z+16),nnormals:h(a,z+16+4),nuvs:h(a,z+16+8),ntri_flat:h(a,z+16+12),ntri_smooth:h(a,z+16+16),ntri_flat_uv:h(a,z+16+20),ntri_smooth_uv:h(a,
-z+16+24),nquad_flat:h(a,z+16+28),nquad_smooth:h(a,z+16+32),nquad_flat_uv:h(a,z+16+36),nquad_smooth_uv:h(a,z+16+40)};z+=n.header_bytes;G=n.vertex_index_bytes;K=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;H=n.vertex_index_bytes*3+n.material_index_bytes;E=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;L=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;P=n.vertex_index_bytes;Q=n.vertex_index_bytes*2;R=n.vertex_index_bytes*3;M=n.vertex_index_bytes*4;F=n.vertex_index_bytes*
-4+n.material_index_bytes;N=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;T=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;U=n.uv_index_bytes;X=n.uv_index_bytes*2;ea=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;W=n.vertex_index_bytes*4+n.material_index_bytes;Y=n.ntri_flat*f;Z=n.ntri_smooth*(f+n.normal_index_bytes*3);$=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);aa=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ba=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);z+=function(t){for(var v,C,D,I=n.vertex_coordinate_bytes*3,S=t+n.nvertices*I;t<S;t+=I){v=g(a,t);C=g(a,t+n.vertex_coordinate_bytes);D=g(a,t+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,v,C,D)}return n.nvertices*I}(z);z+=function(t){for(var v,C,D,I=n.normal_coordinate_bytes*3,S=t+n.nnormals*I;t<
-S;t+=I){v=l(a,t);C=l(a,t+n.normal_coordinate_bytes);D=l(a,t+n.normal_coordinate_bytes*2);y.push(v/127,C/127,D/127)}return n.nnormals*I}(z);z+=function(t){for(var v,C,D=n.uv_coordinate_bytes*2,I=t+n.nuvs*D;t<I;t+=D){v=g(a,t);C=g(a,t+n.uv_coordinate_bytes);B.push(v,C)}return n.nuvs*D}(z);Y=z+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;f=ba+f;W=f+W;(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=C+n.uv_index_bytes*3,I=t+n.ntri_flat_uv*D;for(v=t;v<I;v+=D){m(v);w(v+C)}return I-t})(Z);(function(t){var v,
-C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,D=C+n.uv_index_bytes*3,I=t+n.ntri_smooth_uv*D;for(v=t;v<I;v+=D){p(v);w(v+C)}return I-t})($);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes,D=C+n.uv_index_bytes*4,I=t+n.nquad_flat_uv*D;for(v=t;v<I;v+=D){o(v);u(v+C)}return I-t})(f);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,D=C+n.uv_index_bytes*4,I=t+n.nquad_smooth_uv*D;for(v=t;v<I;v+=D){x(v);u(v+C)}return I-t})(W);
-(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=t+n.ntri_flat*C;for(v=t;v<D;v+=C)m(v);return D-t})(z);(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,D=t+n.ntri_smooth*C;for(v=t;v<D;v+=C)p(v);return D-t})(Y);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes,D=t+n.nquad_flat*C;for(v=t;v<D;v+=C)o(v);return D-t})(aa);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,D=t+n.nquad_smooth*
-C;for(v=t;v<D;v+=C)x(v);return D-t})(ba);this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;d(new c(b))},v:function(a,d,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,e)))},f3:function(a,d,b,e,c){a.faces.push(new THREE.Face3(d,b,e,null,null,a.materials[c]))},f4:function(a,d,b,e,c,f){a.faces.push(new THREE.Face4(d,b,e,c,null,null,a.materials[f]))},f3n:function(a,d,b,e,c,f,g,h,j){f=a.materials[f];var l=d[h*3],k=d[h*3+1];h=d[h*3+2];
-var m=d[j*3],p=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,e,c,[new THREE.Vector3(d[g*3],d[g*3+1],d[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,f))},f4n:function(a,d,b,e,c,f,g,h,j,l,k){g=a.materials[g];var m=d[j*3],p=d[j*3+1];j=d[j*3+2];var o=d[l*3],x=d[l*3+1];l=d[l*3+2];var w=d[k*3],u=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,e,c,f,[new THREE.Vector3(d[h*3],d[h*3+1],d[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(o,x,l),new THREE.Vector3(w,u,k)],null,g))},
-uv3:function(a,d,b,e,c,f,g){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(e,c));h.push(new THREE.UV(f,g));a.push(h)},uv4:function(a,d,b,e,c,f,g,h,j){var l=[];l.push(new THREE.UV(d,b));l.push(new THREE.UV(e,c));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,j));a.push(l)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(a,d,b,e){var c=new Worker(a);c.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);c.onmessage=function(g){function h(U,X){return X=="relativeToHTML"?U:f+"/"+U}function j(){for(o in E.objects)if(!F.objects[o]){z=E.objects[o];if(G=F.geometries[z.geometry]){H=[];for(T=0;T<z.materials.length;T++)H[T]=F.materials[z.materials[T]];n=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;H.length==0&&(H[0]=new THREE.MeshFaceMaterial);H.length>1&&(H=[new THREE.MeshFaceMaterial]);
-object=new THREE.Mesh(G,H);object.position.set(n[0],n[1],n[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=z.visible;F.scene.addObject(object);F.objects[o]=object;if(z.meshCollider){var U=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(U)}}}}function l(U){return function(X){F.geometries[U]=X;j();P-=1;k()}}function k(){e({total_models:R,total_textures:M,
-loaded_models:R-P,loaded_textures:M-Q},F);P==0&&Q==0&&b(F)}var m,p,o,x,w,u,A,z,n,y,B,G,K,J,H,E,L,P,Q,R,M,F;E=g.data;g=new THREE.BinaryLoader;L=new THREE.JSONLoader;Q=P=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(E.transform){var N=E.transform.position;y=E.transform.rotation;var O=E.transform.scale;N&&F.scene.position.set(N[0],N[1],N[2]);y&&F.scene.rotation.set(y[0],y[1],y[2]);O&&F.scene.scale.set(O[0],O[1],O[2]);(N||y||O)&&F.scene.updateMatrix()}N=
-function(){Q-=1;k()};for(w in E.cameras){y=E.cameras[w];if(y.type=="perspective")K=new THREE.Camera(y.fov,y.aspect,y.near,y.far);else if(y.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(y.left,y.right,y.top,y.bottom,y.near,y.far)}n=y.position;y=y.target;K.position.set(n[0],n[1],n[2]);K.target.position.set(y[0],y[1],y[2]);F.cameras[w]=K}for(x in E.lights){w=E.lights[x];K=w.color!==undefined?w.color:16777215;y=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){n=
-w.direction;light=new THREE.DirectionalLight(K,y);light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(w.type=="point"){n=w.position;light=new THREE.PointLight(K,y);light.position.set(n[0],n[1],n[2])}F.scene.addLight(light);F.lights[x]=light}for(u in E.fogs){x=E.fogs[u];if(x.type=="linear")J=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(J=new THREE.FogExp2(0,x.density));y=x.color;J.color.setRGB(y[0],y[1],y[2]);F.fogs[u]=J}if(F.cameras&&E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];
-if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];y=E.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(y[0],y[1],y[2]);F.bgColorAlpha=E.defaults.bgalpha;for(m in E.geometries){u=E.geometries[m];if(u.type=="bin_mesh"||u.type=="ascii_mesh")P+=1}R=P;for(m in E.geometries){u=E.geometries[m];if(u.type=="cube"){G=new THREE.Cube(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides);F.geometries[m]=G}else if(u.type=="plane"){G=new THREE.Plane(u.width,
-u.height,u.segmentsWidth,u.segmentsHeight);F.geometries[m]=G}else if(u.type=="sphere"){G=new THREE.Sphere(u.radius,u.segmentsWidth,u.segmentsHeight);F.geometries[m]=G}else if(u.type=="cylinder"){G=new THREE.Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset);F.geometries[m]=G}else if(u.type=="torus"){G=new THREE.Torus(u.radius,u.tube,u.segmentsR,u.segmentsT);F.geometries[m]=G}else if(u.type=="icosahedron"){G=new THREE.Icosahedron(u.subdivisions);F.geometries[m]=G}else if(u.type==
-"bin_mesh")g.load({model:h(u.url,E.urlBaseType),callback:l(m)});else u.type=="ascii_mesh"&&L.load({model:h(u.url,E.urlBaseType),callback:l(m)})}for(A in E.textures){m=E.textures[A];Q+=m.url instanceof Array?m.url.length:1}M=Q;for(A in E.textures){m=E.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){u=[];for(var T=0;T<m.url.length;T++)u[T]=h(m.url[T],E.urlBaseType);u=THREE.ImageUtils.loadTextureCube(u,m.mapping,N)}else{u=THREE.ImageUtils.loadTexture(h(m.url,
-E.urlBaseType),m.mapping,N);if(THREE[m.minFilter]!=undefined)u.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)u.magFilter=THREE[m.magFilter]}F.textures[A]=u}for(p in E.materials){A=E.materials[p];for(B in A.parameters)if(B=="envMap"||B=="map"||B=="lightMap")A.parameters[B]=F.textures[A.parameters[B]];else if(B=="shading")A.parameters[B]=A.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")A.parameters[B]=THREE[A.parameters[B]]?THREE[A.parameters[B]]:THREE.NormalBlending;
-else if(B=="combine")A.parameters[B]=A.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(A.parameters[B]=="face")A.parameters[B]=THREE.FaceColors;else if(A.parameters[B])A.parameters[B]=THREE.VertexColors;A=new THREE[A.type](A.parameters);F.materials[p]=A}j();d(F)}}};
-THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,c){return b+(e-b)*c};this.VIntX=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h+g*this.delta;e[f+1]=j;e[f+2]=l;c[f]=this.lerp(k[b],k[b+3],g);c[f+1]=this.lerp(k[b+1],k[b+4],g);c[f+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j+g*this.delta;e[f+
-2]=l;e=b+this.yd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j;e[f+2]=l+g*this.delta;e=b+this.zd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,c,f,g,h){var j=f+1,l=f+this.yd,k=f+this.zd,m=j+this.yd,p=j+this.zd,o=f+this.yd+this.zd,x=j+this.yd+this.zd,w=0,u=this.field[f],A=this.field[j],z=this.field[l],n=this.field[m],y=this.field[k],B=this.field[p],G=this.field[o],K=this.field[x];u<g&&(w|=1);A<g&&(w|=2);z<g&&(w|=8);n<g&&(w|=4);y<g&&(w|=16);B<g&&(w|=32);G<g&&(w|=128);K<g&&(w|=64);var J=THREE.edgeTable[w];if(J==0)return 0;
-var H=this.delta,E=b+H,L=e+H;H=c+H;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,e,c,u,A)}if(J&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,g,E,e,c,A,n)}if(J&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,c,z,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,e,c,u,z)}if(J&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,g,b,e,H,
-y,B)}if(J&32){this.compNorm(p);this.compNorm(x);this.VIntY(p*3,this.vlist,this.nlist,15,g,E,e,H,B,K)}if(J&64){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,18,g,b,L,H,G,K)}if(J&128){this.compNorm(k);this.compNorm(o);this.VIntY(k*3,this.vlist,this.nlist,21,g,b,e,H,y,G)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,e,c,u,y)}if(J&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,g,E,e,c,A,B)}if(J&1024){this.compNorm(m);
-this.compNorm(x);this.VIntZ(m*3,this.vlist,this.nlist,30,g,E,L,c,n,K)}if(J&2048){this.compNorm(l);this.compNorm(o);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,c,z,G)}w<<=4;for(g=f=0;THREE.triTable[w+g]!=-1;){b=w+g;e=b+1;c=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[c],h);g+=3;f++}return f};this.posnormtriv=function(b,e,c,f,g,h){var j=this.count*3;this.positionArray[j]=b[c];this.positionArray[j+1]=b[c+1];this.positionArray[j+2]=b[c+2];this.positionArray[j+
-3]=b[f];this.positionArray[j+4]=b[f+1];this.positionArray[j+5]=b[f+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=e[c];this.normalArray[j+1]=e[c+1];this.normalArray[j+2]=e[c+2];this.normalArray[j+3]=e[f];this.normalArray[j+4]=e[f+1];this.normalArray[j+5]=e[f+2];this.normalArray[j+6]=e[g];this.normalArray[j+7]=e[g+1];this.normalArray[j+8]=e[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,c,f,g){var h=this.size*Math.sqrt(f/g),j=c*this.size,l=e*this.size,k=b*this.size,m=Math.floor(j-h);m<1&&(m=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var x,w,u,A,z,n;m<j;m++){k=this.size2*m;w=m/this.size-c;z=w*w;for(w=p;w<l;w++){u=k+this.size*w;x=w/this.size-e;n=x*x;for(x=o;x<h;x++){A=x/this.size-b;A=f/(1.0E-6+A*A+n+z)-g;A>0&&(this.field[u+x]+=A)}}}};this.addPlaneX=function(b,e){var c,f,g,h,j,l=this.size,k=this.yd,m=this.zd,p=this.field,o=l*Math.sqrt(b/e);o>l&&(o=l);for(c=0;c<o;c++){f=c/l;f*=f;h=b/(1.0E-4+f)-e;if(h>0)for(f=0;f<l;f++){j=c+f*k;for(g=0;g<l;g++)p[m*g+j]+=h}}};this.addPlaneY=function(b,e){var c,f,
-g,h,j,l,k=this.size,m=this.yd,p=this.zd,o=this.field,x=k*Math.sqrt(b/e);x>k&&(x=k);for(f=0;f<x;f++){c=f/k;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=f*m;for(c=0;c<k;c++){l=j+c;for(g=0;g<k;g++)o[p*g+l]+=h}}}};this.addPlaneZ=function(b,e){var c,f,g,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(g=0;g<dist;g++){c=g/size;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=zd*g;for(f=0;f<size;f++){l=j+f*yd;for(c=0;c<size;c++)field[l+c]+=h}}}};this.reset=function(){var b;
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,c,f,g,h,j,l,k,m,p=this.size-2;for(g=1;g<p;g++){m=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=m+this.size*f;j=(f-this.halfsize)/this.halfsize;for(c=1;c<p;c++){h=(c-this.halfsize)/this.halfsize;e=k+c;this.polygonize(h,j,l,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,c=[];this.render(function(f){var g,h,j,l,k,m,p,o;for(g=
-0;g<f.count;g++){p=g*3;k=p+1;o=p+2;h=f.positionArray[p];j=f.positionArray[k];l=f.positionArray[o];m=new THREE.Vector3(h,j,l);h=f.normalArray[p];j=f.normalArray[k];l=f.normalArray[o];p=new THREE.Vector3(h,j,l);p.normalize();k=new THREE.Vertex(m);e.vertices.push(k);c.push(p)}nfaces=f.count/3;for(g=0;g<nfaces;g++){p=(b+g)*3;k=p+1;o=p+2;m=c[p];h=c[k];j=c[o];p=new THREE.Face3(p,k,o,[m,h,j]);e.faces.push(p)}b+=nfaces;f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,k){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var j=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));h.image.width=j;h.image.height=t;h.image.getContext("2d").drawImage(this,0,0,j,t)}else h.image=this;h.needsUpdate=!0};l.src=k}var d,f,g;d="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")d="MeshPhongMaterial";else a.shading=="Basic"&&(d="MeshBasicMaterial");if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending==
+"Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==undefined)f.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&c){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;e(f.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
+16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=g;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;e(f.lightMap,c+"/"+a.mapLightmap)}return new THREE[d](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,d=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){c.createModel(f.data,e,d);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,f,g,h,k,l,j,t,o,n,w,p,z,v,y,m=a.faces;n=a.vertices;var D=a.normals,C=a.colors;l=a.scale!==undefined?a.scale:1;var I=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&I++;for(d=0;d<I;d++){e.faceUvs[d]=[];e.faceVertexUvs[d]=[]}h=0;for(k=n.length;h<k;){j=new THREE.Vertex;j.position.x=n[h++]/
+l;j.position.y=n[h++]/l;j.position.z=n[h++]/l;e.vertices.push(j)}h=0;for(k=m.length;h<k;){n=m[h++];l=n&1;g=n&2;d=n&4;f=n&8;t=n&16;j=n&32;w=n&64;n&=128;if(l){p=new THREE.Face4;p.a=m[h++];p.b=m[h++];p.c=m[h++];p.d=m[h++];l=4}else{p=new THREE.Face3;p.a=m[h++];p.b=m[h++];p.c=m[h++];l=3}if(g){g=m[h++];p.materials=e.materials[g]}g=e.faces.length;if(d)for(d=0;d<I;d++){z=a.uvs[d];o=m[h++];y=z[o*2];o=z[o*2+1];e.faceUvs[d][g]=new THREE.UV(y,o)}if(f)for(d=0;d<I;d++){z=a.uvs[d];v=[];for(f=0;f<l;f++){o=m[h++];
+y=z[o*2];o=z[o*2+1];v[f]=new THREE.UV(y,o)}e.faceVertexUvs[d][g]=v}if(t){t=m[h++]*3;f=new THREE.Vector3;f.x=D[t++];f.y=D[t++];f.z=D[t];p.normal=f}if(j)for(d=0;d<l;d++){t=m[h++]*3;f=new THREE.Vector3;f.x=D[t++];f.y=D[t++];f.z=D[t];p.vertexNormals.push(f)}if(w){j=m[h++];j=new THREE.Color(C[j]);p.color=j}if(n)for(d=0;d<l;d++){j=m[h++];j=new THREE.Color(C[j]);p.vertexColors.push(j)}e.faces.push(p)}}})();(function(){var d,f,g,h;if(a.skinWeights){d=0;for(f=a.skinWeights.length;d<f;d+=2){g=a.skinWeights[d];
+h=a.skinWeights[d+1];e.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){d=0;for(f=a.skinIndices.length;d<f;d+=2){g=a.skinIndices[d];h=a.skinIndices[d+1];e.skinIndices.push(new THREE.Vector4(g,h,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var d,f,g,h,k,l;d=0;for(f=a.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=a.morphTargets[d].name;e.morphTargets[d].vertices=[];k=e.morphTargets[d].vertices;l=a.morphTargets[d].vertices;
+g=0;for(h=l.length;g<h;g+=3)k.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1],l[g+2])))}}if(a.morphColors!==undefined){var j,t;d=0;for(f=a.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=a.morphColors[d].name;e.morphColors[d].colors=[];l=e.morphColors[d].colors;j=a.morphColors[d].colors;h=0;for(k=j.length;h<k;h+=3){t=new THREE.Color(16755200);t.setRGB(j[g],j[g+1],j[g+2]);l.push(t)}}}})();(function(){if(a.edges!==undefined){var d,f,g;for(d=0;d<a.edges.length;d+=2){f=a.edges[d];
+g=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[f],e.vertices[g],f,g))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),d=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,d,e,f)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,d,f){var g=new XMLHttpRequest,h=e+"/"+a,k=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,d,c):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(f){k==0&&(k=g.getResponseHeader("Content-Length"));f({total:k,loaded:g.responseText.length})}}else g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,e){var d=function(f){function g(u,x){var A=j(u,x),E=j(u,x+1),G=j(u,x+2),R=j(u,x+3),U=(R<<1&255|G>>7)-127;A|=(G&127)<<16|E<<8;if(A==0&&U==-127)return 0;return(1-2*(R>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,U)}function h(u,x){var A=j(u,x),E=j(u,x+1),G=j(u,x+2);return(j(u,x+3)<<24)+(G<<16)+(E<<8)+A}function k(u,x){var A=j(u,x);return(j(u,x+1)<<8)+A}function l(u,x){var A=j(u,x);return A>127?A-256:A}function j(u,
+x){return u.charCodeAt(x)&255}function t(u){var x,A,E;x=h(a,u);A=h(a,u+I);E=h(a,u+L);u=k(a,u+H);THREE.BinaryLoader.prototype.f3(v,x,A,E,u)}function o(u){var x,A,E,G,R,U;x=h(a,u);A=h(a,u+I);E=h(a,u+L);G=k(a,u+H);R=h(a,u+B);U=h(a,u+K);u=h(a,u+J);THREE.BinaryLoader.prototype.f3n(v,D,x,A,E,G,R,U,u)}function n(u){var x,A,E,G;x=h(a,u);A=h(a,u+P);E=h(a,u+T);G=h(a,u+Q);u=k(a,u+F);THREE.BinaryLoader.prototype.f4(v,x,A,E,G,u)}function w(u){var x,A,E,G,R,U,ba,ca;x=h(a,u);A=h(a,u+P);E=h(a,u+T);G=h(a,u+Q);R=k(a,
+u+F);U=h(a,u+N);ba=h(a,u+S);ca=h(a,u+M);u=h(a,u+O);THREE.BinaryLoader.prototype.f4n(v,D,x,A,E,G,R,U,ba,ca,u)}function p(u){var x,A;x=h(a,u);A=h(a,u+W);u=h(a,u+da);THREE.BinaryLoader.prototype.uv3(v.faceVertexUvs[0],C[x*2],C[x*2+1],C[A*2],C[A*2+1],C[u*2],C[u*2+1])}function z(u){var x,A,E;x=h(a,u);A=h(a,u+ea);E=h(a,u+fa);u=h(a,u+ga);THREE.BinaryLoader.prototype.uv4(v.faceVertexUvs[0],C[x*2],C[x*2+1],C[A*2],C[A*2+1],C[E*2],C[E*2+1],C[u*2],C[u*2+1])}var v=this,y=0,m,D=[],C=[],I,L,H,B,K,J,P,T,Q,F,N,S,
+M,O,W,da,ea,fa,ga,X,Y,Z,$,aa,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,e,f);m={signature:a.substr(y,8),header_bytes:j(a,y+8),vertex_coordinate_bytes:j(a,y+9),normal_coordinate_bytes:j(a,y+10),uv_coordinate_bytes:j(a,y+11),vertex_index_bytes:j(a,y+12),normal_index_bytes:j(a,y+13),uv_index_bytes:j(a,y+14),material_index_bytes:j(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,
+y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=m.header_bytes;I=m.vertex_index_bytes;L=m.vertex_index_bytes*2;H=m.vertex_index_bytes*3;B=m.vertex_index_bytes*3+m.material_index_bytes;K=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;J=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes;T=m.vertex_index_bytes*2;Q=m.vertex_index_bytes*3;F=m.vertex_index_bytes*4;N=m.vertex_index_bytes*
+4+m.material_index_bytes;S=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;M=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;O=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;W=m.uv_index_bytes;da=m.uv_index_bytes*2;ea=m.uv_index_bytes;fa=m.uv_index_bytes*2;ga=m.uv_index_bytes*3;f=m.vertex_index_bytes*3+m.material_index_bytes;V=m.vertex_index_bytes*4+m.material_index_bytes;X=m.ntri_flat*f;Y=m.ntri_smooth*(f+m.normal_index_bytes*3);Z=m.ntri_flat_uv*
+(f+m.uv_index_bytes*3);$=m.ntri_smooth_uv*(f+m.normal_index_bytes*3+m.uv_index_bytes*3);aa=m.nquad_flat*V;f=m.nquad_smooth*(V+m.normal_index_bytes*4);V=m.nquad_flat_uv*(V+m.uv_index_bytes*4);y+=function(u){for(var x,A,E,G=m.vertex_coordinate_bytes*3,R=u+m.nvertices*G;u<R;u+=G){x=g(a,u);A=g(a,u+m.vertex_coordinate_bytes);E=g(a,u+m.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(v,x,A,E)}return m.nvertices*G}(y);y+=function(u){for(var x,A,E,G=m.normal_coordinate_bytes*3,R=u+m.nnormals*G;u<
+R;u+=G){x=l(a,u);A=l(a,u+m.normal_coordinate_bytes);E=l(a,u+m.normal_coordinate_bytes*2);D.push(x/127,A/127,E/127)}return m.nnormals*G}(y);y+=function(u){for(var x,A,E=m.uv_coordinate_bytes*2,G=u+m.nuvs*E;u<G;u+=E){x=g(a,u);A=g(a,u+m.uv_coordinate_bytes);C.push(x,A)}return m.nuvs*E}(y);X=y+X;Y=X+Y;Z=Y+Z;$=Z+$;aa=$+aa;f=aa+f;V=f+V;(function(u){var x,A=m.vertex_index_bytes*3+m.material_index_bytes,E=A+m.uv_index_bytes*3,G=u+m.ntri_flat_uv*E;for(x=u;x<G;x+=E){t(x);p(x+A)}return G-u})(Y);(function(u){var x,
+A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,E=A+m.uv_index_bytes*3,G=u+m.ntri_smooth_uv*E;for(x=u;x<G;x+=E){o(x);p(x+A)}return G-u})(Z);(function(u){var x,A=m.vertex_index_bytes*4+m.material_index_bytes,E=A+m.uv_index_bytes*4,G=u+m.nquad_flat_uv*E;for(x=u;x<G;x+=E){n(x);z(x+A)}return G-u})(f);(function(u){var x,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,E=A+m.uv_index_bytes*4,G=u+m.nquad_smooth_uv*E;for(x=u;x<G;x+=E){w(x);z(x+A)}return G-u})(V);
+(function(u){var x,A=m.vertex_index_bytes*3+m.material_index_bytes,E=u+m.ntri_flat*A;for(x=u;x<E;x+=A)t(x);return E-u})(y);(function(u){var x,A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,E=u+m.ntri_smooth*A;for(x=u;x<E;x+=A)o(x);return E-u})(X);(function(u){var x,A=m.vertex_index_bytes*4+m.material_index_bytes,E=u+m.nquad_flat*A;for(x=u;x<E;x+=A)n(x);return E-u})($);(function(u){var x,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,E=u+m.nquad_smooth*
+A;for(x=u;x<E;x+=A)w(x);return E-u})(aa);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,d){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[d]))},f4:function(a,c,b,e,d,f){a.faces.push(new THREE.Face4(c,b,e,d,null,null,a.materials[f]))},f3n:function(a,c,b,e,d,f,g,h,k){f=a.materials[f];var l=c[h*3],j=c[h*3+1];h=c[h*3+2];
+var t=c[k*3],o=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,e,d,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(l,j,h),new THREE.Vector3(t,o,k)],null,f))},f4n:function(a,c,b,e,d,f,g,h,k,l,j){g=a.materials[g];var t=c[k*3],o=c[k*3+1];k=c[k*3+2];var n=c[l*3],w=c[l*3+1];l=c[l*3+2];var p=c[j*3],z=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face4(b,e,d,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(t,o,k),new THREE.Vector3(n,w,l),new THREE.Vector3(p,z,j)],null,g))},
+uv3:function(a,c,b,e,d,f,g){var h=[];h.push(new THREE.UV(c,b));h.push(new THREE.UV(e,d));h.push(new THREE.UV(f,g));a.push(h)},uv4:function(a,c,b,e,d,f,g,h,k){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(e,d));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var d=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(f){function g(O,W){return W=="relativeToHTML"?O:d+"/"+O}function h(){for(o in B.objects)if(!F.objects[o]){v=B.objects[o];if(C=F.geometries[v.geometry]){H=[];for(M=0;M<v.materials.length;M++)H[M]=F.materials[v.materials[M]];y=v.position;r=v.rotation;q=v.quaternion;s=v.scale;q=0;H.length==0&&(H[0]=new THREE.MeshFaceMaterial);H.length>1&&(H=[new THREE.MeshFaceMaterial]);
+object=new THREE.Mesh(C,H);object.name=o;object.position.set(y[0],y[1],y[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=v.visible;F.scene.addObject(object);F.objects[o]=object;if(v.meshCollider){var O=THREE.CollisionUtils.MeshColliderWBox(object);F.scene.collisions.colliders.push(O)}if(v.castsShadow){O=new THREE.ShadowVolume(C);F.scene.addChild(O);O.position=object.position;O.rotation=
+object.rotation;O.scale=object.scale}}}}function k(O){return function(W){F.geometries[O]=W;h();J-=1;b.onLoadComplete();l()}}function l(){b.callbackProgress({totalModels:T,totalTextures:Q,loadedModels:T-J,loadedTextures:Q-P},F);b.onLoadProgress();J==0&&P==0&&c(F)}var j,t,o,n,w,p,z,v,y,m,D,C,I,L,H,B,K,J,P,T,Q,F;B=f.data;f=new THREE.BinaryLoader;K=new THREE.JSONLoader;P=J=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};var N=!1;for(o in B.objects){v=
+B.objects[o];if(v.meshCollider){N=!0;break}}if(N)F.scene.collisions=new THREE.CollisionSystem;if(B.transform){N=B.transform.position;m=B.transform.rotation;var S=B.transform.scale;N&&F.scene.position.set(N[0],N[1],N[2]);m&&F.scene.rotation.set(m[0],m[1],m[2]);S&&F.scene.scale.set(S[0],S[1],S[2]);(N||m||S)&&F.scene.updateMatrix()}N=function(){P-=1;l();b.onLoadComplete()};for(w in B.cameras){m=B.cameras[w];if(m.type=="perspective")I=new THREE.Camera(m.fov,m.aspect,m.near,m.far);else if(m.type=="ortho"){I=
+new THREE.Camera;I.projectionMatrix=THREE.Matrix4.makeOrtho(m.left,m.right,m.top,m.bottom,m.near,m.far)}y=m.position;m=m.target;I.position.set(y[0],y[1],y[2]);I.target.position.set(m[0],m[1],m[2]);F.cameras[w]=I}for(n in B.lights){w=B.lights[n];I=w.color!==undefined?w.color:16777215;m=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){y=w.direction;light=new THREE.DirectionalLight(I,m);light.position.set(y[0],y[1],y[2]);light.position.normalize()}else if(w.type=="point"){y=w.position;
+light=new THREE.PointLight(I,m);light.position.set(y[0],y[1],y[2])}F.scene.addLight(light);F.lights[n]=light}for(p in B.fogs){n=B.fogs[p];if(n.type=="linear")L=new THREE.Fog(0,n.near,n.far);else n.type=="exp2"&&(L=new THREE.FogExp2(0,n.density));m=n.color;L.color.setRGB(m[0],m[1],m[2]);F.fogs[p]=L}if(F.cameras&&B.defaults.camera)F.currentCamera=F.cameras[B.defaults.camera];if(F.fogs&&B.defaults.fog)F.scene.fog=F.fogs[B.defaults.fog];m=B.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(m[0],
+m[1],m[2]);F.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries){p=B.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh"){J+=1;b.onLoadStart()}}T=J;for(j in B.geometries){p=B.geometries[j];if(p.type=="cube"){C=new THREE.Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);F.geometries[j]=C}else if(p.type=="plane"){C=new THREE.Plane(p.width,p.height,p.segmentsWidth,p.segmentsHeight);F.geometries[j]=C}else if(p.type=="sphere"){C=new THREE.Sphere(p.radius,
+p.segmentsWidth,p.segmentsHeight);F.geometries[j]=C}else if(p.type=="cylinder"){C=new THREE.Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);F.geometries[j]=C}else if(p.type=="torus"){C=new THREE.Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);F.geometries[j]=C}else if(p.type=="icosahedron"){C=new THREE.Icosahedron(p.subdivisions);F.geometries[j]=C}else if(p.type=="bin_mesh")f.load({model:g(p.url,B.urlBaseType),callback:k(j)});else p.type=="ascii_mesh"&&K.load({model:g(p.url,
+B.urlBaseType),callback:k(j)})}for(z in B.textures){j=B.textures[z];if(j.url instanceof Array){P+=j.url.length;for(p=0;p<j.url.length;p++)b.onLoadStart()}else{P+=1;b.onLoadStart()}}Q=P;for(z in B.textures){j=B.textures[z];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){p=[];for(var M=0;M<j.url.length;M++)p[M]=g(j.url[M],B.urlBaseType);p=THREE.ImageUtils.loadTextureCube(p,j.mapping,N)}else{p=THREE.ImageUtils.loadTexture(g(j.url,B.urlBaseType),
+j.mapping,N);if(THREE[j.minFilter]!=undefined)p.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)p.magFilter=THREE[j.magFilter]}F.textures[z]=p}for(t in B.materials){z=B.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=F.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")z.parameters[D]=THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;
+else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==undefined&&z.parameters.opacity<1)z.parameters.transparent=!0;z=new THREE[z.type](z.parameters);F.materials[t]=z}h();b.callbackSync(F)}}};
+THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,d){return b+(e-b)*d};this.VIntX=function(b,e,d,f,g,h,k,l,j,t){g=(g-j)/(t-j);j=this.normal_cache;e[f]=h+g*this.delta;e[f+1]=k;e[f+2]=l;d[f]=this.lerp(j[b],j[b+3],g);d[f+1]=this.lerp(j[b+1],j[b+4],g);d[f+2]=this.lerp(j[b+2],j[b+5],g)};this.VIntY=function(b,e,d,f,g,h,k,l,j,t){g=(g-j)/(t-j);j=this.normal_cache;e[f]=h;e[f+1]=k+g*this.delta;e[f+
+2]=l;e=b+this.yd*3;d[f]=this.lerp(j[b],j[e],g);d[f+1]=this.lerp(j[b+1],j[e+1],g);d[f+2]=this.lerp(j[b+2],j[e+2],g)};this.VIntZ=function(b,e,d,f,g,h,k,l,j,t){g=(g-j)/(t-j);j=this.normal_cache;e[f]=h;e[f+1]=k;e[f+2]=l+g*this.delta;e=b+this.zd*3;d[f]=this.lerp(j[b],j[e],g);d[f+1]=this.lerp(j[b+1],j[e+1],g);d[f+2]=this.lerp(j[b+2],j[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,d,f,g,h){var k=f+1,l=f+this.yd,j=f+this.zd,t=k+this.yd,o=k+this.zd,n=f+this.yd+this.zd,w=k+this.yd+this.zd,p=0,z=this.field[f],v=this.field[k],y=this.field[l],m=this.field[t],D=this.field[j],C=this.field[o],I=this.field[n],L=this.field[w];z<g&&(p|=1);v<g&&(p|=2);y<g&&(p|=8);m<g&&(p|=4);D<g&&(p|=16);C<g&&(p|=32);I<g&&(p|=128);L<g&&(p|=64);var H=THREE.edgeTable[p];if(H==0)return 0;
+var B=this.delta,K=b+B,J=e+B;B=d+B;if(H&1){this.compNorm(f);this.compNorm(k);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,e,d,z,v)}if(H&2){this.compNorm(k);this.compNorm(t);this.VIntY(k*3,this.vlist,this.nlist,3,g,K,e,d,v,m)}if(H&4){this.compNorm(l);this.compNorm(t);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,J,d,y,m)}if(H&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,e,d,z,y)}if(H&16){this.compNorm(j);this.compNorm(o);this.VIntX(j*3,this.vlist,this.nlist,12,g,b,e,B,
+D,C)}if(H&32){this.compNorm(o);this.compNorm(w);this.VIntY(o*3,this.vlist,this.nlist,15,g,K,e,B,C,L)}if(H&64){this.compNorm(n);this.compNorm(w);this.VIntX(n*3,this.vlist,this.nlist,18,g,b,J,B,I,L)}if(H&128){this.compNorm(j);this.compNorm(n);this.VIntY(j*3,this.vlist,this.nlist,21,g,b,e,B,D,I)}if(H&256){this.compNorm(f);this.compNorm(j);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,e,d,z,D)}if(H&512){this.compNorm(k);this.compNorm(o);this.VIntZ(k*3,this.vlist,this.nlist,27,g,K,e,d,v,C)}if(H&1024){this.compNorm(t);
+this.compNorm(w);this.VIntZ(t*3,this.vlist,this.nlist,30,g,K,J,d,m,L)}if(H&2048){this.compNorm(l);this.compNorm(n);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,J,d,y,I)}p<<=4;for(g=f=0;THREE.triTable[p+g]!=-1;){b=p+g;e=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[d],h);g+=3;f++}return f};this.posnormtriv=function(b,e,d,f,g,h){var k=this.count*3;this.positionArray[k]=b[d];this.positionArray[k+1]=b[d+1];this.positionArray[k+2]=b[d+2];this.positionArray[k+
+3]=b[f];this.positionArray[k+4]=b[f+1];this.positionArray[k+5]=b[f+2];this.positionArray[k+6]=b[g];this.positionArray[k+7]=b[g+1];this.positionArray[k+8]=b[g+2];this.normalArray[k]=e[d];this.normalArray[k+1]=e[d+1];this.normalArray[k+2]=e[d+2];this.normalArray[k+3]=e[f];this.normalArray[k+4]=e[f+1];this.normalArray[k+5]=e[f+2];this.normalArray[k+6]=e[g];this.normalArray[k+7]=e[g+1];this.normalArray[k+8]=e[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,d,f,g){var h=this.size*Math.sqrt(f/g),k=d*this.size,l=e*this.size,j=b*this.size,t=Math.floor(k-h);t<1&&(t=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-h);o<1&&(o=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);
+h>this.size-1&&(h=this.size-1);for(var w,p,z,v,y,m;t<k;t++){j=this.size2*t;p=t/this.size-d;y=p*p;for(p=o;p<l;p++){z=j+this.size*p;w=p/this.size-e;m=w*w;for(w=n;w<h;w++){v=w/this.size-b;v=f/(1.0E-6+v*v+m+y)-g;v>0&&(this.field[z+w]+=v)}}}};this.addPlaneX=function(b,e){var d,f,g,h,k,l=this.size,j=this.yd,t=this.zd,o=this.field,n=l*Math.sqrt(b/e);n>l&&(n=l);for(d=0;d<n;d++){f=d/l;f*=f;h=b/(1.0E-4+f)-e;if(h>0)for(f=0;f<l;f++){k=d+f*j;for(g=0;g<l;g++)o[t*g+k]+=h}}};this.addPlaneY=function(b,e){var d,f,
+g,h,k,l,j=this.size,t=this.yd,o=this.zd,n=this.field,w=j*Math.sqrt(b/e);w>j&&(w=j);for(f=0;f<w;f++){d=f/j;d*=d;h=b/(1.0E-4+d)-e;if(h>0){k=f*t;for(d=0;d<j;d++){l=k+d;for(g=0;g<j;g++)n[o*g+l]+=h}}}};this.addPlaneZ=function(b,e){var d,f,g,h,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(g=0;g<dist;g++){d=g/size;d*=d;h=b/(1.0E-4+d)-e;if(h>0){k=zd*g;for(f=0;f<size;f++){l=k+f*yd;for(d=0;d<size;d++)field[l+d]+=h}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,d,f,g,h,k,l,j,t,o=this.size-2;for(g=1;g<o;g++){t=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++){j=t+this.size*f;k=(f-this.halfsize)/this.halfsize;for(d=1;d<o;d++){h=(d-this.halfsize)/this.halfsize;e=j+d;this.polygonize(h,k,l,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,d=[];this.render(function(f){var g,h,k,l,j,t,o,n;for(g=
+0;g<f.count;g++){o=g*3;j=o+1;n=o+2;h=f.positionArray[o];k=f.positionArray[j];l=f.positionArray[n];t=new THREE.Vector3(h,k,l);h=f.normalArray[o];k=f.normalArray[j];l=f.normalArray[n];o=new THREE.Vector3(h,k,l);o.normalize();j=new THREE.Vertex(t);e.vertices.push(j);d.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;j=o+1;n=o+2;t=d[o];h=d[j];k=d[n];o=new THREE.Face3(o,j,n,[t,h,k]);e.faces.push(o)}b+=nfaces;f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
 THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -163,18 +168,18 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,d){this.point=a;this.normal=d};THREE.SphereCollider=function(a,d){this.center=a;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(a,d){this.min=a;this.max=d;this.dynamic=!0};
-THREE.MeshCollider=function(a,d,b,e){this.vertices=a;this.faces=d;this.normals=b;this.box=e;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var d,b,e,c,f=0;d=0;for(b=this.colliders.length;d<b;d++){c=this.colliders[d];e=this.rayCast(a,c);if(e<Number.MAX_VALUE){c.distance=e;e>f?this.hits.push(c):this.hits.unshift(c);f=e}}return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var d=this.rayCastAll(a);if(d.length==0)return null;for(var b=0;d[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,d[b]);if(e<Number.MAX_VALUE){d[b].distance=e;break}b++}if(b>d.length)return null;return d[b]};
-THREE.CollisionSystem.prototype.rayCast=function(a,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(a,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(a,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(a,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(a,d.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,d){for(var b=this.makeRayLocal(a,d.mesh),e=Number.MAX_VALUE,c=0;c<d.numFaces/3;c++){var f=c*3;e=Math.min(e,this.rayTriangle(b,d.vertices[d.faces[f+0]],d.vertices[d.faces[f+1]],d.vertices[d.faces[f+2]],d.normals[d.faces[c]],e))}return e};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,d,b,e,c,f){var g=THREE.CollisionSystem.__v1,h=THREE.CollisionSystem.__v2;g.sub(b,d);h.sub(e,b);c.cross(g,h);h=c.dot(a.direction);if(!(h<0))return Number.MAX_VALUE;g=c.dot(d)-c.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=h*f))return Number.MAX_VALUE;g/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(g);h.addSelf(a.origin);if(Math.abs(c.x)>Math.abs(c.y))if(Math.abs(c.x)>Math.abs(c.z)){a=h.y-d.y;c=b.y-d.y;f=e.y-d.y;
-h=h.z-d.z;b=b.z-d.z;e=e.z-d.z}else{a=h.x-d.x;c=b.x-d.x;f=e.x-d.x;h=h.y-d.y;b=b.y-d.y;e=e.y-d.y}else if(Math.abs(c.y)>Math.abs(c.z)){a=h.x-d.x;c=b.x-d.x;f=e.x-d.x;h=h.z-d.z;b=b.z-d.z;e=e.z-d.z}else{a=h.x-d.x;c=b.x-d.x;f=e.x-d.x;h=h.y-d.y;b=b.y-d.y;e=e.y-d.y}d=c*e-b*f;if(d==0)return Number.MAX_VALUE;d=1/d;e=(a*e-h*f)*d;if(!(e>=0))return Number.MAX_VALUE;d*=c*h-b*a;if(!(d>=0))return Number.MAX_VALUE;if(!(1-e-d>=0))return Number.MAX_VALUE;return g};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,d){var b=new THREE.Ray(a.origin.clone(),a.direction.clone()),e=THREE.Matrix4.makeInvert(d.matrixWorld);e.multiplyVector3(b.origin);e.rotateAxis(b.direction);b.direction.normalize();return b};
-THREE.CollisionSystem.prototype.rayBox=function(a,d){var b;b=d.dynamic&&d.mesh&&d.mesh.matrixWorld?this.makeRayLocal(a,d.mesh):new THREE.Ray(a.origin.clone(),a.direction.clone());var e=0,c=0,f=0,g=0,h=0,j=0,l=!0;if(b.origin.x<d.min.x){e=d.min.x-b.origin.x;e/=b.direction.x;l=!1;g=-1}else if(b.origin.x>d.max.x){e=d.max.x-b.origin.x;e/=b.direction.x;l=!1;g=1}if(b.origin.y<d.min.y){c=d.min.y-b.origin.y;c/=b.direction.y;l=!1;h=-1}else if(b.origin.y>d.max.y){c=d.max.y-b.origin.y;c/=b.direction.y;l=!1;h=
-1}if(b.origin.z<d.min.z){f=d.min.z-b.origin.z;f/=b.direction.z;l=!1;j=-1}else if(b.origin.z>d.max.z){f=d.max.z-b.origin.z;f/=b.direction.z;l=!1;j=1}if(l)return-1;l=0;if(c>e){l=1;e=c}if(f>e){l=2;e=f}switch(l){case 0:h=b.origin.y+b.direction.y*e;if(h<d.min.y||h>d.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<d.min.z||b>d.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<d.min.x||g>d.max.x)return Number.MAX_VALUE;b=b.origin.z+
-b.direction.z*e;if(b<d.min.z||b>d.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,h,0);break;case 2:g=b.origin.x+b.direction.x*e;if(g<d.min.x||g>d.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*e;if(h<d.min.y||h>d.max.y)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,0,j)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,d){var b=a.direction.dot(d.normal),e=d.point.dot(d.normal);if(b<0)b=(e-a.origin.dot(d.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,d){var b=d.center.clone().subSelf(a.origin);if(b.lengthSq<d.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=d.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={};
-THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var d=a.geometry.boundingBox,b=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);b=new THREE.BoxCollider(b,d);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var d=THREE.CollisionUtils.MeshOBB(a);d.min.addSelf(a.position);d.max.addSelf(a.position);d.dynamic=!1;return d};
-THREE.CollisionUtils.MeshColliderWBox=function(a){for(var d=a.geometry.vertices,b=d.length,e=a.geometry.faces,c=e.length,f=[],g=[],h=[],j=0;j<b;j++)f.push(new THREE.Vector3(d[j].position.x,d[j].position.y,d[j].position.z));for(j=0;j<c;j++){g.push(e[j].a,e[j].b,e[j].c);h.push(new THREE.Vector3(e[j].normal.x,e[j].normal.y,e[j].normal.z))}d=new THREE.MeshCollider(f,g,h,THREE.CollisionUtils.MeshOBB(a));d.mesh=a;return d};
+2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,c,b,e){this.vertices=a;this.faces=c;this.normals=b;this.box=e;this.numFaces=this.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,d,f=0;c=0;for(b=this.colliders.length;c<b;c++){d=this.colliders[c];e=this.rayCast(a,d);if(e<Number.MAX_VALUE){d.distance=e;e>f?this.hits.push(d):this.hits.unshift(d);f=e}}return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e<Number.MAX_VALUE){c[b].distance=e;break}b++}if(b>c.length)return null;return c[b]};
+THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,d=0;d<c.numFaces/3;d++){var f=d*3;f=this.rayTriangle(b,c.vertices[c.faces[f+0]],c.vertices[c.faces[f+1]],c.vertices[c.faces[f+2]],e,this.collisionNormal);if(f<e){e=f;c.normal.copy(this.collisionNormal);c.normal.normalize()}}return e};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,d,f){var g=THREE.CollisionSystem.__v1,h=THREE.CollisionSystem.__v2;f.set(0,0,0);g.sub(b,c);h.sub(e,b);f.cross(g,h);h=f.dot(a.direction);if(!(h<0))return Number.MAX_VALUE;g=f.dot(c)-f.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=h*d))return Number.MAX_VALUE;g/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(g);h.addSelf(a.origin);if(Math.abs(f.x)>Math.abs(f.y))if(Math.abs(f.x)>Math.abs(f.z)){a=h.y-c.y;f=b.y-
+c.y;d=e.y-c.y;h=h.z-c.z;b=b.z-c.z;e=e.z-c.z}else{a=h.x-c.x;f=b.x-c.x;d=e.x-c.x;h=h.y-c.y;b=b.y-c.y;e=e.y-c.y}else if(Math.abs(f.y)>Math.abs(f.z)){a=h.x-c.x;f=b.x-c.x;d=e.x-c.x;h=h.z-c.z;b=b.z-c.z;e=e.z-c.z}else{a=h.x-c.x;f=b.x-c.x;d=e.x-c.x;h=h.y-c.y;b=b.y-c.y;e=e.y-c.y}c=f*e-b*d;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-h*d)*c;if(!(e>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return g};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;if(c.dynamic&&c.mesh&&c.mesh.matrixWorld)b=this.makeRayLocal(a,c.mesh);else{b=THREE.CollisionSystem.__r;b.origin.copy(a.origin);b.direction.copy(a.direction)}var e=0,d=0,f=0,g=0,h=0,k=0,l=!0;if(b.origin.x<c.min.x){e=c.min.x-b.origin.x;e/=b.direction.x;l=!1;g=-1}else if(b.origin.x>c.max.x){e=c.max.x-b.origin.x;e/=b.direction.x;l=!1;g=1}if(b.origin.y<c.min.y){d=c.min.y-b.origin.y;d/=b.direction.y;l=!1;h=-1}else if(b.origin.y>c.max.y){d=c.max.y-
+b.origin.y;d/=b.direction.y;l=!1;h=1}if(b.origin.z<c.min.z){f=c.min.z-b.origin.z;f/=b.direction.z;l=!1;k=-1}else if(b.origin.z>c.max.z){f=c.max.z-b.origin.z;f/=b.direction.z;l=!1;k=1}if(l)return-1;l=0;if(d>e){l=1;e=d}if(f>e){l=2;e=f}switch(l){case 0:h=b.origin.y+b.direction.y*e;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;
+b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*e;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,k)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]);c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]);b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
+THREE.CollisionUtils.MeshColliderWBox=function(a){for(var c=a.geometry.vertices,b=c.length,e=a.geometry.faces,d=e.length,f=[],g=[],h=[],k=0;k<b;k++)f.push(new THREE.Vector3(c[k].position.x,c[k].position.y,c[k].position.z));for(k=0;k<d;k++){g.push(e[k].a,e[k].b,e[k].c);h.push(new THREE.Vector3(e[k].normal.x,e[k].normal.y,e[k].normal.z))}c=new THREE.MeshCollider(f,g,h,THREE.CollisionUtils.MeshOBB(a));c.mesh=a;return c};

+ 13 - 12
build/custom/ThreeSVG.js

@@ -31,20 +31,21 @@ this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,i=a.z,g=e*h,j=e*f;this.set(g*
-h+c,g*f-d*i,g*i+d*f,0,g*f+d*i,j*f+c,j*i-d*h,0,g*i-d*f,j*i+d*h,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,i=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=i*h+a*d;this.n22=-i*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,i=d+d;a=b*h;var g=b*f;b*=i;var j=c*f;c*=i;d*=i;h*=e;f*=e;e*=i;this.n11=1-(j+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+h+c,g*f-d*i,g*i+d*f,0,g*f+d*i,j*f+c,j*i-d*h,0,g*i-d*f,j*i+d*h,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,i=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=i*h+a*d;this.n22=-i*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,i=d+d;a=b*h;var g=b*f;b*=i;var j=c*f;c*=i;d*=i;h*=e;f*=e;e*=i;this.n11=1-(j+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,i=a.n22,g=a.n23,j=a.n24,m=a.n31,k=a.n32,n=a.n33,l=a.n34,r=a.n41,s=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*l*s-j*n*s+j*k*y-i*l*y-g*k*u+i*n*u;b.n12=h*n*s-e*l*s-h*k*y+d*l*y+e*k*u-d*n*u;b.n13=e*j*s-h*g*s+h*i*y-d*j*y-e*i*u+d*g*u;b.n14=h*g*k-e*j*k-h*i*n+d*j*n+e*i*l-d*g*l;b.n21=j*n*r-g*l*r-j*m*y+f*l*y+g*m*u-f*n*u;b.n22=e*l*r-h*n*r+h*m*y-c*l*y-e*m*u+c*n*u;b.n23=h*g*r-e*j*r-h*f*y+c*j*y+e*f*u-c*g*u;
 b.n24=e*j*m-h*g*m+h*f*n-c*j*n-e*f*l+c*g*l;b.n31=i*l*r-j*k*r+j*m*s-f*l*s-i*m*u+f*k*u;b.n32=h*k*r-d*l*r-h*m*s+c*l*s+d*m*u-c*k*u;b.n33=e*j*r-h*i*r+h*f*s-c*j*s-d*f*u+c*i*u;b.n34=h*i*m-d*j*m-h*f*k+c*j*k+d*f*l-c*i*l;b.n41=g*k*r-i*n*r-g*m*s+f*n*s+i*m*y-f*k*y;b.n42=d*n*r-e*k*r+e*m*s-c*n*s-d*m*y+c*k*y;b.n43=e*i*r-d*g*r-e*f*s+c*g*s+d*f*y-c*i*y;b.n44=d*g*m-e*i*m+e*f*k-c*g*k-d*f*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*i;c[5]=a*g;c[6]=a*j;c[7]=a*m;c[8]=a*k;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+e)/(h-e);f.n34=-2*h*e/(h-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,h){var f,i,g,j;f=new THREE.Matrix4;i=b-a;g=c-d;j=h-e;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((h+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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=
-!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
+-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
+this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);
+this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);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},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);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},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,i=this.z,g=this.w,j=g*c+f*e-i*d,m=
@@ -67,9 +68,9 @@ this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];h=f.vertexIndice
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
-THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0;this.castShadow=d!==undefined?d:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};
+THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;
+THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==undefined?a.linewidth:1;this.linecap=a.linecap!==undefined?a.linecap:"round";this.linejoin=a.linejoin!==undefined?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
 THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
 a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
@@ -94,7 +95,7 @@ THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.is
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;

+ 19 - 18
build/custom/ThreeWebGL.js

@@ -31,20 +31,21 @@ this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,
 0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),g=Math.sin(d),h=
-1-e,o=b.x,n=b.y,p=b.z,q=h*o,v=h*n;this.set(q*o+e,q*n-g*p,q*p+g*n,0,q*n+g*p,v*n+e,v*p-g*o,0,q*p-g*n,v*p+g*o,h*p*p+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,g=b.z;b=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var o=Math.cos(g);g=Math.sin(g);var n=b*e,p=d*e;this.n11=h*o;this.n12=-h*g;this.n13=e;this.n21=p*o+b*g;this.n22=-p*g+b*o;this.n23=-d*h;this.n31=-n*o+d*g;this.n32=n*g+d*o;this.n33=
-b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,g=b.z,h=b.w,o=d+d,n=e+e,p=g+g;b=d*o;var q=d*n;d*=p;var v=e*n;e*=p;g*=p;o*=h;n*=h;h*=p;this.n11=1-(v+g);this.n12=q-h;this.n13=d+n;this.n21=q+h;this.n22=1-(b+g);this.n23=e-o;this.n31=d-n;this.n32=e+o;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,g=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*g;this.n22=b.n22*g;this.n32=b.n32*g;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
+1-e,o=b.x,n=b.y,p=b.z,q=h*o,v=h*n;this.set(q*o+e,q*n-g*p,q*p+g*n,0,q*n+g*p,v*n+e,v*p-g*o,0,q*p-g*n,v*p+g*o,h*p*p+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=
+new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,g=b.z;b=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var o=Math.cos(g);g=Math.sin(g);var n=b*e,p=d*e;this.n11=h*o;this.n12=-h*g;this.n13=e;this.n21=p*o+b*g;this.n22=-p*g+b*o;this.n23=-d*h;this.n31=-n*o+d*g;this.n32=n*g+
+d*o;this.n33=b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,g=b.z,h=b.w,o=d+d,n=e+e,p=g+g;b=d*o;var q=d*n;d*=p;var v=e*n;e*=p;g*=p;o*=h;n*=h;h*=p;this.n11=1-(v+g);this.n12=q-h;this.n13=d+n;this.n21=q+h;this.n22=1-(b+g);this.n23=e-o;this.n31=d-n;this.n32=e+o;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},
+extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,g=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*g;this.n22=b.n22*g;this.n32=b.n32*g;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
 THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,g=b.n12,h=b.n13,o=b.n14,n=b.n21,p=b.n22,q=b.n23,v=b.n24,E=b.n31,F=b.n32,H=b.n33,I=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=q*I*N-v*H*N+v*F*U-p*I*U-q*F*L+p*H*L;d.n12=o*H*N-h*I*N-o*F*U+g*I*U+h*F*L-g*H*L;d.n13=h*v*N-o*q*N+o*p*U-g*v*U-h*p*L+g*q*L;d.n14=o*q*F-h*v*F-o*p*H+g*v*H+h*p*I-g*q*I;d.n21=v*H*M-q*I*M-v*E*U+n*I*U+q*E*L-n*H*L;d.n22=h*I*M-o*H*M+o*E*U-e*I*U-h*E*L+e*H*L;d.n23=o*q*M-h*v*M-o*n*U+e*v*U+h*n*L-e*q*L;
 d.n24=h*v*E-o*q*E+o*n*H-e*v*H-h*n*I+e*q*I;d.n31=p*I*M-v*F*M+v*E*N-n*I*N-p*E*L+n*F*L;d.n32=o*F*M-g*I*M-o*E*N+e*I*N+g*E*L-e*F*L;d.n33=h*v*M-o*p*M+o*n*N-e*v*N-g*n*L+e*p*L;d.n34=o*p*E-g*v*E-o*n*F+e*v*F+g*n*I-e*p*I;d.n41=q*F*M-p*H*M-q*E*N+n*H*N+p*E*U-n*F*U;d.n42=g*H*M-h*F*M+h*E*N-e*H*N-g*E*U+e*F*U;d.n43=h*p*M-g*q*M-h*n*N+e*q*N+g*n*U-e*p*U;d.n44=g*q*E-h*p*E+h*n*F-e*q*F-g*n*H+e*p*H;d.multiplyScalar(1/b.determinant());return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,g=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,o=b.n32*b.n21-b.n31*b.n22,n=-b.n33*b.n12+b.n32*b.n13,p=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*g+b.n21*n+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*g;e[1]=b*h;e[2]=b*o;e[3]=b*n;e[4]=b*p;e[5]=b*q;e[6]=b*v;e[7]=b*E;e[8]=b*F;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,g,h,o){var n;n=new THREE.Matrix4;n.n11=2*h/(d-b);n.n12=0;n.n13=(d+b)/(d-b);n.n14=0;n.n21=0;n.n22=2*h/(g-e);n.n23=(g+e)/(g-e);n.n24=0;n.n31=0;n.n32=0;n.n33=-(o+h)/(o-h);n.n34=-2*o*h/(o-h);n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(b,d,e,g){var h;b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,g)};
 THREE.Matrix4.makeOrtho=function(b,d,e,g,h,o){var n,p,q,v;n=new THREE.Matrix4;p=d-b;q=e-g;v=o-h;n.n11=2/p;n.n12=0;n.n13=0;n.n14=-((d+b)/p);n.n21=0;n.n22=2/q;n.n23=0;n.n24=-((e+g)/q);n.n31=0;n.n32=0;n.n33=-2/v;n.n34=-((o+h)/v);n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};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=
-!0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
-undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var g=this.children.length;b<g;b++)this.children[b].update(this.matrixWorld,
-d,e)}};THREE.Quaternion=function(b,d,e,g){this.set(b||0,d||0,e||0,g!==undefined?g:1)};
+!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
+-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},getChildByName:function(b,d){var e,g,h;e=0;for(g=this.children.length;e<g;e++){h=this.children[e];if(h.name===b)return h;if(d){h=h.getChildByName(b,d);if(h!==undefined)return h}}},updateMatrix:function(){this.matrix.setPosition(this.position);
+this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);
+this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var g=this.children.length;b<g;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,g){this.set(b||0,d||0,e||0,g!==undefined?g:1)};
 THREE.Quaternion.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;this.w=g;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,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},setFromAxisAngle:function(b,d){var e=d/2,g=Math.sin(e);this.x=b.x*g;this.y=
 b.y*g;this.z=b.z*g;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);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},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,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=
@@ -68,8 +69,8 @@ THREE.Camera=function(b,d,e,g,h){THREE.Object3D.call(this);this.fov=b||50;this.a
 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.update=function(b,d,e){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=e||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=e||0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,e,g){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,e,g)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,e,g){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=e||0;this.castShadow=g!==undefined?g:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=e||0};
+THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,e,g){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,e,g)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
 THREE.LensFlare.prototype.add=function(b,d,e,g){d===undefined&&(d=-1);e===undefined&&(e=0);if(g===undefined)g=THREE.BillboardBlending;e=Math.min(e,Math.max(0,e));this.lensFlares.push({texture:b,size:d,distance:e,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:g})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var b,d=this.lensFlares.length,e,g=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(b=0;b<d;b++){e=this.lensFlares[b];e.x=this.positionScreen.x+g*e.distance;e.y=this.positionScreen.y+h*e.distance;e.wantedRotation=e.x*Math.PI*0.25;e.rotation+=(e.wantedRotation-e.rotation)*0.25}};
 THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
@@ -123,7 +124,7 @@ n){v="d";H=L[o]+3}if(g.a===p){v+="a";I=L[o]+0}else if(g.b===p){v+="b";I=L[o]+1}e
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,g=this.geometry.edgeFaces,h=b.faces;b=b.vertices;var o=h.length,n,p,q,v,E,F=["a","b","c","d"];for(q=0;q<o;q++){p=d.length;n=h[q];if(n instanceof THREE.Face4){v=4;p=new THREE.Face4(p,p+1,p+2,p+3)}else{v=3;p=new THREE.Face3(p,p+1,p+2)}p.normal.copy(n.normal);e.push(p);
 for(p=0;p<v;p++){E=b[n[F[p]]];d.push(new THREE.Vertex(E.position.clone()))}}for(o=0;o<h.length-1;o++){b=e[o];for(n=o+1;n<h.length;n++){p=e[n];p=this.facesShareEdge(d,b,p);if(p!==undefined){p=new THREE.Face4(p.indices[0],p.indices[3],p.indices[2],p.indices[1]);p.normal.set(1,0,0);g.push(p)}}}};
 THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var g,h,o,n,p,q,v,E,F,H,I,M,N,U=0,L=["a","b","c","d"];g=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(M=0;M<g;M++){o=d[L[M]];p=b[o];for(N=0;N<h;N++){n=e[L[N]];q=b[n];if(Math.abs(p.position.x-q.position.x)<1.0E-4&&Math.abs(p.position.y-q.position.y)<1.0E-4&&Math.abs(p.position.z-q.position.z)<1.0E-4){U++;if(U===1){v=p;E=q;F=o;H=n;I=L[M]}if(U===2){I+=L[M];return I==="ad"||I==="ac"?{faces:[d,e],vertices:[v,E,q,p],indices:[F,
-H,n,o],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,p,q,E],indices:[F,o,n,H],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+H,n,o],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,p,q,E],indices:[F,o,n,H],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else 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,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
@@ -193,7 +194,7 @@ c.vertexAttribPointer(r.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIAN
 f.n14);aa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);aa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);aa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);aa[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=aa[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=aa[k].x*r.n14+aa[k].y*r.n24+aa[k].z*
 r.n34+aa[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||V.initMaterial(u,m,undefined,k);u=u.program;A=u.uniforms;t=u.attributes;if(sa!==u){c.useProgram(u);sa=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,
+THREE.DirectionalLight&&k.castShadow){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||V.initMaterial(u,m,undefined,k);u=u.program;A=u.uniforms;t=u.attributes;if(sa!==u){c.useProgram(u);sa=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);ha="";sa=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(Y)}function M(f,r){var j,k,m;j=_sprite.attributes;var w=_sprite.uniforms,x=Aa/za,u,A=[],t=za*0.5,y=Aa*0.5,z=!0;c.useProgram(_sprite.program);sa=_sprite.program;ha="";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,
@@ -256,12 +257,12 @@ c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J
 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,r){ga.width=f;ga.height=r;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(f,r,j,k){va=f;qa=r;za=j;Aa=k;c.viewport(va,qa,za,Aa)};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){Y=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=xa.length;D<w;D++)if(xa[D].code==x){z=xa[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.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Y=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.getContext=function(){return c};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=xa.length;D<w;D++)if(xa[D].code==x){z=xa[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 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)}xa.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);

+ 34 - 37
examples/js/Detector.js

@@ -1,62 +1,59 @@
 /**
  * @author alteredq / http://alteredqualia.com/
+ * @author mr.doob / http://mrdoob.com/
  */
 
 Detector = {
 
-	// supported features
-
-	canvas	: !!window.CanvasRenderingContext2D,
-	webgl	: !!window.WebGLRenderingContext,
-	workers : !!window.Worker,
+	canvas : !! window.CanvasRenderingContext2D,
+	webgl : ( function () { try { return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); } catch( e ) { return false; } } )(),
+	workers : !! window.Worker,
 	fileapi : window.File && window.FileReader && window.FileList && window.Blob,
 
-	// helper methods
+	getWebGLErrorMessage : function () {
 
-	addGetWebGLMessage: function( parameters ) {
+		var domElement = document.createElement( 'div' );
 
-		var parent = document.body,
-			id = "oldie" ;
+		domElement.style.fontFamily = 'monospace';
+		domElement.style.fontSize = '13px';
+		domElement.style.textAlign = 'center';
+		domElement.style.background = '#eee';
+		domElement.style.color = '#000';
+		domElement.style.padding = '1em';
+		domElement.style.width = '475px';
+		domElement.style.margin = '5em auto 0';
 
-		if ( parameters ) {
+		if ( ! this.webgl ) {
 
-			if ( parameters.parent !== undefined ) parent  = parameters.parent;
-			if ( parameters.id !== undefined ) id  = parameters.id;
+			domElement.innerHTML = window.WebGLRenderingContext ? [
+				'Sorry, your graphics card doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a>'
+			].join( '\n' ) : [
+				'Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>',
+				'Please try with',
+				'<a href="http://www.google.com/chrome">Chrome</a>, ',
+				'<a href="http://www.mozilla.com/en-US/firefox/new/">Firefox 4</a> or',
+				'<a href="http://nightly.webkit.org/">Webkit Nightly (Mac)</a>'
+			].join( '\n' );
 
 		}
 
-		var html = [
-
-			'Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>',
-			'<br/>',
-			'Please try with',
-			'<a href="http://www.google.com/chrome">Chrome 9+</a> /',
-			'<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /',
-			'<a href="http://nightly.webkit.org/">Safari 10.6+</a>'
+		return domElement;
 
-		].join("\n");
+	},
 
-		var wrap = document.createElement( "center" ),
-			message = document.createElement( "div" );
+	addGetWebGLMessage : function ( parameters ) {
 
-		message.innerHTML = html;
-		message.id = id;
+		var parent, id, domElement;
 
-		var style = message.style;
+		parameters = parameters || {};
 
-		style.fontFamily = "monospace";
-		style.fontSize = "13px";
-		style.textAlign = "center";
-		style.background = "#eee";
-		style.color = "#000";
-		style.padding = "1em";
-		style.width = "475px";
-		style.margin = "5em auto 0";
+		parent = parameters.parent !== undefined ? parameters.parent : document.body;
+		id = parameters.id !== undefined ? parameters.id : 'oldie';
 
-		wrap.appendChild( message )
-		parent.appendChild( wrap );
+		domElement = Detector.getWebGLErrorMessage();
+		domElement.id = id;
 
-		return message;
+		parent.appendChild( domElement );
 
 	}
 

+ 29 - 87
examples/misc_rollCamera.html

@@ -1,7 +1,7 @@
 <!DOCTYPE HTML>
 <html lang="en">
 	<head>
-		<title>three.js - webgl - roll camera example</title>
+		<title>three.js webgl - roll camera</title>
 		<meta charset="utf-8">
 		<style type="text/css">
 		    body {
@@ -32,10 +32,12 @@
 	<body>
 		<div id="container"></div>
 		<div id="info">
-			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - roll camera example -</br>W/S forward/backward</br>A/D to roll</br>Mouse to look around 
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - roll camera example</br>
+			WASD move, RF up/down, QE roll,	mouse look around 
 		</div>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
+		
 		<script type="text/javascript" src="js/Stats.js"></script>
 
 		<script type="text/javascript">
@@ -48,17 +50,6 @@
 
 			var cross;
 
-			var mouseX = 0, mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var doRoll = false, rollDirection = 1, forwardSpeed = 0;
-
-			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-			document.addEventListener( 'keydown', onKeyDown, false );
-			document.addEventListener( 'keyup', onKeyUp, false );
-
 			init();
 
 			function init() {
@@ -66,27 +57,34 @@
 				// scene and camera
 
 				scene = new THREE.Scene();
+				scene.fog = new THREE.FogExp2( 0xffffff, 0.002 );
+				
 				camera = new THREE.RollCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
-
+				camera.movementSpeed = 100;
+				camera.lookSpeed = 3;
+				camera.constrainVertical = [ -0.5, 0.5 ];
+				//camera.autoForward = true;
 
 				// world
 
 				var cube = new THREE.Cube( 20, 60, 20 );
 				
-				cube.vertices[ 0 ].position.multiplyScalar( 0.1 );
-				cube.vertices[ 1 ].position.multiplyScalar( 0.1 );
-				cube.vertices[ 4 ].position.multiplyScalar( 0.1 );
-				cube.vertices[ 5 ].position.multiplyScalar( 0.1 );
+				cube.vertices[ 0 ].position.multiplyScalar( 0.01 );
+				cube.vertices[ 1 ].position.multiplyScalar( 0.01 );
+				cube.vertices[ 4 ].position.multiplyScalar( 0.01 );
+				cube.vertices[ 5 ].position.multiplyScalar( 0.01 );
 				
-				var material = new THREE.MeshPhongMaterial( { color:0xffffff } );
+				var material =  new THREE.MeshLambertMaterial( { color:0xffffff } );
 
-				for( var i = 0; i < 200; i++ ) {
+				for( var i = 0; i < 500; i++ ) {
 					
 					var mesh = new THREE.Mesh( cube, material );
 					mesh.position.set(( Math.random() - 0.5 ) * 1000,
 									  ( Math.random() - 0.5 ) * 1000,
 									  ( Math.random() - 0.5 ) * 1000 );
 									  
+					mesh.updateMatrix();
+					mesh.matrixAutoUpdate = false;
 					scene.addChild( mesh );
 					
 				}
@@ -94,6 +92,7 @@
 
 				// create cross
 
+				/*
 				cross = new THREE.Object3D();
 				cross.scale.set( 0.5, 0.5, 0.5 );
 				cross.matrixAutoUpdate = false;
@@ -111,23 +110,26 @@
 				var material = new THREE.MeshPhongMaterial( { color:0x0000ff } );
 				var mesh = new THREE.Mesh( new THREE.Cube( 5, 5, 40 ), material );
 				mesh.position.z = 20;
+				
 				cross.addChild( mesh );
+				camera.addChild( cross );
+
+				*/
 				
-				//camera.addChild( cross );
 				scene.addChild( camera );
 
 
 				// lights				
 
-				light = new THREE.DirectionalLight( 0xfffff );
+				light = new THREE.DirectionalLight( 0xffffff );
 				light.position.set( 1, 1, 1 );
 				scene.addChild( light );
 
-				light = new THREE.DirectionalLight( 0xff0000 );
+				light = new THREE.DirectionalLight( 0x002288 );
 				light.position.set( -1, -1, -1 );
 				scene.addChild( light );
 
-				light = new THREE.AmbientLight( 0x666666 );
+				light = new THREE.AmbientLight( 0x222222 );
 				scene.addChild( light );
 
 
@@ -151,25 +153,19 @@
 				}
 
 				setInterval( loop, 1000 / 60 );
+
 			}
 
 
 			function loop() {
 
-				camera.rotateHorizontally( mouseX * 0.05 );
-				camera.rotateVertically( mouseY * 0.05 );
-				camera.translateZ( forwardSpeed )
-
-				if( doRoll ) {
-					
-					camera.roll += 0.01 * rollDirection;
-				}
-
+				/*
 				cross.matrix.copy( camera.matrix );
 				cross.matrix.n14 = 0;
 				cross.matrix.n24 = 0;
 				cross.matrix.n34 = -200;
 				cross.matrixWorldNeedsUpdate = true;
+				*/
 
 				renderer.render( scene, camera );
 
@@ -178,60 +174,6 @@
 			}
 
 
-			function onKeyDown( event ) {
-		
-				switch( event.keyCode ) {
-		
-					case 38: /*up*/
-					case 87: /*W*/ forwardSpeed = 1; break;
-		
-					case 37: /*left*/
-					case 65: /*A*/ doRoll = true; rollDirection = 1; break;
-		
-					case 40: /*down*/
-					case 83: /*S*/ forwardSpeed = -1; break;
-		
-					case 39: /*right*/
-					case 68: /*D*/ doRoll = true; rollDirection = -1; break;
-		
-				}
-		
-			}
-		
-			function onKeyUp( event ) {
-		
-				switch( event.keyCode ) {
-		
-					case 38: /*up*/
-					case 87: /*W*/ forwardSpeed = 0; break;
-		
-					case 37: /*left*/
-					case 65: /*A*/ doRoll = false; break;
-		
-					case 40: /*down*/
-					case 83: /*S*/ forwardSpeed = 0; break;
-		
-					case 39: /*right*/
-					case 68: /*D*/ doRoll = false; break;
-		
-				}
-		
-			}
-
-			function onDocumentMouseMove(event) {
-
-				mouseX = ( event.clientX - windowHalfX ) / window.innerWidth;
-				mouseY = ( event.clientY - windowHalfY ) / window.innerHeight;
-
-			}
-
-
-			function log( text ) {
-
-				var e = document.getElementById("log");
-				e.innerHTML = text + "<br/>" + e.innerHTML;
-
-			}
 		</script>
 
 	</body>

+ 227 - 0
examples/webgl_collisions_normal.html

@@ -0,0 +1,227 @@
+
+<html> 
+ 
+<head> 
+<title>three.js webgl - intersection: ray/mesh readinf normal</title> 
+<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
+<style type="text/css"> 
+
+body {
+	font-family: Monospace;
+	background-color: #f0f0f0;
+	margin: 0px;
+	overflow: hidden;
+}
+ 
+#oldie { background-color: #ddd !important }
+
+#info {
+	position: absolute;
+	top: 30px; left: 10px; width: 800px;
+	color: #000000;
+	padding: 5px;
+	font-family: Monospace;
+	font-size: 13px;
+	text-align: left;
+	z-index:100;
+}
+
+#options {
+	position: absolute;
+	top: 10px; left: 10px; width: 800px;
+	color: #000000;
+	padding: 5px;
+	font-family: Monospace;
+	font-size: 13px;
+	text-align: left;
+	z-index:100;
+}
+
+</style>
+ 
+<script type="text/javascript" src="../build/Three.js"></script> 
+<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+<script type="text/javascript" src="js/Stats.js"></script>
+
+<script type="text/javascript"> 
+
+var scene, camera, renderer, info, mouse2d, sun, loader, stats, line;
+var meshes = [];
+
+var theta = 0;
+var camdist = 500;
+
+var totalFaces = 0;
+var totalColliders = 0;
+
+var ray = new THREE.Ray();
+var matrix = new THREE.Matrix4(),
+	matrix2 = new THREE.Matrix4();
+
+function init() {
+
+	container = document.createElement( 'div' );
+	document.body.appendChild( container );
+	
+	info = document.getElementById("info");
+	
+	camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
+	camera.position.z = camdist;
+	mouse2d = new THREE.Vector3( 0, 0, 1 );
+	
+	loader = new THREE.JSONLoader(  );
+
+	scene = new THREE.Scene();
+
+	renderer = new THREE.WebGLRenderer();
+	renderer.setSize( window.innerWidth, window.innerHeight );
+	container.appendChild( renderer.domElement );
+	
+	var ambientLight = new THREE.AmbientLight( 0x606060 );
+	scene.addLight( ambientLight );
+
+	sun = new THREE.DirectionalLight( 0xffffff );
+	sun.position = camera.position.clone();
+	scene.addLight( sun );
+	
+	loadCube();
+	
+	var lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, opacity: 1, linewidth: 3 } );
+	
+	var geom = new THREE.Geometry();
+	geom.vertices.push( new THREE.Vertex( new THREE.Vector3(-100, 0, 0) ) );
+	geom.vertices.push( new THREE.Vertex( new THREE.Vector3( 100, 0, 0) ) );
+	
+	line = new THREE.Line(geom, lineMat);
+	scene.addObject( line );
+
+	stats = new Stats();
+	stats.domElement.style.position = 'absolute';
+	stats.domElement.style.top = '0px';
+	container.appendChild( stats.domElement );
+
+	container.onmousemove = onDocumentMouseMove;
+	animate();
+
+}
+
+function loadCube(p) {
+
+	var onGeometry = function( geometry ) {	
+	
+		var sx = 300;
+		var sy = 240;
+		var sz = 300;
+		
+		addCube( new THREE.Vector3(	0,	0,	0), geometry );
+		
+	};
+
+	
+	loader.load( { model: "obj/suzanne/suzanneHi.js", callback: onGeometry } );
+}
+
+function addCube( p, g) {
+
+	totalFaces += g.faces.length;
+	totalColliders++;
+
+	var mesh = new THREE.Mesh( g, new THREE.MeshLambertMaterial( { color: 0x003300 } ) );
+	mesh.position = p;
+
+	scene.addObject( mesh );
+	var mc = THREE.CollisionUtils.MeshColliderWBox(mesh);
+	THREE.Collisions.colliders.push( mc );
+	meshes.push( mesh );
+
+};
+
+function onDocumentMouseMove( event ) {
+
+	event.preventDefault();	
+	mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
+	mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
+	mouse2d.z = 1;
+
+};
+
+
+function animate() {
+
+	requestAnimationFrame( animate );
+	
+	ray.origin.copy( mouse2d );
+
+	matrix.copy( camera.matrixWorld );
+	matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix, matrix2 ) );
+	matrix.multiplyVector3( ray.origin );
+	
+	ray.direction.copy( ray.origin );
+	ray.direction.subSelf( camera.position );
+	
+	//var ray2 = new THREE.Ray();
+	//ray2.origin = ray.origin.clone();
+	
+	if( meshes.length == 0 ) return;
+	
+	var i, l = meshes.length;
+	
+	for ( i = 0; i < l; i++ ) {
+		meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
+	}
+	
+	info.innerHTML = "";
+
+
+	var c = THREE.Collisions.rayCastNearest( ray );
+	
+	if( c ) {
+	
+		info.innerHTML += "Found @ normal " + vts(c.normal);
+		
+		var poi = ray.origin.clone().addSelf( ray.direction.clone().multiplyScalar(c.distance) );
+		line.geometry.vertices[0].position = poi;
+		line.geometry.vertices[1].position = poi.clone().addSelf(c.normal.multiplyScalar(100));
+		line.geometry.__dirtyVertices = true; 
+		line.geometry.__dirtyElements = true;
+		
+		c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
+
+	} else {
+	
+		info.innerHTML += "No intersection";
+
+	}
+
+	camera.position.x = camdist * Math.cos( theta );
+	camera.position.z = camdist * Math.sin( theta );
+	camera.position.y = camdist/2 * Math.sin( theta * 2) ;
+
+	sun.position.copy( camera.position );
+	sun.position.normalize();
+
+	theta += 0.005;		
+
+	renderer.render( scene, camera );
+	
+	stats.update();
+	
+};
+
+function vts(v) {
+
+	if(!v) return "undefined<br>";
+	else return v.x.toFixed(2) + " , " + v.y.toFixed(2) + " , " + v.z.toFixed(2) + "<br>";
+
+};
+
+</script>
+
+</head> 
+
+<body onload="init();"> 
+<div id="info"></div>
+<div id="options"></div>
+</body> 
+
+</html> 

+ 10 - 6
examples/webgl_scene_test.html

@@ -241,11 +241,11 @@
 
 				$( "start" ).addEventListener( 'click', onStartClick, false );
 
-				var callback_progress = function( progress, result ) {
+				var callbackProgress = function( progress, result ) {
 
 					var bar = 250,
-						total = progress.total_models + progress.total_textures,
-						loaded = progress.loaded_models + progress.loaded_textures;
+						total = progress.totalModels + progress.totalTextures,
+						loaded = progress.loadedModels + progress.loadedTextures;
 
 					if ( total )
 						bar = Math.floor( bar * loaded / total );
@@ -259,7 +259,7 @@
 
 				}
 
-				var callback_sync = function( result ) {
+				var callbackSync = function( result ) {
 
 					/*
 
@@ -279,7 +279,7 @@
 
 				}
 
-				var callback_async = function( result ) {
+				var callbackFinished = function( result ) {
 
 					loaded = result;
 
@@ -306,7 +306,11 @@
 				$( "progress" ).style.display = "block";
 
 				var loader = new THREE.SceneLoader();
-				loader.load( "scenes/test_scene.js", callback_sync, callback_async, callback_progress );
+				
+				loader.callbackSync = callbackSync;
+				loader.callbackProgress = callbackProgress;
+				
+				loader.load( "scenes/test_scene.js", callbackFinished );
 
 				$( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false );
 

+ 5 - 23
examples/webgl_scene_test_blender.html

@@ -241,7 +241,7 @@
 
 				$( "start" ).addEventListener( 'click', onStartClick, false );
 
-				var callback_progress = function( progress, result ) {
+				var callbackProgress = function( progress, result ) {
 
 					var bar = 250,
 						total = progress.total_models + progress.total_textures,
@@ -259,27 +259,7 @@
 
 				}
 
-				var callback_sync = function( result ) {
-
-					/*
-
-					// uncomment to see progressive scene loading
-
-					scene = result.scene;
-					camera = result.currentCamera;
-
-					camera.aspect = window.innerWidth / window.innerHeight;
-					camera.updateProjectionMatrix();
-
-					renderer.setClearColor( result.bgColor, result.bgAlpha );
-
-					*/
-
-					//handle_update( result, 1 );
-
-				}
-
-				var callback_async = function( result ) {
+				var callbackFinished = function( result ) {
 
 					loaded = result;
 
@@ -295,7 +275,9 @@
 				$( "progress" ).style.display = "block";
 
 				var loader = new THREE.SceneLoader();
-				loader.load( "obj/blenderscene/scene.js", callback_sync, callback_async, callback_progress );
+				loader.callbackProgress = callbackProgress;
+				
+				loader.load( "obj/blenderscene/scene.js", callbackFinished );
 
 				$( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false );
 

+ 4 - 1
src/extras/cameras/FlyCamera.js

@@ -59,7 +59,7 @@ THREE.FlyCamera = function ( parameters ) {
 	this.moveVector = new THREE.Vector3( 0, 0, 0 );
 	this.rotationVector = new THREE.Vector3( 0, 0, 0 );
 
-	this.lastUpdate = new Date().getTime();
+	this.lastUpdate = -1;
 	this.tdiff = 0;
 
 	this.handleEvent = function ( event ) {
@@ -208,6 +208,9 @@ THREE.FlyCamera = function ( parameters ) {
 	this.update = function( parentMatrixWorld, forceUpdate, camera ) {
 
 		var now = new Date().getTime();
+		
+		if ( this.lastUpdate == -1 ) this.lastUpdate = now;
+		
 		this.tdiff = ( now - this.lastUpdate ) / 1000;
 		this.lastUpdate = now;
 

+ 1 - 1
src/extras/cameras/PathCamera.js

@@ -270,7 +270,7 @@ THREE.PathCamera = function ( parameters ) {
 		parent.addChild( particleObj );
 
 		var waypoint,
-			geo = new Sphere( 1, 16, 8 ),
+			geo = new THREE.Sphere( 1, 16, 8 ),
 			mat = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
 
 		for ( i = 0; i < spline.points.length; i++ ) {

+ 1 - 0
src/extras/cameras/QuakeCamera.js

@@ -240,6 +240,7 @@ THREE.QuakeCamera = function ( parameters ) {
 			targetPosition.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
 			targetPosition.y = position.y + 100 * Math.cos( this.phi );
 			targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
+
 		}
 
 		this.lon += this.mouseX * actualLookSpeed;

+ 164 - 13
src/extras/cameras/RollCamera.js

@@ -1,19 +1,19 @@
 /**
  * @author mikael emtinger / http://gomo.se/
+ * @author alteredq / http://alteredqualia.com/
  *
  * parameters = {
  *  fov: <float>,
  *  aspect: <float>,
  *  near: <float>,
  *  far: <float>,
- *  target: <THREE.Object3D>,
 
  *  movementSpeed: <float>,
  *  lookSpeed: <float>,
  *  rollSpeed: <float>,
 
  *  autoForward: <bool>,
-
+ * 	mouseLook: <bool>,
 
  *  domElement: <HTMLElement>,
  * }
@@ -23,31 +23,87 @@ THREE.RollCamera = function ( fov, aspect, near, far ) {
 
 	THREE.Camera.call( this, fov, aspect, near, far );
 
-	this.forward = new THREE.Vector3( 0, 0, 1 );
-	this.roll = 0;
+	// API
+
+	this.mouseLook = true;
+	this.autoForward = false;
+
+	this.lookSpeed = 1;
+	this.movementSpeed = 1;
+	this.rollSpeed = 1;
+
+	this.constrainVertical = [ -0.9, 0.9 ];
+
+	this.domElement = document;
+
+	// disable default camera behavior
+
 	this.useTarget = false;
 	this.matrixAutoUpdate = false;
 
+	// internals
+
+	this.forward = new THREE.Vector3( 0, 0, 1 );
+	this.roll = 0;
+
+	this.lastUpdate = -1;
+	this.delta = 0;
+	
 	var xTemp = new THREE.Vector3();
 	var yTemp = new THREE.Vector3();
 	var zTemp = new THREE.Vector3();
 	var rollMatrix = new THREE.Matrix4();
 
+	var doRoll = false, rollDirection = 1, forwardSpeed = 0, sideSpeed = 0, upSpeed = 0;
+
+	var mouseX = 0, mouseY = 0;
+	
+	var windowHalfX = window.innerWidth / 2;
+	var windowHalfY = window.innerHeight / 2;
 
 	// custom update
 
 	this.update = function() {
-	
+
+		var now = new Date().getTime();
+
+		if ( this.lastUpdate == -1 ) this.lastUpdate = now;
+		
+		this.delta = ( now - this.lastUpdate ) / 1000;
+		this.lastUpdate = now;
+
+		if ( this.mouseLook ) {
+		
+			var actualLookSpeed = this.delta * this.lookSpeed;
+			
+			this.rotateHorizontally( actualLookSpeed * mouseX );
+			this.rotateVertically( actualLookSpeed * mouseY );
+
+		}
+
+		var actualSpeed = this.delta * this.movementSpeed;
+		var forwardOrAuto = ( forwardSpeed > 0 || ( this.autoForward && ! ( forwardSpeed < 0 ) ) ) ? 1 : forwardSpeed;
+		
+		this.translateZ( actualSpeed * forwardOrAuto );
+		this.translateX( actualSpeed * sideSpeed );
+		this.translateY( actualSpeed * upSpeed );
+
+		if( doRoll ) {
+			
+			this.roll += this.rollSpeed * this.delta * rollDirection;
+
+		}
+		
 		// cap forward up / down
 		
-		if( this.forward.y > 0.9 ) {
+		if( this.forward.y > this.constrainVertical[ 1 ] ) {
 			
-			this.forward.y = 0.9;
+			this.forward.y = this.constrainVertical[ 1 ];
 			this.forward.normalize();
 			
-		} else if( this.forward.y < -0.9 ) {
+		} else if( this.forward.y < this.constrainVertical[ 0 ] ) {
 			
-			this.forward.y = -0.9;
+			this.forward.y = this.constrainVertical[ 0 ];
 			this.forward.normalize();
 			
 		}
@@ -90,7 +146,7 @@ THREE.RollCamera = function ( fov, aspect, near, far ) {
 
 		this.supr.update.call( this );
 
-	}
+	};
 	
 	this.translateX = function ( distance ) {
 		
@@ -127,7 +183,7 @@ THREE.RollCamera = function ( fov, aspect, near, far ) {
 		this.forward.subSelf( xTemp );
 		this.forward.normalize();
 	
-	}
+	};
 	
 	this.rotateVertically = function ( amount ) {
 		
@@ -139,9 +195,104 @@ THREE.RollCamera = function ( fov, aspect, near, far ) {
 		this.forward.addSelf( yTemp );
 		this.forward.normalize();
 	
-	}
+	};
+
+	function onKeyDown( event ) {
+
+		switch( event.keyCode ) {
+
+			case 38: /*up*/
+			case 87: /*W*/ forwardSpeed = 1; break;
+
+			case 37: /*left*/
+			case 65: /*A*/ sideSpeed = -1; break;
+
+			case 40: /*down*/
+			case 83: /*S*/ forwardSpeed = -1; break;
+
+			case 39: /*right*/
+			case 68: /*D*/ sideSpeed = 1; break;
+
+			case 81: /*Q*/ doRoll = true; rollDirection = 1; break;
+			case 69: /*E*/ doRoll = true; rollDirection = -1; break;
+
+			case 82: /*R*/ upSpeed = 1; break;
+			case 70: /*F*/ upSpeed = -1; break;
+
+		}
+
+	};
+
+	function onKeyUp( event ) {
+
+		switch( event.keyCode ) {
+
+			case 38: /*up*/
+			case 87: /*W*/ forwardSpeed = 0; break;
+
+			case 37: /*left*/
+			case 65: /*A*/ sideSpeed = 0; break;
+
+			case 40: /*down*/
+			case 83: /*S*/ forwardSpeed = 0; break;
+
+			case 39: /*right*/
+			case 68: /*D*/ sideSpeed = 0; break;
+
+			case 81: /*Q*/ doRoll = false; break;
+			case 69: /*E*/ doRoll = false; break;
+
+			case 82: /*R*/ upSpeed = 0; break;
+			case 70: /*F*/ upSpeed = 0; break;
+
+		}
+
+	};
+
+	function onMouseMove( event ) {
+
+		mouseX = ( event.clientX - windowHalfX ) / window.innerWidth;
+		mouseY = ( event.clientY - windowHalfY ) / window.innerHeight;
+
+	};
+	
+	function onMouseDown ( event ) {
+
+		event.preventDefault();
+		event.stopPropagation();
+
+		switch ( event.button ) {
+
+			case 0: forwardSpeed = 1; break;
+			case 2: forwardSpeed = -1; break;
+
+		}
+
+	};
+
+	function onMouseUp ( event ) {
+
+		event.preventDefault();
+		event.stopPropagation();
+
+		switch ( event.button ) {
+
+			case 0: forwardSpeed = 0; break;
+			case 2: forwardSpeed = 0; break;
+
+		}
+
+	};
+	
+	this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
+
+	this.domElement.addEventListener( 'mousemove', onMouseMove, false );
+	this.domElement.addEventListener( 'mousedown', onMouseDown, false );
+	this.domElement.addEventListener( 'mouseup', onMouseUp, false );
+	this.domElement.addEventListener( 'keydown', onKeyDown, false );
+	this.domElement.addEventListener( 'keyup', onKeyUp, false );	
 
-}
+};
 
 
 THREE.RollCamera.prototype = new THREE.Camera();

+ 1 - 1
src/extras/io/Loader.js

@@ -147,7 +147,7 @@ THREE.Loader.prototype = {
 
 		}
 
-		if ( m.transparent !== undefined ) {
+		if ( m.transparent !== undefined || m.opacity < 1.0 ) {
 
 			mpars.transparent = m.transparent;
 

+ 81 - 12
src/extras/io/SceneLoader.js

@@ -3,11 +3,21 @@
  */
 
 THREE.SceneLoader = function () {
+
+	this.onLoadStart = function () {};
+	this.onLoadProgress = function() {};
+	this.onLoadComplete = function () {};
+		
+	this.callbackSync = function () {};
+	this.callbackProgress = function () {};
+
 };
 
 THREE.SceneLoader.prototype = {
 
-	load : function ( url, callback_sync, callback_async, callback_progress ) {
+	load : function ( url, callbackFinished ) {
+
+		var scope = this;
 
 		var worker = new Worker( url );
 		worker.postMessage( 0 );
@@ -47,6 +57,29 @@ THREE.SceneLoader.prototype = {
 
 			};
 
+			// find out if there are some colliders
+			
+			var hasColliders = false;
+			
+			for( dd in data.objects ) {
+				
+				o = data.objects[ dd ];
+
+				if ( o.meshCollider )  {
+					
+					hasColliders = true;
+					break;
+
+				}
+				
+			}
+			
+			if ( hasColliders ) {
+			
+				result.scene.collisions = new THREE.CollisionSystem();
+
+			}
+
 			if ( data.transform ) {
 
 				var position = data.transform.position,
@@ -149,10 +182,24 @@ THREE.SceneLoader.prototype = {
 							if ( o.meshCollider ) {
 
 								var meshCollider = THREE.CollisionUtils.MeshColliderWBox( object );
-								THREE.Collisions.colliders.push( meshCollider );
+								result.scene.collisions.colliders.push( meshCollider );
 
 							}
 
+							if ( o.castsShadow ) {
+								
+								//object.visible = true;
+								//object.materials = [ new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ];
+
+								var shadow = new THREE.ShadowVolume( geometry )
+								result.scene.addChild( shadow );
+								
+								shadow.position = object.position;
+								shadow.rotation = object.rotation;
+								shadow.scale = object.scale;
+
+							}
+							
 						}
 
 
@@ -176,6 +223,8 @@ THREE.SceneLoader.prototype = {
 					handle_mesh( geo, id );
 
 					counter_models -= 1;
+					
+					scope.onLoadComplete();
 
 					async_callback_gate();
 
@@ -187,28 +236,32 @@ THREE.SceneLoader.prototype = {
 
 				var progress = {
 
-					total_models: total_models,
-					total_textures: total_textures,
-					loaded_models: total_models - counter_models,
-					loaded_textures: total_textures - counter_textures
+					totalModels		: total_models,
+					totalTextures	: total_textures,
+					loadedModels	: total_models - counter_models,
+					loadedTextures	: total_textures - counter_textures
 
 				};
 
-				callback_progress( progress, result );
+				scope.callbackProgress( progress, result );
+				
+				scope.onLoadProgress();
 
 				if( counter_models == 0 && counter_textures == 0 ) {
 
-					callback_async( result );
+					callbackFinished( result );
 
 				}
 
 			};
 
-			var callback_texture = function( images ) {
+			var callbackTexture = function( images ) {
 
 				counter_textures -= 1;
 				async_callback_gate();
 
+				scope.onLoadComplete();
+
 			};
 
 			// first go synchronous elements
@@ -329,6 +382,8 @@ THREE.SceneLoader.prototype = {
 				if ( g.type == "bin_mesh" || g.type == "ascii_mesh" ) {
 
 					counter_models += 1;
+					
+					scope.onLoadStart();
 
 				}
 
@@ -397,11 +452,19 @@ THREE.SceneLoader.prototype = {
 				if( tt.url instanceof Array ) {
 
 					counter_textures += tt.url.length;
+					
+					for( var n = 0; n < tt.url.length; n ++ ) {
+						
+						scope.onLoadStart();
+
+					}
 
 				} else {
 
 					counter_textures += 1;
 
+					scope.onLoadStart();
+
 				}
 
 			}
@@ -428,11 +491,11 @@ THREE.SceneLoader.prototype = {
 
 					}
 
-					texture = THREE.ImageUtils.loadTextureCube( url_array, tt.mapping, callback_texture );
+					texture = THREE.ImageUtils.loadTextureCube( url_array, tt.mapping, callbackTexture );
 
 				} else {
 
-					texture = THREE.ImageUtils.loadTexture( get_url( tt.url, data.urlBaseType ), tt.mapping, callback_texture );
+					texture = THREE.ImageUtils.loadTexture( get_url( tt.url, data.urlBaseType ), tt.mapping, callbackTexture );
 
 					if ( THREE[ tt.minFilter ] != undefined )
 						texture.minFilter = THREE[ tt.minFilter ];
@@ -488,6 +551,12 @@ THREE.SceneLoader.prototype = {
 
 				}
 
+				if ( m.parameters.opacity !== undefined && m.parameters.opacity < 1.0 ) {
+					
+					m.parameters.transparent = true;
+
+				}
+				
 				material = new THREE[ m.type ]( m.parameters );
 				result.materials[ dm ] = material;
 
@@ -499,7 +568,7 @@ THREE.SceneLoader.prototype = {
 
 			// synchronous callback
 
-			callback_sync( result );
+			scope.callbackSync( result );
 
 		};
 

+ 1 - 1
src/extras/physics/CollisionUtils.js

@@ -1,5 +1,5 @@
 /**
- * @author drojdjou / http://everyday3d.com/
+ * @author bartek drozdz / http://everyday3d.com/
  */
 
 THREE.CollisionUtils = {};

+ 62 - 31
src/extras/physics/Collisions.js

@@ -1,5 +1,5 @@
 /**
- * @author drojdjou / http://everyday3d.com/
+ * @author bartek drozdz / http://everyday3d.com/
  */
 
 THREE.PlaneCollider = function( point, normal ) {
@@ -24,6 +24,8 @@ THREE.BoxCollider = function( min, max ) {
 	this.max = max;
 	this.dynamic = true;
 
+	this.normal = new THREE.Vector3();
+
 };
 
 THREE.MeshCollider = function( vertices, faces, normals, box ) {
@@ -34,17 +36,29 @@ THREE.MeshCollider = function( vertices, faces, normals, box ) {
 	this.box = box;
 	this.numFaces = this.faces.length;
 
+	this.normal = new THREE.Vector3();
+
 };
 
 THREE.CollisionSystem = function() {
 
+	this.collisionNormal = new THREE.Vector3();
 	this.colliders = [];
 	this.hits = [];
 
+	// console.log("Collision system init / 004");
+
 };
 
 THREE.Collisions = new THREE.CollisionSystem();
 
+THREE.CollisionSystem.prototype.merge = function( collisionSystem ) {
+
+	this.colliders = this.colliders.concat( collisionSystem.colliders );
+	this.hits = this.hits.concat( collisionSystem.hits );
+
+};
+
 THREE.CollisionSystem.prototype.rayCastAll = function( ray ) {
 
 	ray.direction.normalize();
@@ -108,19 +122,19 @@ THREE.CollisionSystem.prototype.rayCastNearest = function( ray ) {
 
 };
 
-THREE.CollisionSystem.prototype.rayCast = function( r, c ) {
+THREE.CollisionSystem.prototype.rayCast = function( ray, collider ) {
 
-	if ( c instanceof THREE.PlaneCollider )
-		return this.rayPlane( r, c );
+	if ( collider instanceof THREE.PlaneCollider )
+		return this.rayPlane( ray, collider );
 
-	else if ( c instanceof THREE.SphereCollider )
-		return this.raySphere( r, c );
+	else if ( collider instanceof THREE.SphereCollider )
+		return this.raySphere( ray, collider );
 
-	else if ( c instanceof THREE.BoxCollider )
-		return this.rayBox( r, c );
+	else if ( collider instanceof THREE.BoxCollider )
+		return this.rayBox( ray, collider );
 
-	else if ( c instanceof THREE.MeshCollider && c.box )
-		return this.rayBox( r, c.box );
+	else if ( collider instanceof THREE.MeshCollider && collider.box )
+		return this.rayBox( ray, collider.box );
 
 };
 
@@ -137,9 +151,16 @@ THREE.CollisionSystem.prototype.rayMesh = function( r, me ) {
 		var p0 = me.vertices[ me.faces[ t + 0 ] ];
 		var p1 = me.vertices[ me.faces[ t + 1 ] ];
 		var p2 = me.vertices[ me.faces[ t + 2 ] ];
-		var n = me.normals[ me.faces[ i ] ];
 
-		d = Math.min(d, this.rayTriangle( rt, p0, p1, p2, n, d ) );
+		var nd = this.rayTriangle( rt, p0, p1, p2, d, this.collisionNormal );
+
+		if( nd < d ) {
+
+			d = nd;
+			me.normal.copy( this.collisionNormal );
+			me.normal.normalize();
+
+		}
 
 	}
 
@@ -147,15 +168,15 @@ THREE.CollisionSystem.prototype.rayMesh = function( r, me ) {
 
 };
 
-THREE.CollisionSystem.prototype.rayTriangle = function( ray, p0, p1, p2, n, mind ) {
+THREE.CollisionSystem.prototype.rayTriangle = function( ray, p0, p1, p2, mind, n ) {
 
 	var e1 = THREE.CollisionSystem.__v1,
 		e2 = THREE.CollisionSystem.__v2;
+	
+	n.set( 0, 0, 0 );
 
 	// do not crash on quads, fail instead
 
-	//if ( !n ) n = THREE.CollisionSystem.__v3;
-
 	e1.sub( p1, p0 );
 	e2.sub( p2, p1 );
 	n.cross( e1, e2 )
@@ -252,28 +273,35 @@ THREE.CollisionSystem.prototype.rayTriangle = function( ray, p0, p1, p2, n, mind
 
 THREE.CollisionSystem.prototype.makeRayLocal = function( ray, m ) {
 
-	var rt = new THREE.Ray( ray.origin.clone(), ray.direction.clone() );
-	var mt = THREE.Matrix4.makeInvert( m.matrixWorld );
+	var mt = THREE.CollisionSystem.__m;
+	THREE.Matrix4.makeInvert( m.matrixWorld, mt );
+
+	var rt = THREE.CollisionSystem.__r;
+	rt.origin.copy( ray.origin );
+	rt.direction.copy( ray.direction );
 
 	mt.multiplyVector3( rt.origin );
 	mt.rotateAxis( rt.direction );
 	rt.direction.normalize();
 	//m.localRay = rt;
+
 	return rt;
 
 };
 
-THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
+THREE.CollisionSystem.prototype.rayBox = function( ray, ab ) {
 
 	var rt;
 
 	if ( ab.dynamic && ab.mesh && ab.mesh.matrixWorld ) {
 
-		rt = this.makeRayLocal( r, ab.mesh );
+		rt = this.makeRayLocal( ray, ab.mesh );
 
 	} else {
 
-		rt = new THREE.Ray( r.origin.clone(), r.direction.clone() );
+		rt = THREE.CollisionSystem.__r;
+		rt.origin.copy( ray.origin );
+		rt.direction.copy( ray.direction );
 
 	}
 
@@ -284,7 +312,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	if( rt.origin.x < ab.min.x ) {
 
 		xt = ab.min.x - rt.origin.x;
-		//if(xt > r.direction.x) return return Number.MAX_VALUE;
+		//if(xt > ray.direction.x) return return Number.MAX_VALUE;
 		xt /= rt.direction.x;
 		ins = false;
 		xn = -1;
@@ -292,7 +320,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	} else if( rt.origin.x > ab.max.x ) {
 
 		xt = ab.max.x - rt.origin.x;
-		//if(xt < r.direction.x) return return Number.MAX_VALUE;
+		//if(xt < ray.direction.x) return return Number.MAX_VALUE;
 		xt /= rt.direction.x;
 		ins = false;
 		xn = 1;
@@ -302,7 +330,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	if( rt.origin.y < ab.min.y ) {
 
 		yt = ab.min.y - rt.origin.y;
-		//if(yt > r.direction.y) return return Number.MAX_VALUE;
+		//if(yt > ray.direction.y) return return Number.MAX_VALUE;
 		yt /= rt.direction.y;
 		ins = false;
 		yn = -1;
@@ -310,7 +338,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	} else if( rt.origin.y > ab.max.y ) {
 
 		yt = ab.max.y - rt.origin.y;
-		//if(yt < r.direction.y) return return Number.MAX_VALUE;
+		//if(yt < ray.direction.y) return return Number.MAX_VALUE;
 		yt /= rt.direction.y;
 		ins = false;
 		yn = 1;
@@ -320,7 +348,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	if( rt.origin.z < ab.min.z ) {
 
 		zt = ab.min.z - rt.origin.z;
-		//if(zt > r.direction.z) return return Number.MAX_VALUE;
+		//if(zt > ray.direction.z) return return Number.MAX_VALUE;
 		zt /= rt.direction.z;
 		ins = false;
 		zn = -1;
@@ -328,7 +356,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 	} else if( rt.origin.z > ab.max.z ) {
 
 		zt = ab.max.z - rt.origin.z;
-		//if(zt < r.direction.z) return return Number.MAX_VALUE;
+		//if(zt < ray.direction.z) return return Number.MAX_VALUE;
 		zt /= rt.direction.z;
 		ins = false;
 		zn = 1;
@@ -362,7 +390,7 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 			if ( y < ab.min.y || y > ab.max.y ) return Number.MAX_VALUE;
 			var z = rt.origin.z + rt.direction.z * t;
 			if ( z < ab.min.z || z > ab.max.z ) return Number.MAX_VALUE;
-			ab.normal = new THREE.Vector3( xn, 0, 0 );
+			ab.normal.set( xn, 0, 0 );
 			break;
 
 		case 1:
@@ -371,16 +399,16 @@ THREE.CollisionSystem.prototype.rayBox = function( r, ab ) {
 			if ( x < ab.min.x || x > ab.max.x ) return Number.MAX_VALUE;
 			var z = rt.origin.z + rt.direction.z * t;
 			if ( z < ab.min.z || z > ab.max.z ) return Number.MAX_VALUE;
-			ab.normal = new THREE.Vector3( 0, yn, 0) ;
+			ab.normal.set( 0, yn, 0) ;
 			break;
 
 		case 2:
 
 			var x = rt.origin.x + rt.direction.x * t;
-			if (x < ab.min.x || x > ab.max.x ) return Number.MAX_VALUE;
+			if ( x < ab.min.x || x > ab.max.x ) return Number.MAX_VALUE;
 			var y = rt.origin.y + rt.direction.y * t;
-			if (y < ab.min.y || y > ab.max.y ) return Number.MAX_VALUE;
-			ab.normal = new THREE.Vector3( 0, 0, zn );
+			if ( y < ab.min.y || y > ab.max.y ) return Number.MAX_VALUE;
+			ab.normal.set( 0, 0, zn );
 			break;
 
 	}
@@ -421,3 +449,6 @@ THREE.CollisionSystem.prototype.raySphere = function( r, s ) {
 THREE.CollisionSystem.__v1 = new THREE.Vector3();
 THREE.CollisionSystem.__v2 = new THREE.Vector3();
 THREE.CollisionSystem.__v3 = new THREE.Vector3();
+THREE.CollisionSystem.__nr = new THREE.Vector3();
+THREE.CollisionSystem.__m = new THREE.Matrix4();
+THREE.CollisionSystem.__r = new THREE.Ray();

+ 4 - 4
src/renderers/WebGLRenderer.js

@@ -72,9 +72,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	parameters = parameters || {};
 
-	stencil = parameters.stencil !== undefined ? parameters.stencil : true;
-	antialias = parameters.antialias !== undefined ? parameters.antialias : false;
-	clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 );
+	stencil = parameters.stencil !== undefined ? parameters.stencil : true,
+	antialias = parameters.antialias !== undefined ? parameters.antialias : false,
+	clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ),
 	clearAlpha = parameters.clearAlpha !== undefined ? parameters.clearAlpha : 0;
 
 	this.data = {
@@ -82,7 +82,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		vertices: 0,
 		faces: 0
 
-	}
+	};
 
 	this.maxMorphTargets = 8;
 	this.domElement = _canvas;

+ 2 - 0
src/scenes/Scene.js

@@ -11,6 +11,8 @@ THREE.Scene = function () {
 
 	this.fog = null;
 
+	this.collisions = null;
+	
 	this.objects = [];
 	this.lights = [];
 	this.sounds = [];

+ 10 - 0
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/__init__.py

@@ -151,6 +151,9 @@ def save_settings_export(properties):
 
     settings = {
     "option_export_scene" : properties.option_export_scene,
+    
+    "option_lights" : properties.option_lights,
+    "option_cameras" : properties.option_cameras,
 
     "option_flip_yz"      : properties.option_flip_yz,
 
@@ -198,6 +201,9 @@ def restore_settings_export(properties):
 
     properties.option_export_scene = settings.get("option_export_scene", False)
 
+    properties.option_lights = settings.get("option_lights", False)
+    properties.option_cameras = settings.get("option_cameras", False)
+
 # ################################################################
 # Exporter
 # ################################################################
@@ -231,6 +237,8 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
     option_flip_yz = BoolProperty(name = "Flip YZ", description = "Flip YZ", default = True)
 
     option_export_scene = BoolProperty(name = "Scene", description = "Export scene", default = False)
+    option_lights = BoolProperty(name = "Lights", description = "Export default scene lights", default = False)
+    option_cameras = BoolProperty(name = "Cameras", description = "Export default scene cameras", default = False)
 
     def invoke(self, context, event):
         restore_settings_export(self.properties)
@@ -306,6 +314,8 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
 
         row = layout.row()
         row.prop(self.properties, "option_export_scene")
+        row.prop(self.properties, "option_lights")
+        row.prop(self.properties, "option_cameras")
         layout.separator()
 
 

+ 81 - 62
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -1022,8 +1022,8 @@ def generate_objects(data):
             meshCollider = obj.THREE_meshCollider
 
             visible = True
-            #if obj.draw_type in ["BOUNDS", "WIRE"] and meshCollider:
-            if meshCollider:
+            #if obj.draw_type in ["BOUNDS", "WIRE"] and (meshCollider or castsShadow):
+            if meshCollider or castsShadow:
                 visible = False
 
             object_string = TEMPLATE_OBJECT % {
@@ -1222,7 +1222,7 @@ def generate_materials_scene(data):
     # TODO: extract just materials actually used by some objects in the scene
 
     for m in bpy.data.materials:
-        material = extract_material_data(m, data["usecolors"])
+        material = extract_material_data(m, data["use_colors"])
         material_string = generate_material_string(material)
         chunks.append(material_string)
 
@@ -1233,74 +1233,87 @@ def generate_materials_scene(data):
 # #####################################################
 
 def generate_cameras(data):
-    cameras = data.get("cameras", [])
-    if not cameras:
-        cameras.append(DEFAULTS["camera"])
+    if data["use_cameras"]:
 
-    chunks = []
-    for camera in cameras:
-
-        if camera["type"] == "perspective":
-            camera_string = TEMPLATE_CAMERA_PERSPECTIVE % {
-            "camera_id" : generate_string(camera["name"]),
-            "fov"       : camera["fov"],
-            "aspect"    : camera["aspect"],
-            "near"      : camera["near"],
-            "far"       : camera["far"],
-            "position"  : generate_vec3(camera["position"]),
-            "target"    : generate_vec3(camera["target"])
-            }
+        cameras = data.get("cameras", [])
+        
+        if not cameras:
+            cameras.append(DEFAULTS["camera"])
 
-        elif camera["type"] == "ortho":
-            camera_string = TEMPLATE_CAMERA_ORTHO % {
-            "camera_id" : generate_string(camera["name"]),
-            "left"      : camera["left"],
-            "right"     : camera["right"],
-            "top"       : camera["top"],
-            "bottom"    : camera["bottom"],
-            "near"      : camera["near"],
-            "far"       : camera["far"],
-            "position"  : generate_vec3(camera["position"]),
-            "target"    : generate_vec3(camera["target"])
-            }
+        chunks = []
+
+        for camera in cameras:
+
+            if camera["type"] == "perspective":
+
+                camera_string = TEMPLATE_CAMERA_PERSPECTIVE % {
+                "camera_id" : generate_string(camera["name"]),
+                "fov"       : camera["fov"],
+                "aspect"    : camera["aspect"],
+                "near"      : camera["near"],
+                "far"       : camera["far"],
+                "position"  : generate_vec3(camera["position"]),
+                "target"    : generate_vec3(camera["target"])
+                }
+
+            elif camera["type"] == "ortho":
+
+                camera_string = TEMPLATE_CAMERA_ORTHO % {
+                "camera_id" : generate_string(camera["name"]),
+                "left"      : camera["left"],
+                "right"     : camera["right"],
+                "top"       : camera["top"],
+                "bottom"    : camera["bottom"],
+                "near"      : camera["near"],
+                "far"       : camera["far"],
+                "position"  : generate_vec3(camera["position"]),
+                "target"    : generate_vec3(camera["target"])
+                }
 
-        chunks.append(camera_string)
+            chunks.append(camera_string)
 
-    return ",\n\n".join(chunks)
+        return ",\n\n".join(chunks)
+
+    return ""
 
 # #####################################################
 # Scene exporter - lights
 # #####################################################
 
 def generate_lights(data):
-    lights = data.get("lights", [])
-    if not lights:
-        lights.append(DEFAULTS["light"])
 
-    chunks = []
-    for light in lights:
-
-        if light["type"] == "directional":
-            light_string = TEMPLATE_LIGHT_DIRECTIONAL % {
-            "light_id"      : generate_string(light["name"]),
-            "direction"     : generate_vec3(light["direction"]),
-            #"color"         : generate_hex(rgb2int(light["color"])),
-            "color"         : rgb2int(light["color"]),
-            "intensity"     : light["intensity"]
-            }
+    if data["use_lights"]:
 
-        elif light["type"] == "point":
-            light_string = TEMPLATE_LIGHT_POINT % {
-            "light_id"      : generate_string(light["name"]),
-            "position"      : generate_vec3(light["position"]),
-            #"color"         : generate_hex(rgb2int(light["color"])),
-            "color"         : rgb2int(light["color"]),
-            "intensity"     : light["intensity"]
-            }
+        lights = data.get("lights", [])
+        if not lights:
+            lights.append(DEFAULTS["light"])
+
+        chunks = []
+        for light in lights:
 
-        chunks.append(light_string)
+            if light["type"] == "directional":
+                light_string = TEMPLATE_LIGHT_DIRECTIONAL % {
+                "light_id"      : generate_string(light["name"]),
+                "direction"     : generate_vec3(light["direction"]),
+                #"color"         : generate_hex(rgb2int(light["color"])),
+                "color"         : rgb2int(light["color"]),
+                "intensity"     : light["intensity"]
+                }
+
+            elif light["type"] == "point":
+                light_string = TEMPLATE_LIGHT_POINT % {
+                "light_id"      : generate_string(light["name"]),
+                "position"      : generate_vec3(light["position"]),
+                #"color"         : generate_hex(rgb2int(light["color"])),
+                "color"         : rgb2int(light["color"]),
+                "intensity"     : light["intensity"]
+                }
 
-    return ",\n\n".join(chunks)
+            chunks.append(light_string)
+
+        return ",\n\n".join(chunks)
+        
+    return ""
 
 # #####################################################
 # Scene exporter - generate ASCII scene
@@ -1332,7 +1345,9 @@ def generate_ascii_scene(data):
 
     sections_string = "\n".join(chunks)
 
-    default_camera = "default_camera"
+    default_camera = ""
+    if data["use_cameras"]:
+        default_camera = generate_string("default_camera")
 
     parameters = {
     "fname"     : data["source_file"],
@@ -1341,7 +1356,7 @@ def generate_ascii_scene(data):
 
     "bgcolor"   : generate_vec3(DEFAULTS["bgcolor"]),
     "bgalpha"   : DEFAULTS["bgalpha"],
-    "defcamera" : generate_string(default_camera),
+    "defcamera" :  generate_string(default_camera),
 
     "nobjects"      : nobjects,
     "ngeometries"   : ngeometries,
@@ -1357,7 +1372,7 @@ def generate_ascii_scene(data):
 
     return text
 
-def export_scene(scene, filepath, flipyz, option_colors):
+def export_scene(scene, filepath, flipyz, option_colors, option_lights, option_cameras):
 
     source_file = os.path.basename(bpy.data.filepath)
 
@@ -1368,7 +1383,9 @@ def export_scene(scene, filepath, flipyz, option_colors):
     "source_file" : source_file,
     "filepath"    : filepath,
     "flipyz"      : flipyz,
-    "usecolors"   : option_colors
+    "use_colors"  : option_colors,
+    "use_lights"  : option_lights, 
+    "use_cameras" : option_cameras
     }
     scene_text += generate_ascii_scene(data)
 
@@ -1390,6 +1407,8 @@ def save(operator, context, filepath = "",
          option_colors = True,
          align_model = 0,
          option_export_scene = False,
+         option_lights = False,
+         option_cameras = False,
          option_scale = 1.0):
 
     filepath = ensure_extension(filepath, '.js')
@@ -1401,7 +1420,7 @@ def save(operator, context, filepath = "",
 
     if option_export_scene:
 
-        export_scene(scene, filepath, option_flip_yz, option_colors)
+        export_scene(scene, filepath, option_flip_yz, option_colors, option_lights, option_cameras)
 
         geo_set = set()
 

+ 1 - 2
utils/exporters/convert_obj_three.py

@@ -20,7 +20,6 @@ Notes:
         -e						export edges
 
     - by default:
-        converted model will be centered (middle of bounding box goes to 0,0,0)
         use smooth shading (if there were vertex normals in the original model)
         will be in ASCII format
         original model is assumed to use non-inverted transparency / dissolve (0.0 fully transparent, 1.0 fully opaque)
@@ -142,7 +141,7 @@ import glob
 # #####################################################
 # Configuration
 # #####################################################
-ALIGN = "center"        # center centerxz bottom top none
+ALIGN = "none"        	# center centerxz bottom top none
 SHADING = "smooth"      # smooth flat 
 TYPE = "ascii"          # ascii binary
 TRANSPARENCY = "normal" # normal invert