瀏覽代碼

Added CrosseyedWebGLRenderer.

alteredq 14 年之前
父節點
當前提交
dcbcf72f55

+ 151 - 147
build/Three.js

@@ -14,19 +14,19 @@ b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,d){return b.distance-d.distance});return e},intersectObject:function(b){function c(b,d,c){var e;e=c.position.clone().subSelf(b).dot(d);if(e<0)return!1;b=b.clone().addSelf(d.clone().multiplyScalar(e));return c.position.distanceTo(b)}function d(b,d,c,e){var e=e.clone().subSelf(d),c=c.clone().subSelf(d),
 f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(b*h-d*d),h=(h*e-d*c)*f,b=(b*c-d*e)*f;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,h,j,k,m,o,n,p,t,u,v=b.geometry,
-C=v.vertices,E=[],e=0;for(f=v.faces.length;e<f;e++)if(h=v.faces[e],t=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(C[h.a].position.clone()),k=o.multiplyVector3(C[h.b].position.clone()),m=o.multiplyVector3(C[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(C[h.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),p=u.dot(n),b.doubleSided||(b.flipSided?p>0:p<0))if(n=n.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(u.multiplyScalar(n)),
+z=v.vertices,E=[],e=0;for(f=v.faces.length;e<f;e++)if(h=v.faces[e],t=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(z[h.a].position.clone()),k=o.multiplyVector3(z[h.b].position.clone()),m=o.multiplyVector3(z[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(z[h.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),p=u.dot(n),b.doubleSided||(b.flipSided?p>0:p<0))if(n=n.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(u.multiplyScalar(n)),
 h instanceof THREE.Face3)d(t,j,k,m)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,o)||d(t,k,m,o)))h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h);return E}else return[]}};
 THREE.Rectangle=function(){function b(){h=e-c;j=f-d}var c,d,e,f,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,j,n,p){k=!1;c=h;d=j;e=n;f=p;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,e=h,f=j):(c=c<h?c:h,d=d<j?d:j,e=e>h?e:h,f=f>j?f:j);b()};this.add3Points=
 function(h,j,n,p,t,u){k?(k=!1,c=h<n?h<t?h:t:n<t?n:t,d=j<p?j<u?j:u:p<u?p:u,e=h>n?h>t?h:t:n>t?n:t,f=j>p?j>u?j:u:p>u?p:u):(c=h<n?h<t?h<c?h:c:t<c?t:c:n<t?n<c?n:c:t<c?t:c,d=j<p?j<u?j<d?j:d:u<d?u:d:p<u?p<d?p:d:u<d?u:d,e=h>n?h>t?h>e?h:e:t>e?t:e:n>t?n>e?n:e:t>e?t:e,f=j>p?j>u?j>f?j:f:u>f?u:f:p>u?p>f?p:f:u>f?u:f);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),f=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
 h.getBottom()?f:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;f+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(f,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;f=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,h,j,k,m,o,n,p,t,u,v,C){this.set(b||1,c||0,d||0,e||0,f||0,h||1,j||0,k||0,m||0,o||0,n||1,p||0,t||0,u||0,v||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,d,e,f,h,j,k,m,o,n,p,t,u,v,C){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=p;this.n41=t;this.n42=u;this.n43=v;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,h,j,k,m,o,n,p,t,u,v,z){this.set(b||1,c||0,d||0,e||0,f||0,h||1,j||0,k||0,m||0,o||0,n||1,p||0,t||0,u||0,v||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,d,e,f,h,j,k,m,o,n,p,t,u,v,z){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=p;this.n41=t;this.n42=u;this.n43=v;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23*
 e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44,D=c.n11,x=c.n12,I=c.n13,A=c.n14,z=c.n21,S=c.n22,
-G=c.n23,M=c.n24,F=c.n31,N=c.n32,g=c.n33,Y=c.n34;this.n11=d*D+e*z+f*F;this.n12=d*x+e*S+f*N;this.n13=d*I+e*G+f*g;this.n14=d*A+e*M+f*Y+h;this.n21=j*D+k*z+m*F;this.n22=j*x+k*S+m*N;this.n23=j*I+k*G+m*g;this.n24=j*A+k*M+m*Y+o;this.n31=n*D+p*z+t*F;this.n32=n*x+p*S+t*N;this.n33=n*I+p*G+t*g;this.n34=n*A+p*M+t*Y+u;this.n41=v*D+C*z+E*F;this.n42=v*x+C*S+E*N;this.n43=v*I+C*G+E*g;this.n44=v*A+C*M+E*Y+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,E=b.n43,y=b.n44,D=c.n11,x=c.n12,J=c.n13,C=c.n14,B=c.n21,S=c.n22,
+G=c.n23,M=c.n24,F=c.n31,N=c.n32,g=c.n33,Y=c.n34;this.n11=d*D+e*B+f*F;this.n12=d*x+e*S+f*N;this.n13=d*J+e*G+f*g;this.n14=d*C+e*M+f*Y+h;this.n21=j*D+k*B+m*F;this.n22=j*x+k*S+m*N;this.n23=j*J+k*G+m*g;this.n24=j*C+k*M+m*Y+o;this.n31=n*D+p*B+t*F;this.n32=n*x+p*S+t*N;this.n33=n*J+p*G+t*g;this.n34=n*C+p*M+t*Y+u;this.n41=v*D+z*B+E*F;this.n42=v*x+z*S+E*N;this.n43=v*J+z*G+E*g;this.n44=v*C+z*M+E*Y+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
 this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
-this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,p=this.n34,t=this.n41,u=this.n42,v=this.n43,C=this.n44;return e*j*o*t-d*k*o*t-e*h*n*t+c*k*n*t+d*h*p*t-c*j*p*t-e*j*m*u+d*k*m*u+e*f*n*u-b*k*n*u-d*f*p*u+b*j*p*u+e*h*m*v-c*k*m*v-e*f*o*v+b*k*o*v+c*f*p*v-b*h*p*v-d*h*m*C+c*j*m*C+d*f*o*C-b*j*o*C-c*f*n*C+b*h*n*C},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.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,p=this.n34,t=this.n41,u=this.n42,v=this.n43,z=this.n44;return e*j*o*t-d*k*o*t-e*h*n*t+c*k*n*t+d*h*p*t-c*j*p*t-e*j*m*u+d*k*m*u+e*f*n*u-b*k*n*u-d*f*p*u+b*j*p*u+e*h*m*v-c*k*m*v-e*f*o*v+b*k*o*v+c*f*p*v-b*h*p*v-d*h*m*z+c*j*m*z+d*f*o*z-b*j*o*z-c*f*n*z+b*h*n*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
 this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
 this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,
@@ -35,8 +35,8 @@ h+d,m*j-e*k,m*k+e*j,0,m*j+e*k,o*j+d,o*k-e*h,0,m*k-e*j,o*k+e*h,f*k*k+d,0,0,0,0,1)
 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 c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=k*h+b*e;this.n22=-k*e+b*h;this.n23=-c*f;this.n31=-j*h+c*e;this.n32=j*e+c*h;this.n33=b*f;return this},
 setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,h=c+c,j=d+d,k=e+e,b=c*h,m=c*j;c*=k;var o=d*j;d*=k;e*=k;h*=f;j*=f;f*=k;this.n11=1-(o+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*C-o*t*C+o*p*E-k*u*E-m*p*y+k*t*y;c.n12=h*t*C-f*u*C-h*p*E+e*u*E+f*p*y-e*t*y;c.n13=f*o*C-h*m*C+h*k*E-e*o*E-f*k*y+e*m*y;c.n14=h*m*p-f*o*p-h*k*t+e*o*t+f*k*u-e*m*u;c.n21=o*t*v-m*u*v-o*n*E+j*u*E+m*n*y-j*t*y;c.n22=f*u*v-h*t*v+h*n*E-d*u*E-f*n*y+d*t*y;c.n23=h*m*v-f*o*v-h*j*E+d*o*E+f*j*y-d*m*y;c.n24=
-f*o*n-h*m*n+h*j*t-d*o*t-f*j*u+d*m*u;c.n31=k*u*v-o*p*v+o*n*C-j*u*C-k*n*y+j*p*y;c.n32=h*p*v-e*u*v-h*n*C+d*u*C+e*n*y-d*p*y;c.n33=f*o*v-h*k*v+h*j*C-d*o*C-e*j*y+d*k*y;c.n34=h*k*n-e*o*n-h*j*p+d*o*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*n*C+j*t*C+k*n*E-j*p*E;c.n42=e*t*v-f*p*v+f*n*C-d*t*C-e*n*E+d*p*E;c.n43=f*k*v-e*m*v-f*j*C+d*m*C+e*j*E-d*k*E;c.n44=e*m*n-f*k*n+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,E=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*z-o*t*z+o*p*E-k*u*E-m*p*y+k*t*y;c.n12=h*t*z-f*u*z-h*p*E+e*u*E+f*p*y-e*t*y;c.n13=f*o*z-h*m*z+h*k*E-e*o*E-f*k*y+e*m*y;c.n14=h*m*p-f*o*p-h*k*t+e*o*t+f*k*u-e*m*u;c.n21=o*t*v-m*u*v-o*n*E+j*u*E+m*n*y-j*t*y;c.n22=f*u*v-h*t*v+h*n*E-d*u*E-f*n*y+d*t*y;c.n23=h*m*v-f*o*v-h*j*E+d*o*E+f*j*y-d*m*y;c.n24=
+f*o*n-h*m*n+h*j*t-d*o*t-f*j*u+d*m*u;c.n31=k*u*v-o*p*v+o*n*z-j*u*z-k*n*y+j*p*y;c.n32=h*p*v-e*u*v-h*n*z+d*u*z+e*n*y-d*p*y;c.n33=f*o*v-h*k*v+h*j*z-d*o*z-e*j*y+d*k*y;c.n34=h*k*n-e*o*n-h*j*p+d*o*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*n*z+j*t*z+k*n*E-j*p*E;c.n42=e*t*v-f*p*v+f*n*z-d*t*z-e*n*E+d*p*E;c.n43=f*k*v-e*m*v-f*j*z+d*m*z+e*j*E-d*k*E;c.n44=e*m*n-f*k*n+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
 THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-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,n=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*o;d[7]=b*n;d[8]=b*p;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,e,f,h){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+f)/(h-f);j.n34=-2*h*f/(h-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)};
 THREE.Matrix4.makeOrtho=function(b,c,d,e,f,h){var j,k,m,o;j=new THREE.Matrix4;k=c-b;m=d-e;o=h-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+f)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;thi
 e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
 multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*h+d*k-e*j;this.y=d*b+f*j+e*h-c*k;this.z=e*b+f*k+c*j-d*h;this.w=f*b-c*h-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*d+j*f-k*e,n=
 m*e+k*d-h*f,p=m*f+h*e-j*d,d=-h*d-j*e-k*f;c.x=o*m+d*-h+n*-k-p*-j;c.y=n*m+d*-j+p*-h-o*-k;c.z=p*m+d*-k+o*-j-n*-h;return c}};
-THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,e,f,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,f,h,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -58,8 +58,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f
 d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,f,h,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),m.sub(c.position,d.position),k.crossSelf(m);k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,e,h,f,G){k=b.vertices[d].position;m=b.vertices[c].position;o=b.vertices[e].position;n=j[h];p=j[f];t=j[G];u=m.x-k.x;v=o.x-k.x;C=m.y-k.y;E=o.y-k.y;y=m.z-k.z;D=o.z-k.z;x=p.u-n.u;I=t.u-n.u;A=p.v-n.v;z=t.v-n.v;S=1/(x*z-I*A);N.set((z*u-A*v)*
-S,(z*C-A*E)*S,(z*y-A*D)*S);g.set((x*v-I*u)*S,(x*E-I*C)*S,(x*D-I*y)*S);M[d].addSelf(N);M[c].addSelf(N);M[e].addSelf(N);F[d].addSelf(g);F[c].addSelf(g);F[e].addSelf(g)}var c,d,e,f,h,j,k,m,o,n,p,t,u,v,C,E,y,D,x,I,A,z,S,G,M=[],F=[],N=new THREE.Vector3,g=new THREE.Vector3,Y=new THREE.Vector3,O=new THREE.Vector3,V=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)M[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,e,h,f,G){k=b.vertices[d].position;m=b.vertices[c].position;o=b.vertices[e].position;n=j[h];p=j[f];t=j[G];u=m.x-k.x;v=o.x-k.x;z=m.y-k.y;E=o.y-k.y;y=m.z-k.z;D=o.z-k.z;x=p.u-n.u;J=t.u-n.u;C=p.v-n.v;B=t.v-n.v;S=1/(x*B-J*C);N.set((B*u-C*v)*
+S,(B*z-C*E)*S,(B*y-C*D)*S);g.set((x*v-J*u)*S,(x*E-J*z)*S,(x*D-J*y)*S);M[d].addSelf(N);M[c].addSelf(N);M[e].addSelf(N);F[d].addSelf(g);F[c].addSelf(g);F[e].addSelf(g)}var c,d,e,f,h,j,k,m,o,n,p,t,u,v,z,E,y,D,x,J,C,B,S,G,M=[],F=[],N=new THREE.Vector3,g=new THREE.Vector3,Y=new THREE.Vector3,O=new THREE.Vector3,V=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)M[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
 THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var L=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)V.copy(h.vertexNormals[e]),f=h[L[e]],G=M[f],Y.copy(G),Y.subSelf(V.multiplyScalar(V.dot(G))).normalize(),O.cross(h.vertexNormals[e],G),f=O.dot(F[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Y.x,Y.y,Y.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function c(b,d,c){b[d]===
@@ -123,12 +123,12 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
 this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,h,j,k,m,o,n,p,t,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var C=v.egdes=this.geometry.edges,E=v.edgeFaces=[];f=0;var y=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],y.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
-d.normal;b=0;for(c=C.length;b<c;b++)k=C[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],h=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",n=y[f]+0):d.b===j?(m="b",n=y[f]+1):d.c===j?(m="c",n=y[f]+2):d.d===j&&(m="d",n=y[f]+3),d.a===k?(m+="a",p=y[f]+0):d.b===k?(m+="b",p=y[f]+1):d.c===k?(m+="c",p=y[f]+2):d.d===k&&(m+="d",p=y[f]+3),e.a===j?(o="a",t=y[h]+0):e.b===j?(o="b",t=y[h]+1):e.c===j?(o="c",t=y[h]+2):e.d===j&&(o="d",t=y[h]+3),e.a===k?(o+="a",u=y[h]+0):e.b===k?(o+="b",u=y[h]+
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,h,j,k,m,o,n,p,t,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var z=v.egdes=this.geometry.edges,E=v.edgeFaces=[];f=0;var y=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],y.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
+d.normal;b=0;for(c=z.length;b<c;b++)k=z[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],h=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",n=y[f]+0):d.b===j?(m="b",n=y[f]+1):d.c===j?(m="c",n=y[f]+2):d.d===j&&(m="d",n=y[f]+3),d.a===k?(m+="a",p=y[f]+0):d.b===k?(m+="b",p=y[f]+1):d.c===k?(m+="c",p=y[f]+2):d.d===k&&(m+="d",p=y[f]+3),e.a===j?(o="a",t=y[h]+0):e.b===j?(o="b",t=y[h]+1):e.c===j?(o="c",t=y[h]+2):e.d===j&&(o="d",t=y[h]+3),e.a===k?(o+="a",u=y[h]+0):e.b===k?(o+="b",u=y[h]+
 1):e.c===k?(o+="c",u=y[h]+2):e.d===k&&(o+="d",u=y[h]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?n>p&&(d=n,n=p,p=d):n<p&&(d=n,n=p,p=d),o==="ac"||o==="ad"||o==="ca"||o==="da"?t>u&&(d=t,t=u,u=d):t<u&&(d=t,t=u,u=d),d=new THREE.Face4(n,p,t,u),d.normal.set(1,0,0),E.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,h=f.length,j,k,m,o,n,p=["a","b","c","d"];for(m=0;m<h;m++){k=c.length;j=f[m];j instanceof THREE.Face4?(o=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(o=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
 for(k=0;k<o;k++)n=b[j[p[k]]],c.push(new THREE.Vertex(n.position.clone()))}for(h=0;h<f.length-1;h++){b=d[h];for(j=h+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,h,j,k,m,o,n,p,t,u,v,C,E=0,y=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){h=c[y[v]];k=b[h];for(C=0;C<f;C++)if(j=d[y[C]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(E++,E===1&&(o=k,n=m,p=h,t=j,u=y[v]),E===2))return u+=y[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[o,n,m,k],indices:[p,t,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,h,j,k,m,o,n,p,t,u,v,z,E=0,y=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){h=c[y[v]];k=b[h];for(z=0;z<f;z++)if(j=d[y[z]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(E++,E===1&&(o=k,n=m,p=h,t=j,u=y[v]),E===2))return u+=y[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[o,n,m,k],indices:[p,t,
 j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[o,k,m,n],indices:[p,h,j,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=
 b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
@@ -138,56 +138,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.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 c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,e=1,h=b.z+b.w,f=d.z+d.w,j=-b.z+b.w,k=-d.z+d.w;return h>=0&&f>=0&&j>=0&&k>=0?!0:h<0&&f<0||j<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-f)):f<0&&(e=Math.min(e,h/(h-f))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var e,f,h=[],j,k,m=[],o,n,p=[],t,u=[],v,C,E=[],y,D,x=[],I=new THREE.Vector4,A=new THREE.Vector4,
-z=new THREE.Matrix4,S=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,d){z.multiply(d.projectionMatrix,d.matrixWorldInverse);z.multiplyVector3(b);return b};this.unprojectVector=function(b,d){z.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));z.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],k,m,o;f=0;m=
-b.objects;b=0;for(k=m.length;b<k;b++){o=m[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=G[u].x*n.n14+G[u].y*n.n24+G[u].z*n.n34+G[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=h[f]=h[f]||new THREE.RenderableObject,f++,e=p,I.copy(o.position),z.multiplyVector3(I),e.object=o,e.z=I.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,g,h){var f=[],
-I=g.near,L=g.far,$,T,Q,fa,U,ka,ga,ca,aa,R,P,W,X,ea,ha,J,da;D=C=t=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);e.update(void 0,!1,g);z.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);G[1].set(z.n41+z.n11,z.n42+z.n12,z.n43+z.n13,z.n44+z.n14);G[2].set(z.n41+z.n21,z.n42+z.n22,z.n43+z.n23,z.n44+z.n24);G[3].set(z.n41-z.n21,z.n42-z.n22,z.n43-z.n23,z.n44-z.n24);G[4].set(z.n41-z.n31,z.n42-z.n32,z.n43-z.n33,z.n44-z.n34);G[5].set(z.n41+z.n31,z.n42+z.n32,
-z.n43+z.n33,z.n44+z.n34);for($=0;$<6;$++)aa=G[$],aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z));aa=this.projectObjects(e,g,!0);e=0;for($=aa.length;e<$;e++)if(R=aa[e].object,R.visible)if(P=R.matrixWorld,W=R.matrixRotationWorld,X=R.materials,ea=R.overdraw,k=0,R instanceof THREE.Mesh){ha=R.geometry;fa=ha.vertices;J=ha.faces;ha=ha.faceVertexUvs;T=0;for(Q=fa.length;T<Q;T++)j=b(),j.positionWorld.copy(fa[T].position),P.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),z.multiplyVector4(j.positionScreen),
-j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>I&&j.positionScreen.z<L;fa=0;for(T=J.length;fa<T;fa++){Q=J[fa];if(Q instanceof THREE.Face3)if(U=m[Q.a],ka=m[Q.b],ga=m[Q.c],U.visible&&ka.visible&&ga.visible&&(R.doubleSided||R.flipSided!=(ga.positionScreen.x-U.positionScreen.x)*(ka.positionScreen.y-U.positionScreen.y)-(ga.positionScreen.y-U.positionScreen.y)*(ka.positionScreen.x-U.positionScreen.x)<0))ca=p[n]=p[n]||new THREE.RenderableFace3,
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,e=1,h=b.z+b.w,f=d.z+d.w,j=-b.z+b.w,k=-d.z+d.w;return h>=0&&f>=0&&j>=0&&k>=0?!0:h<0&&f<0||j<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-f)):f<0&&(e=Math.min(e,h/(h-f))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var e,f,h=[],j,k,m=[],o,n,p=[],t,u=[],v,z,E=[],y,D,x=[],J=new THREE.Vector4,C=new THREE.Vector4,
+B=new THREE.Matrix4,S=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,d){B.multiply(d.projectionMatrix,d.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,d){B.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],k,m,o;f=0;m=
+b.objects;b=0;for(k=m.length;b<k;b++){o=m[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=G[u].x*n.n14+G[u].y*n.n24+G[u].z*n.n34+G[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=h[f]=h[f]||new THREE.RenderableObject,f++,e=p,J.copy(o.position),B.multiplyVector3(J),e.object=o,e.z=J.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,g,h){var f=[],
+J=g.near,L=g.far,$,T,Q,fa,U,ka,ga,ca,aa,R,P,W,X,ea,ia,I,da;D=z=t=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);e.update(void 0,!1,g);B.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);G[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);G[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);G[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);G[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);G[5].set(B.n41+B.n31,B.n42+B.n32,
+B.n43+B.n33,B.n44+B.n34);for($=0;$<6;$++)aa=G[$],aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z));aa=this.projectObjects(e,g,!0);e=0;for($=aa.length;e<$;e++)if(R=aa[e].object,R.visible)if(P=R.matrixWorld,W=R.matrixRotationWorld,X=R.materials,ea=R.overdraw,k=0,R instanceof THREE.Mesh){ia=R.geometry;fa=ia.vertices;I=ia.faces;ia=ia.faceVertexUvs;T=0;for(Q=fa.length;T<Q;T++)j=b(),j.positionWorld.copy(fa[T].position),P.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),B.multiplyVector4(j.positionScreen),
+j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>J&&j.positionScreen.z<L;fa=0;for(T=I.length;fa<T;fa++){Q=I[fa];if(Q instanceof THREE.Face3)if(U=m[Q.a],ka=m[Q.b],ga=m[Q.c],U.visible&&ka.visible&&ga.visible&&(R.doubleSided||R.flipSided!=(ga.positionScreen.x-U.positionScreen.x)*(ka.positionScreen.y-U.positionScreen.y)-(ga.positionScreen.y-U.positionScreen.y)*(ka.positionScreen.x-U.positionScreen.x)<0))ca=p[n]=p[n]||new THREE.RenderableFace3,
 n++,o=ca,o.v1.copy(U),o.v2.copy(ka),o.v3.copy(ga);else continue;else if(Q instanceof THREE.Face4)if(U=m[Q.a],ka=m[Q.b],ga=m[Q.c],ca=m[Q.d],U.visible&&ka.visible&&ga.visible&&ca.visible&&(R.doubleSided||R.flipSided!=((ca.positionScreen.x-U.positionScreen.x)*(ka.positionScreen.y-U.positionScreen.y)-(ca.positionScreen.y-U.positionScreen.y)*(ka.positionScreen.x-U.positionScreen.x)<0||(ka.positionScreen.x-ga.positionScreen.x)*(ca.positionScreen.y-ga.positionScreen.y)-(ka.positionScreen.y-ga.positionScreen.y)*
-(ca.positionScreen.x-ga.positionScreen.x)<0)))da=u[t]=u[t]||new THREE.RenderableFace4,t++,o=da,o.v1.copy(U),o.v2.copy(ka),o.v3.copy(ga),o.v4.copy(ca);else continue;o.normalWorld.copy(Q.normal);W.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Q.centroid);P.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);z.multiplyVector3(o.centroidScreen);ga=Q.vertexNormals;U=0;for(ka=ga.length;U<ka;U++)ca=o.vertexNormalsWorld[U],ca.copy(ga[U]),W.multiplyVector3(ca);U=0;for(ka=ha.length;U<
-ka;U++)if(da=ha[U][fa]){ga=0;for(ca=da.length;ga<ca;ga++)o.uvs[U][ga]=da[ga]}o.meshMaterials=X;o.faceMaterials=Q.materials;o.overdraw=ea;o.z=o.centroidScreen.z;f.push(o)}}else if(R instanceof THREE.Line){S.multiply(z,P);fa=R.geometry.vertices;U=b();U.positionScreen.copy(fa[0].position);S.multiplyVector4(U.positionScreen);T=1;for(Q=fa.length;T<Q;T++)if(U=b(),U.positionScreen.copy(fa[T].position),S.multiplyVector4(U.positionScreen),ka=m[k-2],M.copy(U.positionScreen),F.copy(ka.positionScreen),d(M,F))M.multiplyScalar(1/
-M.w),F.multiplyScalar(1/F.w),P=E[C]=E[C]||new THREE.RenderableLine,C++,v=P,v.v1.positionScreen.copy(M),v.v2.positionScreen.copy(F),v.z=Math.max(M.z,F.z),v.materials=R.materials,f.push(v)}else if(R instanceof THREE.Particle&&(A.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),z.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))P=x[D]=x[D]||new THREE.RenderableParticle,D++,y=P,y.x=A.x/A.w,y.y=A.y/A.w,y.z=A.z,y.rotation=R.rotation.z,y.scale.x=R.scale.x*Math.abs(y.x-(A.x+g.projectionMatrix.n11)/(A.w+
-g.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(A.y+g.projectionMatrix.n22)/(A.w+g.projectionMatrix.n24)),y.materials=R.materials,f.push(y);h&&f.sort(c);return f}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,h;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;h=e/2};this.render=function(d,e){var m,o,n,p,t,u,v,C;b=c.projectScene(d,e);m=0;for(o=b.length;m<o;m++)if(t=b[m],t instanceof THREE.RenderableParticle){v=t.x*f+f;C=t.y*h+h;n=0;for(p=t.material.length;n<p;n++)if(u=t.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=C+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function d(b){if(D!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}D=b}}function e(b){if(x!=b.hex)x=b.hex,v.strokeStyle="#"+h(x.toString(16))}function f(b){if(I!=b.hex)I=b.hex,v.fillStyle="#"+h(I.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
-var j=this,k=null,m=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,p,t,u,v=o.getContext("2d"),C=new THREE.Color(0),E=0,y=1,D=0,x=null,I=null,A=null,z=null,S=null,G,M,F,N,g=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,O,V,L,$,T,Q,fa,U,ka,ga,ca,aa,R=new THREE.Color(0),P=new THREE.Color(0),W=new THREE.Color(0),X=new THREE.Color(0),ea=new THREE.Color(0),ha,J,da,la,ma,ya,va,Z,K,wa,qa=new THREE.Rectangle,ia=new THREE.Rectangle,pa=new THREE.Rectangle,
+(ca.positionScreen.x-ga.positionScreen.x)<0)))da=u[t]=u[t]||new THREE.RenderableFace4,t++,o=da,o.v1.copy(U),o.v2.copy(ka),o.v3.copy(ga),o.v4.copy(ca);else continue;o.normalWorld.copy(Q.normal);W.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Q.centroid);P.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);B.multiplyVector3(o.centroidScreen);ga=Q.vertexNormals;U=0;for(ka=ga.length;U<ka;U++)ca=o.vertexNormalsWorld[U],ca.copy(ga[U]),W.multiplyVector3(ca);U=0;for(ka=ia.length;U<
+ka;U++)if(da=ia[U][fa]){ga=0;for(ca=da.length;ga<ca;ga++)o.uvs[U][ga]=da[ga]}o.meshMaterials=X;o.faceMaterials=Q.materials;o.overdraw=ea;o.z=o.centroidScreen.z;f.push(o)}}else if(R instanceof THREE.Line){S.multiply(B,P);fa=R.geometry.vertices;U=b();U.positionScreen.copy(fa[0].position);S.multiplyVector4(U.positionScreen);T=1;for(Q=fa.length;T<Q;T++)if(U=b(),U.positionScreen.copy(fa[T].position),S.multiplyVector4(U.positionScreen),ka=m[k-2],M.copy(U.positionScreen),F.copy(ka.positionScreen),d(M,F))M.multiplyScalar(1/
+M.w),F.multiplyScalar(1/F.w),P=E[z]=E[z]||new THREE.RenderableLine,z++,v=P,v.v1.positionScreen.copy(M),v.v2.positionScreen.copy(F),v.z=Math.max(M.z,F.z),v.materials=R.materials,f.push(v)}else if(R instanceof THREE.Particle&&(C.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),B.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))P=x[D]=x[D]||new THREE.RenderableParticle,D++,y=P,y.x=C.x/C.w,y.y=C.y/C.w,y.z=C.z,y.rotation=R.rotation.z,y.scale.x=R.scale.x*Math.abs(y.x-(C.x+g.projectionMatrix.n11)/(C.w+
+g.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(C.y+g.projectionMatrix.n22)/(C.w+g.projectionMatrix.n24)),y.materials=R.materials,f.push(y);h&&f.sort(c);return f}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,h;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;h=e/2};this.render=function(d,e){var m,o,n,p,t,u,v,z;b=c.projectScene(d,e);m=0;for(o=b.length;m<o;m++)if(t=b[m],t instanceof THREE.RenderableParticle){v=t.x*f+f;z=t.y*h+h;n=0;for(p=t.material.length;n<p;n++)if(u=t.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function d(b){if(D!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}D=b}}function e(b){if(x!=b.hex)x=b.hex,v.strokeStyle="#"+h(x.toString(16))}function f(b){if(J!=b.hex)J=b.hex,v.fillStyle="#"+h(J.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
+var j=this,k=null,m=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,p,t,u,v=o.getContext("2d"),z=new THREE.Color(0),E=0,y=1,D=0,x=null,J=null,C=null,B=null,S=null,G,M,F,N,g=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,O,V,L,$,T,Q,fa,U,ka,ga,ca,aa,R=new THREE.Color(0),P=new THREE.Color(0),W=new THREE.Color(0),X=new THREE.Color(0),ea=new THREE.Color(0),ia,I,da,la,ma,ya,va,Z,K,wa,qa=new THREE.Rectangle,ha=new THREE.Rectangle,pa=new THREE.Rectangle,
 Sa=!1,sa=new THREE.Color,ra=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,na=new THREE.Vector3,Ja,Ka,Ta,ta,La,Oa,b=16;Ja=document.createElement("canvas");Ja.width=Ja.height=2;Ka=Ja.getContext("2d");Ka.fillStyle="rgba(0,0,0,1)";Ka.fillRect(0,0,2,2);Ta=Ka.getImageData(0,0,2,2);ta=Ta.data;La=document.createElement("canvas");La.width=La.height=b;Oa=La.getContext("2d");Oa.translate(-b/2,-b/2);Oa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.width=n;o.height=p;qa.set(-t,-u,t,u);y=1;D=0;S=z=A=I=x=null};this.setClearColor=function(b,d){C=b;E=d};this.setClearColorHex=function(b,d){C.setHex(b);E=d};this.clear=function(){v.setTransform(1,0,0,-1,t,u);if(!ia.isEmpty())ia.inflate(1),ia.minSelf(qa),C.hex==0&&E==0?v.clearRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*
-255)+","+E+")",v.fillRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight())),ia.empty()};this.render=function(b,h){function o(b){var d,c,g,e=b.lights;ra.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);b=0;for(d=e.length;b<d;b++)c=e[b],g=c.color,c instanceof THREE.AmbientLight?(ra.r+=g.r,ra.g+=g.g,ra.b+=g.b):c instanceof THREE.DirectionalLight?(Ma.r+=g.r,Ma.g+=g.g,Ma.b+=g.b):c instanceof THREE.PointLight&&(Na.r+=g.r,Na.g+=g.g,Na.b+=g.b)}function p(b,d,c,g){var e,h,f,j,k=b.lights,b=0;for(e=k.length;b<
-e;b++)h=k[b],f=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,g.r+=f.r*j,g.g+=f.g*j,g.b+=f.b*j)):h instanceof THREE.PointLight&&(j=c.dot(na.sub(h.position,d).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(d.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,g.r+=f.r*j,g.g+=f.g*j,g.b+=f.b*j)))}function n(b,g,h){c(h.opacity);d(h.blending);var j,k,ia,m,p,o;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)m=h.map.image,p=m.width>>1,o=m.height>>1,
-h=g.scale.x*t,ia=g.scale.y*u,j=h*p,k=ia*o,pa.set(b.x-j,b.y-k,b.x+j,b.y+k),qa.instersects(pa)&&(v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(h,-ia),v.translate(-p,-o),v.drawImage(m,0,0),v.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*t,k=g.scale.y*u,pa.set(b.x-j,b.y-k,b.x+j,b.y+k),qa.instersects(pa)&&(e(h.color),f(h.color),v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(j,k),h.program(v),v.restore()))}function y(b,g,h,f){c(f.opacity);d(f.blending);
-v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(g.positionScreen.x,g.positionScreen.y);v.closePath();if(f instanceof THREE.LineBasicMaterial){b=f.linewidth;if(A!=b)v.lineWidth=A=b;b=f.linecap;if(z!=b)v.lineCap=z=b;b=f.linejoin;if(S!=b)v.lineJoin=S=b;e(f.color);v.stroke();pa.inflate(f.linewidth*2)}}function x(b,g,e,f,k,ia,m,o,n){j.data.vertices+=3;j.data.faces++;c(o.opacity);d(o.blending);O=b.positionScreen.x;V=b.positionScreen.y;L=g.positionScreen.x;$=g.positionScreen.y;T=e.positionScreen.x;
-Q=e.positionScreen.y;E(O,V,L,$,T,Q);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,o.map.image,la[f].u,la[f].v,la[k].u,la[k].v,la[ia].u,la[ia].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,na.copy(m.vertexNormalsWorld[0]),ma=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,ya=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(m.vertexNormalsWorld[1]),va=(na.x*b.n11+na.y*
-b.n12+na.z*b.n13)*0.5+0.5,Z=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(m.vertexNormalsWorld[2]),K=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,wa=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,w(O,V,L,$,T,Q,o.envMap.image,ma,ya,va,Z,K,wa)}else o.wireframe?B(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,o.map.image,la[f].u,la[f].v,
-la[k].u,la[k].v,la[ia].u,la[ia].v)),d(THREE.SubtractiveBlending)),Sa?!o.wireframe&&o.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(P.r=W.r=X.r=ra.r,P.g=W.g=X.g=ra.g,P.b=W.b=X.b=ra.b,p(n,m.v1.positionWorld,m.vertexNormalsWorld[0],P),p(n,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(n,m.v3.positionWorld,m.vertexNormalsWorld[2],X),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1)):(sa.r=ra.r,sa.g=ra.g,sa.b=ra.b,p(n,m.centroidWorld,
-m.normalWorld,sa),R.r=Math.max(0,Math.min(o.color.r*sa.r,1)),R.g=Math.max(0,Math.min(o.color.g*sa.g,1)),R.b=Math.max(0,Math.min(o.color.b*sa.b,1)),R.updateHex(),o.wireframe?B(R,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(R)):o.wireframe?B(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color);else if(o instanceof THREE.MeshDepthMaterial)ha=h.near,J=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ha,J),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ha,J),X.r=X.g=X.b=1-Ca(e.positionScreen.z,
-ha,J),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),o.wireframe?B(R,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(R)}function C(b,g,e,f,k,ia,m,o,n){j.data.vertices+=4;j.data.faces++;c(o.opacity);d(o.blending);if(o.map||o.envMap)x(b,g,f,0,1,3,m,o,n),x(k,e,ia,1,2,3,m,o,n);else if(O=b.positionScreen.x,
-V=b.positionScreen.y,L=g.positionScreen.x,$=g.positionScreen.y,T=e.positionScreen.x,Q=e.positionScreen.y,fa=f.positionScreen.x,U=f.positionScreen.y,ka=k.positionScreen.x,ga=k.positionScreen.y,ca=ia.positionScreen.x,aa=ia.positionScreen.y,o instanceof THREE.MeshBasicMaterial)I(O,V,L,$,T,Q,fa,U),o.wireframe?B(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color);else if(o instanceof THREE.MeshLambertMaterial)Sa?!o.wireframe&&o.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==
-4?(P.r=W.r=X.r=ea.r=ra.r,P.g=W.g=X.g=ea.g=ra.g,P.b=W.b=X.b=ea.b=ra.b,p(n,m.v1.positionWorld,m.vertexNormalsWorld[0],P),p(n,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(n,m.v4.positionWorld,m.vertexNormalsWorld[3],X),p(n,m.v3.positionWorld,m.vertexNormalsWorld[2],ea),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)):(sa.r=ra.r,sa.g=ra.g,sa.b=ra.b,p(n,m.centroidWorld,m.normalWorld,sa),R.r=Math.max(0,Math.min(o.color.r*sa.r,1)),R.g=
-Math.max(0,Math.min(o.color.g*sa.g,1)),R.b=Math.max(0,Math.min(o.color.b*sa.b,1)),R.updateHex(),I(O,V,L,$,T,Q,fa,U),o.wireframe?B(R,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(R)):(I(O,V,L,$,T,Q,fa,U),o.wireframe?B(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color));else if(o instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),I(O,V,L,$,T,Q,fa,U),o.wireframe?B(R,o.wireframeLinewidth,
-o.wireframeLinecap,o.wireframeLinejoin):D(R);else if(o instanceof THREE.MeshDepthMaterial)ha=h.near,J=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ha,J),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ha,J),X.r=X.g=X.b=1-Ca(f.positionScreen.z,ha,J),ea.r=ea.g=ea.b=1-Ca(e.positionScreen.z,ha,J),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)}function E(b,d,c,g,e,h){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,h);v.lineTo(b,d);v.closePath()}
-function I(b,d,c,g,e,h,f,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,h);v.lineTo(f,j);v.lineTo(b,d);v.closePath()}function B(b,d,c,g){if(A!=d)v.lineWidth=A=d;if(z!=c)v.lineCap=z=c;if(S!=g)v.lineJoin=S=g;e(b);v.stroke();pa.inflate(d*2)}function D(b){f(b);v.fill()}function w(b,d,c,g,e,h,f,j,k,ia,o,m,p){var n,t;n=f.width-1;t=f.height-1;j*=n;k*=t;ia*=n;o*=t;m*=n;p*=t;c-=b;g-=d;e-=b;h-=d;ia-=j;o-=k;m-=j;p-=k;n=ia*p-m*o;n!=0&&(t=1/n,n=(p*c-o*e)*t,o=(p*g-o*h)*t,c=(ia*e-m*c)*t,g=(ia*h-m*g)*t,
-b=b-n*j-c*k,d=d-o*j-g*k,v.save(),v.transform(n,o,c,g,b,d),v.clip(),v.drawImage(f,0,0),v.restore())}function Pa(b,d,c,g){var e=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),f=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),ia=~~(g.r*255),m=~~(g.g*255),g=~~(g.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=h<0?0:h>255?255:h;ta[2]=b<0?0:b>255?255:b;ta[4]=f<0?0:f>255?255:f;ta[5]=j<0?0:j>255?255:j;ta[6]=d<0?0:d>255?255:d;ta[8]=k<0?0:k>255?255:k;ta[9]=o<0?0:o>255?255:o;ta[10]=c<0?0:c>255?
-255:c;ta[12]=ia<0?0:ia>255?255:ia;ta[13]=m<0?0:m>255?255:m;ta[14]=g<0?0:g>255?255:g;Ka.putImageData(Ta,0,0);Oa.drawImage(Ja,0,0);return La}function Ca(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ha(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function za(b,d){var c=d.x-b.x,g=d.y-b.y,e=1/Math.sqrt(c*c+g*g);c*=e;g*=e;d.x+=c;d.y+=g;b.x-=c;b.y-=g}var Qa,Ya,ja,ua,Aa,Ia,Ra,H;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,h,this.sortElements);(Sa=
-b.lights.length>0)&&o(b);Qa=0;for(Ya=k.length;Qa<Ya;Qa++){ja=k[Qa];pa.empty();if(ja instanceof THREE.RenderableParticle){G=ja;G.x*=t;G.y*=u;ua=0;for(Aa=ja.materials.length;ua<Aa;)H=ja.materials[ua++],H.opacity!=0&&n(G,ja,H,b)}else if(ja instanceof THREE.RenderableLine){if(G=ja.v1,M=ja.v2,G.positionScreen.x*=t,G.positionScreen.y*=u,M.positionScreen.x*=t,M.positionScreen.y*=u,pa.addPoint(G.positionScreen.x,G.positionScreen.y),pa.addPoint(M.positionScreen.x,M.positionScreen.y),qa.instersects(pa)){ua=
+faces:0};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.width=n;o.height=p;qa.set(-t,-u,t,u);y=1;D=0;S=B=C=J=x=null};this.setClearColor=function(b,d){z=b;E=d};this.setClearColorHex=function(b,d){z.setHex(b);E=d};this.clear=function(){v.setTransform(1,0,0,-1,t,u);if(!ha.isEmpty())ha.inflate(1),ha.minSelf(qa),z.hex==0&&E==0?v.clearRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*
+255)+","+E+")",v.fillRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight())),ha.empty()};this.render=function(b,h){function o(b){var d,c,g,e=b.lights;ra.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);b=0;for(d=e.length;b<d;b++)c=e[b],g=c.color,c instanceof THREE.AmbientLight?(ra.r+=g.r,ra.g+=g.g,ra.b+=g.b):c instanceof THREE.DirectionalLight?(Ma.r+=g.r,Ma.g+=g.g,Ma.b+=g.b):c instanceof THREE.PointLight&&(Na.r+=g.r,Na.g+=g.g,Na.b+=g.b)}function p(b,d,c,g){var e,h,f,j,k=b.lights,b=0;for(e=k.length;b<
+e;b++)h=k[b],f=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,g.r+=f.r*j,g.g+=f.g*j,g.b+=f.b*j)):h instanceof THREE.PointLight&&(j=c.dot(na.sub(h.position,d).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(d.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,g.r+=f.r*j,g.g+=f.g*j,g.b+=f.b*j)))}function n(b,g,h){c(h.opacity);d(h.blending);var j,k,ha,m,o,p;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)m=h.map.image,o=m.width>>1,p=m.height>>1,
+h=g.scale.x*t,ha=g.scale.y*u,j=h*o,k=ha*p,pa.set(b.x-j,b.y-k,b.x+j,b.y+k),qa.instersects(pa)&&(v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(h,-ha),v.translate(-o,-p),v.drawImage(m,0,0),v.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*t,k=g.scale.y*u,pa.set(b.x-j,b.y-k,b.x+j,b.y+k),qa.instersects(pa)&&(e(h.color),f(h.color),v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(j,k),h.program(v),v.restore()))}function y(b,g,h,f){c(f.opacity);d(f.blending);
+v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(g.positionScreen.x,g.positionScreen.y);v.closePath();if(f instanceof THREE.LineBasicMaterial){b=f.linewidth;if(C!=b)v.lineWidth=C=b;b=f.linecap;if(B!=b)v.lineCap=B=b;b=f.linejoin;if(S!=b)v.lineJoin=S=b;e(f.color);v.stroke();pa.inflate(f.linewidth*2)}}function z(b,g,e,f,k,ha,m,o,n){j.data.vertices+=3;j.data.faces++;c(o.opacity);d(o.blending);O=b.positionScreen.x;V=b.positionScreen.y;L=g.positionScreen.x;$=g.positionScreen.y;T=e.positionScreen.x;
+Q=e.positionScreen.y;E(O,V,L,$,T,Q);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,o.map.image,la[f].u,la[f].v,la[k].u,la[k].v,la[ha].u,la[ha].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,na.copy(m.vertexNormalsWorld[0]),ma=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,ya=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(m.vertexNormalsWorld[1]),va=(na.x*b.n11+na.y*
+b.n12+na.z*b.n13)*0.5+0.5,Z=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(m.vertexNormalsWorld[2]),K=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,wa=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,w(O,V,L,$,T,Q,o.envMap.image,ma,ya,va,Z,K,wa)}else o.wireframe?A(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,o.map.image,la[f].u,la[f].v,
+la[k].u,la[k].v,la[ha].u,la[ha].v)),d(THREE.SubtractiveBlending)),Sa?!o.wireframe&&o.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(P.r=W.r=X.r=ra.r,P.g=W.g=X.g=ra.g,P.b=W.b=X.b=ra.b,p(n,m.v1.positionWorld,m.vertexNormalsWorld[0],P),p(n,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(n,m.v3.positionWorld,m.vertexNormalsWorld[2],X),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1)):(sa.r=ra.r,sa.g=ra.g,sa.b=ra.b,p(n,m.centroidWorld,
+m.normalWorld,sa),R.r=Math.max(0,Math.min(o.color.r*sa.r,1)),R.g=Math.max(0,Math.min(o.color.g*sa.g,1)),R.b=Math.max(0,Math.min(o.color.b*sa.b,1)),R.updateHex(),o.wireframe?A(R,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(R)):o.wireframe?A(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(o.color);else if(o instanceof THREE.MeshDepthMaterial)ia=h.near,I=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ia,I),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ia,I),X.r=X.g=X.b=1-Ca(e.positionScreen.z,
+ia,I),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),o.wireframe?A(R,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):D(R)}function x(b,g,e,f,k,ha,o,m,n){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,g,f,0,1,3,o,m,n),z(k,e,ha,1,2,3,o,m,n);else if(O=b.positionScreen.x,
+V=b.positionScreen.y,L=g.positionScreen.x,$=g.positionScreen.y,T=e.positionScreen.x,Q=e.positionScreen.y,fa=f.positionScreen.x,U=f.positionScreen.y,ka=k.positionScreen.x,ga=k.positionScreen.y,ca=ha.positionScreen.x,aa=ha.positionScreen.y,m instanceof THREE.MeshBasicMaterial)J(O,V,L,$,T,Q,fa,U),m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):D(m.color);else if(m instanceof THREE.MeshLambertMaterial)Sa?!m.wireframe&&m.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==
+4?(P.r=W.r=X.r=ea.r=ra.r,P.g=W.g=X.g=ea.g=ra.g,P.b=W.b=X.b=ea.b=ra.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],W),p(n,o.v4.positionWorld,o.vertexNormalsWorld[3],X),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],ea),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)):(sa.r=ra.r,sa.g=ra.g,sa.b=ra.b,p(n,o.centroidWorld,o.normalWorld,sa),R.r=Math.max(0,Math.min(m.color.r*sa.r,1)),R.g=
+Math.max(0,Math.min(m.color.g*sa.g,1)),R.b=Math.max(0,Math.min(m.color.b*sa.b,1)),R.updateHex(),J(O,V,L,$,T,Q,fa,U),m.wireframe?A(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):D(R)):(J(O,V,L,$,T,Q,fa,U),m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):D(m.color));else if(m instanceof THREE.MeshNormalMaterial)R.r=Ha(o.normalWorld.x),R.g=Ha(o.normalWorld.y),R.b=Ha(o.normalWorld.z),R.updateHex(),J(O,V,L,$,T,Q,fa,U),m.wireframe?A(R,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):D(R);else if(m instanceof THREE.MeshDepthMaterial)ia=h.near,I=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ia,I),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ia,I),X.r=X.g=X.b=1-Ca(f.positionScreen.z,ia,I),ea.r=ea.g=ea.b=1-Ca(e.positionScreen.z,ia,I),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)}function E(b,d,c,g,e,h){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,h);v.lineTo(b,d);v.closePath()}
+function J(b,d,c,g,e,h,f,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,h);v.lineTo(f,j);v.lineTo(b,d);v.closePath()}function A(b,d,c,g){if(C!=d)v.lineWidth=C=d;if(B!=c)v.lineCap=B=c;if(S!=g)v.lineJoin=S=g;e(b);v.stroke();pa.inflate(d*2)}function D(b){f(b);v.fill()}function w(b,d,c,g,e,h,f,j,k,m,ha,o,p){var n,t;n=f.width-1;t=f.height-1;j*=n;k*=t;m*=n;ha*=t;o*=n;p*=t;c-=b;g-=d;e-=b;h-=d;m-=j;ha-=k;o-=j;p-=k;n=m*p-o*ha;n!=0&&(t=1/n,n=(p*c-ha*e)*t,ha=(p*g-ha*h)*t,c=(m*e-o*c)*t,g=(m*h-o*g)*t,
+b=b-n*j-c*k,d=d-ha*j-g*k,v.save(),v.transform(n,ha,c,g,b,d),v.clip(),v.drawImage(f,0,0),v.restore())}function Pa(b,d,c,g){var e=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),f=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),ha=~~(g.r*255),o=~~(g.g*255),g=~~(g.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=h<0?0:h>255?255:h;ta[2]=b<0?0:b>255?255:b;ta[4]=f<0?0:f>255?255:f;ta[5]=j<0?0:j>255?255:j;ta[6]=d<0?0:d>255?255:d;ta[8]=k<0?0:k>255?255:k;ta[9]=m<0?0:m>255?255:m;ta[10]=c<0?0:c>
+255?255:c;ta[12]=ha<0?0:ha>255?255:ha;ta[13]=o<0?0:o>255?255:o;ta[14]=g<0?0:g>255?255:g;Ka.putImageData(Ta,0,0);Oa.drawImage(Ja,0,0);return La}function Ca(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ha(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function za(b,d){var c=d.x-b.x,g=d.y-b.y,e=1/Math.sqrt(c*c+g*g);c*=e;g*=e;d.x+=c;d.y+=g;b.x-=c;b.y-=g}var Qa,Ya,ja,ua,Aa,Ia,Ra,H;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,h,this.sortElements);
+(Sa=b.lights.length>0)&&o(b);Qa=0;for(Ya=k.length;Qa<Ya;Qa++){ja=k[Qa];pa.empty();if(ja instanceof THREE.RenderableParticle){G=ja;G.x*=t;G.y*=u;ua=0;for(Aa=ja.materials.length;ua<Aa;)H=ja.materials[ua++],H.opacity!=0&&n(G,ja,H,b)}else if(ja instanceof THREE.RenderableLine){if(G=ja.v1,M=ja.v2,G.positionScreen.x*=t,G.positionScreen.y*=u,M.positionScreen.x*=t,M.positionScreen.y*=u,pa.addPoint(G.positionScreen.x,G.positionScreen.y),pa.addPoint(M.positionScreen.x,M.positionScreen.y),qa.instersects(pa)){ua=
 0;for(Aa=ja.materials.length;ua<Aa;)H=ja.materials[ua++],H.opacity!=0&&y(G,M,ja,H,b)}}else if(ja instanceof THREE.RenderableFace3){if(G=ja.v1,M=ja.v2,F=ja.v3,G.positionScreen.x*=t,G.positionScreen.y*=u,M.positionScreen.x*=t,M.positionScreen.y*=u,F.positionScreen.x*=t,F.positionScreen.y*=u,ja.overdraw&&(za(G.positionScreen,M.positionScreen),za(M.positionScreen,F.positionScreen),za(F.positionScreen,G.positionScreen)),pa.add3Points(G.positionScreen.x,G.positionScreen.y,M.positionScreen.x,M.positionScreen.y,
-F.positionScreen.x,F.positionScreen.y),qa.instersects(pa)){ua=0;for(Aa=ja.meshMaterials.length;ua<Aa;)if(H=ja.meshMaterials[ua++],H instanceof THREE.MeshFaceMaterial){Ia=0;for(Ra=ja.faceMaterials.length;Ia<Ra;)(H=ja.faceMaterials[Ia++])&&H.opacity!=0&&x(G,M,F,0,1,2,ja,H,b)}else H.opacity!=0&&x(G,M,F,0,1,2,ja,H,b)}}else if(ja instanceof THREE.RenderableFace4&&(G=ja.v1,M=ja.v2,F=ja.v3,N=ja.v4,G.positionScreen.x*=t,G.positionScreen.y*=u,M.positionScreen.x*=t,M.positionScreen.y*=u,F.positionScreen.x*=
+F.positionScreen.x,F.positionScreen.y),qa.instersects(pa)){ua=0;for(Aa=ja.meshMaterials.length;ua<Aa;)if(H=ja.meshMaterials[ua++],H instanceof THREE.MeshFaceMaterial){Ia=0;for(Ra=ja.faceMaterials.length;Ia<Ra;)(H=ja.faceMaterials[Ia++])&&H.opacity!=0&&z(G,M,F,0,1,2,ja,H,b)}else H.opacity!=0&&z(G,M,F,0,1,2,ja,H,b)}}else if(ja instanceof THREE.RenderableFace4&&(G=ja.v1,M=ja.v2,F=ja.v3,N=ja.v4,G.positionScreen.x*=t,G.positionScreen.y*=u,M.positionScreen.x*=t,M.positionScreen.y*=u,F.positionScreen.x*=
 t,F.positionScreen.y*=u,N.positionScreen.x*=t,N.positionScreen.y*=u,g.positionScreen.copy(M.positionScreen),Y.positionScreen.copy(N.positionScreen),ja.overdraw&&(za(G.positionScreen,M.positionScreen),za(M.positionScreen,N.positionScreen),za(N.positionScreen,G.positionScreen),za(F.positionScreen,g.positionScreen),za(F.positionScreen,Y.positionScreen)),pa.addPoint(G.positionScreen.x,G.positionScreen.y),pa.addPoint(M.positionScreen.x,M.positionScreen.y),pa.addPoint(F.positionScreen.x,F.positionScreen.y),
-pa.addPoint(N.positionScreen.x,N.positionScreen.y),qa.instersects(pa))){ua=0;for(Aa=ja.meshMaterials.length;ua<Aa;)if(H=ja.meshMaterials[ua++],H instanceof THREE.MeshFaceMaterial){Ia=0;for(Ra=ja.faceMaterials.length;Ia<Ra;)(H=ja.faceMaterials[Ia++])&&H.opacity!=0&&C(G,M,F,N,g,Y,ja,H,b)}else H.opacity!=0&&C(G,M,F,N,g,Y,ja,H,b)}ia.addRectangle(pa)}v.setTransform(1,0,0,1,0,0)}};
+pa.addPoint(N.positionScreen.x,N.positionScreen.y),qa.instersects(pa))){ua=0;for(Aa=ja.meshMaterials.length;ua<Aa;)if(H=ja.meshMaterials[ua++],H instanceof THREE.MeshFaceMaterial){Ia=0;for(Ra=ja.faceMaterials.length;Ia<Ra;)(H=ja.faceMaterials[Ia++])&&H.opacity!=0&&x(G,M,F,N,g,Y,ja,H,b)}else H.opacity!=0&&x(G,M,F,N,g,Y,ja,H,b)}ha.addRectangle(pa)}v.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(b,d,c){var g,e,h,f;g=0;for(e=b.lights.length;g<e;g++)h=b.lights[g],h instanceof THREE.DirectionalLight?(f=d.normalWorld.dot(h.position)*h.intensity,f>0&&(c.r+=h.color.r*f,c.g+=h.color.g*f,c.b+=h.color.b*f)):h instanceof THREE.PointLight&&(N.sub(h.position,d.centroidWorld),N.normalize(),f=d.normalWorld.dot(N)*h.intensity,f>0&&(c.r+=h.color.r*f,c.g+=h.color.g*f,c.b+=h.color.b*f))}function c(d,c,g,k,m,p){j.data.vertices+=3;j.data.faces++;O=e(V++);O.setAttribute("d",
-"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?A.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(p,k,z),A.r=Math.max(0,Math.min(m.color.r*z.r,1)),A.g=Math.max(0,Math.min(m.color.g*z.g,1)),A.b=Math.max(0,Math.min(m.color.b*z.b,1)),A.updateHex()):A.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear-
-k.z*m.__farMinusNear),A.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&A.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):O.setAttribute("style","fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+m.opacity);o.appendChild(O)}function d(d,c,g,k,
-m,p,n){j.data.vertices+=4;j.data.faces++;O=e(V++);O.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?A.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(n,m,z),A.r=Math.max(0,Math.min(p.color.r*z.r,1)),A.g=Math.max(0,Math.min(p.color.g*z.g,1)),A.b=Math.max(0,Math.min(p.color.b*
-z.b,1)),A.updateHex()):A.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(F=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),A.setRGB(F,F,F)):p instanceof THREE.MeshNormalMaterial&&A.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style",
-"fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(O)}function e(b){g[b]==null&&(g[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&g[b].setAttribute("shape-rendering","crispEdges"));return g[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,t,u,v,C,E,y,D=new THREE.Rectangle,x=new THREE.Rectangle,I=
-!1,A=new THREE.Color(16777215),z=new THREE.Color(16777215),S=new THREE.Color(0),G=new THREE.Color(0),M=new THREE.Color(0),F,N=new THREE.Vector3,g=[],Y=[],O,V,L,$=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":$=1;break;case "low":$=0}};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.setAttribute("viewBox",-t+" "+-u+" "+n+" "+p);o.setAttribute("width",n);o.setAttribute("height",p);D.set(-t,-u,
-t,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,g){var e,f,p,n,z,A,F,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);L=V=0;if(I=b.lights.length>0){F=b.lights;S.setRGB(0,0,0);G.setRGB(0,0,0);M.setRGB(0,0,0);e=0;for(f=F.length;e<f;e++)p=F[e],n=p.color,p instanceof THREE.AmbientLight?(S.r+=n.r,S.g+=n.g,S.b+=n.b):p instanceof THREE.DirectionalLight?(G.r+=n.r,G.g+=n.g,G.b+=n.b):p instanceof
-THREE.PointLight&&(M.r+=n.r,M.g+=n.g,M.b+=n.b)}e=0;for(f=k.length;e<f;e++)if(F=k[e],x.empty(),F instanceof THREE.RenderableParticle){v=F;v.x*=t;v.y*=-u;p=0;for(n=F.materials.length;p<n;)p++}else if(F instanceof THREE.RenderableLine){if(v=F.v1,C=F.v2,v.positionScreen.x*=t,v.positionScreen.y*=-u,C.positionScreen.x*=t,C.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),D.instersects(x)){p=0;for(n=F.materials.length;p<n;)if((P=F.materials[p++])&&
-P.opacity!=0){z=v;A=C;var N=L++;Y[N]==null&&(Y[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),$==0&&Y[N].setAttribute("shape-rendering","crispEdges"));O=Y[N];O.setAttribute("x1",z.positionScreen.x);O.setAttribute("y1",z.positionScreen.y);O.setAttribute("x2",A.positionScreen.x);O.setAttribute("y2",A.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+h(P.color.hex.toString(16))+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+
-P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),o.appendChild(O))}}}else if(F instanceof THREE.RenderableFace3){if(v=F.v1,C=F.v2,E=F.v3,v.positionScreen.x*=t,v.positionScreen.y*=-u,C.positionScreen.x*=t,C.positionScreen.y*=-u,E.positionScreen.x*=t,E.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),x.addPoint(E.positionScreen.x,E.positionScreen.y),D.instersects(x)){p=0;for(n=F.meshMaterials.length;p<
-n;)if(P=F.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){z=0;for(A=F.faceMaterials.length;z<A;)(P=F.faceMaterials[z++])&&P.opacity!=0&&c(v,C,E,F,P,b)}else P&&P.opacity!=0&&c(v,C,E,F,P,b)}}else if(F instanceof THREE.RenderableFace4&&(v=F.v1,C=F.v2,E=F.v3,y=F.v4,v.positionScreen.x*=t,v.positionScreen.y*=-u,C.positionScreen.x*=t,C.positionScreen.y*=-u,E.positionScreen.x*=t,E.positionScreen.y*=-u,y.positionScreen.x*=t,y.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(C.positionScreen.x,
-C.positionScreen.y),x.addPoint(E.positionScreen.x,E.positionScreen.y),x.addPoint(y.positionScreen.x,y.positionScreen.y),D.instersects(x))){p=0;for(n=F.meshMaterials.length;p<n;)if(P=F.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){z=0;for(A=F.faceMaterials.length;z<A;)(P=F.faceMaterials[z++])&&P.opacity!=0&&d(v,C,E,y,F,P,b)}else P&&P.opacity!=0&&d(v,C,E,y,F,P,b)}}};
+"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?C.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?J?(B.r=S.r,B.g=S.g,B.b=S.b,b(p,k,B),C.r=Math.max(0,Math.min(m.color.r*B.r,1)),C.g=Math.max(0,Math.min(m.color.g*B.g,1)),C.b=Math.max(0,Math.min(m.color.b*B.b,1)),C.updateHex()):C.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear-
+k.z*m.__farMinusNear),C.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&C.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(C.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):O.setAttribute("style","fill: #"+h(C.hex.toString(16))+"; fill-opacity: "+m.opacity);o.appendChild(O)}function d(d,c,g,k,
+m,p,n){j.data.vertices+=4;j.data.faces++;O=e(V++);O.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?C.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?J?(B.r=S.r,B.g=S.g,B.b=S.b,b(n,m,B),C.r=Math.max(0,Math.min(p.color.r*B.r,1)),C.g=Math.max(0,Math.min(p.color.g*B.g,1)),C.b=Math.max(0,Math.min(p.color.b*
+B.b,1)),C.updateHex()):C.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(F=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),C.setRGB(F,F,F)):p instanceof THREE.MeshNormalMaterial&&C.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(C.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style",
+"fill: #"+h(C.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(O)}function e(b){g[b]==null&&(g[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&g[b].setAttribute("shape-rendering","crispEdges"));return g[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,t,u,v,z,E,y,D=new THREE.Rectangle,x=new THREE.Rectangle,J=
+!1,C=new THREE.Color(16777215),B=new THREE.Color(16777215),S=new THREE.Color(0),G=new THREE.Color(0),M=new THREE.Color(0),F,N=new THREE.Vector3,g=[],Y=[],O,V,L,$=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":$=1;break;case "low":$=0}};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.setAttribute("viewBox",-t+" "+-u+" "+n+" "+p);o.setAttribute("width",n);o.setAttribute("height",p);D.set(-t,-u,
+t,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,g){var e,f,p,n,B,C,F,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);L=V=0;if(J=b.lights.length>0){F=b.lights;S.setRGB(0,0,0);G.setRGB(0,0,0);M.setRGB(0,0,0);e=0;for(f=F.length;e<f;e++)p=F[e],n=p.color,p instanceof THREE.AmbientLight?(S.r+=n.r,S.g+=n.g,S.b+=n.b):p instanceof THREE.DirectionalLight?(G.r+=n.r,G.g+=n.g,G.b+=n.b):p instanceof
+THREE.PointLight&&(M.r+=n.r,M.g+=n.g,M.b+=n.b)}e=0;for(f=k.length;e<f;e++)if(F=k[e],x.empty(),F instanceof THREE.RenderableParticle){v=F;v.x*=t;v.y*=-u;p=0;for(n=F.materials.length;p<n;)p++}else if(F instanceof THREE.RenderableLine){if(v=F.v1,z=F.v2,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),D.instersects(x)){p=0;for(n=F.materials.length;p<n;)if((P=F.materials[p++])&&
+P.opacity!=0){B=v;C=z;var N=L++;Y[N]==null&&(Y[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),$==0&&Y[N].setAttribute("shape-rendering","crispEdges"));O=Y[N];O.setAttribute("x1",B.positionScreen.x);O.setAttribute("y1",B.positionScreen.y);O.setAttribute("x2",C.positionScreen.x);O.setAttribute("y2",C.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+h(P.color.hex.toString(16))+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+
+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),o.appendChild(O))}}}else if(F instanceof THREE.RenderableFace3){if(v=F.v1,z=F.v2,E=F.v3,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,E.positionScreen.x*=t,E.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),x.addPoint(E.positionScreen.x,E.positionScreen.y),D.instersects(x)){p=0;for(n=F.meshMaterials.length;p<
+n;)if(P=F.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){B=0;for(C=F.faceMaterials.length;B<C;)(P=F.faceMaterials[B++])&&P.opacity!=0&&c(v,z,E,F,P,b)}else P&&P.opacity!=0&&c(v,z,E,F,P,b)}}else if(F instanceof THREE.RenderableFace4&&(v=F.v1,z=F.v2,E=F.v3,y=F.v4,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,E.positionScreen.x*=t,E.positionScreen.y*=-u,y.positionScreen.x*=t,y.positionScreen.y*=-u,x.addPoint(v.positionScreen.x,v.positionScreen.y),x.addPoint(z.positionScreen.x,
+z.positionScreen.y),x.addPoint(E.positionScreen.x,E.positionScreen.y),x.addPoint(y.positionScreen.x,y.positionScreen.y),D.instersects(x))){p=0;for(n=F.meshMaterials.length;p<n;)if(P=F.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){B=0;for(C=F.faceMaterials.length;B<C;)(P=F.faceMaterials[B++])&&P.opacity!=0&&d(v,z,E,y,F,P,b)}else P&&P.opacity!=0&&d(v,z,E,y,F,P,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -222,13 +222,13 @@ THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vert
 THREE.WebGLRenderer=function(b){function c(b,d,c){var e,h,f,j=b.vertices,k=j.length,m=b.colors,o=m.length,p=b.__vertexArray,n=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){R.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)h=j[e].position,X.copy(h),R.multiplyVector3(X),t[e]=[X.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)h=j[t[e][1]].position,f=e*3,p[f]=h.x,p[f+1]=h.y,p[f+2]=h.z;for(e=0;e<o;e++)f=e*3,color=m[t[e][1]],n[f]=color.r,n[f+1]=color.g,
 n[f+2]=color.b}else{if(u)for(e=0;e<k;e++)h=j[e].position,f=e*3,p[f]=h.x,p[f+1]=h.y,p[f+2]=h.z;if(v)for(e=0;e<o;e++)color=m[e],f=e*3,n[f]=color.r,n[f+1]=color.g,n[f+2]=color.b}if(u||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,p,d);if(v||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,b.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,n,d)}function d(b,d,c,e,h){e.program||N.initMaterial(e,d,c,h);var f=e.program,j=f.uniforms,k=e.uniforms;f!=O&&(g.useProgram(f),
 O=f);g.uniformMatrix4fv(j.projectionMatrix,!1,P);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,
-o,p=0,n=0,t=0,u,v,y,x,E=ea,C=E.directional.colors,F=E.directional.positions,D=E.point.colors,I=E.point.positions,J=E.point.distances,G=0,B=0,c=o=x=0;for(m=d.length;c<m;c++)if(o=d[c],u=o.color,v=o.position,y=o.intensity,x=o.distance,o instanceof THREE.AmbientLight)p+=u.r,n+=u.g,t+=u.b;else if(o instanceof THREE.DirectionalLight)x=G*3,C[x]=u.r*y,C[x+1]=u.g*y,C[x+2]=u.b*y,F[x]=v.x,F[x+1]=v.y,F[x+2]=v.z,G+=1;else if(o instanceof THREE.PointLight)o=B*3,D[o]=u.r*y,D[o+1]=u.g*y,D[o+2]=u.b*y,I[o]=v.x,I[o+
-1]=v.y,I[o+2]=v.z,J[B]=x,B+=1;for(c=G*3;c<C.length;c++)C[c]=0;for(c=B*3;c<D.length;c++)D[c]=0;E.point.length=B;E.directional.length=G;E.ambient[0]=p;E.ambient[1]=n;E.ambient[2]=t;c=ea;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof
+o,p=0,n=0,t=0,u,v,y,z,x=ea,E=x.directional.colors,F=x.directional.positions,D=x.point.colors,J=x.point.positions,I=x.point.distances,G=0,A=0,c=o=z=0;for(m=d.length;c<m;c++)if(o=d[c],u=o.color,v=o.position,y=o.intensity,z=o.distance,o instanceof THREE.AmbientLight)p+=u.r,n+=u.g,t+=u.b;else if(o instanceof THREE.DirectionalLight)z=G*3,E[z]=u.r*y,E[z+1]=u.g*y,E[z+2]=u.b*y,F[z]=v.x,F[z+1]=v.y,F[z+2]=v.z,G+=1;else if(o instanceof THREE.PointLight)o=A*3,D[o]=u.r*y,D[o+1]=u.g*y,D[o+2]=u.b*y,J[o]=v.x,J[o+
+1]=v.y,J[o+2]=v.z,I[A]=z,A+=1;for(c=G*3;c<E.length;c++)E[c]=0;for(c=A*3;c<D.length;c++)D[c]=0;x.point.length=A;x.directional.length=G;x.ambient[0]=p;x.ambient[1]=n;x.ambient[2]=t;c=ea;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof
 THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
-if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=ha.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof
+if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=ia.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof
 THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var Xa in k)if(n=f.uniforms[Xa])if(m=k[Xa],p=m.type,c=m.value,p=="i")g.uniform1i(n,c);else if(p=="f")g.uniform1f(n,c);else if(p=="fv1")g.uniform1fv(n,c);else if(p=="fv")g.uniform3fv(n,c);else if(p=="v2")g.uniform2f(n,c.x,c.y);else if(p=="v3")g.uniform3f(n,c.x,c.y,c.z);else if(p=="v4")g.uniform4f(n,c.x,c.y,c.z,c.w);else if(p=="c")g.uniform3f(n,c.r,c.g,c.b);else if(p=="t"&&(g.uniform1i(n,c),m=m.texture))if(m.image instanceof Array&&m.image.length==
-6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,g.RGBA,g.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=g.createTexture();g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}A(g.TEXTURE_CUBE_MAP,m,m.image[0]);g.bindTexture(g.TEXTURE_CUBE_MAP,
-null);m.needsUpdate=!1}g.activeTexture(g.TEXTURE0+c);g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else z(m,c);g.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);g.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&g.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==
+6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,g.RGBA,g.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=g.createTexture();g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}C(g.TEXTURE_CUBE_MAP,m,m.image[0]);g.bindTexture(g.TEXTURE_CUBE_MAP,
+null);m.needsUpdate=!1}g.activeTexture(g.TEXTURE0+c);g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else B(m,c);g.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);g.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&g.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==
 null&&g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&g.uniformMatrix4fv(j.viewMatrix,!1,W);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,g.uniform3fv(j.directionalLightDirection,b),g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray),
 g.uniformMatrix4fv(j.viewMatrix,!1,W);e.skinning&&(g.uniformMatrix4fv(j.cameraInverseMatrix,!1,W),g.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return f}function e(b,c,e,h,f,j){if(h.opacity!=0){var k,b=d(b,c,e,h,j).attributes;if(!h.morphTargets&&b.position>=0)g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.vertexAttribPointer(b.position,3,g.FLOAT,!1,0,0);else{c=h.program.attributes;j.morphTargetBase!==-1?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j.morphTargetBase]),
 g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):c.position>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;e<h.numSupportedMorphTargets&&e<m.length;)g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m[e]]),g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=o[m[e]],e++;else{var m=[],p=-1,
@@ -249,49 +249,49 @@ j.__webglNormalBuffer),g.vertexAttribPointer(o.normal,3,g.FLOAT,!1,0,0),g.bindBu
 ca/ga,k,m=[],o=ga*0.5,p=ca*0.5,n=!0;g.useProgram(_sprite.program);O=_sprite.program;Q=-1;qa||(g.enableVertexAttribArray(_sprite.attributes.position),g.enableVertexAttribArray(_sprite.attributes.uv),qa=!0);g.disable(g.CULL_FACE);g.enable(g.BLEND);g.depthMask(!0);g.bindBuffer(g.ARRAY_BUFFER,_sprite.vertexBuffer);g.vertexAttribPointer(c.position,2,g.FLOAT,!1,16,0);g.vertexAttribPointer(c.uv,2,g.FLOAT,!1,16,8);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);g.uniformMatrix4fv(h.projectionMatrix,
 !1,P);g.activeTexture(g.TEXTURE0);g.uniform1i(h.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(t);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(g.uniform1i(h.useScreenCoordinates,1),g.uniform3f(h.screenPosition,
 (f.position.x-o)/o,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(g.uniform1i(h.useScreenCoordinates,0),g.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),g.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.affectedByDistance?1:ca),m[0]=k*j*f.scale.x,m[1]=k*f.scale.y,g.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),g.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),g.uniform2f(h.alignment,f.alignment.x,f.alignment.y),g.uniform1f(h.opacity,f.opacity),
