Bladeren bron

Added handling of shadow geometry to scene loader. Made default light and camera option to Blender scene exporter. Made shadow geometry invisible in exported scene.

alteredq 14 jaren geleden
bovenliggende
commit
691a5ea3ed

+ 137 - 136
build/Three.js

@@ -12,7 +12,7 @@ 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,
+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 O=W.dot(W);W=W.dot(U);U=1/(H*O-J*J);O=(O*B-J*W)*U;H=(H*W-J*B)*U;return O>0&&H>0&&O+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()};
@@ -23,17 +23,18 @@ 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,
 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,
 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,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,O=d.n14,M=d.n21,va=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*M+g*ga;this.n12=c*B+f*va+g*ha;this.n13=c*U+f*la+g*e;this.n14=c*O+f*pa+g*oa+h;this.n21=j*W+k*M+m*ga;this.n22=j*B+k*va+m*ha;this.n23=j*U+k*la+m*e;this.n24=j*O+k*pa+m*oa+o;this.n31=p*W+t*M+z*ga;this.n32=p*B+t*va+z*ha;this.n33=p*U+t*la+z*e;this.n34=p*O+t*pa+z*oa+u;this.n41=A*W+E*M+H*ga;this.n42=A*B+E*va+H*ha;this.n43=A*U+E*la+H*e;this.n44=A*O+E*pa+H*oa+J;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=
 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},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},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}};
+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=
+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},
+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};
@@ -49,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;thi
 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.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.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};
 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};