-g.uniform1f(h.rotation,f.rotation),g.uniform2fv(h.scale,m),f.mergeWith3D&&!n?(g.enable(g.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(g.disable(g.DEPTH_TEST),n=!1),I(f.blending),z(f.map,0),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0));g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function C(b,d){var c,e,f=b.__webglLensFlares.length,h,j,k,m=new THREE.Vector3,o=ca/ga,p=ga*0.5,n=ca*0.5,t=16/ca,u=[t*o,t],v=[1,1,0],y=[1,1],x=K.uniforms;c=K.attributes;g.useProgram(K.program);O=K.program;Q=-1;
-wa||(g.enableVertexAttribArray(K.attributes.vertex),g.enableVertexAttribArray(K.attributes.uv),wa=!0);g.uniform1i(x.occlusionMap,0);g.uniform1i(x.map,1);g.bindBuffer(g.ARRAY_BUFFER,K.vertexBuffer);g.vertexAttribPointer(c.vertex,2,g.FLOAT,!1,16,0);g.vertexAttribPointer(c.uv,2,g.FLOAT,!1,16,8);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,K.elementBuffer);g.disable(g.CULL_FACE);g.depthMask(!1);g.activeTexture(g.TEXTURE0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.activeTexture(g.TEXTURE1);for(e=0;e<f;e++)if(c=
-b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,y[0]=v[0]*p+p,y[1]=v[1]*n+n,K.hasVertexTexture||y[0]>0&&y[0]<ga&&y[1]>0&&y[1]<ca){g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGB,y[0]-8,y[1]-8,16,16,0);g.uniform1i(x.renderType,0);g.uniform2fv(x.scale,u);g.uniform3fv(x.screenPosition,v);g.disable(g.BLEND);g.enable(g.DEPTH_TEST);
-g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,y[0]-8,y[1]-8,16,16,0);g.uniform1i(x.renderType,1);g.disable(g.DEPTH_TEST);g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);c.positionScreen.x=v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();g.uniform1i(x.renderType,2);g.enable(g.BLEND);h=0;for(j=c.lensFlares.length;h<
-j;h++)if(k=c.lensFlares[h],k.opacity>0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*o,u[1]=t,g.uniform3fv(x.screenPosition,v),g.uniform2fv(x.scale,u),g.uniform1f(x.rotation,k.rotation),g.uniform1f(x.opacity,k.opacity),I(k.blending),z(k.texture,1),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0)}g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function y(b){var d,e,f,h,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(h in f.__webglCustomAttributes)if(f.__webglCustomAttributes[h].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=g.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,o=void 0,p=void 0,n=void 0,t=p=void 0,u=void 0,v=void 0,y=void 0,x=void 0,E=void 0,C=void 0,
-F=void 0,ha=void 0,z=void 0,A=void 0,D=void 0,I=void 0,B=n=y=n=v=u=void 0,J=void 0,w=J=B=u=void 0,G=void 0,M=w=J=B=p=p=t=y=n=w=J=B=G=w=J=B=G=w=J=B=void 0,da=0,K=0,la=0,L=0,P=0,S=0,N=0,R=0,O=0,H=0,Q=0,J=B=0,U=f.__vertexArray,Z=f.__uvArray,$=f.__uv2Array,fa=f.__normalArray,T=f.__tangentArray,ma=f.__colorArray,V=f.__skinVertexAArray,W=f.__skinVertexBArray,X=f.__skinIndexArray,Y=f.__skinWeightArray,ga=f.__morphTargetsArrays,ca=f.__webglCustomAttributes,w=void 0,aa=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals,
-E=f.__vertexColorType,x=f.__uvType,C=f.__normalType,oa=j.geometry,ya=oa.__dirtyVertices,va=oa.__dirtyElements,qa=oa.__dirtyUvs,wa=oa.__dirtyNormals,Ua=oa.__dirtyTangents,Va=oa.__dirtyColors,Wa=oa.__dirtyMorphTargets,Da=oa.vertices,Za=f.faces,bb=oa.faces,$a=oa.faceVertexUvs[0],ab=oa.faceVertexUvs[1],Ea=oa.skinVerticesA,Fa=oa.skinVerticesB,Ga=oa.skinIndices,xa=oa.skinWeights,Ba=j instanceof THREE.ShadowVolume?oa.edgeFaces:void 0;morphTargets=oa.morphTargets;if(ca)for(M in ca)ca[M].offset=0,ca[M].offsetSrc=
-0;m=0;for(o=Za.length;m<o;m++)if(p=Za[m],n=bb[p],$a&&(F=$a[p]),ab&&(ha=ab[p]),p=n.vertexNormals,t=n.normal,u=n.vertexColors,v=n.color,y=n.vertexTangents,n instanceof THREE.Face3){if(ya)z=Da[n.a].position,A=Da[n.b].position,D=Da[n.c].position,U[K]=z.x,U[K+1]=z.y,U[K+2]=z.z,U[K+3]=A.x,U[K+4]=A.y,U[K+5]=A.z,U[K+6]=D.x,U[K+7]=D.y,U[K+8]=D.z,K+=9;if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)B=w.offset,J=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[B+0]=w.value[n.a],w.array[B+
-1]=w.value[n.b],w.array[B+2]=w.value[n.c]):w.boundTo==="faces"?(w.array[B+0]=w.value[J],w.array[B+1]=w.value[J],w.array[B+2]=w.value[J],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[B+0]=w.value[J+0],w.array[B+1]=w.value[J+1],w.array[B+2]=w.value[J+2],w.offsetSrc+=3),w.offset+=3):(w.boundTo===void 0||w.boundTo==="vertices"?(z=w.value[n.a],A=w.value[n.b],D=w.value[n.c]):w.boundTo==="faces"?(z=w.value[J],A=w.value[J],D=w.value[J],w.offsetSrc++):w.boundTo==="faceVertices"&&(z=w.value[J+0],A=w.value[J+
-1],D=w.value[J+2],w.offsetSrc+=3),w.size===2?(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=A.x,w.array[B+3]=A.y,w.array[B+4]=D.x,w.array[B+5]=D.y,w.offset+=6):w.size===3?(w.type==="c"?(w.array[B+0]=z.r,w.array[B+1]=z.g,w.array[B+2]=z.b,w.array[B+3]=A.r,w.array[B+4]=A.g,w.array[B+5]=A.b,w.array[B+6]=D.r,w.array[B+7]=D.g,w.array[B+8]=D.b):(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=z.z,w.array[B+3]=A.x,w.array[B+4]=A.y,w.array[B+5]=A.z,w.array[B+6]=D.x,w.array[B+7]=D.y,w.array[B+8]=D.z),w.offset+=
-9):(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=z.z,w.array[B+3]=z.w,w.array[B+4]=A.x,w.array[B+5]=A.y,w.array[B+6]=A.z,w.array[B+7]=A.w,w.array[B+8]=D.x,w.array[B+9]=D.y,w.array[B+10]=D.z,w.array[B+11]=D.w,w.offset+=12));if(Wa){B=0;for(J=morphTargets.length;B<J;B++)z=morphTargets[B].vertices[n.a].position,A=morphTargets[B].vertices[n.b].position,D=morphTargets[B].vertices[n.c].position,w=ga[B],w[Q+0]=z.x,w[Q+1]=z.y,w[Q+2]=z.z,w[Q+3]=A.x,w[Q+4]=A.y,w[Q+5]=A.z,w[Q+6]=D.x,w[Q+7]=D.y,w[Q+8]=D.z;Q+=
-9}if(xa.length)B=xa[n.a],J=xa[n.b],w=xa[n.c],Y[H]=B.x,Y[H+1]=B.y,Y[H+2]=B.z,Y[H+3]=B.w,Y[H+4]=J.x,Y[H+5]=J.y,Y[H+6]=J.z,Y[H+7]=J.w,Y[H+8]=w.x,Y[H+9]=w.y,Y[H+10]=w.z,Y[H+11]=w.w,B=Ga[n.a],J=Ga[n.b],w=Ga[n.c],X[H]=B.x,X[H+1]=B.y,X[H+2]=B.z,X[H+3]=B.w,X[H+4]=J.x,X[H+5]=J.y,X[H+6]=J.z,X[H+7]=J.w,X[H+8]=w.x,X[H+9]=w.y,X[H+10]=w.z,X[H+11]=w.w,B=Ea[n.a],J=Ea[n.b],w=Ea[n.c],V[H]=B.x,V[H+1]=B.y,V[H+2]=B.z,V[H+3]=1,V[H+4]=J.x,V[H+5]=J.y,V[H+6]=J.z,V[H+7]=1,V[H+8]=w.x,V[H+9]=w.y,V[H+10]=w.z,V[H+11]=1,B=Fa[n.a],
-J=Fa[n.b],w=Fa[n.c],W[H]=B.x,W[H+1]=B.y,W[H+2]=B.z,W[H+3]=1,W[H+4]=J.x,W[H+5]=J.y,W[H+6]=J.z,W[H+7]=1,W[H+8]=w.x,W[H+9]=w.y,W[H+10]=w.z,W[H+11]=1,H+=12;if(Va&&E)u.length==3&&E==THREE.VertexColors?(n=u[0],B=u[1],J=u[2]):J=B=n=v,ma[O]=n.r,ma[O+1]=n.g,ma[O+2]=n.b,ma[O+3]=B.r,ma[O+4]=B.g,ma[O+5]=B.b,ma[O+6]=J.r,ma[O+7]=J.g,ma[O+8]=J.b,O+=9;if(Ua&&oa.hasTangents)u=y[0],v=y[1],n=y[2],T[N]=u.x,T[N+1]=u.y,T[N+2]=u.z,T[N+3]=u.w,T[N+4]=v.x,T[N+5]=v.y,T[N+6]=v.z,T[N+7]=v.w,T[N+8]=n.x,T[N+9]=n.y,T[N+10]=n.z,
-T[N+11]=n.w,N+=12;if(wa&&C)if(p.length==3&&ka)for(y=0;y<3;y++)t=p[y],fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;else for(y=0;y<3;y++)fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;if(qa&&F!==void 0&&x)for(y=0;y<3;y++)p=F[y],Z[la]=p.u,Z[la+1]=p.v,la+=2;if(qa&&ha!==void 0&&x)for(y=0;y<3;y++)p=ha[y],$[L]=p.u,$[L+1]=p.v,L+=2;va&&(aa[P]=da,aa[P+1]=da+1,aa[P+2]=da+2,P+=3,ea[R]=da,ea[R+1]=da+1,ea[R+2]=da,ea[R+3]=da+2,ea[R+4]=da+1,ea[R+5]=da+2,R+=6,da+=3)}else if(n instanceof THREE.Face4){if(ya)z=Da[n.a].position,A=
-Da[n.b].position,D=Da[n.c].position,I=Da[n.d].position,U[K]=z.x,U[K+1]=z.y,U[K+2]=z.z,U[K+3]=A.x,U[K+4]=A.y,U[K+5]=A.z,U[K+6]=D.x,U[K+7]=D.y,U[K+8]=D.z,U[K+9]=I.x,U[K+10]=I.y,U[K+11]=I.z,K+=12;if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)B=w.offset,J=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[B+0]=w.value[n.a],w.array[B+1]=w.value[n.b],w.array[B+2]=w.value[n.c],w.array[B+3]=w.value[n.d]):w.boundTo==="faces"?(w.array[B+0]=w.value[J],w.array[B+1]=w.value[J],w.array[B+
-2]=w.value[J],w.array[B+3]=w.value[J],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[B+0]=w.value[J+0],w.array[B+1]=w.value[J+1],w.array[B+2]=w.value[J+2],w.array[B+3]=w.value[J+3],w.offsetSrc+=4),w.offset+=4):(w.boundTo===void 0||w.boundTo==="vertices"?(z=w.value[n.a],A=w.value[n.b],D=w.value[n.c],I=w.value[n.d]):w.boundTo==="faces"?(z=w.value[J],A=w.value[J],D=w.value[J],I=w.value[J],w.offsetSrc++):w.boundTo==="faceVertices"&&(z=w.value[J+0],A=w.value[J+1],D=w.value[J+2],I=w.value[J+3],w.offsetSrc+=
-4),w.size===2?(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=A.x,w.array[B+3]=A.y,w.array[B+4]=D.x,w.array[B+5]=D.y,w.array[B+6]=I.x,w.array[B+7]=I.y,w.offset+=8):w.size===3?(w.type==="c"?(w.array[B+0]=z.r,w.array[B+1]=z.g,w.array[B+2]=z.b,w.array[B+3]=A.r,w.array[B+4]=A.g,w.array[B+5]=A.b,w.array[B+6]=D.r,w.array[B+7]=D.g,w.array[B+8]=D.b,w.array[B+9]=I.r,w.array[B+10]=I.g,w.array[B+11]=I.b):(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=z.z,w.array[B+3]=A.x,w.array[B+4]=A.y,w.array[B+5]=A.z,w.array[B+
-6]=D.x,w.array[B+7]=D.y,w.array[B+8]=D.z,w.array[B+9]=I.x,w.array[B+10]=I.y,w.array[B+11]=I.z),w.offset+=12):(w.array[B+0]=z.x,w.array[B+1]=z.y,w.array[B+2]=z.z,w.array[B+3]=z.w,w.array[B+4]=A.x,w.array[B+5]=A.y,w.array[B+6]=A.z,w.array[B+7]=A.w,w.array[B+8]=D.x,w.array[B+9]=D.y,w.array[B+10]=D.z,w.array[B+11]=D.w,w.array[B+12]=I.x,w.array[B+13]=I.y,w.array[B+14]=I.z,w.array[B+15]=I.w,w.offset+=16));if(Wa){B=0;for(J=morphTargets.length;B<J;B++)z=morphTargets[B].vertices[n.a].position,A=morphTargets[B].vertices[n.b].position,
-D=morphTargets[B].vertices[n.c].position,I=morphTargets[B].vertices[n.d].position,w=ga[B],w[Q+0]=z.x,w[Q+1]=z.y,w[Q+2]=z.z,w[Q+3]=A.x,w[Q+4]=A.y,w[Q+5]=A.z,w[Q+6]=D.x,w[Q+7]=D.y,w[Q+8]=D.z,w[Q+9]=I.x,w[Q+10]=I.y,w[Q+11]=I.z;Q+=12}if(xa.length)B=xa[n.a],J=xa[n.b],w=xa[n.c],G=xa[n.d],Y[H]=B.x,Y[H+1]=B.y,Y[H+2]=B.z,Y[H+3]=B.w,Y[H+4]=J.x,Y[H+5]=J.y,Y[H+6]=J.z,Y[H+7]=J.w,Y[H+8]=w.x,Y[H+9]=w.y,Y[H+10]=w.z,Y[H+11]=w.w,Y[H+12]=G.x,Y[H+13]=G.y,Y[H+14]=G.z,Y[H+15]=G.w,B=Ga[n.a],J=Ga[n.b],w=Ga[n.c],G=Ga[n.d],
-X[H]=B.x,X[H+1]=B.y,X[H+2]=B.z,X[H+3]=B.w,X[H+4]=J.x,X[H+5]=J.y,X[H+6]=J.z,X[H+7]=J.w,X[H+8]=w.x,X[H+9]=w.y,X[H+10]=w.z,X[H+11]=w.w,X[H+12]=G.x,X[H+13]=G.y,X[H+14]=G.z,X[H+15]=G.w,B=Ea[n.a],J=Ea[n.b],w=Ea[n.c],G=Ea[n.d],V[H]=B.x,V[H+1]=B.y,V[H+2]=B.z,V[H+3]=1,V[H+4]=J.x,V[H+5]=J.y,V[H+6]=J.z,V[H+7]=1,V[H+8]=w.x,V[H+9]=w.y,V[H+10]=w.z,V[H+11]=1,V[H+12]=G.x,V[H+13]=G.y,V[H+14]=G.z,V[H+15]=1,B=Fa[n.a],J=Fa[n.b],w=Fa[n.c],n=Fa[n.d],W[H]=B.x,W[H+1]=B.y,W[H+2]=B.z,W[H+3]=1,W[H+4]=J.x,W[H+5]=J.y,W[H+6]=
-J.z,W[H+7]=1,W[H+8]=w.x,W[H+9]=w.y,W[H+10]=w.z,W[H+11]=1,W[H+12]=n.x,W[H+13]=n.y,W[H+14]=n.z,W[H+15]=1,H+=16;if(Va&&E)u.length==4&&E==THREE.VertexColors?(n=u[0],B=u[1],J=u[2],u=u[3]):u=J=B=n=v,ma[O]=n.r,ma[O+1]=n.g,ma[O+2]=n.b,ma[O+3]=B.r,ma[O+4]=B.g,ma[O+5]=B.b,ma[O+6]=J.r,ma[O+7]=J.g,ma[O+8]=J.b,ma[O+9]=u.r,ma[O+10]=u.g,ma[O+11]=u.b,O+=12;if(Ua&&oa.hasTangents)u=y[0],v=y[1],n=y[2],y=y[3],T[N]=u.x,T[N+1]=u.y,T[N+2]=u.z,T[N+3]=u.w,T[N+4]=v.x,T[N+5]=v.y,T[N+6]=v.z,T[N+7]=v.w,T[N+8]=n.x,T[N+9]=n.y,
-T[N+10]=n.z,T[N+11]=n.w,T[N+12]=y.x,T[N+13]=y.y,T[N+14]=y.z,T[N+15]=y.w,N+=16;if(wa&&C)if(p.length==4&&ka)for(y=0;y<4;y++)t=p[y],fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;else for(y=0;y<4;y++)fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;if(qa&&F!==void 0&&x)for(y=0;y<4;y++)p=F[y],Z[la]=p.u,Z[la+1]=p.v,la+=2;if(qa&&ha!==void 0&&x)for(y=0;y<4;y++)p=ha[y],$[L]=p.u,$[L+1]=p.v,L+=2;va&&(aa[P]=da,aa[P+1]=da+1,aa[P+2]=da+3,aa[P+3]=da+1,aa[P+4]=da+2,aa[P+5]=da+3,P+=6,ea[R]=da,ea[R+1]=da+1,ea[R+2]=da,ea[R+3]=da+3,
-ea[R+4]=da+1,ea[R+5]=da+2,ea[R+6]=da+2,ea[R+7]=da+3,R+=8,da+=4)}if(Ba){m=0;for(o=Ba.length;m<o;m++)aa[P]=Ba[m].a,aa[P+1]=Ba[m].b,aa[P+2]=Ba[m].c,aa[P+3]=Ba[m].a,aa[P+4]=Ba[m].c,aa[P+5]=Ba[m].d,P+=6}ya&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,U,k));if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)g.bindBuffer(g.ARRAY_BUFFER,w.buffer),g.bufferData(g.ARRAY_BUFFER,w.array,k),w.needsUpdate=!1;if(Wa){B=0;for(J=morphTargets.length;B<J;B++)g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[B]),
-g.bufferData(g.ARRAY_BUFFER,ga[B],k)}Va&&O>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,ma,k));wa&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglNormalBuffer),g.bufferData(g.ARRAY_BUFFER,fa,k));Ua&&oa.hasTangents&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglTangentBuffer),g.bufferData(g.ARRAY_BUFFER,T,k));qa&&la>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Z,k));qa&&L>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER,
+g.uniform1f(h.rotation,f.rotation),g.uniform2fv(h.scale,m),f.mergeWith3D&&!n?(g.enable(g.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(g.disable(g.DEPTH_TEST),n=!1),J(f.blending),B(f.map,0),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0));g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function z(b,d){var c,e,f=b.__webglLensFlares.length,h,j,k,m=new THREE.Vector3,o=ca/ga,p=ga*0.5,n=ca*0.5,t=16/ca,u=[t*o,t],v=[1,1,0],y=[1,1],z=K.uniforms;c=K.attributes;g.useProgram(K.program);O=K.program;Q=-1;
+wa||(g.enableVertexAttribArray(K.attributes.vertex),g.enableVertexAttribArray(K.attributes.uv),wa=!0);g.uniform1i(z.occlusionMap,0);g.uniform1i(z.map,1);g.bindBuffer(g.ARRAY_BUFFER,K.vertexBuffer);g.vertexAttribPointer(c.vertex,2,g.FLOAT,!1,16,0);g.vertexAttribPointer(c.uv,2,g.FLOAT,!1,16,8);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,K.elementBuffer);g.disable(g.CULL_FACE);g.depthMask(!1);g.activeTexture(g.TEXTURE0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.activeTexture(g.TEXTURE1);for(e=0;e<f;e++)if(c=
+b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,y[0]=v[0]*p+p,y[1]=v[1]*n+n,K.hasVertexTexture||y[0]>0&&y[0]<ga&&y[1]>0&&y[1]<ca){g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGB,y[0]-8,y[1]-8,16,16,0);g.uniform1i(z.renderType,0);g.uniform2fv(z.scale,u);g.uniform3fv(z.screenPosition,v);g.disable(g.BLEND);g.enable(g.DEPTH_TEST);
+g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,y[0]-8,y[1]-8,16,16,0);g.uniform1i(z.renderType,1);g.disable(g.DEPTH_TEST);g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);c.positionScreen.x=v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();g.uniform1i(z.renderType,2);g.enable(g.BLEND);h=0;for(j=c.lensFlares.length;h<
+j;h++)if(k=c.lensFlares[h],k.opacity>0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*o,u[1]=t,g.uniform3fv(z.screenPosition,v),g.uniform2fv(z.scale,u),g.uniform1f(z.rotation,k.rotation),g.uniform1f(z.opacity,k.opacity),J(k.blending),B(k.texture,1),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0)}g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function y(b){var d,e,f,h,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(h in f.__webglCustomAttributes)if(f.__webglCustomAttributes[h].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=g.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,o=void 0,p=void 0,n=void 0,t=p=void 0,u=void 0,v=void 0,y=void 0,z=void 0,x=void 0,E=void 0,
+F=void 0,ia=void 0,B=void 0,C=void 0,D=void 0,J=void 0,A=n=y=n=v=u=void 0,I=void 0,w=I=A=u=void 0,G=void 0,M=w=I=A=p=p=t=y=n=w=I=A=G=w=I=A=G=w=I=A=void 0,da=0,K=0,la=0,L=0,P=0,S=0,N=0,R=0,O=0,H=0,Q=0,I=A=0,U=f.__vertexArray,Z=f.__uvArray,$=f.__uv2Array,fa=f.__normalArray,T=f.__tangentArray,ma=f.__colorArray,V=f.__skinVertexAArray,W=f.__skinVertexBArray,X=f.__skinIndexArray,Y=f.__skinWeightArray,ga=f.__morphTargetsArrays,ca=f.__webglCustomAttributes,w=void 0,aa=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals,
+x=f.__vertexColorType,z=f.__uvType,E=f.__normalType,oa=j.geometry,ya=oa.__dirtyVertices,va=oa.__dirtyElements,qa=oa.__dirtyUvs,wa=oa.__dirtyNormals,Ua=oa.__dirtyTangents,Va=oa.__dirtyColors,Wa=oa.__dirtyMorphTargets,Da=oa.vertices,Za=f.faces,bb=oa.faces,$a=oa.faceVertexUvs[0],ab=oa.faceVertexUvs[1],Ea=oa.skinVerticesA,Fa=oa.skinVerticesB,Ga=oa.skinIndices,xa=oa.skinWeights,Ba=j instanceof THREE.ShadowVolume?oa.edgeFaces:void 0;morphTargets=oa.morphTargets;if(ca)for(M in ca)ca[M].offset=0,ca[M].offsetSrc=
+0;m=0;for(o=Za.length;m<o;m++)if(p=Za[m],n=bb[p],$a&&(F=$a[p]),ab&&(ia=ab[p]),p=n.vertexNormals,t=n.normal,u=n.vertexColors,v=n.color,y=n.vertexTangents,n instanceof THREE.Face3){if(ya)B=Da[n.a].position,C=Da[n.b].position,D=Da[n.c].position,U[K]=B.x,U[K+1]=B.y,U[K+2]=B.z,U[K+3]=C.x,U[K+4]=C.y,U[K+5]=C.z,U[K+6]=D.x,U[K+7]=D.y,U[K+8]=D.z,K+=9;if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)A=w.offset,I=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[A+0]=w.value[n.a],w.array[A+
+1]=w.value[n.b],w.array[A+2]=w.value[n.c]):w.boundTo==="faces"?(w.array[A+0]=w.value[I],w.array[A+1]=w.value[I],w.array[A+2]=w.value[I],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[A+0]=w.value[I+0],w.array[A+1]=w.value[I+1],w.array[A+2]=w.value[I+2],w.offsetSrc+=3),w.offset+=3):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[n.a],C=w.value[n.b],D=w.value[n.c]):w.boundTo==="faces"?(B=w.value[I],C=w.value[I],D=w.value[I],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[I+0],C=w.value[I+
+1],D=w.value[I+2],w.offsetSrc+=3),w.size===2?(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=C.x,w.array[A+3]=C.y,w.array[A+4]=D.x,w.array[A+5]=D.y,w.offset+=6):w.size===3?(w.type==="c"?(w.array[A+0]=B.r,w.array[A+1]=B.g,w.array[A+2]=B.b,w.array[A+3]=C.r,w.array[A+4]=C.g,w.array[A+5]=C.b,w.array[A+6]=D.r,w.array[A+7]=D.g,w.array[A+8]=D.b):(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=B.z,w.array[A+3]=C.x,w.array[A+4]=C.y,w.array[A+5]=C.z,w.array[A+6]=D.x,w.array[A+7]=D.y,w.array[A+8]=D.z),w.offset+=
+9):(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=B.z,w.array[A+3]=B.w,w.array[A+4]=C.x,w.array[A+5]=C.y,w.array[A+6]=C.z,w.array[A+7]=C.w,w.array[A+8]=D.x,w.array[A+9]=D.y,w.array[A+10]=D.z,w.array[A+11]=D.w,w.offset+=12));if(Wa){A=0;for(I=morphTargets.length;A<I;A++)B=morphTargets[A].vertices[n.a].position,C=morphTargets[A].vertices[n.b].position,D=morphTargets[A].vertices[n.c].position,w=ga[A],w[Q+0]=B.x,w[Q+1]=B.y,w[Q+2]=B.z,w[Q+3]=C.x,w[Q+4]=C.y,w[Q+5]=C.z,w[Q+6]=D.x,w[Q+7]=D.y,w[Q+8]=D.z;Q+=
+9}if(xa.length)A=xa[n.a],I=xa[n.b],w=xa[n.c],Y[H]=A.x,Y[H+1]=A.y,Y[H+2]=A.z,Y[H+3]=A.w,Y[H+4]=I.x,Y[H+5]=I.y,Y[H+6]=I.z,Y[H+7]=I.w,Y[H+8]=w.x,Y[H+9]=w.y,Y[H+10]=w.z,Y[H+11]=w.w,A=Ga[n.a],I=Ga[n.b],w=Ga[n.c],X[H]=A.x,X[H+1]=A.y,X[H+2]=A.z,X[H+3]=A.w,X[H+4]=I.x,X[H+5]=I.y,X[H+6]=I.z,X[H+7]=I.w,X[H+8]=w.x,X[H+9]=w.y,X[H+10]=w.z,X[H+11]=w.w,A=Ea[n.a],I=Ea[n.b],w=Ea[n.c],V[H]=A.x,V[H+1]=A.y,V[H+2]=A.z,V[H+3]=1,V[H+4]=I.x,V[H+5]=I.y,V[H+6]=I.z,V[H+7]=1,V[H+8]=w.x,V[H+9]=w.y,V[H+10]=w.z,V[H+11]=1,A=Fa[n.a],
+I=Fa[n.b],w=Fa[n.c],W[H]=A.x,W[H+1]=A.y,W[H+2]=A.z,W[H+3]=1,W[H+4]=I.x,W[H+5]=I.y,W[H+6]=I.z,W[H+7]=1,W[H+8]=w.x,W[H+9]=w.y,W[H+10]=w.z,W[H+11]=1,H+=12;if(Va&&x)u.length==3&&x==THREE.VertexColors?(n=u[0],A=u[1],I=u[2]):I=A=n=v,ma[O]=n.r,ma[O+1]=n.g,ma[O+2]=n.b,ma[O+3]=A.r,ma[O+4]=A.g,ma[O+5]=A.b,ma[O+6]=I.r,ma[O+7]=I.g,ma[O+8]=I.b,O+=9;if(Ua&&oa.hasTangents)u=y[0],v=y[1],n=y[2],T[N]=u.x,T[N+1]=u.y,T[N+2]=u.z,T[N+3]=u.w,T[N+4]=v.x,T[N+5]=v.y,T[N+6]=v.z,T[N+7]=v.w,T[N+8]=n.x,T[N+9]=n.y,T[N+10]=n.z,
+T[N+11]=n.w,N+=12;if(wa&&E)if(p.length==3&&ka)for(y=0;y<3;y++)t=p[y],fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;else for(y=0;y<3;y++)fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;if(qa&&F!==void 0&&z)for(y=0;y<3;y++)p=F[y],Z[la]=p.u,Z[la+1]=p.v,la+=2;if(qa&&ia!==void 0&&z)for(y=0;y<3;y++)p=ia[y],$[L]=p.u,$[L+1]=p.v,L+=2;va&&(aa[P]=da,aa[P+1]=da+1,aa[P+2]=da+2,P+=3,ea[R]=da,ea[R+1]=da+1,ea[R+2]=da,ea[R+3]=da+2,ea[R+4]=da+1,ea[R+5]=da+2,R+=6,da+=3)}else if(n instanceof THREE.Face4){if(ya)B=Da[n.a].position,C=
+Da[n.b].position,D=Da[n.c].position,J=Da[n.d].position,U[K]=B.x,U[K+1]=B.y,U[K+2]=B.z,U[K+3]=C.x,U[K+4]=C.y,U[K+5]=C.z,U[K+6]=D.x,U[K+7]=D.y,U[K+8]=D.z,U[K+9]=J.x,U[K+10]=J.y,U[K+11]=J.z,K+=12;if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)A=w.offset,I=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[A+0]=w.value[n.a],w.array[A+1]=w.value[n.b],w.array[A+2]=w.value[n.c],w.array[A+3]=w.value[n.d]):w.boundTo==="faces"?(w.array[A+0]=w.value[I],w.array[A+1]=w.value[I],w.array[A+
+2]=w.value[I],w.array[A+3]=w.value[I],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[A+0]=w.value[I+0],w.array[A+1]=w.value[I+1],w.array[A+2]=w.value[I+2],w.array[A+3]=w.value[I+3],w.offsetSrc+=4),w.offset+=4):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[n.a],C=w.value[n.b],D=w.value[n.c],J=w.value[n.d]):w.boundTo==="faces"?(B=w.value[I],C=w.value[I],D=w.value[I],J=w.value[I],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[I+0],C=w.value[I+1],D=w.value[I+2],J=w.value[I+3],w.offsetSrc+=
+4),w.size===2?(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=C.x,w.array[A+3]=C.y,w.array[A+4]=D.x,w.array[A+5]=D.y,w.array[A+6]=J.x,w.array[A+7]=J.y,w.offset+=8):w.size===3?(w.type==="c"?(w.array[A+0]=B.r,w.array[A+1]=B.g,w.array[A+2]=B.b,w.array[A+3]=C.r,w.array[A+4]=C.g,w.array[A+5]=C.b,w.array[A+6]=D.r,w.array[A+7]=D.g,w.array[A+8]=D.b,w.array[A+9]=J.r,w.array[A+10]=J.g,w.array[A+11]=J.b):(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=B.z,w.array[A+3]=C.x,w.array[A+4]=C.y,w.array[A+5]=C.z,w.array[A+
+6]=D.x,w.array[A+7]=D.y,w.array[A+8]=D.z,w.array[A+9]=J.x,w.array[A+10]=J.y,w.array[A+11]=J.z),w.offset+=12):(w.array[A+0]=B.x,w.array[A+1]=B.y,w.array[A+2]=B.z,w.array[A+3]=B.w,w.array[A+4]=C.x,w.array[A+5]=C.y,w.array[A+6]=C.z,w.array[A+7]=C.w,w.array[A+8]=D.x,w.array[A+9]=D.y,w.array[A+10]=D.z,w.array[A+11]=D.w,w.array[A+12]=J.x,w.array[A+13]=J.y,w.array[A+14]=J.z,w.array[A+15]=J.w,w.offset+=16));if(Wa){A=0;for(I=morphTargets.length;A<I;A++)B=morphTargets[A].vertices[n.a].position,C=morphTargets[A].vertices[n.b].position,
+D=morphTargets[A].vertices[n.c].position,J=morphTargets[A].vertices[n.d].position,w=ga[A],w[Q+0]=B.x,w[Q+1]=B.y,w[Q+2]=B.z,w[Q+3]=C.x,w[Q+4]=C.y,w[Q+5]=C.z,w[Q+6]=D.x,w[Q+7]=D.y,w[Q+8]=D.z,w[Q+9]=J.x,w[Q+10]=J.y,w[Q+11]=J.z;Q+=12}if(xa.length)A=xa[n.a],I=xa[n.b],w=xa[n.c],G=xa[n.d],Y[H]=A.x,Y[H+1]=A.y,Y[H+2]=A.z,Y[H+3]=A.w,Y[H+4]=I.x,Y[H+5]=I.y,Y[H+6]=I.z,Y[H+7]=I.w,Y[H+8]=w.x,Y[H+9]=w.y,Y[H+10]=w.z,Y[H+11]=w.w,Y[H+12]=G.x,Y[H+13]=G.y,Y[H+14]=G.z,Y[H+15]=G.w,A=Ga[n.a],I=Ga[n.b],w=Ga[n.c],G=Ga[n.d],
+X[H]=A.x,X[H+1]=A.y,X[H+2]=A.z,X[H+3]=A.w,X[H+4]=I.x,X[H+5]=I.y,X[H+6]=I.z,X[H+7]=I.w,X[H+8]=w.x,X[H+9]=w.y,X[H+10]=w.z,X[H+11]=w.w,X[H+12]=G.x,X[H+13]=G.y,X[H+14]=G.z,X[H+15]=G.w,A=Ea[n.a],I=Ea[n.b],w=Ea[n.c],G=Ea[n.d],V[H]=A.x,V[H+1]=A.y,V[H+2]=A.z,V[H+3]=1,V[H+4]=I.x,V[H+5]=I.y,V[H+6]=I.z,V[H+7]=1,V[H+8]=w.x,V[H+9]=w.y,V[H+10]=w.z,V[H+11]=1,V[H+12]=G.x,V[H+13]=G.y,V[H+14]=G.z,V[H+15]=1,A=Fa[n.a],I=Fa[n.b],w=Fa[n.c],n=Fa[n.d],W[H]=A.x,W[H+1]=A.y,W[H+2]=A.z,W[H+3]=1,W[H+4]=I.x,W[H+5]=I.y,W[H+6]=
+I.z,W[H+7]=1,W[H+8]=w.x,W[H+9]=w.y,W[H+10]=w.z,W[H+11]=1,W[H+12]=n.x,W[H+13]=n.y,W[H+14]=n.z,W[H+15]=1,H+=16;if(Va&&x)u.length==4&&x==THREE.VertexColors?(n=u[0],A=u[1],I=u[2],u=u[3]):u=I=A=n=v,ma[O]=n.r,ma[O+1]=n.g,ma[O+2]=n.b,ma[O+3]=A.r,ma[O+4]=A.g,ma[O+5]=A.b,ma[O+6]=I.r,ma[O+7]=I.g,ma[O+8]=I.b,ma[O+9]=u.r,ma[O+10]=u.g,ma[O+11]=u.b,O+=12;if(Ua&&oa.hasTangents)u=y[0],v=y[1],n=y[2],y=y[3],T[N]=u.x,T[N+1]=u.y,T[N+2]=u.z,T[N+3]=u.w,T[N+4]=v.x,T[N+5]=v.y,T[N+6]=v.z,T[N+7]=v.w,T[N+8]=n.x,T[N+9]=n.y,
+T[N+10]=n.z,T[N+11]=n.w,T[N+12]=y.x,T[N+13]=y.y,T[N+14]=y.z,T[N+15]=y.w,N+=16;if(wa&&E)if(p.length==4&&ka)for(y=0;y<4;y++)t=p[y],fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;else for(y=0;y<4;y++)fa[S]=t.x,fa[S+1]=t.y,fa[S+2]=t.z,S+=3;if(qa&&F!==void 0&&z)for(y=0;y<4;y++)p=F[y],Z[la]=p.u,Z[la+1]=p.v,la+=2;if(qa&&ia!==void 0&&z)for(y=0;y<4;y++)p=ia[y],$[L]=p.u,$[L+1]=p.v,L+=2;va&&(aa[P]=da,aa[P+1]=da+1,aa[P+2]=da+3,aa[P+3]=da+1,aa[P+4]=da+2,aa[P+5]=da+3,P+=6,ea[R]=da,ea[R+1]=da+1,ea[R+2]=da,ea[R+3]=da+3,
+ea[R+4]=da+1,ea[R+5]=da+2,ea[R+6]=da+2,ea[R+7]=da+3,R+=8,da+=4)}if(Ba){m=0;for(o=Ba.length;m<o;m++)aa[P]=Ba[m].a,aa[P+1]=Ba[m].b,aa[P+2]=Ba[m].c,aa[P+3]=Ba[m].a,aa[P+4]=Ba[m].c,aa[P+5]=Ba[m].d,P+=6}ya&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,U,k));if(ca)for(M in ca)if(w=ca[M],w.needsUpdate)g.bindBuffer(g.ARRAY_BUFFER,w.buffer),g.bufferData(g.ARRAY_BUFFER,w.array,k),w.needsUpdate=!1;if(Wa){A=0;for(I=morphTargets.length;A<I;A++)g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[A]),
+g.bufferData(g.ARRAY_BUFFER,ga[A],k)}Va&&O>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,ma,k));wa&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglNormalBuffer),g.bufferData(g.ARRAY_BUFFER,fa,k));Ua&&oa.hasTangents&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglTangentBuffer),g.bufferData(g.ARRAY_BUFFER,T,k));qa&&la>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Z,k));qa&&L>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER,
 $,k));va&&(g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,aa,k),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,ea,k));H>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,V,k),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,W,k),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,X,k),g.bindBuffer(g.ARRAY_BUFFER,
 f.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,Y,k));j.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents=