@@ -57,16 +58,16 @@ 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(fa,wa,ta,qa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ta].position;o=fa.vertices[qa].position;p=j[ca];t=j[ka];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;O=t.v-p.v;M=z.v-p.v;va=1/(B*
+M-U*O);ha.set((M*u-O*A)*va,(M*E-O*H)*va,(M*J-O*W)*va);e.set((B*A-U*u)*va,(B*H-U*E)*va,(B*W-U*J)*va);pa[wa].addSelf(ha);pa[ta].addSelf(ha);pa[qa].addSelf(ha);ga[wa].addSelf(e);ga[ta].addSelf(e);ga[qa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,z,u,A,E,H,J,W,B,U,O,M,va,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 ia=["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[ia[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,
 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);
 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+=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=[],O=new THREE.Vector3,M=this.getLength();U.push(O.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){E=M.chunks[A]-M.chunks[A-1];B=Math.ceil(u*E/M.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(O.copy(position).clone())}U.push(O.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.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=
@@ -136,58 +137,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 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.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,ia=e.z+e.w,fa=-ha.z+ha.w,wa=-e.z+e.w;if(Aa>=0&&ia>=0&&fa>=0&&wa>=0)return!0;else if(Aa<0&&ia<0||fa<0&&wa<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-ia));else ia<0&&(Da=Math.min(Da,Aa/(Aa-ia)));if(fa<0)oa=Math.max(oa,fa/(fa-wa));else wa<0&&(Da=Math.min(Da,fa/(fa-wa)));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,O=new THREE.Vector4,M=new THREE.Matrix4,va=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){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ha);return ha};this.unprojectVector=function(ha,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
+M.multiplyVector3(ha);return ha};this.projectObjects=function(ha,e,oa){e=[];var Da,Aa,ia;g=0;Aa=ha.objects;ha=0;for(Da=Aa.length;ha<Da;ha++){ia=Aa[ha];var fa;if(!(fa=!ia.visible))if(fa=ia instanceof THREE.Mesh){a:{fa=void 0;for(var wa=ia.matrixWorld,ta=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),qa=0;qa<6;qa++){fa=la[qa].x*wa.n14+la[qa].y*wa.n24+la[qa].z*wa.n34+la[qa].w;if(fa<=ta){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
+g++;f=fa;U.copy(ia.position);M.multiplyVector3(U);f.object=ia;f.z=U.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ha,e,oa){var Da=[],Aa=e.near,ia=e.far,fa,wa,ta,qa,ca,ka,ma,Fa,ja,da,Ja,Xa,Za,Ta,R,S,P;W=E=z=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ha.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
+M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(fa=0;fa<6;fa++){ja=la[fa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ha,e,!0);ha=0;for(fa=ja.length;ha<fa;ha++){da=ja[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;
+qa=R.vertices;S=R.faces;R=R.faceVertexUvs;wa=0;for(ta=qa.length;wa<ta;wa++){j=b();j.positionWorld.copy(qa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<ia}qa=0;for(wa=S.length;qa<wa;qa++){ta=S[qa];if(ta instanceof THREE.Face3){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];if(ca.visible&&ka.visible&&ma.visible&&
+(da.doubleSided||da.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(da.doubleSided||da.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
+(ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.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))){P=u[z]=u[z]||new THREE.RenderableFace4;z++;o=P;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ta.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ta.centroid);
+Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=R.length;ca<ka;ca++)if(P=R[ca][qa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(da instanceof THREE.Line){va.multiply(M,Ja);qa=da.geometry.vertices;
+ca=b();ca.positionScreen.copy(qa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=qa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(qa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];pa.copy(ca.positionScreen);ga.copy(ka.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){O.set(da.position.x,da.position.y,da.position.z,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=B[W]=B[W]||new THREE.RenderableParticle;W++;J=Ja;J.x=O.x/O.w;J.y=O.y/O.w;J.z=O.z;J.rotation=da.rotation.z;J.scale.x=da.scale.x*Math.abs(J.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));J.scale.y=da.scale.y*Math.abs(J.y-(O.y+e.projectionMatrix.n22)/(O.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,w=new THREE.Rectangle,x=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;w.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(!x.isEmpty()){x.inflate(1);x.minSelf(w);if(z.hex==0&&u==0)t.clearRect(x.getX(),x.getY(),x.getWidth(),x.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(x.getX(),x.getY(),x.getWidth(),x.getHeight())}x.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(w.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(w.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(w.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(w.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(w.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)}}}x.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)}}}}}};
+1,E=0,H=null,J=null,W=null,B=null,U=null,O,M,va,la,pa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ha,e,oa,Da,Aa,ia,fa,wa,ta,qa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,da=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,C,w=new THREE.Rectangle,x=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,ra,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);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,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;w.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(!x.isEmpty()){x.inflate(1);x.minSelf(w);if(z.hex==0&&u==0)t.clearRect(x.getX(),x.getY(),x.getWidth(),x.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(x.getX(),x.getY(),x.getWidth(),x.getHeight())}x.empty()}};this.render=function(Ga,xa){function Ea(V){var na,ea,$,ua=V.lights;F.setRGB(0,
+0,0);T.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=ua.length;V<na;V++){ea=ua[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 ua,sa,ya,X,Ia=V.lights;V=0;for(ua=Ia.length;V<ua;V++){sa=Ia[V];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ea.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
+ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ea.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.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 $,ua,sa,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;sa=na.scale.y*p;$=ea*X;ua=sa*Ia;y.set(V.x-$,V.y-ua,V.x+$,V.y+
+ua);if(w.instersects(y)){t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale(ea,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;y.set(V.x-$,V.y-ua,V.x+$,V.y+ua);if(w.instersects(y)){c(ea.color.__styleString);sa=ea.color.__styleString;if(J!=sa)t.fillStyle=J=sa;t.save();t.translate(V.x,V.y);t.rotate(-na.rotation);t.scale($,ua);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,$,ua,sa,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;ia=ea.positionScreen.y;ab(ha,e,oa,Da,Aa,ia);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,ia,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].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,ia,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,ia,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=da.r=F.r;Fa.g=ja.g=da.g=F.g;Fa.b=ja.b=da.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],da);Ja.r=(ja.r+da.r)*0.5;Ja.g=(ja.g+da.g)*0.5;Ja.b=(ja.b+da.b)*
+0.5;Ta=hb(Fa,ja,da,Ja);cb(ha,e,oa,Da,Aa,ia,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);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);da.r=da.g=da.b=1-Wa(ea.positionScreen.z,Xa,Za);Ja.r=(ja.r+da.r)*0.5;Ja.g=(ja.g+da.g)*0.5;Ja.b=(ja.b+da.b)*0.5;Ta=hb(Fa,ja,da,Ja);cb(ha,e,oa,Da,Aa,ia,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,$,ua,sa,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(ua,ea,sa,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;ia=ea.positionScreen.y;fa=$.positionScreen.x;wa=$.positionScreen.y;ta=ua.positionScreen.x;qa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ha,
+e,oa,Da,Aa,ia,fa,wa);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=ja.r=da.r=Ja.r=F.r;Fa.g=ja.g=da.g=Ja.g=F.g;Fa.b=ja.b=da.b=Ja.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
+da);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,da,Ja);ab(ha,e,oa,Da,fa,wa);cb(ha,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,qa,Aa,ia,ca,ka);cb(ta,qa,Aa,ia,ca,ka,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,ia,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ha,e,oa,
+Da,Aa,ia,fa,wa);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,ia,fa,wa);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);ja.r=ja.g=ja.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,ja,da,Ja);ab(ha,e,oa,Da,fa,wa);cb(ha,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,qa,Aa,ia,ca,ka);cb(ta,qa,Aa,ia,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(V,na,ea,$,ua,sa){t.beginPath();t.moveTo(V,na);t.lineTo(ea,$);t.lineTo(ua,sa);t.lineTo(V,na);t.closePath()}function fb(V,na,ea,$,ua,sa,ya,X){t.beginPath();t.moveTo(V,na);t.lineTo(ea,
+$);t.lineTo(ua,sa);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,$,ua,sa,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;ua-=V;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ea-eb*ua)*db;eb=(kb*$-eb*sa)*db;ea=(Ya*ua-
+Sa*ea)*db;$=(Ya*sa-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 ua=~~(V.r*255),sa=~~(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);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=V<0?0:V>255?255:V;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;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]=ea<0?0:ea>255?255:ea;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(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,ua=1/Math.sqrt(ea*ea+$*$);ea*=ua;$*=ua;na.x+=ea;na.y+=$;V.x-=ea;V.y-=$}var bb,Va,N,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++){N=g[bb];y.empty();if(N instanceof THREE.RenderableParticle){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;y.addPoint(O.positionScreen.x,
+O.positionScreen.y);y.addPoint(M.positionScreen.x,M.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&D(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}y.add3Points(O.positionScreen.x,
+O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
+p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;pa.positionScreen.copy(M.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,pa.positionScreen);Ma(va.positionScreen,ga.positionScreen)}y.addPoint(O.positionScreen.x,O.positionScreen.y);y.addPoint(M.positionScreen.x,
+M.positionScreen.y);y.addPoint(va.positionScreen.x,va.positionScreen.y);y.addPoint(la.positionScreen.x,la.positionScreen.y);if(w.instersects(y)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}else Pa.opacity!=0&&v(O,M,va,la,pa,ga,N,Pa,Ga)}}}x.addRectangle(y)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(fa,wa,ta){var qa,ca,ka,ma;qa=0;for(ca=fa.lights.length;qa<ca;qa++){ka=fa.lights[qa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(fa,wa,
+ta,qa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)U.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(B){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,qa,O);U.r=ca.color.r*O.r;U.g=ca.color.g*O.g;U.b=ca.color.b*O.b;U.updateStyleString()}else U.__styleString=
+ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){pa=1-ca.__2near/(ca.__farPlusNear-qa.z*ca.__farMinusNear);U.setRGB(pa,pa,pa)}else ca instanceof THREE.MeshNormalMaterial&&U.setRGB(g(qa.normalWorld.x),g(qa.normalWorld.y),g(qa.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,wa,ta,qa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)U.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(B){O.r=
+M.r;O.g=M.g;O.b=M.b;b(ma,ca,O);U.r=ka.color.r*O.r;U.g=ka.color.g*O.g;U.b=ka.color.b*O.b;U.updateStyleString()}else U.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){pa=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);U.setRGB(pa,pa,pa)}else ka instanceof THREE.MeshNormalMaterial&&U.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+U.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+U.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(fa){if(ha[fa]==null){ha[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");ia==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),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),pa,ga=new THREE.Vector3,ha=[],e=[],oa,Da,Aa,ia=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":ia=1;break;case "low":ia=0}};this.setSize=function(fa,
+wa){o=fa;p=wa;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,wa){var ta,qa,ca,ka,ma,Fa,ja,da;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,wa,this.sortElements);Aa=Da=0;if(B=fa.lights.length>0){ja=fa.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(qa=ja.length;ta<
+qa;ta++){ca=ja[ta];ka=ca.color;if(ca instanceof THREE.AmbientLight){M.r+=ka.r;M.g+=ka.g;M.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){va.r+=ka.r;va.g+=ka.g;va.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ta=0;for(qa=j.length;ta<qa;ta++){ja=j[ta];W.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=t;u.y*=-z;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;A=ja.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(ka=ja.materials.length;ca<ka;)if((da=ja.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");ia==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(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;E=ja.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(ka=ja.meshMaterials.length;ca<ka;){da=ja.meshMaterials[ca++];if(da instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(da=ja.faceMaterials[ma++])&&da.opacity!=0&&d(u,A,E,ja,da,fa)}else da&&da.opacity!=0&&d(u,A,E,ja,da,fa)}}}else if(ja instanceof
+THREE.RenderableFace4){u=ja.v1;A=ja.v2;E=ja.v3;H=ja.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(ka=ja.meshMaterials.length;ca<ka;){da=
+ja.meshMaterials[ca++];if(da instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(da=ja.faceMaterials[ma++])&&da.opacity!=0&&c(u,A,E,H,ja,da,fa)}else da&&da.opacity!=0&&c(u,A,E,H,ja,da,fa)}}}}}};
 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",
@@ -218,16 +219,16 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(n,C,w){var x,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(w.sortParticles){Ja.multiplySelf(w.matrixWorld);for(x=0;x<F;x++){y=K[x].position;Ta.copy(y);Ja.multiplyVector3(Ta);Z[x]=[Ta.z,x]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(x=0;x<F;x++){y=K[Z[x][1]].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}for(x=0;x<G;x++){Q=x*3;color=T[Z[x][1]];L[Q]=color.r;
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(x=0;x<F;x++){y=K[x].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}if(qa)for(x=0;x<G;x++){color=T[x];Q=x*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}if(qa||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,w,x,y){x.program||ha.initMaterial(x,C,w,y);var Q=x.program,K=Q.uniforms,F=x.uniforms;
+THREE.WebGLRenderer=function(b){function d(n,C,w){var x,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,ra=n.__dirtyColors;if(w.sortParticles){Ja.multiplySelf(w.matrixWorld);for(x=0;x<F;x++){y=K[x].position;Ta.copy(y);Ja.multiplyVector3(Ta);Z[x]=[Ta.z,x]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(x=0;x<F;x++){y=K[Z[x][1]].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}for(x=0;x<G;x++){Q=x*3;color=T[Z[x][1]];L[Q]=color.r;
+L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(x=0;x<F;x++){y=K[x].position;Q=x*3;I[Q]=y.x;I[Q+1]=y.y;I[Q+2]=y.z}if(ra)for(x=0;x<G;x++){color=T[x];Q=x*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}if(ra||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function c(n,C,w,x,y){x.program||ha.initMaterial(x,C,w,y);var Q=x.program,K=Q.uniforms,F=x.uniforms;
 if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(w&&(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial||x instanceof THREE.LineBasicMaterial||x instanceof THREE.ParticleBasicMaterial||x.fog)){F.fogColor.value=w.color;if(w instanceof THREE.Fog){F.fogNear.value=w.near;F.fogFar.value=w.far}else if(w instanceof THREE.FogExp2)F.fogDensity.value=w.density}if(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||
-x.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;w=G=Ca=0;for(T=C.length;w<T;w++){G=C[w];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(w=D*3;w<Ga.length;w++)Ga[w]=0;for(w=aa*3;w<Ea.length;w++)Ea[w]=0;Ha.point.length=aa;Ha.directional.length=D;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;w=R;F.enableLighting.value=w.directional.length+w.point.length;F.ambientLightColor.value=w.ambient;F.directionalLightColor.value=w.directional.colors;F.directionalLightDirection.value=w.directional.positions;F.pointLightColor.value=w.point.colors;
+x.lights){var T,G,I=0,L=0,Z=0,Y,ra,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;w=G=Ca=0;for(T=C.length;w<T;w++){G=C[w];Y=G.color;ra=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]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.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]=ra.x;za[G+1]=ra.y;za[G+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(w=D*3;w<Ga.length;w++)Ga[w]=0;for(w=aa*3;w<Ea.length;w++)Ea[w]=0;Ha.point.length=aa;Ha.directional.length=D;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;w=R;F.enableLighting.value=w.directional.length+w.point.length;F.ambientLightColor.value=w.ambient;F.directionalLightColor.value=w.directional.colors;F.directionalLightDirection.value=w.directional.positions;F.pointLightColor.value=w.point.colors;
 F.pointLightPosition.value=w.point.positions;F.pointLightDistance.value=w.point.distances}if(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial){F.diffuse.value=x.color;F.opacity.value=x.opacity;F.map.texture=x.map;F.lightMap.texture=x.lightMap;F.envMap.texture=x.envMap;F.reflectivity.value=x.reflectivity;F.refractionRatio.value=x.refractionRatio;F.combine.value=x.combine;F.useRefract.value=x.envMap&&x.envMap.mapping instanceof THREE.CubeRefractionMapping}if(x instanceof
 THREE.LineBasicMaterial){F.diffuse.value=x.color;F.opacity.value=x.opacity}else if(x instanceof THREE.ParticleBasicMaterial){F.psColor.value=x.color;F.opacity.value=x.opacity;F.size.value=x.size;F.scale.value=oa.height/2;F.map.texture=x.map}else if(x instanceof THREE.MeshPhongMaterial){F.ambient.value=x.ambient;F.specular.value=x.specular;F.shininess.value=x.shininess}else if(x instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=x.opacity}else if(x instanceof
 THREE.MeshNormalMaterial)F.opacity.value=x.opacity;for(var v in F)if(L=Q.uniforms[v]){T=F[v];I=T.type;w=T.value;if(I=="i")e.uniform1i(L,w);else if(I=="f")e.uniform1f(L,w);else if(I=="fv1")e.uniform1fv(L,w);else if(I=="fv")e.uniform3fv(L,w);else if(I=="v2")e.uniform2f(L,w.x,w.y);else if(I=="v3")e.uniform3f(L,w.x,w.y,w.z);else if(I=="v4")e.uniform4f(L,w.x,w.y,w.z,w.w);else if(I=="c")e.uniform3f(L,w.r,w.g,w.b);else if(I=="t"){e.uniform1i(L,w);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+w);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else O(T,w)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,y._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
+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}O(e.TEXTURE_CUBE_MAP,T,T.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
+null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else M(T,w)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,y._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(K.objectMatrix,
 !1,y._objectMatrixArray);(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshShaderMaterial||x.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(x instanceof THREE.ShadowVolumeDynamicMaterial){n=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(x.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,
 !1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,y.boneMatrices)}return Q}function f(n,C,w,x,y,Q){if(x.opacity!=0){var K;n=c(n,C,w,x,Q).attributes;if(x.morphTargets){C=x.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){w=0;for(var F=Q.morphTargetForcedOrder,T=Q.morphTargetInfluences;w<x.numSupportedMorphTargets&&
 w<F.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[F[w]]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[w]=T[F[w]];w++}}else{F=[];var G=-1,I=0;T=Q.morphTargetInfluences;var L,Z=T.length;w=0;for(Q.morphTargetBase!==-1&&(F[Q.morphTargetBase]=!0);w<x.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"+w],3,e.FLOAT,!1,0,0);
@@ -237,59 +238,59 @@ y.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertex
 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(x.wireframe){e.lineWidth(x.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(x.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,w){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,
 n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(w==THREE.FlatShading){var x,y,Q,K,F,T,G,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){w=n.normalArray;x=w[Z];y=w[Z+1];Q=w[Z+2];K=w[Z+3];T=w[Z+4];I=w[Z+5];F=w[Z+6];G=w[Z+7];L=w[Z+8];x=(x+K+F)/3;y=(y+T+G)/3;Q=(Q+I+L)/3;w[Z]=x;w[Z+1]=y;w[Z+2]=Q;w[Z+3]=
-x;w[Z+4]=y;w[Z+5]=Q;w[Z+6]=x;w[Z+7]=y;w[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):
+x;w[Z+4]=y;w[Z+5]=Q;w[Z+6]=x;w[Z+7]=y;w[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(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=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,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),x=0;x<6;x++){n=da[x].x*C.n14+da[x].y*C.n24+da[x].z*C.n34+da[x].w;if(n<=w)return!1}return!0}function o(n,C){n.list[n.count]=C;n.count+=1}function p(n){var C,w,x=n.object,y=n.opaque,Q=n.transparent;Q.count=0;n=y.count=0;for(C=x.materials.length;n<C;n++){w=x.materials[n];w.transparent?o(Q,w):o(y,w)}}function t(n){var C,w,x,y,Q=n.object,K=n.buffer,F=n.opaque,T=n.transparent;T.count=0;n=F.count=0;for(x=
 Q.materials.length;n<x;n++){C=Q.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(w=K.materials.length;C<w;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,w=n.lights.length,x,y=n.lights,Q=[],K,F,T,G,I,L=n.__webglShadowVolumes.length;for(C=0;C<w;C++){x=n.lights[C];if(x instanceof THREE.DirectionalLight){Q[0]=-x.position.x;Q[1]=-x.position.y;Q[2]=-x.position.z;for(I=0;I<L;I++){x=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;F=x.materials[0];F.program||ha.initMaterial(F,y,undefined,x);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)}x.matrixWorld.flattenToArray(x._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,x._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 w,x,y;w=_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);
+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);qa="";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 w,x,y;w=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,F,T=[],G=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;qa="";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(w.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);w=0;for(x=n.__webglSprites.length;w<x;w++){y=n.__webglSprites[w];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);w=0;for(x=n.__webglSprites.length;w<x;w++){y=n.__webglSprites[w];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 w,x,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;w=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(w.vertex,
-2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.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(x=0;x<y;x++){w=n.__webglLensFlares[x].object;T.set(w.matrixWorld.n14,w.matrixWorld.n24,w.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);w.positionScreen.x=qa[0];w.positionScreen.y=qa[1];w.positionScreen.z=qa[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=w.lensFlares.length;Q<K;Q++){F=w.lensFlares[Q];if(F.opacity>0.001&&F.scale>0.001){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,w,x,y,Q;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){x=
-w.geometryGroups[C];Q=!1;for(y in x.__webglCustomAttributes)if(x.__webglCustomAttributes[y].needsUpdate){Q=!0;break}if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__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=x.__vertexArray,ib=x.__uvArray,jb=x.__uv2Array,Pa=x.__normalArray,V=x.__tangentArray,na=x.__colorArray,ea=x.__skinVertexAArray,$=x.__skinVertexBArray,ta=x.__skinIndexArray,ra=x.__skinWeightArray,
-ya=x.__morphTargetsArrays,X=x.__webglCustomAttributes;v=void 0;var Ia=x.__faceArray,Ya=x.__lineArray,eb=x.__needsSmoothNormals;Ka=x.__vertexColorType;qa=x.__uvType;Ca=x.__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=x.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,
+!1,y._modelViewMatrixArray)}F=y.map.image.width/(y.affectedByDistance?1:ja);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);M(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 w,x,y=n.__webglLensFlares.length,Q,K,F,T=new THREE.Vector3,G=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*G,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;w=P.attributes;e.useProgram(P.program);Aa=P.program;qa="";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(w.vertex,
+2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.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(x=0;x<y;x++){w=n.__webglLensFlares[x].object;T.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(T);C.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]*
+L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){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,ra);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);w.positionScreen.x=ra[0];w.positionScreen.y=ra[1];w.positionScreen.z=ra[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=w.lensFlares.length;Q<K;Q++){F=w.lensFlares[Q];if(F.opacity>0.0010&&F.scale>0.0010){ra[0]=F.x;ra[1]=F.y;ra[2]=F.z;Z=F.size*F.scale/ja;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);
+e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);U(F.blending);M(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,w,x,y,Q;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){x=
+w.geometryGroups[C];Q=!1;for(y in x.__webglCustomAttributes)if(x.__webglCustomAttributes[y].needsUpdate){Q=!0;break}if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__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,ra=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,N=0,Na=0;aa=D=0;var Ra=x.__vertexArray,ib=x.__uvArray,jb=x.__uv2Array,Pa=x.__normalArray,V=x.__tangentArray,na=x.__colorArray,ea=x.__skinVertexAArray,$=x.__skinVertexBArray,ua=x.__skinIndexArray,sa=x.__skinWeightArray,
+ya=x.__morphTargetsArrays,X=x.__webglCustomAttributes;v=void 0;var Ia=x.__faceArray,Ya=x.__lineArray,eb=x.__needsSmoothNormals;Ka=x.__vertexColorType;ra=x.__uvType;Ca=x.__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=x.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;
+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];sa[N]=D.x;sa[N+1]=D.y;sa[N+2]=D.z;sa[N+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;
+D=qb[G.a];aa=qb[G.b];v=qb[G.c];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];$[N]=D.x;$[N+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;
+$[N+11]=1;N+=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&&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(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;
+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];sa[N]=D.x;sa[N+1]=D.y;
+sa[N+2]=D.z;sa[N+3]=D.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=v.x;sa[N+9]=v.y;sa[N+10]=v.z;sa[N+11]=v.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;sa[N+15]=ab.w;D=qb[G.a];aa=qb[G.b];v=qb[G.c];ab=qb[G.d];ua[N]=D.x;ua[N+1]=D.y;ua[N+2]=D.z;ua[N+3]=D.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=v.x;ua[N+9]=v.y;ua[N+10]=v.z;ua[N+11]=v.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;D=ob[G.a];aa=ob[G.b];v=ob[G.c];ab=ob[G.d];ea[N]=D.x;ea[N+1]=D.y;ea[N+2]=D.z;
+ea[N+3]=1;ea[N+4]=aa.x;ea[N+5]=aa.y;ea[N+6]=aa.z;ea[N+7]=1;ea[N+8]=v.x;ea[N+9]=v.y;ea[N+10]=v.z;ea[N+11]=1;ea[N+12]=ab.x;ea[N+13]=ab.y;ea[N+14]=ab.z;ea[N+15]=1;D=pb[G.a];aa=pb[G.b];v=pb[G.c];G=pb[G.d];$[N]=D.x;$[N+1]=D.y;$[N+2]=D.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=v.x;$[N+9]=v.y;$[N+10]=v.z;$[N+11]=1;$[N+12]=G.x;$[N+13]=G.y;$[N+14]=G.z;$[N+15]=1;N+=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+
+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){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,x.__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,x.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,ya[D],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);
 e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,V,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
-Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(M>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ta,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ra,Q)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=
-!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.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=x[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)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.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=x[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)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&d(w,e.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function W(n){function C(Z){var Y=
+Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ea,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=
+!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=
+0;F<Q;F++){color=x[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)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;x=n.colors;Ca=Ka.length;Q=x.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){ra=Ka[F].position;y=F*3;Ha[y]=ra.x;Ha[y+1]=ra.y;Ha[y+2]=
+ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<Q;F++){color=x[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)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&d(w,e.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function W(n){function C(Z){var Y=
 [];w=0;for(x=Z.length;w<x;w++)Z[w]==undefined?Y.push("undefined"):Y.push(Z[w].id);return Y.join("_")}var w,x,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,w){n.push({buffer:C,object:w,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,w){if((w.width&w.width-1)==0&&(w.height&w.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();
+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,w){n.push({buffer:C,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function U(n){if(n!=qa){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)}qa=n}}function O(n,C,w){if((w.width&w.width-1)==0&&(w.height&w.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 M(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}O(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 va(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,
 n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
-n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,w;if(n){C=n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=Fa;n=ia}if(C!=ka){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ja,ma,w,n);ka=C}}function la(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,
+n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,w;if(n){C=n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=Fa;n=ja}if(C!=ia){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,ma,w,n);ia=C}}function la(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,
 C);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(C);return null}return w}function 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;
 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,
+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,ia=null,fa=!0,wa=null,ta=null,qa=null,ca=null,ka=0,ma=0,Fa=0,ja=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,w,x){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:x})))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,w)})(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]=
@@ -304,7 +305,7 @@ la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{P.hasVertexTexture=!0;
 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,w,x){ja=n;ma=C;Fa=w;ia=x;e.viewport(ja,ma,Fa,ia)};this.setScissor=function(n,C,w,x){e.scissor(n,C,w,x)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=
+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,w,x){ka=n;ma=C;Fa=w;ja=x;e.viewport(ka,ma,Fa,ja)};this.setScissor=function(n,C,w,x){e.scissor(n,C,w,x)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=
 n;e.depthMask(n)};this.setClearColorHex=function(n,C){var w=new THREE.Color(n);e.clearColor(w.r,w.g,w.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=n};this.initMaterial=function(n,C,w,x){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(x!==undefined&&x instanceof THREE.SkinnedMesh)I=x.bones.length;var L;a:{T=n.fragmentShader;G=n.vertexShader;F=n.uniforms;C=n.attributes;w={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:w,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,
@@ -316,17 +317,17 @@ Y=T;F=0;for(T=Y.length;F<T;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}T
 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++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(y=this.maxMorphTargets;n<y;n++)x.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,w,x){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(w);(this.autoClear||x)&&this.clear();T=n.__webglObjects.length;for(x=0;x<T;x++){y=n.__webglObjects[x];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);
+C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(w);(this.autoClear||x)&&this.clear();T=n.__webglObjects.length;for(x=0;x<T;x++){y=n.__webglObjects[x];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(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];I=y.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);H(I,C);p(y)}}U(THREE.NormalBlending);for(x=0;x<T;x++){y=n.__webglObjects[x];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(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];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(x=0;x<T;x++){y=n.__webglObjects[x];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(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];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&&
+Q=c(C,Z,Y,F,I);I.render(function(ra){g(ra,Q,F.shading)})}}}for(x=0;x<T;x++){y=n.__webglObjects[x];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(x=0;x<G;x++){y=n.__webglObjectsImmediate[x];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(ra){g(ra,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(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],w=n,x=void 0,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(x in y.geometryGroups){Q=y.geometryGroups[x];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<
+Q;F=C;var G=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=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;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=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=
+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(ra*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=ra*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];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();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(w.__webglShadowVolumes,Q,C):B(w.__webglObjects,Q,C)}}else if(C instanceof THREE.LensFlare)B(w.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__webglVertexCount=
 Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(C instanceof THREE.Line){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__webglLineCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(C instanceof THREE.ParticleSystem){y=C.geometry;if(!y.__webglVertexBuffer){x=y;x.__webglVertexBuffer=
 e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=y;Q=x.vertices.length;x.__vertexArray=new Float32Array(Q*3);x.__colorArray=new Float32Array(Q*3);x.__sortArray=[];x.__webglParticleCount=Q;y.__dirtyVertices=!0;y.__dirtyColors=!0}B(w.__webglObjects,y,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)w.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&w.__webglSprites.push(C);n.__objectsAdded.splice(0,
@@ -373,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.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=
+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=
 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=
@@ -385,14 +386,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
 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.005;this.lookVertical=
+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=
 !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.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.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=
+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=
 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;
@@ -406,17 +407,17 @@ THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.forward=
 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.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,J,W,B,U,O,M,va){var la,pa,ga=f||1,ha=g||1,e=U/2,oa=O/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,ia=ha+1;U/=ga;var fa=O/ha;for(pa=0;pa<ia;pa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[H]=(O*U-e)*W;wa[J]=(pa*fa-oa)*B;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(pa=0;pa<ha;pa++)for(O=0;O<ga;O++){p.faces.push(new THREE.Face4(O+
+Aa*pa+Da,O+Aa*(pa+1)+Da,O+1+Aa*(pa+1)+Da,O+1+Aa*pa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/ga,pa/ha),new THREE.UV(O/ga,(pa+1)/ha),new THREE.UV((O+1)/ga,(pa+1)/ha),new THREE.UV((O+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],O=!1,M=0,va=H.length;M<va;M++){var la=
+H[M];if(U.position.x==la.position.x&&U.position.y==la.position.y&&U.position.z==la.position.z){J[W]=M;O=!0;break}}if(!O){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.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);
+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);
 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.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
@@ -435,45 +436,45 @@ Math.LN2));k.image.width=p;k.image.height=t;k.image.getContext("2d").drawImage(t
 "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,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];
+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,O=b.colors;o=b.scale!==undefined?b.scale:1;var M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;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<M;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<M;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(O[p]);E.color=p}if(u)for(g=0;g<o;g++){p=B[k++];p=new THREE.Color(O[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];
 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,w,x;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);w=k(b,R+fa);x=k(b,R+va);R=k(b,R+sa);THREE.BinaryLoader.prototype.f4n(J,U,S,P,Ba,La,n,C,w,x,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,
+S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);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+M);Ba=k(b,R+va);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,w,x;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+ia);w=k(b,R+fa);x=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(J,U,S,P,Ba,La,n,C,w,x,R)}function E(R){var S,P;S=k(b,R);P=k(b,R+qa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function H(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var J=this,
+W=0,B,U=[],O=[],M,va,la,pa,ga,ha,e,oa,Da,Aa,ia,fa,wa,ta,qa,ca,ka,ma,Fa,ja,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;M=B.vertex_index_bytes;va=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;ia=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;wa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;ta=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;qa=B.uv_index_bytes;ca=B.uv_index_bytes*2;ka=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;
+ja=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);O.push(S,P)}return B.nuvs*Ba}(W);ja=W+ja;da=ja+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+=
+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})(ja);(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.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)}}};
+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(qa,ca){return ca=="relativeToHTML"?qa:h+"/"+qa}function m(){for(u in ga.objects)if(!ia.objects[u]){W=ga.objects[u];if(M=ia.geometries[W.geometry]){pa=[];for(ta=0;ta<W.materials.length;ta++)pa[ta]=ia.materials[W.materials[ta]];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(M,pa);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;ia.scene.addObject(object);ia.objects[u]=object;if(W.meshCollider){var qa=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(qa)}if(W.castsShadow){qa=new THREE.ShadowVolume(M);ia.scene.addChild(qa);
+qa.position=object.position;qa.rotation=object.rotation;qa.scale=object.scale}}}}function o(qa){return function(ca){ia.geometries[qa]=ca;m();e-=1;p()}}function p(){f({total_models:Da,total_textures:Aa,loaded_models:Da-e,loaded_textures:Aa-oa},ia);e==0&&oa==0&&c(ia)}var t,z,u,A,E,H,J,W,B,U,O,M,va,la,pa,ga,ha,e,oa,Da,Aa,ia;ga=j.data;j=new THREE.BinaryLoader;ha=new THREE.JSONLoader;oa=e=0;ia={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(ga.transform){var fa=
+ga.transform.position;U=ga.transform.rotation;var wa=ga.transform.scale;fa&&ia.scene.position.set(fa[0],fa[1],fa[2]);U&&ia.scene.rotation.set(U[0],U[1],U[2]);wa&&ia.scene.scale.set(wa[0],wa[1],wa[2]);(fa||U||wa)&&ia.scene.updateMatrix()}fa=function(){oa-=1;p()};for(E in ga.cameras){U=ga.cameras[E];if(U.type=="perspective")va=new THREE.Camera(U.fov,U.aspect,U.near,U.far);else if(U.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(U.left,U.right,U.top,U.bottom,U.near,U.far)}B=
+U.position;U=U.target;va.position.set(B[0],B[1],B[2]);va.target.position.set(U[0],U[1],U[2]);ia.cameras[E]=va}for(A in ga.lights){E=ga.lights[A];va=E.color!==undefined?E.color:16777215;U=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){B=E.direction;light=new THREE.DirectionalLight(va,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(va,U);light.position.set(B[0],B[1],B[2])}ia.scene.addLight(light);ia.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]);ia.fogs[H]=la}if(ia.cameras&&ga.defaults.camera)ia.currentCamera=ia.cameras[ga.defaults.camera];if(ia.fogs&&ga.defaults.fog)ia.scene.fog=ia.fogs[ga.defaults.fog];U=ga.defaults.bgcolor;ia.bgColor=new THREE.Color;ia.bgColor.setRGB(U[0],U[1],U[2]);ia.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"){M=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides);ia.geometries[t]=M}else if(H.type=="plane"){M=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);ia.geometries[t]=M}else if(H.type=="sphere"){M=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);ia.geometries[t]=M}else if(H.type=="cylinder"){M=new THREE.Cylinder(H.numSegs,
+H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);ia.geometries[t]=M}else if(H.type=="torus"){M=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);ia.geometries[t]=M}else if(H.type=="icosahedron"){M=new THREE.Icosahedron(H.subdivisions);ia.geometries[t]=M}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 ta=0;ta<t.url.length;ta++)H[ta]=k(t.url[ta],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]}ia.textures[J]=H}for(z in ga.materials){J=
+ga.materials[z];for(O in J.parameters)if(O=="envMap"||O=="map"||O=="lightMap")J.parameters[O]=ia.textures[J.parameters[O]];else if(O=="shading")J.parameters[O]=J.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")J.parameters[O]=THREE[J.parameters[O]]?THREE[J.parameters[O]]:THREE.NormalBlending;else if(O=="combine")J.parameters[O]=J.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(J.parameters[O]=="face")J.parameters[O]=
+THREE.FaceColors;else if(J.parameters[O])J.parameters[O]=THREE.VertexColors;J=new THREE[J.type](J.parameters);ia.materials[z]=J}m();d(ia)}}};
 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;
+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],O=this.field[z],M=this.field[u],va=this.field[A];H<j&&(E|=1);J<j&&(E|=2);W<j&&(E|=8);B<j&&(E|=4);U<j&&(E|=16);O<j&&(E|=32);M<j&&(E|=128);va<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+
+12,j,c,f,pa,U,O)}if(la&32){this.compNorm(z);this.compNorm(A);this.VIntY(z*3,this.vlist,this.nlist,15,j,ga,f,pa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ha,pa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,pa,U,M)}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,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,ga,ha,g,B,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ha,g,W,M)}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+
 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=

+ 5 - 4
build/custom/ThreeCanvas.js

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

+ 5 - 4
build/custom/ThreeDOM.js

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

+ 25 - 24
build/custom/ThreeExtras.js

@@ -33,7 +33,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,e,c,f=2*Math.ceil(a*3)+1;f>25&&(f=25);c=(f-1)*0.5;b=Array(f);for(d=e=0;d<f;++d){b[d]=Math.exp(-((d-c)*(d-c))/(2*a*a));e+=b[d]}for(d=0;d<f;++d)b[d]/=e;return b}};
-THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.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=
+THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;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=
@@ -45,14 +45,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
 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=
+16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !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=
+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.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==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=
 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;
@@ -66,8 +66,8 @@ THREE.RollCamera=function(a,d,b,e){THREE.Camera.call(this,a,d,b,e);this.forward=
 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]=
+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,Q=y/2,R=B/2,S=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 N=E+1,F=L+1;y/=E;var O=B/L;for(H=0;H<F;H++)for(B=0;B<N;B++){var P=new THREE.Vector3;P[u]=(B*y-Q)*z;P[A]=(H*O-R)*n;P[J]=G;k.vertices.push(new THREE.Vertex(P))}for(H=0;H<L;H++)for(B=0;B<E;B++){k.faces.push(new THREE.Face4(B+N*H+S,B+
+N*(H+1)+S,B+1+N*(H+1)+S,B+1+N*H+S,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));
@@ -76,7 +76,7 @@ e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.
 THREE.Icosahedron=function(a){function d(m,p,o){var x=Math.sqrt(m*m+p*p+o*o);return c.vertices.push(new THREE.Vertex(new THREE.Vector3(m/x,p/x,o/x)))-1}function b(m,p,o,x){x.faces.push(new THREE.Face3(m,p,o))}function e(m,p){var o=c.vertices[m].position,x=c.vertices[p].position;return d((o.x+x.x)/2,(o.y+x.y)/2,(o.z+x.z)/2)}var c=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var j=e(f.faces[h].a,f.faces[h].b),l=e(f.faces[h].b,f.faces[h].c),k=e(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,g);b(f.faces[h].b,l,j,g);b(f.faces[h].c,
 k,l,g);b(j,l,k,g)}f.faces=g.faces}c.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.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);
+THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.0010;j+=d){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=f;j==0&&(f=e);
 for(h=0;h<e.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,h/a.length),new THREE.UV(1-j/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,h/a.length)])}e=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(a,d,b,e){THREE.Geometry.call(this);var c,f=a/2,g=d/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var l=d/e;for(c=0;c<j;c++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-f,-(c*l-g),0)));for(c=0;c<e;c++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*c,d+h*(c+1),d+1+h*(c+1),d+1+h*c));this.faceVertexUvs[0].push([new THREE.UV(d/b,c/e),new THREE.UV(d/b,(c+1)/e),new THREE.UV((d+1)/b,(c+1)/e),new THREE.UV((d+1)/b,c/e)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
@@ -103,29 +103,30 @@ g=0;for(h=l.length;g<h;g+=3)j.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1
 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,
+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),T=k(t,v+3),V=(T<<1&255|I>>7)-127;C|=(I&127)<<16|D<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>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,T,V;v=h(a,t);C=h(a,t+G);D=h(a,t+K);I=j(a,t+J);T=h(a,t+H);V=h(a,t+E);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(A,y,v,C,D,I,T,V,t)}function o(t){var v,C,D,I;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);t=j(a,t+N);THREE.BinaryLoader.prototype.f4(A,v,C,D,I,t)}function x(t){var v,C,D,I,T,V,ca,da;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);T=j(a,
+t+N);V=h(a,t+F);ca=h(a,t+O);da=h(a,t+P);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(A,y,v,C,D,I,T,V,ca,da,t)}function w(t){var v,C;v=h(a,t);C=h(a,t+M);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,Q,R,S,N,F,O,P,
+U,M,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;Q=n.vertex_index_bytes;R=n.vertex_index_bytes*2;S=n.vertex_index_bytes*3;N=n.vertex_index_bytes*4;F=n.vertex_index_bytes*
+4+n.material_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;P=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;M=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,T=t+n.nvertices*I;t<T;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,T=t+n.nnormals*I;t<
+T;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.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(M,X){return X=="relativeToHTML"?M:f+"/"+M}function j(){for(o in E.objects)if(!F.objects[o]){z=E.objects[o];if(G=F.geometries[z.geometry]){H=[];for(U=0;U<z.materials.length;U++)H[U]=F.materials[z.materials[U]];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 M=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(M)}if(z.castsShadow){M=new THREE.ShadowVolume(G);F.scene.addChild(M);M.position=object.position;M.rotation=object.rotation;
+M.scale=object.scale}}}}function l(M){return function(X){F.geometries[M]=X;j();Q-=1;k()}}function k(){e({total_models:S,total_textures:N,loaded_models:S-Q,loaded_textures:N-R},F);Q==0&&R==0&&b(F)}var m,p,o,x,w,u,A,z,n,y,B,G,K,J,H,E,L,Q,R,S,N,F;E=g.data;g=new THREE.BinaryLoader;L=new THREE.JSONLoader;R=Q=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(E.transform){var O=E.transform.position;y=E.transform.rotation;var P=E.transform.scale;
+O&&F.scene.position.set(O[0],O[1],O[2]);y&&F.scene.rotation.set(y[0],y[1],y[2]);P&&F.scene.scale.set(P[0],P[1],P[2]);(O||y||P)&&F.scene.updateMatrix()}O=function(){R-=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")Q+=1}S=Q;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];R+=m.url instanceof Array?m.url.length:1}N=R;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 U=0;U<m.url.length;U++)u[U]=h(m.url[U],E.urlBaseType);u=THREE.ImageUtils.loadTextureCube(u,m.mapping,O)}else{u=THREE.ImageUtils.loadTexture(h(m.url,E.urlBaseType),m.mapping,O);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]-

+ 5 - 4
build/custom/ThreeSVG.js

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

+ 6 - 5
build/custom/ThreeWebGL.js

@@ -31,9 +31,10 @@ 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};
@@ -49,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;thi
 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=
 q*g+p*e-o*h,F=q*h+o*g-n*e;e=-o*e-n*g-p*h;d.x=v*q+e*-o+E*-p-F*-n;d.y=E*q+e*-n+F*-o-v*-p;d.z=F*q+e*-p+v*-n-E*-o;return d}};
-THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,g,h,o){this.a=b;this.b=d;this.c=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=o instanceof Array?o:[o];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,g,h,o,n){this.a=b;this.b=d;this.c=e;this.d=g;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=o instanceof THREE.Color?o:new THREE.Color;this.vertexColors=o instanceof Array?o:[];this.vertexTangents=[];this.materials=n instanceof Array?n:[n];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -203,7 +204,7 @@ u*m.scale.y;c.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y);c.uniform2f(w.uvOffse
 r){var j,k,m=f.__webglLensFlares.length,w,x,u,A=new THREE.Vector3,t=Aa/za,y=za*0.5,z=Aa*0.5,D=16/Aa,B=[D*t,D],O=[1,1,0],W=[1,1],P=J.uniforms;j=J.attributes;c.useProgram(J.program);sa=J.program;ha="";if(!pb){c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);pb=!0}c.uniform1i(P.occlusionMap,0);c.uniform1i(P.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(j.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
 J.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<m;k++){j=f.__webglLensFlares[k].object;A.set(j.matrixWorld.n14,j.matrixWorld.n24,j.matrixWorld.n34);r.matrixWorldInverse.multiplyVector3(A);r.projectionMatrix.multiplyVector3(A);O[0]=A.x;O[1]=A.y;O[2]=A.z;W[0]=O[0]*y+y;W[1]=O[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<za&&W[1]>0&&W[1]<Aa){c.bindTexture(c.TEXTURE_2D,J.tempTexture);
 c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,0);c.uniform2fv(P.scale,B);c.uniform3fv(P.screenPosition,O);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);j.positionScreen.x=
-O[0];j.positionScreen.y=O[1];j.positionScreen.z=O[2];j.customUpdateCallback?j.customUpdateCallback(j):j.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);w=0;for(x=j.lensFlares.length;w<x;w++){u=j.lensFlares[w];if(u.opacity>0.001&&u.scale>0.001){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/Aa;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);pa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,
+O[0];j.positionScreen.y=O[1];j.positionScreen.z=O[2];j.customUpdateCallback?j.customUpdateCallback(j):j.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);w=0;for(x=j.lensFlares.length;w<x;w++){u=j.lensFlares[w];if(u.opacity>0.0010&&u.scale>0.0010){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/Aa;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);pa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,
 6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function U(f,r){f._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var r,j,k,m,w;if(f instanceof THREE.Mesh){j=f.geometry;for(r in j.geometryGroups){k=j.geometryGroups[r];w=!1;for(m in k.__webglCustomAttributes)if(k.__webglCustomAttributes[m].needsUpdate){w=!0;break}if(j.__dirtyVertices||
 j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ta=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var s=void 0,G=void 0;z=void 0;s=void 0;G=void 0;var i=void 0,Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;
 G=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;s=void 0;G=void 0;i=void 0;var Va=void 0,ua=0,Ba=0,Za=0,$a=0,Ja=0,La=0,ea=0,Ma=0,wa=0,C=0,Ca=0;G=s=0;var Da=k.__vertexArray,fb=k.__uvArray,gb=k.__uv2Array,Qa=k.__normalArray,ia=k.__tangentArray,Ea=k.__colorArray,ja=k.__skinVertexAArray,ka=k.__skinVertexBArray,la=k.__skinIndexArray,ma=k.__skinWeightArray,hb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,qb=k.__needsSmoothNormals;W=k.__vertexColorType;

+ 14 - 0
src/extras/io/SceneLoader.js

@@ -152,6 +152,20 @@ THREE.SceneLoader.prototype = {
 
 							}
 
+							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;
+
+							}
+							
 						}
 
 

+ 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()