-!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=g.DYNAMIC_DRAW;x=b.vertices;f=b.colors;E=x.length;j=f.length;C=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<E;m++)o=x[m].position,h=m*3,C[h]=o.x,C[h+1]=o.y,C[h+2]=o.z;g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,C,d)}if(F){for(m=0;m<j;m++)color=f[m],h=m*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;g.bindBuffer(g.ARRAY_BUFFER,
-b.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=g.DYNAMIC_DRAW;x=b.vertices;f=b.colors;E=x.length;j=f.length;C=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<E;m++)o=x[m].position,h=m*3,C[h]=o.x,C[h+1]=o.y,C[h+2]=o.z;g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,C,d)}if(F){for(m=0;m<j;m++)color=
-f[m],h=m*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;g.bindBuffer(g.ARRAY_BUFFER,b.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)e=b.geometry,(e.__dirtyVertices||e.__dirtyColors||b.sortParticles)&&c(e,g.DYNAMIC_DRAW,b),e.__dirtyVertices=!1,e.__dirtyColors=!1}function D(b){function d(b){var g=[];c=0;for(e=b.length;c<e;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,e,g,f,h,j,k,m,
-n={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(f=b.faces.length;g<f;g++)h=b.faces[g],j=h.materials,k=d(j),n[k]==void 0&&(n[k]={hash:k,counter:0}),m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+h>65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,
-vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=h}function x(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=Q){switch(b){case THREE.AdditiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
-g.SRC_COLOR);break;default:g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}Q=b}}function A(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(g.texParameteri(b,g.TEXTURE_WRAP_S,F(d.wrapS)),g.texParameteri(b,g.TEXTURE_WRAP_T,F(d.wrapT)),g.texParameteri(b,g.TEXTURE_MAG_FILTER,F(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,F(d.minFilter)),g.generateMipmap(b)):(g.texParameteri(b,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),
-g.texParameteri(b,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(b,g.TEXTURE_MAG_FILTER,M(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,M(d.minFilter)))}function z(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=g.deleteTexture(b.__webglTexture);b.__webglTexture=g.createTexture();g.bindTexture(g.TEXTURE_2D,b.__webglTexture);g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,b.image);A(g.TEXTURE_2D,b,b.image);g.bindTexture(g.TEXTURE_2D,null);b.needsUpdate=!1}g.activeTexture(g.TEXTURE0+
+!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=g.DYNAMIC_DRAW;z=b.vertices;f=b.colors;x=z.length;j=f.length;E=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<x;m++)o=z[m].position,h=m*3,E[h]=o.x,E[h+1]=o.y,E[h+2]=o.z;g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,E,d)}if(F){for(m=0;m<j;m++)color=f[m],h=m*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;g.bindBuffer(g.ARRAY_BUFFER,
+b.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=g.DYNAMIC_DRAW;z=b.vertices;f=b.colors;x=z.length;j=f.length;E=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<x;m++)o=z[m].position,h=m*3,E[h]=o.x,E[h+1]=o.y,E[h+2]=o.z;g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,E,d)}if(F){for(m=0;m<j;m++)color=
+f[m],h=m*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;g.bindBuffer(g.ARRAY_BUFFER,b.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)e=b.geometry,(e.__dirtyVertices||e.__dirtyColors||b.sortParticles)&&c(e,g.DYNAMIC_DRAW,b),e.__dirtyVertices=!1,e.__dirtyColors=!1}function D(b){function d(b){var f=[];c=0;for(e=b.length;c<e;c++)b[c]==void 0?f.push("undefined"):f.push(b[c].id);return f.join("_")}var c,e,f,g,h,j,k,m,
+n={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],j=h.materials,k=d(j),n[k]==void 0&&(n[k]={hash:k,counter:0}),m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+h>65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,
+vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=h}function x(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=Q){switch(b){case THREE.AdditiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,
+g.SRC_COLOR);break;default:g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}Q=b}}function C(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(g.texParameteri(b,g.TEXTURE_WRAP_S,F(d.wrapS)),g.texParameteri(b,g.TEXTURE_WRAP_T,F(d.wrapT)),g.texParameteri(b,g.TEXTURE_MAG_FILTER,F(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,F(d.minFilter)),g.generateMipmap(b)):(g.texParameteri(b,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),
+g.texParameteri(b,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(b,g.TEXTURE_MAG_FILTER,M(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,M(d.minFilter)))}function B(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=g.deleteTexture(b.__webglTexture);b.__webglTexture=g.createTexture();g.bindTexture(g.TEXTURE_2D,b.__webglTexture);g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,b.image);C(g.TEXTURE_2D,b,b.image);g.bindTexture(g.TEXTURE_2D,null);b.needsUpdate=!1}g.activeTexture(g.TEXTURE0+
 d);g.bindTexture(g.TEXTURE_2D,b.__webglTexture)}function S(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=g.createFramebuffer();b.__webglRenderbuffer=g.createRenderbuffer();b.__webglTexture=g.createTexture();g.bindTexture(g.TEXTURE_2D,b.__webglTexture);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,F(b.wrapS));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,F(b.wrapT));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,
 F(b.magFilter));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,F(b.minFilter));g.texImage2D(g.TEXTURE_2D,0,F(b.format),b.width,b.height,0,F(b.format),F(b.type),null);g.bindRenderbuffer(g.RENDERBUFFER,b.__webglRenderbuffer);g.bindFramebuffer(g.FRAMEBUFFER,b.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,
 g.DEPTH_ATTACHMENT,g.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,b.__webglRenderbuffer)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height);g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,
 c=ga,b=ca);d!=V&&(g.bindFramebuffer(g.FRAMEBUFFER,d),g.viewport(U,ka,c,b),V=d)}function G(b,d){var c;b=="fragment"?c=g.createShader(g.FRAGMENT_SHADER):b=="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,d);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS))return console.error(g.getShaderInfoLog(c)),console.error(d),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}
 function F(b){switch(b){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return g.BYTE;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedShortType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA}return 0}
-var N=this,g,Y=[],O=null,V=null,L=!0,$=null,T=null,Q=null,fa=null,U=0,ka=0,ga=0,ca=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Matrix4,P=new Float32Array(16),W=new Float32Array(16),X=new THREE.Vector4,ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ha=b.canvas!==void 0?b.canvas:document.createElement("canvas"),J=b.stencil!==void 0?b.stencil:
-!0,da=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ha;this.sortObjects=this.autoClear=!0;try{if(!(g=ha.getContext("experimental-webgl",{antialias:da,stencil:J})))throw"Error creating WebGL context.";}catch(ya){console.error(ya)}console.log(navigator.userAgent+" | "+g.getParameter(g.VERSION)+" | "+g.getParameter(g.VENDOR)+
-" | "+g.getParameter(g.RENDERER)+" | "+g.getParameter(g.SHADING_LANGUAGE_VERSION));g.clearColor(0,0,0,1);g.clearDepth(1);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(la.r,la.g,la.b,ma);this.context=g;var va=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(J){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness=
+var N=this,g,Y=[],O=null,V=null,L=!0,$=null,T=null,Q=null,fa=null,U=0,ka=0,ga=0,ca=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Matrix4,P=new Float32Array(16),W=new Float32Array(16),X=new THREE.Vector4,ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ia=b.canvas!==void 0?b.canvas:document.createElement("canvas"),I=b.stencil!==void 0?b.stencil:
+!0,da=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ia;this.sortObjects=this.autoClear=!0;try{if(!(g=ia.getContext("experimental-webgl",{antialias:da,stencil:I})))throw"Error creating WebGL context.";}catch(ya){console.error(ya)}console.log(navigator.userAgent+" | "+g.getParameter(g.VERSION)+" | "+g.getParameter(g.VENDOR)+
+" | "+g.getParameter(g.RENDERER)+" | "+g.getParameter(g.SHADING_LANGUAGE_VERSION));g.clearColor(0,0,0,1);g.clearDepth(1);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(la.r,la.g,la.b,ma);this.context=g;var va=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(I){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness=
 0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;Z.vertices[5]=-1;Z.vertices[6]=20;Z.vertices[7]=20;Z.vertices[8]=-1;Z.vertices[9]=-20;Z.vertices[10]=20;Z.vertices[11]=-1;Z.faces[0]=0;Z.faces[1]=1;Z.faces[2]=2;Z.faces[3]=0;Z.faces[4]=2;Z.faces[5]=3;Z.vertexBuffer=g.createBuffer();Z.elementBuffer=g.createBuffer();g.bindBuffer(g.ARRAY_BUFFER,Z.vertexBuffer);g.bufferData(g.ARRAY_BUFFER,Z.vertices,g.STATIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);
 g.bufferData(g.ELEMENT_ARRAY_BUFFER,Z.faces,g.STATIC_DRAW);Z.program=g.createProgram();g.attachShader(Z.program,G("fragment",THREE.ShaderLib.shadowPost.fragmentShader));g.attachShader(Z.program,G("vertex",THREE.ShaderLib.shadowPost.vertexShader));g.linkProgram(Z.program);Z.vertexLocation=g.getAttribLocation(Z.program,"position");Z.projectionLocation=g.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=g.getUniformLocation(Z.program,"darkness")}var K={};K.vertices=new Float32Array(16);
 K.faces=new Uint16Array(6);b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=g.createBuffer();K.elementBuffer=g.createBuffer();K.tempTexture=g.createTexture();
@@ -303,7 +303,7 @@ g.getUniformLocation(K.program,"screenPosition");var wa=!1;_sprite={};_sprite.ve
 0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=g.createBuffer();_sprite.elementBuffer=g.createBuffer();g.bindBuffer(g.ARRAY_BUFFER,_sprite.vertexBuffer);g.bufferData(g.ARRAY_BUFFER,_sprite.vertices,g.STATIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,_sprite.faces,g.STATIC_DRAW);_sprite.program=g.createProgram();
 g.attachShader(_sprite.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));g.attachShader(_sprite.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));g.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=g.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=g.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=g.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=g.getUniformLocation(_sprite.program,
 "uvScale");_sprite.uniforms.rotation=g.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=g.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=g.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=g.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=g.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=g.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
-g.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=g.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=g.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=g.getUniformLocation(_sprite.program,"projectionMatrix");var qa=!1;this.setSize=function(b,d){ha.width=b;ha.height=d;this.setViewport(0,0,ha.width,ha.height)};this.setViewport=function(b,d,c,e){U=b;ka=d;ga=c;ca=e;g.viewport(U,ka,ga,
+g.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=g.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=g.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=g.getUniformLocation(_sprite.program,"projectionMatrix");var qa=!1;this.setSize=function(b,d){ia.width=b;ia.height=d;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(b,d,c,e){U=b;ka=d;ga=c;ca=e;g.viewport(U,ka,ga,
 ca)};this.setScissor=function(b,d,c,e){g.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;g.depthMask(b)};this.setClearColorHex=function(b,d){la.setHex(b);ma=d;g.clearColor(la.r,la.g,la.b,ma)};this.setClearColor=function(b,d){la.copy(b);ma=d;g.clearColor(la.r,la.g,la.b,ma)};this.clear=function(){g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Z.darkness=
 b};this.getContext=function(){return g};this.initMaterial=function(b,d,c,e){var f,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");
 if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,n,o;m=o=k=0;for(n=d.length;m<n;m++)h=d[m],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&k++;k+o<=4?d=o:(d=Math.ceil(4*o/(k+o)),k=4-d);h={directional:d,point:k};o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var p;a:{m=b.fragmentShader;n=b.vertexShader;var k=b.uniforms,d=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
@@ -314,18 +314,18 @@ g.attachShader(t,G("fragment",prefix_fragment+m));g.attachShader(t,G("vertex",pr
 u=m;k=0;for(m=u.length;k<m;k++)n=u[k],t.uniforms[n]=g.getUniformLocation(t,n);m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)m.push("morphTarget"+u);for(p in d)m.push(p);p=m;u=0;for(d=p.length;u<d;u++)c=p[u],t.attributes[c]=g.getAttribLocation(t,c);Y.push({program:t,code:j});p=t}b.program=p;p=b.program.attributes;p.position>=0&&g.enableVertexAttribArray(p.position);p.color>=0&&g.enableVertexAttribArray(p.color);
 p.normal>=0&&g.enableVertexAttribArray(p.normal);p.tangent>=0&&g.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(g.enableVertexAttribArray(p.skinVertexA),g.enableVertexAttribArray(p.skinVertexB),g.enableVertexAttribArray(p.skinIndex),g.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(f in b.attributes)p[f]!==void 0&&p[f]>=0&&g.enableVertexAttribArray(p[f]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=
 0&&(g.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(g.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(g.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(g.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(g.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(g.enableVertexAttribArray(p.morphTarget5),
-b.numSupportedMorphTargets++);p.morphTarget6>=0&&(g.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(g.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b<f;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,y){var x,z,A,D,F,ha,G,da,K=b.lights,M=b.fog;N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&
+b.numSupportedMorphTargets++);p.morphTarget6>=0&&(g.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(g.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b<f;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,y){var x,B,C,D,F,ia,G,da,K=b.lights,M=b.fog;N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&
 c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(W);c.projectionMatrix.flattenToArray(P);R.multiply(c.projectionMatrix,c.matrixWorldInverse);k(R);this.initWebGLObjects(b);S(o);(this.autoClear||y)&&this.clear();F=b.__webglObjects.length;for(y=0;y<F;y++)if(x=b.__webglObjects[y],G=x.object,G.visible)if(!(G instanceof THREE.Mesh)||m(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),E(G,c),p(x),x.render=!0,this.sortObjects)X.copy(G.position),R.multiplyVector3(X),x.z=
-X.z}else x.render=!1;else x.render=!1;this.sortObjects&&b.__webglObjects.sort(t);ha=b.__webglObjectsImmediate.length;for(y=0;y<ha;y++)x=b.__webglObjectsImmediate[y],G=x.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),E(G,c),n(x));I(THREE.NormalBlending);for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;A=x.opaque;h(G);for(x=0;x<A.count;x++)D=A.list[x],j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ha;y++)if(x=b.__webglObjectsImmediate[y],
-G=x.object,G.visible){A=x.opaque;h(G);for(x=0;x<A.count;x++)D=A.list[x],j(D.depthTest),z=d(c,K,M,D,G),G.render(function(b){f(b,z,D.shading)})}for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;A=x.transparent;h(G);for(x=0;x<A.count;x++)D=A.list[x],I(D.blending),j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ha;y++)if(x=b.__webglObjectsImmediate[y],G=x.object,G.visible){A=x.transparent;h(G);for(x=0;x<A.count;x++)D=A.list[x],I(D.blending),j(D.depthTest),z=d(c,K,M,D,G),G.render(function(b){f(b,
-z,D.shading)})}b.__webglSprites.length&&v(b,c);J&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&C(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(g.bindTexture(g.TEXTURE_2D,o.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=
+X.z}else x.render=!1;else x.render=!1;this.sortObjects&&b.__webglObjects.sort(t);ia=b.__webglObjectsImmediate.length;for(y=0;y<ia;y++)x=b.__webglObjectsImmediate[y],G=x.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),E(G,c),n(x));J(THREE.NormalBlending);for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;C=x.opaque;h(G);for(x=0;x<C.count;x++)D=C.list[x],j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ia;y++)if(x=b.__webglObjectsImmediate[y],
+G=x.object,G.visible){C=x.opaque;h(G);for(x=0;x<C.count;x++)D=C.list[x],j(D.depthTest),B=d(c,K,M,D,G),G.render(function(b){f(b,B,D.shading)})}for(y=0;y<F;y++)if(x=b.__webglObjects[y],x.render){G=x.object;da=x.buffer;C=x.transparent;h(G);for(x=0;x<C.count;x++)D=C.list[x],J(D.blending),j(D.depthTest),e(c,K,M,D,da,G)}for(y=0;y<ia;y++)if(x=b.__webglObjectsImmediate[y],G=x.object,G.visible){C=x.transparent;h(G);for(x=0;x<C.count;x++)D=C.list[x],J(D.blending),j(D.depthTest),B=d(c,K,M,D,G),G.render(function(b){f(b,
+B,D.shading)})}b.__webglSprites.length&&v(b,c);I&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&z(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(g.bindTexture(g.TEXTURE_2D,o.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=
 b.__objectsAdded[0],d=b,e=void 0,f=void 0,h=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(e in f=c.geometry,f.geometryGroups==void 0&&D(f),f.geometryGroups){h=f.geometryGroups[e];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=g.createBuffer();j.__webglNormalBuffer=
 g.createBuffer();j.__webglTangentBuffer=g.createBuffer();j.__webglColorBuffer=g.createBuffer();j.__webglUVBuffer=g.createBuffer();j.__webglUV2Buffer=g.createBuffer();j.__webglSkinVertexABuffer=g.createBuffer();j.__webglSkinVertexBBuffer=g.createBuffer();j.__webglSkinIndicesBuffer=g.createBuffer();j.__webglSkinWeightsBuffer=g.createBuffer();j.__webglFaceBuffer=g.createBuffer();j.__webglLineBuffer=g.createBuffer();if(j.numMorphTargets){var k=void 0,m=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(m=
-j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(g.createBuffer())}for(var j=h,k=c,p=void 0,n=void 0,o=void 0,t=o=void 0,u=void 0,v=void 0,J=v=m=0,A=o=n=void 0,n=p=void 0,t=k.geometry,A=t.faces,u=j.faces,p=0,n=u.length;p<n;p++)o=u[p],o=A[o],o instanceof THREE.Face3?(m+=3,v+=1,J+=3):o instanceof THREE.Face4&&(m+=4,v+=2,J+=4);for(var p=j,n=k,z=u=A=void 0,E=void 0,z=void 0,o=[],A=0,u=n.materials.length;A<u;A++)if(z=n.materials[A],z instanceof THREE.MeshFaceMaterial){z=0;for(l=p.materials.length;z<
-l;z++)(E=p.materials[z])&&o.push(E)}else(E=z)&&o.push(E);p=o;a:{A=n=void 0;u=p.length;for(n=0;n<u;n++)if(A=p[n],A.map||A.lightMap||A instanceof THREE.MeshShaderMaterial){n=!0;break a}n=!1}a:{A=p;o=u=void 0;z=A.length;for(u=0;u<z;u++)if(o=A[u],!(o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial)){A=o&&o.shading!=void 0&&o.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{o=u=void 0;z=p.length;for(u=0;u<z;u++)if(o=p[u],o.vertexColors){o=
-o.vertexColors;break a}o=!1}j.__vertexArray=new Float32Array(m*3);if(A)j.__normalArray=new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(o)j.__colorArray=new Float32Array(m*3);if(n){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=
-new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(J*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=A==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=o;j.__normalType=A;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?
-k.geometry.edgeFaces.length*6:0);j.__webglLineCount=J*2;t=0;for(u=p.length;t<u;t++)if(p[t].attributes)for(a in j.__webglCustomAttributes={},p[t].attributes){n={};for(prop in p[t].attributes[a])n[prop]=p[t].attributes[a][prop];if(!n.__webglInitialized||n.createUniqueBuffers)n.__webglInitialized=!0,v=1,n.type==="v2"?v=2:n.type==="v3"?v=3:n.type==="v4"?v=4:n.type==="c"&&(v=3),n.size=v,n.needsUpdate=!0,n.array=new Float32Array(m*v),n.buffer=g.createBuffer(),n.buffer.belongsToAttribute=a;j.__webglCustomAttributes[a]=
+j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(g.createBuffer())}for(var j=h,k=c,p=void 0,n=void 0,o=void 0,t=o=void 0,u=void 0,v=void 0,z=v=m=0,I=o=n=void 0,n=p=void 0,t=k.geometry,I=t.faces,u=j.faces,p=0,n=u.length;p<n;p++)o=u[p],o=I[o],o instanceof THREE.Face3?(m+=3,v+=1,z+=3):o instanceof THREE.Face4&&(m+=4,v+=2,z+=4);for(var p=j,n=k,C=u=I=void 0,B=void 0,C=void 0,o=[],I=0,u=n.materials.length;I<u;I++)if(C=n.materials[I],C instanceof THREE.MeshFaceMaterial){C=0;for(l=p.materials.length;C<
+l;C++)(B=p.materials[C])&&o.push(B)}else(B=C)&&o.push(B);p=o;a:{I=n=void 0;u=p.length;for(n=0;n<u;n++)if(I=p[n],I.map||I.lightMap||I instanceof THREE.MeshShaderMaterial){n=!0;break a}n=!1}a:{I=p;o=u=void 0;C=I.length;for(u=0;u<C;u++)if(o=I[u],!(o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial)){I=o&&o.shading!=void 0&&o.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}I=!1}a:{o=u=void 0;C=p.length;for(u=0;u<C;u++)if(o=p[u],o.vertexColors){o=
+o.vertexColors;break a}o=!1}j.__vertexArray=new Float32Array(m*3);if(I)j.__normalArray=new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(o)j.__colorArray=new Float32Array(m*3);if(n){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=
+new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=I==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=o;j.__normalType=I;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?
+k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=p.length;t<u;t++)if(p[t].attributes)for(a in j.__webglCustomAttributes={},p[t].attributes){n={};for(prop in p[t].attributes[a])n[prop]=p[t].attributes[a][prop];if(!n.__webglInitialized||n.createUniqueBuffers)n.__webglInitialized=!0,v=1,n.type==="v2"?v=2:n.type==="v3"?v=3:n.type==="v4"?v=4:n.type==="c"&&(v=3),n.size=v,n.needsUpdate=!0,n.array=new Float32Array(m*v),n.buffer=g.createBuffer(),n.buffer.belongsToAttribute=a;j.__webglCustomAttributes[a]=
 n}j.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=!0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}c instanceof THREE.ShadowVolume?x(d.__webglShadowVolumes,h,c):x(d.__webglObjects,h,c)}else if(c instanceof THREE.LensFlare)x(d.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){f=c.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=
 new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglVertexCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(d.__webglObjects,f,c)}else if(c instanceof THREE.Line){f=c.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__webglLineCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(d.__webglObjects,f,c)}else if(c instanceof
 THREE.ParticleSystem){f=c.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__sortArray=[],e.__webglParticleCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(d.__webglObjects,f,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?d.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],
@@ -340,8 +340,8 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,d,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,f);f.h=THREE.ColorUtils.clamp(f.h+c,0,1);f.s=THREE.ColorUtils.clamp(f.s+d,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);b.setHSV(f.h,f.s,f.v)},rgbToHsv:function(b,c){var d=b.r,e=b.g,f=b.b,h=Math.max(Math.max(d,e),f),j=Math.min(Math.min(d,e),f);if(j==h)j=d=0;else{var k=h-j,j=k/h,d=d==h?(e-f)/k:e==h?2+(f-d)/k:4+(d-e)/k;d/=6;d<0&&(d+=1);d>1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=h;return c},
 clamp:function(b,c,d){return b<c?c:b>d?d:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,h=b.vertices,j=f.vertices,k=b.faces,m=f.faces,o=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,p=j.length;n<p;n++){var t=new THREE.Vertex(j[n].position.clone());d&&c.matrix.multiplyVector3(t.position);h.push(t)}n=0;for(p=m.length;n<p;n++){var j=m[n],u,v,C=j.vertexNormals,t=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
-j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(h=C.length;d<h;d++)v=C[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(h=t.length;d<h;d++)v=t[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}n=0;for(p=f.length;n<p;n++){e=f[n];k=[];d=0;for(h=e.length;d<h;d++)k.push(new THREE.UV(e[d].u,e[d].v));o.push(k)}}};
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,h=b.vertices,j=f.vertices,k=b.faces,m=f.faces,o=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,p=j.length;n<p;n++){var t=new THREE.Vertex(j[n].position.clone());d&&c.matrix.multiplyVector3(t.position);h.push(t)}n=0;for(p=m.length;n<p;n++){var j=m[n],u,v,z=j.vertexNormals,t=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
+j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(h=z.length;d<h;d++)v=z[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(h=t.length;d<h;d++)v=t[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}n=0;for(p=f.length;n<p;n++){e=f[n];k=[];d=0;for(h=e.length;d<h;d++)k.push(new THREE.UV(e[d].u,e[d].v));o.push(k)}}};
 THREE.ImageUtils={loadTexture:function(b,c,d){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;d&&d(this)};e.src=b;return f},loadTextureCube:function(b,c,d){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=b.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;d&&d(this)},f[c].src=b[c];return h}};
 THREE.SceneUtils={addMesh:function(b,c,d,e,f,h,j,k,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=h;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),d);b.addObject(c);
 return c},addPanoramaCube:function(b,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,e,!0),
@@ -367,14 +367,14 @@ THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCac
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
 THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,h,j,k,m,o,n=this.data.JIT.hierarchy,p,t;this.currentTime+=b*this.timeScale;t=this.currentTime;p=this.currentTime%=this.data.length;o=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],m=b.animationCache,this.JITCompile&&n[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=n[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var C=0;C<3;C++){d=c[C];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=t){if(p<t)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<p;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
+!1):(b.matrix=n[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){d=c[z];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=t){if(p<t)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<p;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
 p)}m.prevKey[d]=j;m.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;e=(p-j.time)/(k.time-j.time);f=j[d];h=k[d];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=f[0]+(h[0]-f[0])*e,d.y=f[1]+(h[1]-f[1])*e,d.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),d.x=f[0],d.y=f[1],d.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d===
 "rot")THREE.Quaternion.slerp(f,h,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(h[0]-f[0])*e,d.y=f[1]+(h[1]-f[1])*e,d.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,h,j,k,m,o;f=(b.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];o=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(h[0],k[0],m[0],o[0],f,d,j);e[1]=this.interpolate(h[1],k[1],m[1],o[1],f,d,j);e[2]=this.interpolate(h[2],k[2],m[2],o[2],f,d,j);return e};
 THREE.Animation.prototype.interpolate=function(b,c,d,e,f,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
-THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
+THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
 b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
@@ -386,7 +386,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
 THREE.PathCamera=function(b){function c(b,c,d,e){var f={name:d,fps:0.6,length:e,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),m=j.length,D=0;h=m-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<m-1;h++)D=e*k.chunks[h]/k.total,c.keys[h]={time:D,pos:j[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(b,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(b,c){var d,
 e,f=new THREE.Geometry;for(d=0;d<b.points.length*c;d++)e=d/(b.points.length*c),e=b.getPoint(e),f.vertices[d]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(b,c){var e=d(c,10),f=d(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);f=new THREE.Sphere(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,h=Math.PI/180;this.update=function(b,c,d){var e,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi=
@@ -394,7 +394,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j
 b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),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=c(this.animationParent,
 this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),!1)};
 THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -404,12 +404,12 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,n=0,p=0,t=0,u=0,v=0,C=window.innerWidth/2,E=window.innerHeight/2;this.update=
+THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,n=0,p=0,t=0,u=0,v=0,z=window.innerWidth/2,E=window.innerHeight/2;this.update=
 function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*p);this.translateY(b*t);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);h.set(0,1,0);f.cross(h,j).normalize();h.cross(j,f).normalize();this.matrix.n11=f.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=f.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=f.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(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(b);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-C)/window.innerWidth;v=(b.clientY-E)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;
+function(b){u=(b.clientX-z)/window.innerWidth;v=(b.clientY-E)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;
 case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
@@ -422,8 +422,8 @@ c(this,function(b){d&&(h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=
 b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.Cube=function(b,c,d,e,f,h,j,k,m){function o(b,c,d,j,k,m,o,p){var t,u,v=e||1,C=f||1,g=k/2,Y=m/2,O=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",C=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=h||1;var V=v+1,L=C+1;k/=v;var $=m/C;for(u=0;u<L;u++)for(m=0;m<V;m++){var T=new THREE.Vector3;T[b]=(m*k-g)*d;T[c]=(u*$-Y)*j;T[t]=o;n.vertices.push(new THREE.Vertex(T))}for(u=0;u<C;u++)for(m=0;m<v;m++)n.faces.push(new THREE.Face4(m+V*u+O,m+V*(u+
-1)+O,m+1+V*(u+1)+O,m+1+V*u+O,null,null,p)),n.faceVertexUvs[0].push([new THREE.UV(m/v,u/C),new THREE.UV(m/v,(u+1)/C),new THREE.UV((m+1)/v,(u+1)/C),new THREE.UV((m+1)/v,u/C)])}THREE.Geometry.call(this);var n=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var C in m)this.sides[C]!=void 0&&(this.sides[C]=m[C]);
+THREE.Cube=function(b,c,d,e,f,h,j,k,m){function o(b,c,d,j,k,m,o,p){var t,u,v=e||1,z=f||1,g=k/2,Y=m/2,O=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=h||1;var V=v+1,L=z+1;k/=v;var $=m/z;for(u=0;u<L;u++)for(m=0;m<V;m++){var T=new THREE.Vector3;T[b]=(m*k-g)*d;T[c]=(u*$-Y)*j;T[t]=o;n.vertices.push(new THREE.Vertex(T))}for(u=0;u<z;u++)for(m=0;m<v;m++)n.faces.push(new THREE.Face4(m+V*u+O,m+V*(u+
+1)+O,m+1+V*(u+1)+O,m+1+V*u+O,null,null,p)),n.faceVertexUvs[0].push([new THREE.UV(m/v,u/z),new THREE.UV(m/v,(u+1)/z),new THREE.UV((m+1)/v,(u+1)/z),new THREE.UV((m+1)/v,u/z)])}THREE.Geometry.call(this);var n=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var z in m)this.sides[z]!=void 0&&(this.sides[z]=m[z]);
 this.sides.px&&o("z","y",1*k,-1,d,c,-p,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,d,c,p,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,d,t,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,d,-t,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=n.vertices.length;d<e;d++){for(var f=n.vertices[d],h=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==m.position.x&&
 f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;h=!0;break}}if(!h)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=n.faces.length;d<e;d++)f=n.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 THREE.Cylinder=function(b,c,d,e,f,h){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,n=e/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,-n);for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,n);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-n-(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(c>0){j(0,0,n+(f||0));
@@ -432,13 +432,13 @@ e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.
 THREE.Icosahedron=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=f.vertices[b].position,h=f.vertices[d].position;return c((e.x+h.x)/2,(e.y+h.y)/2,(e.z+h.z)/2)}var f=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
 1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=e(h.faces[k].a,h.faces[k].b),o=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,m,n,j);d(h.faces[k].b,o,m,j);d(h.faces[k].c,
 n,o,j);d(m,o,n,j)}h.faces=j.faces}f.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,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.001;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=h;m==0&&(h=e);for(k=0;k<
+THREE.Lathe=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=h;m==0&&(h=e);for(k=0;k<
 e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[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-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(b,c,d,e){THREE.Geometry.call(this);var f,h=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var o=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(f*o-j),0)));for(f=0;f<e;f++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(b,c,d){THREE.Geometry.call(this);for(var e,f=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),o=[],n=0;for(e=0;e<h;e++){var p=2*e/h,t=m*Math.sin(p*f),p=m*Math.cos(p*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);o.push(n)}c.push(o)}for(var u,v,C,f=c.length,d=0;d<f;d++)if(h=c[d].length,d>0)for(e=0;e<h;e++){o=e==h-1;j=c[d][o?0:e+1];k=c[d][o?h-1:e];m=c[d-1][o?h-1:e];o=c[d-
-1][o?0:e+1];t=d/(f-1);u=(d-1)/(f-1);v=(e+1)/h;var p=e/h,n=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),E=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),C=this.vertices[m].position.clone(),u.normalize(),v.normalize(),C.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,t,p]));d>1&&(u=this.vertices[j].position.clone(),
-v=this.vertices[m].position.clone(),C=this.vertices[o].position.clone(),u.normalize(),v.normalize(),C.normalize(),this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,p,E]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(b,c,d){THREE.Geometry.call(this);for(var e,f=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),o=[],n=0;for(e=0;e<h;e++){var p=2*e/h,t=m*Math.sin(p*f),p=m*Math.cos(p*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);o.push(n)}c.push(o)}for(var u,v,z,f=c.length,d=0;d<f;d++)if(h=c[d].length,d>0)for(e=0;e<h;e++){o=e==h-1;j=c[d][o?0:e+1];k=c[d][o?h-1:e];m=c[d-1][o?h-1:e];o=c[d-
+1][o?0:e+1];t=d/(f-1);u=(d-1)/(f-1);v=(e+1)/h;var p=e/h,n=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),E=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,t,p]));d>1&&(u=this.vertices[j].position.clone(),
+v=this.vertices[m].position.clone(),z=this.vertices[o].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,p,E]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
 THREE.Torus=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
 1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,f=(this.segmentsT+1)*c+d-1,h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
 THREE.TorusKnot=function(b,c,d,e,f,h,j){function k(b,c,d,e,f,h){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,h*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
@@ -451,50 +451,50 @@ Math.LN2));b.image.width=c;b.image.height=e;b.image.getContext("2d").drawImage(t
 "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c)j=document.createElement("canvas"),h.map=new THREE.Texture(j),h.map.sourceFile=b.mapDiffuse,e(h.map,c+"/"+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&&c)j=document.createElement("canvas"),h.lightMap=new THREE.Texture(j),h.lightMap.sourceFile=b.mapLightmap,e(h.lightMap,c+"/"+b.mapLightmap);return new THREE[f](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 c=this,d=b.model,e=b.callback,f=b.texture_path?b.texture_path:this.extractUrlbase(d),b=new Worker(d);b.onmessage=function(b){c.createModel(b.data,e,f);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,o,n,p,t,u,v,C,E,y,D,x,I=b.faces;p=b.vertices;var A=b.normals,z=b.colors,S=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&S++;for(d=0;d<S;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];o=0;for(n=p.length;o<n;)t=new THREE.Vertex,t.position.x=p[o++]*c,t.position.y=
-p[o++]*c,t.position.z=p[o++]*c,e.vertices.push(t);o=0;for(n=I.length;o<n;){c=I[o++];p=c&1;m=c&2;d=c&4;f=c&8;u=c&16;t=c&32;C=c&64;c&=128;p?(E=new THREE.Face4,E.a=I[o++],E.b=I[o++],E.c=I[o++],E.d=I[o++],p=4):(E=new THREE.Face3,E.a=I[o++],E.b=I[o++],E.c=I[o++],p=3);if(m)m=I[o++],E.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<S;d++)y=b.uvs[d],v=I[o++],x=y[v*2],v=y[v*2+1],e.faceUvs[d][m]=new THREE.UV(x,v);if(f)for(d=0;d<S;d++){y=b.uvs[d];D=[];for(f=0;f<p;f++)v=I[o++],x=y[v*2],v=y[v*2+1],D[f]=
-new THREE.UV(x,v);e.faceVertexUvs[d][m]=D}if(u)u=I[o++]*3,f=new THREE.Vector3,f.x=A[u++],f.y=A[u++],f.z=A[u],E.normal=f;if(t)for(d=0;d<p;d++)u=I[o++]*3,f=new THREE.Vector3,f.x=A[u++],f.y=A[u++],f.z=A[u],E.vertexNormals.push(f);if(C)t=I[o++],t=new THREE.Color(z[t]),E.color=t;if(c)for(d=0;d<p;d++)t=I[o++],t=new THREE.Color(z[t]),E.vertexColors.push(t);e.faces.push(E)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,o,n,p,t,u,v,z,E,y,D,x,J=b.faces;p=b.vertices;var C=b.normals,B=b.colors,S=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&S++;for(d=0;d<S;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];o=0;for(n=p.length;o<n;)t=new THREE.Vertex,t.position.x=p[o++]*c,t.position.y=
+p[o++]*c,t.position.z=p[o++]*c,e.vertices.push(t);o=0;for(n=J.length;o<n;){c=J[o++];p=c&1;m=c&2;d=c&4;f=c&8;u=c&16;t=c&32;z=c&64;c&=128;p?(E=new THREE.Face4,E.a=J[o++],E.b=J[o++],E.c=J[o++],E.d=J[o++],p=4):(E=new THREE.Face3,E.a=J[o++],E.b=J[o++],E.c=J[o++],p=3);if(m)m=J[o++],E.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<S;d++)y=b.uvs[d],v=J[o++],x=y[v*2],v=y[v*2+1],e.faceUvs[d][m]=new THREE.UV(x,v);if(f)for(d=0;d<S;d++){y=b.uvs[d];D=[];for(f=0;f<p;f++)v=J[o++],x=y[v*2],v=y[v*2+1],D[f]=
+new THREE.UV(x,v);e.faceVertexUvs[d][m]=D}if(u)u=J[o++]*3,f=new THREE.Vector3,f.x=C[u++],f.y=C[u++],f.z=C[u],E.normal=f;if(t)for(d=0;d<p;d++)u=J[o++]*3,f=new THREE.Vector3,f.x=C[u++],f.y=C[u++],f.z=C[u],E.vertexNormals.push(f);if(z)t=J[o++],t=new THREE.Color(B[t]),E.color=t;if(c)for(d=0;d<p;d++)t=J[o++],t=new THREE.Color(B[t]),E.vertexColors.push(t);e.faces.push(E)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
 m,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],m=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,m,o,n,p,t,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;m=0;for(o=v.length;m<o;m+=3)n=v[m]*c,p=v[m+1]*
 c,t=v[m+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,p,t)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];o=e.morphColors[d].colors;n=b.morphColors[d].colors;c=0;for(m=n.length;c<m;c+=3)p=new THREE.Color(16755200),p.setRGB(n[c],n[c+1],n[c+2]),o.push(p)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
 e.vertices[f],d,f))}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,e=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,d,f,e,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,d,e,f,h){var j=new XMLHttpRequest,k=e+"/"+b,m=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]"):j.readyState==3?h&&(m==0&&(m=j.getResponseHeader("Content-Length")),h({total:m,loaded:j.responseText.length})):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,c,d,e){var f=function(c){function d(b,c){var e=n(b,c),f=n(b,c+1),g=n(b,c+2),h=n(b,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=n(b,c),e=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=n(b,c);return(n(b,c+1)<<8)+d}function o(b,c){var d=n(b,c);return d>127?d-256:d}function n(b,
-c){return b.charCodeAt(c)&255}function p(c){var d,e,g;d=f(b,c);e=f(b,c+z);g=f(b,c+S);c=m(b,c+G);THREE.BinaryLoader.prototype.f3(y,d,e,g,c)}function t(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+z);g=f(b,c+S);h=m(b,c+G);j=f(b,c+M);n=f(b,c+F);c=f(b,c+N);THREE.BinaryLoader.prototype.f3n(y,I,d,e,g,h,j,n,c)}function u(c){var d,e,h,j;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);c=m(b,c+V);THREE.BinaryLoader.prototype.f4(y,d,e,h,j,c)}function v(c){var d,e,h,j,n,o,p,t;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);n=m(b,
-c+V);o=f(b,c+L);p=f(b,c+$);t=f(b,c+T);c=f(b,c+Q);THREE.BinaryLoader.prototype.f4n(y,I,d,e,h,j,n,o,p,t,c)}function C(c){var d,e;d=f(b,c);e=f(b,c+fa);c=f(b,c+U);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[c*2],A[c*2+1])}function E(c){var d,e,g;d=f(b,c);e=f(b,c+ka);g=f(b,c+ga);c=f(b,c+ca);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[g*2],A[g*2+1],A[c*2],A[c*2+1])}var y=this,D=0,x,I=[],A=[],z,S,G,M,F,N,g,Y,O,V,L,$,T,Q,
+c){return b.charCodeAt(c)&255}function p(c){var d,e,g;d=f(b,c);e=f(b,c+B);g=f(b,c+S);c=m(b,c+G);THREE.BinaryLoader.prototype.f3(y,d,e,g,c)}function t(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+B);g=f(b,c+S);h=m(b,c+G);j=f(b,c+M);n=f(b,c+F);c=f(b,c+N);THREE.BinaryLoader.prototype.f3n(y,J,d,e,g,h,j,n,c)}function u(c){var d,e,h,j;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);c=m(b,c+V);THREE.BinaryLoader.prototype.f4(y,d,e,h,j,c)}function v(c){var d,e,h,j,n,o,p,t;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);n=m(b,
+c+V);o=f(b,c+L);p=f(b,c+$);t=f(b,c+T);c=f(b,c+Q);THREE.BinaryLoader.prototype.f4n(y,J,d,e,h,j,n,o,p,t,c)}function z(c){var d,e;d=f(b,c);e=f(b,c+fa);c=f(b,c+U);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],C[d*2],C[d*2+1],C[e*2],C[e*2+1],C[c*2],C[c*2+1])}function E(c){var d,e,g;d=f(b,c);e=f(b,c+ka);g=f(b,c+ga);c=f(b,c+ca);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],C[d*2],C[d*2+1],C[e*2],C[e*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var y=this,D=0,x,J=[],C=[],B,S,G,M,F,N,g,Y,O,V,L,$,T,Q,
 fa,U,ka,ga,ca,aa,R,P,W,X,ea;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,c);x={signature:b.substr(D,8),header_bytes:n(b,D+8),vertex_coordinate_bytes:n(b,D+9),normal_coordinate_bytes:n(b,D+10),uv_coordinate_bytes:n(b,D+11),vertex_index_bytes:n(b,D+12),normal_index_bytes:n(b,D+13),uv_index_bytes:n(b,D+14),material_index_bytes:n(b,D+15),nvertices:f(b,D+16),nnormals:f(b,D+16+4),nuvs:f(b,D+16+8),ntri_flat:f(b,D+16+12),ntri_smooth:f(b,D+16+16),ntri_flat_uv:f(b,D+16+20),ntri_smooth_uv:f(b,
-D+16+24),nquad_flat:f(b,D+16+28),nquad_smooth:f(b,D+16+32),nquad_flat_uv:f(b,D+16+36),nquad_smooth_uv:f(b,D+16+40)};D+=x.header_bytes;z=x.vertex_index_bytes;S=x.vertex_index_bytes*2;G=x.vertex_index_bytes*3;M=x.vertex_index_bytes*3+x.material_index_bytes;F=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;N=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;g=x.vertex_index_bytes;Y=x.vertex_index_bytes*2;O=x.vertex_index_bytes*3;V=x.vertex_index_bytes*4;L=x.vertex_index_bytes*
+D+16+24),nquad_flat:f(b,D+16+28),nquad_smooth:f(b,D+16+32),nquad_flat_uv:f(b,D+16+36),nquad_smooth_uv:f(b,D+16+40)};D+=x.header_bytes;B=x.vertex_index_bytes;S=x.vertex_index_bytes*2;G=x.vertex_index_bytes*3;M=x.vertex_index_bytes*3+x.material_index_bytes;F=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;N=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;g=x.vertex_index_bytes;Y=x.vertex_index_bytes*2;O=x.vertex_index_bytes*3;V=x.vertex_index_bytes*4;L=x.vertex_index_bytes*
 4+x.material_index_bytes;$=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;T=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;Q=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;fa=x.uv_index_bytes;U=x.uv_index_bytes*2;ka=x.uv_index_bytes;ga=x.uv_index_bytes*2;ca=x.uv_index_bytes*3;c=x.vertex_index_bytes*3+x.material_index_bytes;ea=x.vertex_index_bytes*4+x.material_index_bytes;aa=x.ntri_flat*c;R=x.ntri_smooth*(c+x.normal_index_bytes*3);P=x.ntri_flat_uv*
 (c+x.uv_index_bytes*3);W=x.ntri_smooth_uv*(c+x.normal_index_bytes*3+x.uv_index_bytes*3);X=x.nquad_flat*ea;c=x.nquad_smooth*(ea+x.normal_index_bytes*4);ea=x.nquad_flat_uv*(ea+x.uv_index_bytes*4);D+=function(c){for(var e,f,g,h=x.vertex_coordinate_bytes*3,k=c+x.nvertices*h;c<k;c+=h)e=d(b,c),f=d(b,c+x.vertex_coordinate_bytes),g=d(b,c+x.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,e,f,g);return x.nvertices*h}(D);D+=function(c){for(var d,e,f,g=x.normal_coordinate_bytes*3,h=c+x.nnormals*g;c<
-h;c+=g)d=o(b,c),e=o(b,c+x.normal_coordinate_bytes),f=o(b,c+x.normal_coordinate_bytes*2),I.push(d/127,e/127,f/127);return x.nnormals*g}(D);D+=function(c){for(var e,f,g=x.uv_coordinate_bytes*2,h=c+x.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+x.uv_coordinate_bytes),A.push(e,f);return x.nuvs*g}(D);aa=D+aa;R=aa+R;P=R+P;W=P+W;X=W+X;c=X+c;ea=c+ea;(function(b){var c,d=x.vertex_index_bytes*3+x.material_index_bytes,e=d+x.uv_index_bytes*3,f=b+x.ntri_flat_uv*e;for(c=b;c<f;c+=e)p(c),C(c+d);return f-b})(R);(function(b){var c,
-d=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=d+x.uv_index_bytes*3,f=b+x.ntri_smooth_uv*e;for(c=b;c<f;c+=e)t(c),C(c+d);return f-b})(P);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes,e=d+x.uv_index_bytes*4,f=b+x.nquad_flat_uv*e;for(c=b;c<f;c+=e)u(c),E(c+d);return f-b})(c);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,e=d+x.uv_index_bytes*4,f=b+x.nquad_smooth_uv*e;for(c=b;c<f;c+=e)v(c),E(c+d);return f-b})(ea);
+h;c+=g)d=o(b,c),e=o(b,c+x.normal_coordinate_bytes),f=o(b,c+x.normal_coordinate_bytes*2),J.push(d/127,e/127,f/127);return x.nnormals*g}(D);D+=function(c){for(var e,f,g=x.uv_coordinate_bytes*2,h=c+x.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+x.uv_coordinate_bytes),C.push(e,f);return x.nuvs*g}(D);aa=D+aa;R=aa+R;P=R+P;W=P+W;X=W+X;c=X+c;ea=c+ea;(function(b){var c,d=x.vertex_index_bytes*3+x.material_index_bytes,e=d+x.uv_index_bytes*3,f=b+x.ntri_flat_uv*e;for(c=b;c<f;c+=e)p(c),z(c+d);return f-b})(R);(function(b){var c,
+d=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=d+x.uv_index_bytes*3,f=b+x.ntri_smooth_uv*e;for(c=b;c<f;c+=e)t(c),z(c+d);return f-b})(P);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes,e=d+x.uv_index_bytes*4,f=b+x.nquad_flat_uv*e;for(c=b;c<f;c+=e)u(c),E(c+d);return f-b})(c);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,e=d+x.uv_index_bytes*4,f=b+x.nquad_smooth_uv*e;for(c=b;c<f;c+=e)v(c),E(c+d);return f-b})(ea);
 (function(b){var c,d=x.vertex_index_bytes*3+x.material_index_bytes,e=b+x.ntri_flat*d;for(c=b;c<e;c+=d)p(c);return e-b})(D);(function(b){var c,d=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=b+x.ntri_smooth*d;for(c=b;c<e;c+=d)t(c);return e-b})(aa);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes,e=b+x.nquad_flat*d;for(c=b;c<e;c+=d)u(c);return e-b})(W);(function(b){var c,d=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,e=b+x.nquad_smooth*
 d;for(c=b;c<e;c+=d)v(c);return e-b})(X);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,h){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[h]))},f3n:function(b,c,d,e,f,h,j,k,m){var h=b.materials[h],o=c[k*3],n=c[k*3+1],k=c[k*3+2],
-p=c[m*3],t=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,t,m)],null,h))},f4n:function(b,c,d,e,f,h,j,k,m,o,n){var j=b.materials[j],p=c[m*3],t=c[m*3+1],m=c[m*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],C=c[n*3],E=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(d,e,f,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,t,m),new THREE.Vector3(u,v,o),new THREE.Vector3(C,E,n)],null,j))},uv3:function(b,
+p=c[m*3],t=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,t,m)],null,h))},f4n:function(b,c,d,e,f,h,j,k,m,o,n){var j=b.materials[j],p=c[m*3],t=c[m*3+1],m=c[m*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],z=c[n*3],E=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(d,e,f,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,t,m),new THREE.Vector3(u,v,o),new THREE.Vector3(z,E,n)],null,j))},uv3:function(b,
 c,d,e,f,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,e,f,h,j,k,m){var o=[];o.push(new THREE.UV(c,d));o.push(new THREE.UV(e,f));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in F.objects)if(!L.objects[u])if(D=F.objects[u],D.geometry!==void 0){if(z=L.geometries[D.geometry]){M=[];for(Q=0;Q<D.materials.length;Q++)M[Q]=L.materials[D.materials[Q]];x=D.position;r=D.rotation;q=D.quaternion;s=D.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);
-M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(z,M);object.name=u;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;L.scene.addObject(object);L.objects[u]=object;if(D.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);L.scene.collisions.colliders.push(b)}if(D.castsShadow)b=new THREE.ShadowVolume(z),L.scene.addChild(b),
+THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in F.objects)if(!L.objects[u])if(D=F.objects[u],D.geometry!==void 0){if(B=L.geometries[D.geometry]){M=[];for(Q=0;Q<D.materials.length;Q++)M[Q]=L.materials[D.materials[Q]];x=D.position;r=D.rotation;q=D.quaternion;s=D.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);
+M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,M);object.name=u;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;L.scene.addObject(object);L.objects[u]=object;if(D.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);L.scene.collisions.colliders.push(b)}if(D.castsShadow)b=new THREE.ShadowVolume(B),L.scene.addChild(b),
 b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}}else x=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,L.scene.addObject(object),
-L.objects[u]=object,L.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}function m(b){return function(c){L.geometries[b]=c;k();g-=1;d.onLoadComplete();n()}}function o(b){return function(c){L.geometries[b]=c}}function n(){d.callbackProgress({totalModels:O,totalTextures:V,loadedModels:O-g,loadedTextures:V-Y},L);d.onLoadProgress();g==0&&Y==0&&c(L)}var p,t,u,v,C,E,y,D,x,I,A,z,S,G,M,F,N,g,Y,O,V,L;F=b.data;b=new THREE.BinaryLoader;N=new THREE.JSONLoader;
-Y=g=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var $=!1;for(u in F.objects)if(D=F.objects[u],D.meshCollider){$=!0;break}if($)L.scene.collisions=new THREE.CollisionSystem;if(F.transform){$=F.transform.position;I=F.transform.rotation;var T=F.transform.scale;$&&L.scene.position.set($[0],$[1],$[2]);I&&L.scene.rotation.set(I[0],I[1],I[2]);T&&L.scene.scale.set(T[0],T[1],T[2]);($||I||T)&&L.scene.updateMatrix()}$=function(){Y-=
-1;n();d.onLoadComplete()};for(C in F.cameras){I=F.cameras[C];if(I.type=="perspective")S=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);x=I.position;I=I.target;S.position.set(x[0],x[1],x[2]);S.target.position.set(I[0],I[1],I[2]);L.cameras[C]=S}for(v in F.lights){C=F.lights[v];S=C.color!==void 0?C.color:16777215;I=C.intensity!==void 0?C.intensity:1;if(C.type=="directional")x=
-C.direction,light=new THREE.DirectionalLight(S,I),light.position.set(x[0],x[1],x[2]),light.position.normalize();else if(C.type=="point")x=C.position,light=new THREE.PointLight(S,I),light.position.set(x[0],x[1],x[2]);L.scene.addLight(light);L.lights[v]=light}for(E in F.fogs)v=F.fogs[E],v.type=="linear"?G=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(G=new THREE.FogExp2(0,v.density)),I=v.color,G.color.setRGB(I[0],I[1],I[2]),L.fogs[E]=G;if(L.cameras&&F.defaults.camera)L.currentCamera=L.cameras[F.defaults.camera];
-if(L.fogs&&F.defaults.fog)L.scene.fog=L.fogs[F.defaults.fog];I=F.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(I[0],I[1],I[2]);L.bgColorAlpha=F.defaults.bgalpha;for(p in F.geometries)if(E=F.geometries[p],E.type=="bin_mesh"||E.type=="ascii_mesh")g+=1,d.onLoadStart();O=g;for(p in F.geometries)E=F.geometries[p],E.type=="cube"?(z=new THREE.Cube(E.width,E.height,E.depth,E.segmentsWidth,E.segmentsHeight,E.segmentsDepth,null,E.flipped,E.sides),L.geometries[p]=z):E.type=="plane"?(z=new THREE.Plane(E.width,
-E.height,E.segmentsWidth,E.segmentsHeight),L.geometries[p]=z):E.type=="sphere"?(z=new THREE.Sphere(E.radius,E.segmentsWidth,E.segmentsHeight),L.geometries[p]=z):E.type=="cylinder"?(z=new THREE.Cylinder(E.numSegs,E.topRad,E.botRad,E.height,E.topOffset,E.botOffset),L.geometries[p]=z):E.type=="torus"?(z=new THREE.Torus(E.radius,E.tube,E.segmentsR,E.segmentsT),L.geometries[p]=z):E.type=="icosahedron"?(z=new THREE.Icosahedron(E.subdivisions),L.geometries[p]=z):E.type=="bin_mesh"?b.load({model:e(E.url,
+L.objects[u]=object,L.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}function m(b){return function(c){L.geometries[b]=c;k();g-=1;d.onLoadComplete();n()}}function o(b){return function(c){L.geometries[b]=c}}function n(){d.callbackProgress({totalModels:O,totalTextures:V,loadedModels:O-g,loadedTextures:V-Y},L);d.onLoadProgress();g==0&&Y==0&&c(L)}var p,t,u,v,z,E,y,D,x,J,C,B,S,G,M,F,N,g,Y,O,V,L;F=b.data;b=new THREE.BinaryLoader;N=new THREE.JSONLoader;
+Y=g=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var $=!1;for(u in F.objects)if(D=F.objects[u],D.meshCollider){$=!0;break}if($)L.scene.collisions=new THREE.CollisionSystem;if(F.transform){$=F.transform.position;J=F.transform.rotation;var T=F.transform.scale;$&&L.scene.position.set($[0],$[1],$[2]);J&&L.scene.rotation.set(J[0],J[1],J[2]);T&&L.scene.scale.set(T[0],T[1],T[2]);($||J||T)&&L.scene.updateMatrix()}$=function(){Y-=
+1;n();d.onLoadComplete()};for(z in F.cameras){J=F.cameras[z];if(J.type=="perspective")S=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);x=J.position;J=J.target;S.position.set(x[0],x[1],x[2]);S.target.position.set(J[0],J[1],J[2]);L.cameras[z]=S}for(v in F.lights){z=F.lights[v];S=z.color!==void 0?z.color:16777215;J=z.intensity!==void 0?z.intensity:1;if(z.type=="directional")x=
+z.direction,light=new THREE.DirectionalLight(S,J),light.position.set(x[0],x[1],x[2]),light.position.normalize();else if(z.type=="point")x=z.position,light=new THREE.PointLight(S,J),light.position.set(x[0],x[1],x[2]);L.scene.addLight(light);L.lights[v]=light}for(E in F.fogs)v=F.fogs[E],v.type=="linear"?G=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(G=new THREE.FogExp2(0,v.density)),J=v.color,G.color.setRGB(J[0],J[1],J[2]),L.fogs[E]=G;if(L.cameras&&F.defaults.camera)L.currentCamera=L.cameras[F.defaults.camera];
+if(L.fogs&&F.defaults.fog)L.scene.fog=L.fogs[F.defaults.fog];J=F.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(J[0],J[1],J[2]);L.bgColorAlpha=F.defaults.bgalpha;for(p in F.geometries)if(E=F.geometries[p],E.type=="bin_mesh"||E.type=="ascii_mesh")g+=1,d.onLoadStart();O=g;for(p in F.geometries)E=F.geometries[p],E.type=="cube"?(B=new THREE.Cube(E.width,E.height,E.depth,E.segmentsWidth,E.segmentsHeight,E.segmentsDepth,null,E.flipped,E.sides),L.geometries[p]=B):E.type=="plane"?(B=new THREE.Plane(E.width,
+E.height,E.segmentsWidth,E.segmentsHeight),L.geometries[p]=B):E.type=="sphere"?(B=new THREE.Sphere(E.radius,E.segmentsWidth,E.segmentsHeight),L.geometries[p]=B):E.type=="cylinder"?(B=new THREE.Cylinder(E.numSegs,E.topRad,E.botRad,E.height,E.topOffset,E.botOffset),L.geometries[p]=B):E.type=="torus"?(B=new THREE.Torus(E.radius,E.tube,E.segmentsR,E.segmentsT),L.geometries[p]=B):E.type=="icosahedron"?(B=new THREE.Icosahedron(E.subdivisions),L.geometries[p]=B):E.type=="bin_mesh"?b.load({model:e(E.url,
 F.urlBaseType),callback:m(p)}):E.type=="ascii_mesh"?N.load({model:e(E.url,F.urlBaseType),callback:m(p)}):E.type=="embedded_mesh"&&(E=F.embeds[E.id])&&N.createModel(E,o(p),"");for(y in F.textures)if(p=F.textures[y],p.url instanceof Array){Y+=p.url.length;for(b=0;b<p.url.length;b++)d.onLoadStart()}else Y+=1,d.onLoadStart();V=Y;for(y in F.textures){p=F.textures[y];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){for(var b=[],Q=0;Q<p.url.length;Q++)b[Q]=
-e(p.url[Q],F.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,p.mapping,$)}else{b=THREE.ImageUtils.loadTexture(e(p.url,F.urlBaseType),p.mapping,$);if(THREE[p.minFilter]!=void 0)b.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)b.magFilter=THREE[p.magFilter]}L.textures[y]=b}for(t in F.materials){y=F.materials[t];for(A in y.parameters)if(A=="envMap"||A=="map"||A=="lightMap")y.parameters[A]=L.textures[y.parameters[A]];else if(A=="shading")y.parameters[A]=y.parameters[A]=="flat"?THREE.FlatShading:
-THREE.SmoothShading;else if(A=="blending")y.parameters[A]=THREE[y.parameters[A]]?THREE[y.parameters[A]]:THREE.NormalBlending;else if(A=="combine")y.parameters[A]=y.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(y.parameters[A]=="face")y.parameters[A]=THREE.FaceColors;else if(y.parameters[A])y.parameters[A]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;y=new THREE[y.type](y.parameters);
+e(p.url[Q],F.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,p.mapping,$)}else{b=THREE.ImageUtils.loadTexture(e(p.url,F.urlBaseType),p.mapping,$);if(THREE[p.minFilter]!=void 0)b.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)b.magFilter=THREE[p.magFilter]}L.textures[y]=b}for(t in F.materials){y=F.materials[t];for(C in y.parameters)if(C=="envMap"||C=="map"||C=="lightMap")y.parameters[C]=L.textures[y.parameters[C]];else if(C=="shading")y.parameters[C]=y.parameters[C]=="flat"?THREE.FlatShading:
+THREE.SmoothShading;else if(C=="blending")y.parameters[C]=THREE[y.parameters[C]]?THREE[y.parameters[C]]:THREE.NormalBlending;else if(C=="combine")y.parameters[C]=y.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(y.parameters[C]=="face")y.parameters[C]=THREE.FaceColors;else if(y.parameters[C])y.parameters[C]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;y=new THREE[y.type](y.parameters);
 L.materials[t]=y}k();d.callbackSync(L)}}};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,h,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[h]=k+j*this.delta;c[h+1]=m;c[h+2]=o;f[h]=this.lerp(n[b],n[b+3],j);f[h+1]=this.lerp(n[b+1],n[b+4],j);f[h+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,c,f,h,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[h]=k;c[h+1]=m+j*this.delta;c[h+
 2]=o;c=b+this.yd*3;f[h]=this.lerp(n[b],n[c],j);f[h+1]=this.lerp(n[b+1],n[c+1],j);f[h+2]=this.lerp(n[b+2],n[c+2],j)};this.VIntZ=function(b,c,f,h,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[h]=k;c[h+1]=m;c[h+2]=o+j*this.delta;c=b+this.zd*3;f[h]=this.lerp(n[b],n[c],j);f[h+1]=this.lerp(n[b+1],n[c+1],j);f[h+2]=this.lerp(n[b+2],n[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,h,j,k){var m=h+1,o=h+this.yd,n=h+this.zd,p=m+this.yd,t=m+this.zd,u=h+this.yd+this.zd,v=m+this.yd+this.zd,C=0,E=this.field[h],y=this.field[m],D=this.field[o],x=this.field[p],I=this.field[n],A=this.field[t],z=this.field[u],S=this.field[v];E<j&&(C|=1);y<j&&(C|=2);D<j&&(C|=8);x<j&&(C|=4);I<j&&(C|=16);A<j&&(C|=32);z<j&&(C|=128);S<j&&(C|=64);var G=THREE.edgeTable[C];if(G==0)return 0;var M=this.delta,
-F=b+M,N=c+M,M=f+M;G&1&&(this.compNorm(h),this.compNorm(m),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,f,E,y));G&2&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,3,j,F,c,f,y,x));G&4&&(this.compNorm(o),this.compNorm(p),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,N,f,D,x));G&8&&(this.compNorm(h),this.compNorm(o),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,f,E,D));G&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,M,I,A));G&32&&(this.compNorm(t),
-this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,j,F,c,M,A,S));G&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,N,M,z,S));G&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,M,I,z));G&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,f,E,I));G&512&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,27,j,F,c,f,y,A));G&1024&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*
-3,this.vlist,this.nlist,30,j,F,N,f,x,S));G&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,N,f,D,z));C<<=4;for(j=h=0;THREE.triTable[C+j]!=-1;)b=C+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,h++;return h};this.posnormtriv=function(b,c,f,h,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[h];this.positionArray[m+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,h,j,k){var m=h+1,o=h+this.yd,n=h+this.zd,p=m+this.yd,t=m+this.zd,u=h+this.yd+this.zd,v=m+this.yd+this.zd,z=0,E=this.field[h],y=this.field[m],D=this.field[o],x=this.field[p],J=this.field[n],C=this.field[t],B=this.field[u],S=this.field[v];E<j&&(z|=1);y<j&&(z|=2);D<j&&(z|=8);x<j&&(z|=4);J<j&&(z|=16);C<j&&(z|=32);B<j&&(z|=128);S<j&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var M=this.delta,
+F=b+M,N=c+M,M=f+M;G&1&&(this.compNorm(h),this.compNorm(m),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,f,E,y));G&2&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,3,j,F,c,f,y,x));G&4&&(this.compNorm(o),this.compNorm(p),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,N,f,D,x));G&8&&(this.compNorm(h),this.compNorm(o),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,f,E,D));G&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,M,J,C));G&32&&(this.compNorm(t),
+this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,j,F,c,M,C,S));G&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,N,M,B,S));G&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,M,J,B));G&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,f,E,J));G&512&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,27,j,F,c,f,y,C));G&1024&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*
+3,this.vlist,this.nlist,30,j,F,N,f,x,S));G&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,N,f,D,B));z<<=4;for(j=h=0;THREE.triTable[z+j]!=-1;)b=z+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,h++;return h};this.posnormtriv=function(b,c,f,h,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[h];this.positionArray[m+
 4]=b[h+1];this.positionArray[m+5]=b[h+2];this.positionArray[m+6]=b[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=c[f];this.normalArray[m+1]=c[f+1];this.normalArray[m+2]=c[f+2];this.normalArray[m+3]=c[h];this.normalArray[m+4]=c[h+1];this.normalArray[m+5]=c[h+2];this.normalArray[m+6]=c[j];this.normalArray[m+7]=c[j+1];this.normalArray[m+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,h,j){var k=this.size*Math.sqrt(h/j),m=f*this.size,o=c*this.size,n=b*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var v,C,E,y,D,x;p<m;p++){n=this.size2*p;C=p/this.size-f;D=C*C;for(C=t;C<o;C++){E=n+this.size*C;v=C/this.size-c;x=v*v;for(v=u;v<k;v++)y=v/this.size-b,y=h/(1.0E-6+y*y+x+D)-j,y>0&&(this.field[E+v]+=y)}}};this.addPlaneX=function(b,c){var f,h,j,k,m,o=this.size,n=this.yd,p=this.zd,t=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f<u;f++)if(h=f/o,h*=h,k=b/(1.0E-4+h)-c,k>0)for(h=0;h<o;h++){m=f+h*n;for(j=0;j<o;j++)t[p*j+m]+=k}};this.addPlaneY=function(b,c){var f,h,j,k,m,o,n=this.size,p=this.yd,t=
+1);for(var v,z,E,y,D,x;p<m;p++){n=this.size2*p;z=p/this.size-f;D=z*z;for(z=t;z<o;z++){E=n+this.size*z;v=z/this.size-c;x=v*v;for(v=u;v<k;v++)y=v/this.size-b,y=h/(1.0E-6+y*y+x+D)-j,y>0&&(this.field[E+v]+=y)}}};this.addPlaneX=function(b,c){var f,h,j,k,m,o=this.size,n=this.yd,p=this.zd,t=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f<u;f++)if(h=f/o,h*=h,k=b/(1.0E-4+h)-c,k>0)for(h=0;h<o;h++){m=f+h*n;for(j=0;j<o;j++)t[p*j+m]+=k}};this.addPlaneY=function(b,c){var f,h,j,k,m,o,n=this.size,p=this.yd,t=
 this.zd,u=this.field,v=n*Math.sqrt(b/c);v>n&&(v=n);for(h=0;h<v;h++)if(f=h/n,f*=f,k=b/(1.0E-4+f)-c,k>0){m=h*p;for(f=0;f<n;f++){o=m+f;for(j=0;j<n;j++)u[t*j+o]+=k}}};this.addPlaneZ=function(b,c){var f,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;for(f=0;f<size;f++)field[o+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,h,j,k,m,o,n,p,t=this.size-2;for(j=1;j<t;j++){p=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=p+this.size*h;m=(h-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,m,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(h){var j,k,m,o,n,p,t,u;for(j=0;j<h.count;j++)t=j*3,n=t+1,u=t+2,k=h.positionArray[t],
 m=h.positionArray[n],o=h.positionArray[u],p=new THREE.Vector3(k,m,o),k=h.normalArray[t],m=h.normalArray[n],o=h.normalArray[u],t=new THREE.Vector3(k,m,o),t.normalize(),n=new THREE.Vertex(p),c.vertices.push(n),f.push(t);nfaces=h.count/3;for(j=0;j<nfaces;j++)t=(b+j)*3,n=t+1,u=t+2,p=f[t],k=f[n],m=f[u],t=new THREE.Face3(t,n,u,[p,k,m]),c.faces.push(t);b+=nfaces;h.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
@@ -543,3 +543,7 @@ THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(
 THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},j=new THREE.WebGLRenderTarget(512,512,b),k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.Camera(53,1,1,1E4);m.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:j},mapRight:{type:"t",value:1,texture:k}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var o=new THREE.Scene;o.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);j.width=b;j.height=e;k.width=b;k.height=e};this.render=
 function(b,d){f.projectionMatrix=d.projectionMatrix;f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(-10);h.projectionMatrix=d.projectionMatrix;h.position.copy(d.position);h.target.position.copy(d.target.position);h.translateX(10);e.call(c,b,f,j,!0);e.call(c,b,h,k,!0);e.call(c,o,m)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,j={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(256,512,j),m=new THREE.WebGLRenderTarget(256,512,j);c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;var o=window.innerWidth,j=window.innerHeight,b=o/2,n=new THREE.Camera;n.projectionMatrix=THREE.Matrix4.makeOrtho(o/
+-2,o/2,j/2,j/-2,-1E4,1E4);(new THREE.Camera(53,b/j,1,1E4)).position.z=-10;var o=THREE.ShaderUtils.lib.screen,p=THREE.UniformsUtils.clone(o.uniforms),t=THREE.UniformsUtils.clone(o.uniforms);p.tDiffuse.texture=k;t.tDiffuse.texture=m;p=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:p});o=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:t});t=new THREE.Mesh(new THREE.Plane(b,j),p);j=new THREE.Mesh(new THREE.Plane(b,
+j),o);t.position.x=-b/2;j.position.x=b/2;var u=new THREE.Scene;u.addObject(t);u.addObject(j);this.setSize=function(b,e){d.call(c,b,e);k.width=b/2;k.height=e;m.width=b/2;m.height=e};this.render=function(b,d){f.fov=d.fov;f.aspect=0.5*d.aspect;f.near=d.near;f.far=d.far;f.updateProjectionMatrix();f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(c.separation);h.projectionMatrix=f.projectionMatrix;h.position.copy(d.position);h.target.position.copy(d.target.position);h.translateX(-c.separation);
+e.call(c,b,f,k);e.call(c,b,h,m);e.call(c,u,n)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;

+ 1 - 1
build/custom/ThreeCanvas.js

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

+ 1 - 1
build/custom/ThreeDOM.js

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

+ 151 - 147
build/custom/ThreeExtras.js

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

+ 1 - 1
build/custom/ThreeSVG.js

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

+ 2 - 2
build/custom/ThreeWebGL.js

@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;thi
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
 multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,h=this.w,i=b.x,g=b.y,j=b.z,b=b.w;this.x=d*b+h*i+e*j-f*g;this.y=e*b+h*g+f*i-d*j;this.z=f*b+h*j+d*g-e*i;this.w=h*b-d*i-e*g-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,h=b.z,i=this.x,g=this.y,j=this.z,p=this.w,k=p*e+g*h-j*f,n=
 p*f+j*e-i*h,v=p*h+i*f-g*e,e=-i*e-g*f-j*h;d.x=k*p+e*-i+n*-j-v*-g;d.y=n*p+e*-g+v*-i-k*-j;d.z=v*p+e*-j+k*-g-n*-i;return d}};
-THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={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};
@@ -214,7 +214,7 @@ c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.
 (c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
 b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,z[0]=q[0]*o+o,z[1]=q[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
 c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
-i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+i;h++)if(j=e.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
 x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=o=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
 z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=

+ 259 - 0
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -0,0 +1,259 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - cube reflection [camaro]</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background:#000;
+				color:#fff;
+				padding:0;
+				margin:0;
+				overflow:hidden;
+				font-family:georgia;
+				text-align:center;
+			}
+			h1 { }
+			a { color:skyblue }
+			canvas { pointer-events:none; z-index:10; position:relative; }
+			#log { position:absolute; top:50px; text-align:left; display:block; z-index:100 }
+			#d { text-align:center; margin:1em 0 -2.5em 0; z-index:0; position:relative; display:block }
+			#buttons { margin:0.5em 0 0 0 }
+			button { font-family:georgia; border:0; background:#222; color:#fff; padding:0.2em 0.5em; cursor:pointer; border-radius:3px }
+			button:hover { background:#333 }
+		</style>
+	</head>
+
+	<body>
+		<div id="d">
+			<div id="info">
+				<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube reflection demo. chevrolet camaro by <a href="http://www.turbosquid.com/3d-models/blender-camaro/411348" target="_blank">dskfnwn</a>
+					- O, P : change eye separation
+				</div>
+				
+			<div id="buttons"></div>
+		</div>
+
+		<div id="log"></div>
+
+		<script type="text/javascript" src="js/ThreeCross.js"></script>
+		
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var container, stats;
+
+			var camera, scene, webglRenderer;
+
+			var lightMesh;
+
+			var directionalLight, pointLight;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
+				camera.position.z = 1000;
+				camera.updateMatrix();
+
+				scene = new THREE.Scene();
+
+				// LIGHTS
+
+				var ambient = new THREE.AmbientLight( 0x555555 );
+				scene.addLight( ambient );
+
+				directionalLight = new THREE.DirectionalLight( 0xffffff );
+				directionalLight.position.x = 1;
+				directionalLight.position.y = 1;
+				directionalLight.position.z = 0.5;
+				directionalLight.position.normalize();
+				scene.addLight( directionalLight );
+
+				pointLight = new THREE.PointLight( 0xffaa00 );
+				pointLight.position.x = 0;
+				pointLight.position.y = 0;
+				pointLight.position.z = 0;
+				scene.addLight( pointLight );
+
+
+				sphere = new THREE.Sphere( 100, 16, 8, 1 );
+				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
+				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
+				lightMesh.position = pointLight.position;
+				lightMesh.overdraw = true;
+				lightMesh.updateMatrix();
+				scene.addObject(lightMesh);
+
+
+				webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 20 } );
+				webglRenderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( webglRenderer.domElement );
+
+				webglRenderer.setFaceCulling( 0 );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				stats.domElement.style.zIndex = 100;
+				container.appendChild( stats.domElement );
+
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.addEventListener( 'keydown', onKeyDown, false );
+
+				var r = "textures/cube/SwedishRoyalCastle/";
+				var urls = [ r + "px.jpg", r + "nx.jpg",
+							 r + "py.jpg", r + "ny.jpg",
+							 r + "pz.jpg", r + "nz.jpg" ];
+
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
+
+				var camaroMaterials = {
+
+					body: [],
+					chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
+					darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
+					glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
+					tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
+					interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
+					black: new THREE.MeshLambertMaterial( { color: 0x000000 } )
+
+				}
+
+				camaroMaterials.body.push( [ "Orange", new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
+				camaroMaterials.body.push( [ "Blue", new THREE.MeshLambertMaterial( { color: 0x226699, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
+				camaroMaterials.body.push( [ "Red", new THREE.MeshLambertMaterial( { color: 0x660000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "Black", new THREE.MeshLambertMaterial( { color: 0x000000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "White", new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+
+				camaroMaterials.body.push( [ "Carmine", new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+				camaroMaterials.body.push( [ "Gold", new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+				camaroMaterials.body.push( [ "Bronze", new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "Chrome", new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+
+				var loader = new THREE.BinaryLoader();
+				loader.load( { model: "obj/camaro/CamaroNoUv_bin.js", callback: function( geometry ) { createScene( geometry, camaroMaterials ) } } );
+
+			}
+
+			function $( id ) { return document.getElementById( id ) }
+
+
+			function createButtons( materials, geometry ) {
+
+				var i, src = "", parent = $( "buttons" );
+
+				for( i = 0; i < materials.length; i++ ) {
+
+					src += '<button id="m' + i + '">' + materials[ i ][ 0 ] + '</button>';
+
+				}
+
+				parent.innerHTML = src;
+
+				for( i = 0; i < materials.length; i++ ) {
+
+					$( "m" + i ).counter = i;
+					$( "m" + i ).addEventListener( 'click', function() { geometry.materials[ 0 ][ 0 ] = materials[ this.counter ][ 1 ] }, false );
+
+				}
+
+			}
+
+			function createScene( geometry, materials ) {
+
+				var s = 75, m = new THREE.MeshFaceMaterial();
+
+				geometry.materials[ 0 ][ 0 ] = materials.body[ 0 ][ 1 ]; // car body
+				geometry.materials[ 1 ][ 0 ] = materials.chrome; // wheels chrome
+				geometry.materials[ 2 ][ 0 ] = materials.chrome; // grille chrome
+				geometry.materials[ 3 ][ 0 ] = materials.darkchrome; // door lines
+				geometry.materials[ 4 ][ 0 ] = materials.glass; // windshield
+				geometry.materials[ 5 ][ 0 ] = materials.interior; // interior
+				geometry.materials[ 6 ][ 0 ] = materials.tire; // tire
+				geometry.materials[ 7 ][ 0 ] = materials.black; // tireling
+				geometry.materials[ 8 ][ 0 ] = materials.black; // behind grille
+
+				THREE.SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, 0.0, 1.0, 0.0, m );
+
+				createButtons( materials.body, geometry );
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = ( event.clientX - windowHalfX );
+				mouseY = ( event.clientY - windowHalfY );
+
+			}
+
+			function onKeyDown ( event ) {
+
+				switch( event.keyCode ) {
+				
+					/* O */
+					case 79: webglRenderer.separation -= 0.5; break;
+					
+					/* P */
+					case 80: webglRenderer.separation += 0.5; break;
+
+				}
+
+				console.log( webglRenderer.separation );
+
+			};
+
+			// 
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function render() {
+
+				var timer = - new Date().getTime() * 0.0002;
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
+				lightMesh.position.x = 1500 * Math.cos( timer );
+				lightMesh.position.z = 1500 * Math.sin( timer );
+
+				webglRenderer.render( scene, camera );
+
+			}
+
+			function log(text) {
+
+				var e = document.getElementById("log");
+				e.innerHTML = text + "<br/>" + e.innerHTML;
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 170 - 0
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -0,0 +1,170 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - cube refraction [balls]</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background:#777;
+				padding:0;
+				margin:0;
+				font-weight: bold;
+				overflow:hidden;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				color: #ffffff;
+				padding: 5px;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				z-index:1000; 
+			}
+
+			a {
+				color: #ffffff;
+			}
+
+			#oldie a { color:#da0 }
+		</style>
+	</head>
+
+	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube refraction demo. skybox by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a>
+			- O, P : change eye separation
+		</div>
+
+		<script type="text/javascript" src="js/ThreeCross.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var container, timer;
+
+			var camera, scene, webglRenderer;
+
+			var mesh, zmesh, lightMesh, geometry;
+			var spheres = [];
+
+			var directionalLight, pointLight;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+				camera.position.z = 3200;
+
+				scene = new THREE.Scene();
+
+				var geometry = new THREE.Sphere( 100, 32, 16 );
+
+				var path = "textures/cube/skybox/";
+				var format = '.jpg';
+				var urls = [
+					path + 'px' + format, path + 'nx' + format,
+					path + 'py' + format, path + 'ny' + format,
+					path + 'pz' + format, path + 'nz' + format
+				];
+
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
+				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
+
+				for ( var i = 0; i < 500; i ++ ) {
+
+					var mesh = new THREE.Mesh( geometry, material );
+					mesh.position.x = Math.random() * 10000 - 5000;
+					mesh.position.y = Math.random() * 10000 - 5000;
+					mesh.position.z = Math.random() * 10000 - 5000;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
+					scene.addObject( mesh );
+
+					spheres.push( mesh );
+
+				}
+
+				THREE.SceneUtils.addPanoramaCubeWebGL( scene, 100000, textureCube );
+
+				webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 90 } );
+				webglRenderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( webglRenderer.domElement );
+				
+				document.addEventListener( 'keydown', onKeyDown, false );
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = ( event.clientX - windowHalfX ) * 10;
+				mouseY = ( event.clientY - windowHalfY ) * 10;
+
+			}
+
+			function onKeyDown ( event ) {
+
+				switch( event.keyCode ) {
+				
+					/* O */
+					case 79: webglRenderer.separation -= 0.5; break;
+					
+					/* P */
+					case 80: webglRenderer.separation += 0.5; break;
+
+				}
+
+				console.log( webglRenderer.separation );
+
+			};
+
+			//
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+
+			}
+
+			function render() {
+
+				timer = new Date().getTime() * 0.0001;
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
+				for ( var i = 0, il = spheres.length; i < il; i ++ ) {
+
+					var sphere = spheres[ i ];
+
+					sphere.position.x = 5000 * Math.cos( timer + i );
+					sphere.position.y = 5000 * Math.sin( timer + i * 1.1 );
+
+				}
+
+				webglRenderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 93 - 0
src/extras/renderers/CrosseyedWebGLRenderer.js

@@ -0,0 +1,93 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ */
+
+THREE.CrosseyedWebGLRenderer = function ( parameters ) {
+
+	THREE.WebGLRenderer.call( this, parameters );
+
+	var _this = this, _setSize = this.setSize, _render = this.render;
+
+	var _cameraL = new THREE.Camera(), 
+		_cameraR = new THREE.Camera();
+
+	var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
+	
+	var _renderTargetL = new THREE.WebGLRenderTarget( 256, 512, _params ), 
+		_renderTargetR = new THREE.WebGLRenderTarget( 256, 512, _params );
+
+	_this.separation = 10;
+	if ( parameters && parameters.separation !== undefined ) _this.separation = parameters.separation;
+
+	var SCREEN_WIDTH  = window.innerWidth;
+	var SCREEN_HEIGHT = window.innerHeight;
+	var HALF_WIDTH = SCREEN_WIDTH / 2;
+
+	var _orthoCamera = new THREE.Camera();
+	_orthoCamera.projectionMatrix = THREE.Matrix4.makeOrtho( SCREEN_WIDTH / - 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_HEIGHT / - 2, -10000, 10000 );
+	
+	var _camera = new THREE.Camera( 53, HALF_WIDTH / SCREEN_HEIGHT, 1, 10000 );
+	_camera.position.z = -10;
+
+	var base = THREE.ShaderUtils.lib[ "screen" ];
+	
+	var uniformsL = THREE.UniformsUtils.clone( base.uniforms );
+	var uniformsR = THREE.UniformsUtils.clone( base.uniforms );
+	
+	uniformsL.tDiffuse.texture = _renderTargetL;
+	uniformsR.tDiffuse.texture = _renderTargetR;
+	
+	var screenMaterialL = new THREE.MeshShaderMaterial( { fragmentShader: base.fragmentShader, vertexShader: base.vertexShader, uniforms: uniformsL } );
+	var screenMaterialR = new THREE.MeshShaderMaterial( { fragmentShader: base.fragmentShader, vertexShader: base.vertexShader, uniforms: uniformsR } );
+	
+	var _left  = new THREE.Mesh( new THREE.Plane( HALF_WIDTH, SCREEN_HEIGHT ), screenMaterialL );
+	var _right = new THREE.Mesh( new THREE.Plane( HALF_WIDTH, SCREEN_HEIGHT ), screenMaterialR );
+	
+	_left.position.x  = -HALF_WIDTH/2;
+	_right.position.x =  HALF_WIDTH/2;
+	
+	var _scene = new THREE.Scene();
+	_scene.addObject( _left );
+	_scene.addObject( _right );
+
+	this.setSize = function ( width, height ) {
+
+		_setSize.call( _this, width, height );
+
+		_renderTargetL.width = width/2;
+		_renderTargetL.height = height;
+
+		_renderTargetR.width = width/2;
+		_renderTargetR.height = height;
+
+	};
+
+	this.render = function ( scene, camera, renderTarget, forceClear ) {
+		
+		_cameraL.fov = camera.fov;
+		_cameraL.aspect = 0.5 * camera.aspect;
+		_cameraL.near = camera.near;
+		_cameraL.far = camera.far;
+		_cameraL.updateProjectionMatrix();
+		
+		_cameraL.position.copy( camera.position );
+		_cameraL.target.position.copy( camera.target.position );
+		_cameraL.translateX( _this.separation );
+
+		_cameraR.projectionMatrix = _cameraL.projectionMatrix;
+
+		_cameraR.position.copy( camera.position );
+		_cameraR.target.position.copy( camera.target.position );
+		_cameraR.translateX( - _this.separation );
+
+		_render.call( _this, scene, _cameraL, _renderTargetL );
+		_render.call( _this, scene, _cameraR, _renderTargetR );
+
+		_render.call( _this, _scene, _orthoCamera );
+
+	};
+
+};
+
+THREE.CrosseyedWebGLRenderer.prototype = new THREE.WebGLRenderer();
+THREE.CrosseyedWebGLRenderer.prototype.constructor = THREE.CrosseyedWebGLRenderer;

+ 2 - 1
utils/build.py

@@ -110,7 +110,8 @@ EXTRAS_FILES = [
 'extras/objects/Trident.js',
 'extras/physics/Collisions.js',
 'extras/physics/CollisionUtils.js',
-'extras/renderers/AnaglyphWebGLRenderer.js'
+'extras/renderers/AnaglyphWebGLRenderer.js',
+'extras/renderers/CrosseyedWebGLRenderer.js'
 ]
 
 CANVAS_FILES = [