Browse Source

Merge remote branch 'alteredq/master'

Mr.doob 14 years ago
parent
commit
a23f8309ed

+ 190 - 190
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r37 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var e,f,g,h,k,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a;
+THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var e,f,g,j,k,m;if(b==0)e=f=g=0;else{j=Math.floor(a*6);k=a*6-j;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(j){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a;
 g=m;break;case 6:case 0:e=b;f=c;g=a}}this.r=e;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
 THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,75 +12,75 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
 THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(I,F,M,D){D=D.clone().subSelf(F);M=M.clone().subSelf(F);var Q=I.clone().subSelf(F);I=D.dot(D);F=D.dot(M);D=D.dot(Q);var R=M.dot(M);M=M.dot(Q);Q=1/(I*R-F*F);R=(R*D-F*M)*Q;I=(I*M-F*D)*Q;return R>0&&I>0&&R+I<1}var b,e,f,g,h,k,m,n,p,x,
-z,y=a.geometry,B=y.vertices,H=[];b=0;for(e=y.faces.length;b<e;b++){f=y.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(B[f.a].position.clone());h=m.multiplyVector3(B[f.b].position.clone());k=m.multiplyVector3(B[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(B[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=z.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,x))/p;x=x.addSelf(z.multiplyScalar(n));
-if(f instanceof THREE.Face3){if(c(x,g,h,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,h,m)||c(x,h,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}}return H}};
-THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,n,p,x){k=!1;c=m;b=n;e=p;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;e=m;f=n}else{c=c<m?c:m;b=b<n?b:n;e=e>m?e:m;f=f>n?f:n}a()};
-this.add3Points=function(m,n,p,x,z,y){if(k){k=!1;c=m<p?m<z?m:z:p<z?p:z;b=n<x?n<y?n:y:x<y?x:y;e=m>p?m>z?m:z:p>z?p:z;f=n>x?n>y?n:y:x>y?x:y}else{c=m<p?m<z?m<c?m:c:z<c?z:c:p<z?p<c?p:c:z<c?z:c;b=n<x?n<y?n<b?n:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;e=m>p?m>z?m>e?m:e:z>e?z:e:p>z?p>e?p:e:z>e?z:e;f=n>x?n>y?n>f?n:f:y>f?y:f:x>y?x>f?x:f:y>f?y:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,j){return g.distance-j.distance});return f},intersectObject:function(a){function c(I,F,M,D){D=D.clone().subSelf(F);M=M.clone().subSelf(F);var Q=I.clone().subSelf(F);I=D.dot(D);F=D.dot(M);D=D.dot(Q);var R=M.dot(M);M=M.dot(Q);Q=1/(I*R-F*F);R=(R*D-F*M)*Q;I=(I*M-F*D)*Q;return R>0&&I>0&&R+I<1}var b,e,f,g,j,k,m,n,o,x,
+z,y=a.geometry,B=y.vertices,H=[];b=0;for(e=y.faces.length;b<e;b++){f=y.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(B[f.a].position.clone());j=m.multiplyVector3(B[f.b].position.clone());k=m.multiplyVector3(B[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(B[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());o=z.dot(n);if(o<0){n=n.dot((new THREE.Vector3).sub(g,x))/o;x=x.addSelf(z.multiplyScalar(n));
+if(f instanceof THREE.Face3){if(c(x,g,j,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,j,m)||c(x,j,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}}return H}};
+THREE.Rectangle=function(){function a(){g=e-c;j=f-b}var c,b,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,n,o,x){k=!1;c=m;b=n;e=o;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;e=m;f=n}else{c=c<m?c:m;b=b<n?b:n;e=e>m?e:m;f=f>n?f:n}a()};
+this.add3Points=function(m,n,o,x,z,y){if(k){k=!1;c=m<o?m<z?m:z:o<z?o:z;b=n<x?n<y?n:y:x<y?x:y;e=m>o?m>z?m:z:o>z?o:z;f=n>x?n>y?n:y:x>y?x:y}else{c=m<o?m<z?m<c?m:c:z<c?z:c:o<z?o<c?o:c:z<c?z:c;b=n<x?n<y?n<b?n:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;e=m>o?m>z?m>e?m:e:z>e?z:e:o>z?o>e?o:e:z>e?z:e;f=n>x?n>y?n>f?n:f:y>f?y:f:x>y?x>f?x:f:y>f?y:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
 e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){k=!0;f=e=b=c=0;a()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,e,f,g,h,k,m,n,p,x,z,y,B,H){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,k||0,m||0,n||0,p||1,x||0,z||0,y||0,B||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,k,m,n,p,x,z,y,B,H){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=m;this.n32=n;this.n33=p;this.n34=x;this.n41=z;this.n42=y;this.n43=B;this.n44=H;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,c,b,e,f,g,j,k,m,n,o,x,z,y,B,H){this.set(a||1,c||0,b||0,e||0,f||0,g||1,j||0,k||0,m||0,n||0,o||1,x||0,z||0,y||0,B||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,j,k,m,n,o,x,z,y,B,H){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=o;this.n34=x;this.n41=z;this.n42=y;this.n43=B;this.n44=H;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
 e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44,M=c.n11,D=c.n12,Q=c.n13,R=c.n14,P=c.n21,ka=c.n22,
-$=c.n23,d=c.n24,X=c.n31,da=c.n32,Y=c.n33,ua=c.n34;this.n11=b*M+e*P+f*X;this.n12=b*D+e*ka+f*da;this.n13=b*Q+e*$+f*Y;this.n14=b*R+e*d+f*ua+g;this.n21=h*M+k*P+m*X;this.n22=h*D+k*ka+m*da;this.n23=h*Q+k*$+m*Y;this.n24=h*R+k*d+m*ua+n;this.n31=p*M+x*P+z*X;this.n32=p*D+x*ka+z*da;this.n33=p*Q+x*$+z*Y;this.n34=p*R+x*d+z*ua+y;this.n41=B*M+H*P+I*X;this.n42=B*D+H*ka+I*da;this.n43=B*Q+H*$+I*Y;this.n44=B*R+H*d+I*ua+F;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,n=a.n24,o=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44,M=c.n11,D=c.n12,Q=c.n13,R=c.n14,P=c.n21,ka=c.n22,
+$=c.n23,d=c.n24,X=c.n31,da=c.n32,Y=c.n33,ua=c.n34;this.n11=b*M+e*P+f*X;this.n12=b*D+e*ka+f*da;this.n13=b*Q+e*$+f*Y;this.n14=b*R+e*d+f*ua+g;this.n21=j*M+k*P+m*X;this.n22=j*D+k*ka+m*da;this.n23=j*Q+k*$+m*Y;this.n24=j*R+k*d+m*ua+n;this.n31=o*M+x*P+z*X;this.n32=o*D+x*ka+z*da;this.n33=o*Q+x*$+z*Y;this.n34=o*R+x*d+z*ua+y;this.n41=B*M+H*P+I*X;this.n42=B*D+H*ka+I*da;this.n43=B*Q+H*$+I*Y;this.n44=B*R+H*d+I*ua+F;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
-determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,m=this.n31,n=this.n32,p=this.n33,x=this.n34,z=this.n41,y=this.n42,B=this.n43,H=this.n44;return e*h*n*z-b*k*n*z-e*g*p*z+c*k*p*z+b*g*x*z-c*h*x*z-e*h*m*y+b*k*m*y+e*f*p*y-a*k*p*y-b*f*x*y+a*h*x*y+e*g*m*B-c*k*m*B-e*f*n*B+a*k*n*B+c*f*x*B-a*g*x*B-b*g*m*H+c*h*m*H+b*f*n*H-a*h*n*H-c*f*p*H+a*g*p*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,o=this.n33,x=this.n34,z=this.n41,y=this.n42,B=this.n43,H=this.n44;return e*j*n*z-b*k*n*z-e*g*o*z+c*k*o*z+b*g*x*z-c*j*x*z-e*j*m*y+b*k*m*y+e*f*o*y-a*k*o*y-b*f*x*y+a*j*x*y+e*g*m*B-c*k*m*B-e*f*n*B+a*k*n*B+c*f*x*B-a*g*x*B-b*g*m*H+c*j*m*H+b*f*n*H-a*j*n*H-c*f*o*H+a*g*o*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
 a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
 a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
-setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,h=a.y,k=
-a.z,m=f*g,n=f*h;this.set(m*g+b,m*h-e*k,m*k+e*h,0,m*h+e*k,n*h+b,n*k-e*g,0,m*k-e*h,n*k+e*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,k=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=k*g+a*e;this.n22=-k*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this},
-setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,k=e+e;a=c*g;var m=c*h;c*=k;var n=b*h;b*=k;e*=k;g*=f;h*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
+setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,j=a.y,k=
+a.z,m=f*g,n=f*j;this.set(m*g+b,m*j-e*k,m*k+e*j,0,m*j+e*k,n*j+b,n*k-e*g,0,m*k-e*j,n*k+e*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var j=a*b,k=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=k*g+a*e;this.n22=-k*e+a*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=a*f;return this},
+setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,j=b+b,k=e+e;a=c*g;var m=c*j;c*=k;var n=b*j;b*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-j;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*y*H-n*z*H+n*x*I-k*y*I-m*x*F+k*z*F;c.n12=g*z*H-f*y*H-g*x*I+e*y*I+f*x*F-e*z*F;c.n13=f*n*H-g*m*H+g*k*I-e*n*I-f*k*F+e*m*F;c.n14=g*m*x-f*n*x-g*k*z+e*n*z+f*k*y-e*m*y;c.n21=n*z*B-m*y*B-n*p*I+h*y*I+m*p*F-h*z*F;c.n22=f*y*B-g*z*B+g*p*I-b*y*I-f*p*F+b*z*F;c.n23=g*m*B-f*n*B-g*h*I+b*n*I+f*h*F-b*m*F;
-c.n24=f*n*p-g*m*p+g*h*z-b*n*z-f*h*y+b*m*y;c.n31=k*y*B-n*x*B+n*p*H-h*y*H-k*p*F+h*x*F;c.n32=g*x*B-e*y*B-g*p*H+b*y*H+e*p*F-b*x*F;c.n33=f*n*B-g*k*B+g*h*H-b*n*H-e*h*F+b*k*F;c.n34=g*k*p-e*n*p-g*h*x+b*n*x+e*h*y-b*k*y;c.n41=m*x*B-k*z*B-m*p*H+h*z*H+k*p*I-h*x*I;c.n42=e*z*B-f*x*B+f*p*H-b*z*H-e*p*I+b*x*I;c.n43=f*k*B-e*m*B-f*h*H+b*m*H+e*h*I-b*k*I;c.n44=e*m*p-f*k*p+f*h*x-b*m*x-e*h*z+b*k*z;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*p;b[8]=a*x;return c};
-THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
-THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,k,m,n;h=new THREE.Matrix4;k=c-a;m=b-e;n=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,n=a.n24,o=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*y*H-n*z*H+n*x*I-k*y*I-m*x*F+k*z*F;c.n12=g*z*H-f*y*H-g*x*I+e*y*I+f*x*F-e*z*F;c.n13=f*n*H-g*m*H+g*k*I-e*n*I-f*k*F+e*m*F;c.n14=g*m*x-f*n*x-g*k*z+e*n*z+f*k*y-e*m*y;c.n21=n*z*B-m*y*B-n*o*I+j*y*I+m*o*F-j*z*F;c.n22=f*y*B-g*z*B+g*o*I-b*y*I-f*o*F+b*z*F;c.n23=g*m*B-f*n*B-g*j*I+b*n*I+f*j*F-b*m*F;
+c.n24=f*n*o-g*m*o+g*j*z-b*n*z-f*j*y+b*m*y;c.n31=k*y*B-n*x*B+n*o*H-j*y*H-k*o*F+j*x*F;c.n32=g*x*B-e*y*B-g*o*H+b*y*H+e*o*F-b*x*F;c.n33=f*n*B-g*k*B+g*j*H-b*n*H-e*j*F+b*k*F;c.n34=g*k*o-e*n*o-g*j*x+b*n*x+e*j*y-b*k*y;c.n41=m*x*B-k*z*B-m*o*H+j*z*H+k*o*I-j*x*I;c.n42=e*z*B-f*x*B+f*o*H-b*z*H-e*o*I+b*x*I;c.n43=f*k*B-e*m*B-f*j*H+b*m*H+e*j*I-b*k*I;c.n44=e*m*o-f*k*o+f*j*x-b*m*x-e*j*z+b*k*z;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*j;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*o;b[8]=a*x;return c};
+THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(e-b);j.n23=(e+b)/(e-b);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
+THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var j,k,m,n;j=new THREE.Matrix4;k=c-a;m=b-e;n=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+a)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((b+e)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((g+f)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
 c,b)}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,e=a.y*c,f=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=e*f;this.w=h*g-k*b;this.x=h*b+k*g;this.y=e*c*g+a*f*b;this.z=a*f*g-e*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,e=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-e*h;this.y=b*a+f*h+e*g-c*k;this.z=e*a+f*k+c*h-b*g;this.w=f*a-c*g-b*h-e*k;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,h=this.y,k=this.z,m=this.w,n=m*b+h*f-k*e,p=m*e+k*b-g*f,x=m*f+g*e-h*b;b=-g*b-h*e-k*f;c.x=n*m+b*-g+p*-k-x*-h;c.y=p*m+b*-h+x*-g-n*-k;c.z=x*m+b*-k+n*-h-p*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,e){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-e)*g)/h;e=Math.sin(e*g)/h;b.w=a.w*f+c.w*e;b.x=a.x*f+c.x*e;b.y=a.y*f+c.y*e;b.z=a.z*f+c.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,e=a.y*c,f=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var j=a*c,k=e*f;this.w=j*g-k*b;this.x=j*b+k*g;this.y=e*c*g+a*f*b;this.z=a*f*g-e*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,e=this.z,f=this.w,g=a.x,j=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-e*j;this.y=b*a+f*j+e*g-c*k;this.z=e*a+f*k+c*j-b*g;this.w=f*a-c*g-b*j-e*k;return this},
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,j=this.y,k=this.z,m=this.w,n=m*b+j*f-k*e,o=m*e+k*b-g*f,x=m*f+g*e-j*b;b=-g*b-j*e-k*f;c.x=n*m+b*-g+o*-k-x*-j;c.y=o*m+b*-j+x*-g-n*-k;c.z=x*m+b*-k+n*-j-o*-g;return c}};
+THREE.Quaternion.slerp=function(a,c,b,e){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;b.w=a.w*f+c.w*e;b.x=a.x*f+c.x*e;b.y=a.y*f+c.y*e;b.z=a.z*f+c.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,e,f,g){this.a=a;this.b=c;this.c=b;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=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,c,b,e,f,g,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
+THREE.Face4=function(a,c,b,e,f,g,j){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];j=this.vertices[g.c];k.sub(j.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
 k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
 this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
-b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(W,ia,Z,S,N,ha,ra){k=W.vertices[ia].position;m=W.vertices[Z].position;n=W.vertices[S].position;p=h[N];x=h[ha];z=h[ra];y=m.x-k.x;B=n.x-k.x;H=m.y-k.y;I=n.y-k.y;F=m.z-k.z;M=n.z-k.z;D=x.u-p.u;Q=z.u-p.u;R=x.v-p.v;P=z.v-p.v;ka=1/(D*P-Q*R);da.set((P*
-y-R*B)*ka,(P*H-R*I)*ka,(P*F-R*M)*ka);Y.set((D*B-Q*y)*ka,(D*I-Q*H)*ka,(D*M-Q*F)*ka);d[ia].addSelf(da);d[Z].addSelf(da);d[S].addSelf(da);X[ia].addSelf(Y);X[Z].addSelf(Y);X[S].addSelf(Y)}var c,b,e,f,g,h,k,m,n,p,x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d=[],X=[],da=new THREE.Vector3,Y=new THREE.Vector3,ua=new THREE.Vector3,va=new THREE.Vector3,za=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){d[c]=new THREE.Vector3;X[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];h=this.faceVertexUvs[0][c];
+b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(W,ia,Z,S,N,ha,ra){k=W.vertices[ia].position;m=W.vertices[Z].position;n=W.vertices[S].position;o=j[N];x=j[ha];z=j[ra];y=m.x-k.x;B=n.x-k.x;H=m.y-k.y;I=n.y-k.y;F=m.z-k.z;M=n.z-k.z;D=x.u-o.u;Q=z.u-o.u;R=x.v-o.v;P=z.v-o.v;ka=1/(D*P-Q*R);da.set((P*
+y-R*B)*ka,(P*H-R*I)*ka,(P*F-R*M)*ka);Y.set((D*B-Q*y)*ka,(D*I-Q*H)*ka,(D*M-Q*F)*ka);d[ia].addSelf(da);d[Z].addSelf(da);d[S].addSelf(da);X[ia].addSelf(Y);X[Z].addSelf(Y);X[S].addSelf(Y)}var c,b,e,f,g,j,k,m,n,o,x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d=[],X=[],da=new THREE.Vector3,Y=new THREE.Vector3,ua=new THREE.Vector3,va=new THREE.Vector3,za=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){d[c]=new THREE.Vector3;X[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];j=this.faceVertexUvs[0][c];
 if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ma=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){za.copy(g.vertexNormals[e]);f=g[ma[e]];$=d[f];ua.copy($);ua.subSelf(za.multiplyScalar(za.dot($))).normalize();va.cross(g.vertexNormals[e],$);f=va.dot(X[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ua.x,ua.y,ua.z,f)}}this.hasTangents=!0},
 computeBoundingBox:function(){var a;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,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=
 a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(y,B,H,I,F,M,D){y=(H-y)*0.5;I=(I-B)*0.5;return(2*(B-H)+y+I)*D+(-3*(B-H)-2*y-I)*M+y*F+B}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,k,m,n,p,x,z;this.initFromArray=function(y){this.points=[];for(var B=0;B<y.length;B++)this.points[B]={x:y[B][0],y:y[B][1],z:y[B][2]}};this.getPoint=function(y){f=(this.points.length-1)*y;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
-x=this.points[b[2]];z=this.points[b[3]];k=h*h;m=h*k;e.x=c(n.x,p.x,x.x,z.x,h,k,m);e.y=c(n.y,p.y,x.y,z.y,h,k,m);e.z=c(n.z,p.z,x.z,z.z,h,k,m);return e};this.getControlPointsArray=function(){var y,B,H=this.points.length,I=[];for(y=0;y<H;y++){B=this.points[y];I[y]=[B.x,B.y,B.z]}return I};this.getLength=function(y){var B,H,I=B=B=0,F=new THREE.Vector3,M=new THREE.Vector3,D=[],Q=0;D[0]=0;y||(y=100);H=this.points.length*y;F.copy(this.points[0]);for(y=1;y<H;y++){B=y/H;position=this.getPoint(B);M.copy(position);
+THREE.Spline=function(a){function c(y,B,H,I,F,M,D){y=(H-y)*0.5;I=(I-B)*0.5;return(2*(B-H)+y+I)*D+(-3*(B-H)-2*y-I)*M+y*F+B}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,j,k,m,n,o,x,z;this.initFromArray=function(y){this.points=[];for(var B=0;B<y.length;B++)this.points[B]={x:y[B][0],y:y[B][1],z:y[B][2]}};this.getPoint=function(y){f=(this.points.length-1)*y;g=Math.floor(f);j=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];o=this.points[b[1]];
+x=this.points[b[2]];z=this.points[b[3]];k=j*j;m=j*k;e.x=c(n.x,o.x,x.x,z.x,j,k,m);e.y=c(n.y,o.y,x.y,z.y,j,k,m);e.z=c(n.z,o.z,x.z,z.z,j,k,m);return e};this.getControlPointsArray=function(){var y,B,H=this.points.length,I=[];for(y=0;y<H;y++){B=this.points[y];I[y]=[B.x,B.y,B.z]}return I};this.getLength=function(y){var B,H,I=B=B=0,F=new THREE.Vector3,M=new THREE.Vector3,D=[],Q=0;D[0]=0;y||(y=100);H=this.points.length*y;F.copy(this.points[0]);for(y=1;y<H;y++){B=y/H;position=this.getPoint(B);M.copy(position);
 Q+=M.distanceTo(F);F.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=I){D[B]=Q;I=B}}D[D.length]=Q;return{chunks:D,total:Q}};this.reparametrizeByArcLength=function(y){var B,H,I,F,M,D,Q=[],R=new THREE.Vector3,P=this.getLength();Q.push(R.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){H=P.chunks[B]-P.chunks[B-1];D=Math.ceil(y*H/P.total);F=(B-1)/(this.points.length-1);M=B/(this.points.length-1);for(H=1;H<D-1;H++){I=F+H*(1/D)*(M-F);position=this.getPoint(I);Q.push(R.copy(position).clone())}Q.push(R.copy(this.points[B]).clone())}this.points=
 Q}};
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
-0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
-{};for(n in k){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)e(f.children[h],g)};b.LINEAR=
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var j=0;j<f.hierarchy[g].keys.length;j++){if(f.hierarchy[g].keys[j].time<0)f.hierarchy[g].keys[j].time=
+0;if(f.hierarchy[g].keys[j].rot!==undefined&&!(f.hierarchy[g].keys[j].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[j].rot;f.hierarchy[g].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(j=0;j<f.hierarchy[g].keys.length;j++)for(var m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++){var n=f.hierarchy[g].keys[j].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(j=0;j<f.hierarchy[g].keys.length;j++){var o=
+{};for(n in k){for(m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++)if(f.hierarchy[g].keys[j].morphTargets[m]===n){o[n]=f.hierarchy[g].keys[j].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[j].morphTargets.length&&(o[n]=0)}f.hierarchy[g].keys[j].morphTargetsInfluences=o}}for(j=1;j<f.hierarchy[g].keys.length;j++)if(f.hierarchy[g].keys[j].time===f.hierarchy[g].keys[j-1].time){f.hierarchy[g].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[g].keys.length;j++)f.hierarchy[g].keys[j].index=j}j=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)g.push(f.bones[j]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],g)};b.LINEAR=
 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,h,k,m,n,p=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,B=this.hierarchy.length;y<B;y++){a=this.hierarchy[y];m=a.animationCache;if(this.JITCompile&&p[y][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=p[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var H=0;H<3;H++){b=c[H];h=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){h=this.data.hierarchy[y].keys[0];for(k=this.getNextKeyWith(b,y,1);k.time<x;){h=k;k=this.getNextKeyWith(b,y,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,y,k.index+1)}while(k.time<
-x)}m.prevKey[b]=h;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(x-h.time)/(k.time-h.time);f=h[b];g=k[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",y,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)p[y][n]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,h,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,h);e[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,h);e[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,h);return e};
-THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,j,k,m,n,o=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,B=this.hierarchy.length;y<B;y++){a=this.hierarchy[y];m=a.animationCache;if(this.JITCompile&&o[y][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=o[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var H=0;H<3;H++){b=c[H];j=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){j=this.data.hierarchy[y].keys[0];for(k=this.getNextKeyWith(b,y,1);k.time<x;){j=k;k=this.getNextKeyWith(b,y,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(b,y,k.index+1)}while(k.time<
+x)}m.prevKey[b]=j;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(x-j.time)/(k.time-j.time);f=j[b];g=k[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&o[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)o[y][n]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,j,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;j=f*b;e[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,j);e[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,j);e[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,j);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,j){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*j+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
@@ -127,7 +127,7 @@ this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
 c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,f,g,h,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;k=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(h[0],h[1],h[2],h[3]);e.useQuaternion=!0;k!==undefined?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,f,g,j,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;j=f.rotq;k=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;k!==undefined?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
 e=this.bones[b];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
@@ -143,35 +143,35 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=b.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=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(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,k,m,n,p,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(h.normal);b.push(k);for(k=
-0;k<n;k++){p=a[h[x[k]]];c.push(new THREE.Vertex(p.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){k=b[h];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);e.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,k,m,n,p,x,z,y,B,H,I=0,F=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(B=0;B<e;B++){g=c[F[B]];k=a[g];for(H=0;H<f;H++){h=b[F[H]];m=a[h];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){I++;if(I===1){n=k;p=m;x=g;z=h;y=F[B]}if(I===2){y+=F[B];return y==="ad"||y==="ac"?{faces:[c,b],vertices:[n,p,m,k],indices:[x,
-z,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,p],indices:[x,g,h,z],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,j,k,m,n,o,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];if(j instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);b.push(k);for(k=
+0;k<n;k++){o=a[j[x[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(j=g+1;j<f.length;j++){k=b[j];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);e.push(k)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,j,k,m,n,o,x,z,y,B,H,I=0,F=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(B=0;B<e;B++){g=c[F[B]];k=a[g];for(H=0;H<f;H++){j=b[F[H]];m=a[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){I++;if(I===1){n=k;o=m;x=g;z=j;y=F[B]}if(I===2){y+=F[B];return y==="ad"||y==="ac"?{faces:[c,b],vertices:[n,o,m,k],indices:[x,
+z,j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,o],indices:[x,g,j,z],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.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(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
 THREE.Projector=function(){function a(){var da=m[k]=m[k]||new THREE.RenderableVertex;k++;return da}function c(da,Y){return Y.z-da.z}function b(da,Y){var ua=0,va=1,za=da.z+da.w,ma=Y.z+Y.w,W=-da.z+da.w,ia=-Y.z+Y.w;if(za>=0&&ma>=0&&W>=0&&ia>=0)return!0;else if(za<0&&ma<0||W<0&&ia<0)return!1;else{if(za<0)ua=Math.max(ua,za/(za-ma));else ma<0&&(va=Math.min(va,za/(za-ma)));if(W<0)ua=Math.max(ua,W/(W-ia));else ia<0&&(va=Math.min(va,W/(W-ia)));if(va<ua)return!1;else{da.lerpSelf(Y,ua);Y.lerpSelf(da,1-va);return!0}}}
-var e,f,g=[],h,k,m=[],n,p,x=[],z,y=[],B,H,I=[],F,M,D=[],Q=new THREE.Vector4,R=new THREE.Vector4,P=new THREE.Matrix4,ka=new THREE.Matrix4,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],d=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(da,Y){P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);P.multiplyVector3(da);return da};this.unprojectVector=function(da,Y){P.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
+var e,f,g=[],j,k,m=[],n,o,x=[],z,y=[],B,H,I=[],F,M,D=[],Q=new THREE.Vector4,R=new THREE.Vector4,P=new THREE.Matrix4,ka=new THREE.Matrix4,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],d=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(da,Y){P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);P.multiplyVector3(da);return da};this.unprojectVector=function(da,Y){P.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
 P.multiplyVector3(da);return da};this.projectObjects=function(da,Y,ua){Y=[];var va,za,ma;f=0;za=da.objects;da=0;for(va=za.length;da<va;da++){ma=za[da];var W;if(!(W=!ma.visible))if(W=ma instanceof THREE.Mesh){a:{W=void 0;for(var ia=ma.matrixWorld,Z=-ma.geometry.boundingSphere.radius*Math.max(ma.scale.x,Math.max(ma.scale.y,ma.scale.z)),S=0;S<6;S++){W=$[S].x*ia.n14+$[S].y*ia.n24+$[S].z*ia.n34+$[S].w;if(W<=Z){W=!1;break a}}W=!0}W=!W}if(!W){W=g[f]=g[f]||new THREE.RenderableObject;f++;e=W;Q.copy(ma.position);
-P.multiplyVector3(Q);e.object=ma;e.z=Q.z;Y.push(e)}}ua&&Y.sort(c);return Y};this.projectScene=function(da,Y,ua){var va=[],za=Y.near,ma=Y.far,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia,j,t,w;M=H=z=p=0;Y.matrixAutoUpdate&&Y.updateMatrix();da.update(undefined,!1,Y);P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);$[0].set(P.n41-P.n11,P.n42-P.n12,P.n43-P.n13,P.n44-P.n14);$[1].set(P.n41+P.n11,P.n42+P.n12,P.n43+P.n13,P.n44+P.n14);$[2].set(P.n41+P.n21,P.n42+P.n22,P.n43+P.n23,P.n44+P.n24);$[3].set(P.n41-P.n21,
-P.n42-P.n22,P.n43-P.n23,P.n44-P.n24);$[4].set(P.n41-P.n31,P.n42-P.n32,P.n43-P.n33,P.n44-P.n34);$[5].set(P.n41+P.n31,P.n42+P.n32,P.n43+P.n33,P.n44+P.n34);for(W=0;W<6;W++){qa=$[W];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(da,Y,!0);da=0;for(W=qa.length;da<W;da++){xa=qa[da].object;if(xa.visible){Da=xa.matrixWorld;$a=xa.matrixRotationWorld;ab=xa.materials;Ia=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){j=xa.geometry;S=j.vertices;t=j.faces;j=j.faceVertexUvs;ia=0;for(Z=
-S.length;ia<Z;ia++){h=a();h.positionWorld.copy(S[ia].position);Da.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);P.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>za&&h.positionScreen.z<ma}S=0;for(ia=t.length;S<ia;S++){Z=t[S];if(Z instanceof THREE.Face3){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];if(N.visible&&ha.visible&&ra.visible&&(xa.doubleSided||xa.flipSided!=(ra.positionScreen.x-N.positionScreen.x)*
-(ha.positionScreen.y-N.positionScreen.y)-(ra.positionScreen.y-N.positionScreen.y)*(ha.positionScreen.x-N.positionScreen.x)<0)){na=x[p]=x[p]||new THREE.RenderableFace3;p++;n=na;n.v1.copy(N);n.v2.copy(ha);n.v3.copy(ra)}else continue}else if(Z instanceof THREE.Face4){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];na=m[Z.d];if(N.visible&&ha.visible&&ra.visible&&na.visible&&(xa.doubleSided||xa.flipSided!=((na.positionScreen.x-N.positionScreen.x)*(ha.positionScreen.y-N.positionScreen.y)-(na.positionScreen.y-N.positionScreen.y)*
+P.multiplyVector3(Q);e.object=ma;e.z=Q.z;Y.push(e)}}ua&&Y.sort(c);return Y};this.projectScene=function(da,Y,ua){var va=[],za=Y.near,ma=Y.far,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia,h,t,w;M=H=z=o=0;Y.matrixAutoUpdate&&Y.updateMatrix();da.update(undefined,!1,Y);P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);$[0].set(P.n41-P.n11,P.n42-P.n12,P.n43-P.n13,P.n44-P.n14);$[1].set(P.n41+P.n11,P.n42+P.n12,P.n43+P.n13,P.n44+P.n14);$[2].set(P.n41+P.n21,P.n42+P.n22,P.n43+P.n23,P.n44+P.n24);$[3].set(P.n41-P.n21,
+P.n42-P.n22,P.n43-P.n23,P.n44-P.n24);$[4].set(P.n41-P.n31,P.n42-P.n32,P.n43-P.n33,P.n44-P.n34);$[5].set(P.n41+P.n31,P.n42+P.n32,P.n43+P.n33,P.n44+P.n34);for(W=0;W<6;W++){qa=$[W];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(da,Y,!0);da=0;for(W=qa.length;da<W;da++){xa=qa[da].object;if(xa.visible){Da=xa.matrixWorld;$a=xa.matrixRotationWorld;ab=xa.materials;Ia=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){h=xa.geometry;S=h.vertices;t=h.faces;h=h.faceVertexUvs;ia=0;for(Z=
+S.length;ia<Z;ia++){j=a();j.positionWorld.copy(S[ia].position);Da.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);P.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>za&&j.positionScreen.z<ma}S=0;for(ia=t.length;S<ia;S++){Z=t[S];if(Z instanceof THREE.Face3){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];if(N.visible&&ha.visible&&ra.visible&&(xa.doubleSided||xa.flipSided!=(ra.positionScreen.x-N.positionScreen.x)*
+(ha.positionScreen.y-N.positionScreen.y)-(ra.positionScreen.y-N.positionScreen.y)*(ha.positionScreen.x-N.positionScreen.x)<0)){na=x[o]=x[o]||new THREE.RenderableFace3;o++;n=na;n.v1.copy(N);n.v2.copy(ha);n.v3.copy(ra)}else continue}else if(Z instanceof THREE.Face4){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];na=m[Z.d];if(N.visible&&ha.visible&&ra.visible&&na.visible&&(xa.doubleSided||xa.flipSided!=((na.positionScreen.x-N.positionScreen.x)*(ha.positionScreen.y-N.positionScreen.y)-(na.positionScreen.y-N.positionScreen.y)*
 (ha.positionScreen.x-N.positionScreen.x)<0||(ha.positionScreen.x-ra.positionScreen.x)*(na.positionScreen.y-ra.positionScreen.y)-(ha.positionScreen.y-ra.positionScreen.y)*(na.positionScreen.x-ra.positionScreen.x)<0))){w=y[z]=y[z]||new THREE.RenderableFace4;z++;n=w;n.v1.copy(N);n.v2.copy(ha);n.v3.copy(ra);n.v4.copy(na)}else continue}n.normalWorld.copy(Z.normal);$a.multiplyVector3(n.normalWorld);n.centroidWorld.copy(Z.centroid);Da.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
-P.multiplyVector3(n.centroidScreen);ra=Z.vertexNormals;N=0;for(ha=ra.length;N<ha;N++){na=n.vertexNormalsWorld[N];na.copy(ra[N]);$a.multiplyVector3(na)}N=0;for(ha=j.length;N<ha;N++)if(w=j[N][S]){ra=0;for(na=w.length;ra<na;ra++)n.uvs[N][ra]=w[ra]}n.meshMaterials=ab;n.faceMaterials=Z.materials;n.overdraw=Ia;n.z=n.centroidScreen.z;va.push(n)}}else if(xa instanceof THREE.Line){ka.multiply(P,Da);S=xa.geometry.vertices;N=a();N.positionScreen.copy(S[0].position);ka.multiplyVector4(N.positionScreen);ia=1;
+P.multiplyVector3(n.centroidScreen);ra=Z.vertexNormals;N=0;for(ha=ra.length;N<ha;N++){na=n.vertexNormalsWorld[N];na.copy(ra[N]);$a.multiplyVector3(na)}N=0;for(ha=h.length;N<ha;N++)if(w=h[N][S]){ra=0;for(na=w.length;ra<na;ra++)n.uvs[N][ra]=w[ra]}n.meshMaterials=ab;n.faceMaterials=Z.materials;n.overdraw=Ia;n.z=n.centroidScreen.z;va.push(n)}}else if(xa instanceof THREE.Line){ka.multiply(P,Da);S=xa.geometry.vertices;N=a();N.positionScreen.copy(S[0].position);ka.multiplyVector4(N.positionScreen);ia=1;
 for(Z=S.length;ia<Z;ia++){N=a();N.positionScreen.copy(S[ia].position);ka.multiplyVector4(N.positionScreen);ha=m[k-2];d.copy(N.positionScreen);X.copy(ha.positionScreen);if(b(d,X)){d.multiplyScalar(1/d.w);X.multiplyScalar(1/X.w);Da=I[H]=I[H]||new THREE.RenderableLine;H++;B=Da;B.v1.positionScreen.copy(d);B.v2.positionScreen.copy(X);B.z=Math.max(d.z,X.z);B.materials=xa.materials;va.push(B)}}}else if(xa instanceof THREE.Particle){R.set(xa.position.x,xa.position.y,xa.position.z,1);P.multiplyVector4(R);
 R.z/=R.w;if(R.z>0&&R.z<1){Da=D[M]=D[M]||new THREE.RenderableParticle;M++;F=Da;F.x=R.x/R.w;F.y=R.y/R.w;F.z=R.z;F.rotation=xa.rotation.z;F.scale.x=xa.scale.x*Math.abs(F.x-(R.x+Y.projectionMatrix.n11)/(R.w+Y.projectionMatrix.n14));F.scale.y=xa.scale.y*Math.abs(F.y-(R.y+Y.projectionMatrix.n22)/(R.w+Y.projectionMatrix.n24));F.materials=xa.materials;va.push(F)}}}}ua&&va.sort(c);return va}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){b=h;e=k;f=b/2;g=e/2};this.render=function(h,k){var m,n,p,x,z,y,B,H;a=c.projectScene(h,k);m=0;for(n=a.length;m<n;m++){z=a[m];if(z instanceof THREE.RenderableParticle){B=z.x*f+f;H=z.y*g+g;p=0;for(x=z.material.length;p<x;p++){y=z.material[p];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=B+"px";y.style.top=H+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(U){if(z!=U)n.globalAlpha=z=U}function c(U){if(y!=U){switch(U){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=U}}var b=null,e=new THREE.Projector,f=document.createElement("canvas"),g,h,k,m,n=f.getContext("2d"),p=new THREE.Color(0),x=0,z=1,y=0,B=null,H=null,I=1,F,M,D,Q,R=new THREE.RenderableVertex,
-P=new THREE.RenderableVertex,ka,$,d,X,da,Y,ua,va,za,ma,W,ia,Z=new THREE.Color,S=new THREE.Color,N=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,na,qa,xa,Da,$a,ab,Ia,j,t,w,o=new THREE.Rectangle,C=new THREE.Rectangle,G=new THREE.Rectangle,J=!1,E=new THREE.Color,A=new THREE.Color,V=new THREE.Color,K=new THREE.Color,T=new THREE.Vector3,ja,pa,sa,Ba,ya,Fa,fa=16;ja=document.createElement("canvas");ja.width=ja.height=2;pa=ja.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
-0,2,2);Ba=sa.data;ya=document.createElement("canvas");ya.width=ya.height=fa;Fa=ya.getContext("2d");Fa.translate(-fa/2,-fa/2);Fa.scale(fa,fa);fa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,la){g=U;h=la;k=g/2;m=h/2;f.width=g;f.height=h;o.set(-k,-m,k,m);z=1;y=0;H=B=null;I=1};this.setClearColor=function(U,la){p=U;x=la};this.setClearColorHex=function(U,la){p.setHex(U);x=la};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!C.isEmpty()){C.inflate(1);
-C.minSelf(o);if(p.hex==0&&x==0)n.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+x+")";n.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(U,la){function Ma(L){var aa,oa,ea,ta=L.lights;A.setRGB(0,0,0);V.setRGB(0,0,0);K.setRGB(0,0,0);L=0;for(aa=ta.length;L<aa;L++){oa=ta[L];ea=oa.color;if(oa instanceof THREE.AmbientLight){A.r+=ea.r;
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(j,k){b=j;e=k;f=b/2;g=e/2};this.render=function(j,k){var m,n,o,x,z,y,B,H;a=c.projectScene(j,k);m=0;for(n=a.length;m<n;m++){z=a[m];if(z instanceof THREE.RenderableParticle){B=z.x*f+f;H=z.y*g+g;o=0;for(x=z.material.length;o<x;o++){y=z.material[o];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=B+"px";y.style.top=H+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(U){if(z!=U)n.globalAlpha=z=U}function c(U){if(y!=U){switch(U){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=U}}var b=null,e=new THREE.Projector,f=document.createElement("canvas"),g,j,k,m,n=f.getContext("2d"),o=new THREE.Color(0),x=0,z=1,y=0,B=null,H=null,I=1,F,M,D,Q,R=new THREE.RenderableVertex,
+P=new THREE.RenderableVertex,ka,$,d,X,da,Y,ua,va,za,ma,W,ia,Z=new THREE.Color,S=new THREE.Color,N=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,na,qa,xa,Da,$a,ab,Ia,h,t,w,p=new THREE.Rectangle,C=new THREE.Rectangle,G=new THREE.Rectangle,J=!1,E=new THREE.Color,A=new THREE.Color,V=new THREE.Color,K=new THREE.Color,T=new THREE.Vector3,ja,pa,sa,Ba,ya,Fa,fa=16;ja=document.createElement("canvas");ja.width=ja.height=2;pa=ja.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
+0,2,2);Ba=sa.data;ya=document.createElement("canvas");ya.width=ya.height=fa;Fa=ya.getContext("2d");Fa.translate(-fa/2,-fa/2);Fa.scale(fa,fa);fa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,la){g=U;j=la;k=g/2;m=j/2;f.width=g;f.height=j;p.set(-k,-m,k,m);z=1;y=0;H=B=null;I=1};this.setClearColor=function(U,la){o=U;x=la};this.setClearColorHex=function(U,la){o.setHex(U);x=la};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!C.isEmpty()){C.inflate(1);
+C.minSelf(p);if(o.hex==0&&x==0)n.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+x+")";n.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(U,la){function Ma(L){var aa,oa,ea,ta=L.lights;A.setRGB(0,0,0);V.setRGB(0,0,0);K.setRGB(0,0,0);L=0;for(aa=ta.length;L<aa;L++){oa=ta[L];ea=oa.color;if(oa instanceof THREE.AmbientLight){A.r+=ea.r;
 A.g+=ea.g;A.b+=ea.b}else if(oa instanceof THREE.DirectionalLight){V.r+=ea.r;V.g+=ea.g;V.b+=ea.b}else if(oa instanceof THREE.PointLight){K.r+=ea.r;K.g+=ea.g;K.b+=ea.b}}}function Ha(L,aa,oa,ea){var ta,Aa,ga,ca,La=L.lights;L=0;for(ta=La.length;L<ta;L++){Aa=La[L];ga=Aa.color;ca=Aa.intensity;if(Aa instanceof THREE.DirectionalLight){Aa=oa.dot(Aa.position)*ca;if(Aa>0){ea.r+=ga.r*Aa;ea.g+=ga.g*Aa;ea.b+=ga.b*Aa}}else if(Aa instanceof THREE.PointLight){T.sub(Aa.position,aa);T.normalize();Aa=oa.dot(T)*ca;if(Aa>
-0){ea.r+=ga.r*Aa;ea.g+=ga.g*Aa;ea.b+=ga.b*Aa}}}}function fb(L,aa,oa){a(oa.opacity);c(oa.blending);var ea,ta,Aa,ga,ca,La;if(oa instanceof THREE.ParticleBasicMaterial){if(oa.map){ga=oa.map.image;ca=ga.width>>1;La=ga.height>>1;oa=aa.scale.x*k;Aa=aa.scale.y*m;ea=oa*ca;ta=Aa*La;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(o.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(oa,-Aa);n.translate(-ca,-La);n.drawImage(ga,0,0);n.restore()}}}else if(oa instanceof THREE.ParticleCanvasMaterial){if(J){E.r=
-A.r+V.r+K.r;E.g=A.g+V.g+K.g;E.b=A.b+V.b+K.b;Z.r=oa.color.r*E.r;Z.g=oa.color.g*E.g;Z.b=oa.color.b*E.b;Z.updateStyleString()}else Z.__styleString=oa.color.__styleString;ea=aa.scale.x*k;ta=aa.scale.y*m;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(o.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(ea,ta);oa.program(n,Z);n.restore()}}}function Ua(L,aa,oa,ea){a(ea.opacity);c(ea.blending);n.beginPath();n.moveTo(L.positionScreen.x,L.positionScreen.y);n.lineTo(aa.positionScreen.x,aa.positionScreen.y);
+0){ea.r+=ga.r*Aa;ea.g+=ga.g*Aa;ea.b+=ga.b*Aa}}}}function fb(L,aa,oa){a(oa.opacity);c(oa.blending);var ea,ta,Aa,ga,ca,La;if(oa instanceof THREE.ParticleBasicMaterial){if(oa.map){ga=oa.map.image;ca=ga.width>>1;La=ga.height>>1;oa=aa.scale.x*k;Aa=aa.scale.y*m;ea=oa*ca;ta=Aa*La;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(p.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(oa,-Aa);n.translate(-ca,-La);n.drawImage(ga,0,0);n.restore()}}}else if(oa instanceof THREE.ParticleCanvasMaterial){if(J){E.r=
+A.r+V.r+K.r;E.g=A.g+V.g+K.g;E.b=A.b+V.b+K.b;Z.r=oa.color.r*E.r;Z.g=oa.color.g*E.g;Z.b=oa.color.b*E.b;Z.updateStyleString()}else Z.__styleString=oa.color.__styleString;ea=aa.scale.x*k;ta=aa.scale.y*m;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(p.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(ea,ta);oa.program(n,Z);n.restore()}}}function Ua(L,aa,oa,ea){a(ea.opacity);c(ea.blending);n.beginPath();n.moveTo(L.positionScreen.x,L.positionScreen.y);n.lineTo(aa.positionScreen.x,aa.positionScreen.y);
 n.closePath();if(ea instanceof THREE.LineBasicMaterial){Z.__styleString=ea.color.__styleString;L=ea.linewidth;if(I!=L)n.lineWidth=I=L;L=Z.__styleString;if(B!=L)n.strokeStyle=B=L;n.stroke();G.inflate(ea.linewidth*2)}}function Ja(L,aa,oa,ea,ta,Aa,ga,ca,La){a(ca.opacity);c(ca.blending);ka=L.positionScreen.x;$=L.positionScreen.y;d=aa.positionScreen.x;X=aa.positionScreen.y;da=oa.positionScreen.x;Y=oa.positionScreen.y;cb(ka,$,d,X,da,Y);if(ca instanceof THREE.MeshBasicMaterial)if(ca.map){if(ca.map.mapping instanceof
-THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}}else if(ca.envMap){if(ca.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=la.matrixWorldInverse;T.copy(ga.vertexNormalsWorld[0]);$a=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;ab=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[1]);Ia=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;j=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[2]);t=(T.x*
-L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;w=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;Ea(ka,$,d,X,da,Y,ca.envMap.image,$a,ab,Ia,j,t,w)}}else ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString);else if(ca instanceof THREE.MeshLambertMaterial){if(ca.map&&!ca.wireframe){if(ca.map.mapping instanceof THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}c(THREE.SubtractiveBlending)}if(J)if(!ca.wireframe&&ca.shading==
+THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}}else if(ca.envMap){if(ca.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=la.matrixWorldInverse;T.copy(ga.vertexNormalsWorld[0]);$a=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;ab=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[1]);Ia=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;h=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[2]);t=(T.x*
+L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;w=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;Ea(ka,$,d,X,da,Y,ca.envMap.image,$a,ab,Ia,h,t,w)}}else ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString);else if(ca instanceof THREE.MeshLambertMaterial){if(ca.map&&!ca.wireframe){if(ca.map.mapping instanceof THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}c(THREE.SubtractiveBlending)}if(J)if(!ca.wireframe&&ca.shading==
 THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){S.r=N.r=ha.r=A.r;S.g=N.g=ha.g=A.g;S.b=N.b=ha.b=A.b;Ha(La,ga.v1.positionWorld,ga.vertexNormalsWorld[0],S);Ha(La,ga.v2.positionWorld,ga.vertexNormalsWorld[1],N);Ha(La,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ha);ra.r=(N.r+ha.r)*0.5;ra.g=(N.g+ha.g)*0.5;ra.b=(N.b+ha.b)*0.5;xa=Wa(S,N,ha,ra);Ea(ka,$,d,X,da,Y,xa,0,0,1,0,0,1)}else{E.r=A.r;E.g=A.g;E.b=A.b;Ha(La,ga.centroidWorld,ga.normalWorld,E);Z.r=ca.color.r*E.r;Z.g=ca.color.g*E.g;Z.b=ca.color.b*
 E.b;Z.updateStyleString();ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}else ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString)}else if(ca instanceof THREE.MeshDepthMaterial){na=la.near;qa=la.far;S.r=S.g=S.b=1-Na(L.positionScreen.z,na,qa);N.r=N.g=N.b=1-Na(aa.positionScreen.z,na,qa);ha.r=ha.g=ha.b=1-Na(oa.positionScreen.z,na,qa);ra.r=(N.r+ha.r)*0.5;ra.g=(N.g+ha.g)*0.5;ra.b=(N.b+ha.b)*0.5;xa=Wa(S,N,ha,ra);Ea(ka,$,d,X,da,Y,xa,0,0,1,0,
 0,1)}else if(ca instanceof THREE.MeshNormalMaterial){Z.r=O(ga.normalWorld.x);Z.g=O(ga.normalWorld.y);Z.b=O(ga.normalWorld.z);Z.updateStyleString();ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}}function Sa(L,aa,oa,ea,ta,Aa,ga,ca,La){a(ca.opacity);c(ca.blending);if(ca.map||ca.envMap){Ja(L,aa,ea,0,1,3,ga,ca,La);Ja(ta,oa,Aa,1,2,3,ga,ca,La)}else{ka=L.positionScreen.x;$=L.positionScreen.y;d=aa.positionScreen.x;X=aa.positionScreen.y;da=oa.positionScreen.x;Y=oa.positionScreen.y;
@@ -183,22 +183,22 @@ n.lineTo(oa,ea);n.lineTo(ta,Aa);n.lineTo(ga,ca);n.lineTo(L,aa);n.closePath()}fun
 ea=(Ya*Aa-db*ea)*Xa;L=L-bb*ca-oa*La;aa=aa-Za*ca-ea*La;n.save();n.transform(bb,Za,oa,ea,L,aa);n.clip();n.drawImage(ga,0,0);n.restore()}}function Wa(L,aa,oa,ea){var ta=~~(L.r*255),Aa=~~(L.g*255);L=~~(L.b*255);var ga=~~(aa.r*255),ca=~~(aa.g*255);aa=~~(aa.b*255);var La=~~(oa.r*255),Ya=~~(oa.g*255);oa=~~(oa.b*255);var Za=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);Ba[0]=ta<0?0:ta>255?255:ta;Ba[1]=Aa<0?0:Aa>255?255:Aa;Ba[2]=L<0?0:L>255?255:L;Ba[4]=ga<0?0:ga>255?255:ga;Ba[5]=ca<0?0:ca>255?255:ca;Ba[6]=
 aa<0?0:aa>255?255:aa;Ba[8]=La<0?0:La>255?255:La;Ba[9]=Ya<0?0:Ya>255?255:Ya;Ba[10]=oa<0?0:oa>255?255:oa;Ba[12]=Za<0?0:Za>255?255:Za;Ba[13]=db<0?0:db>255?255:db;Ba[14]=ea<0?0:ea>255?255:ea;pa.putImageData(sa,0,0);Fa.drawImage(ja,0,0);return ya}function Na(L,aa,oa){L=(L-aa)/(oa-aa);return L*L*(3-2*L)}function O(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Oa(L,aa){var oa=aa.x-L.x,ea=aa.y-L.y,ta=1/Math.sqrt(oa*oa+ea*ea);oa*=ta;ea*=ta;aa.x+=oa;aa.y+=ea;L.x-=oa;L.y-=ea}var Ra,jb,Ca,Ta,Ga,Pa,Ka,wa;this.autoClear?
 this.clear():n.setTransform(1,0,0,-1,k,m);b=e.projectScene(U,la,this.sortElements);(J=U.lights.length>0)&&Ma(U);Ra=0;for(jb=b.length;Ra<jb;Ra++){Ca=b[Ra];G.empty();if(Ca instanceof THREE.RenderableParticle){F=Ca;F.x*=k;F.y*=m;Ta=0;for(Ga=Ca.materials.length;Ta<Ga;){wa=Ca.materials[Ta++];wa.opacity!=0&&fb(F,Ca,wa,U)}}else if(Ca instanceof THREE.RenderableLine){F=Ca.v1;M=Ca.v2;F.positionScreen.x*=k;F.positionScreen.y*=m;M.positionScreen.x*=k;M.positionScreen.y*=m;G.addPoint(F.positionScreen.x,F.positionScreen.y);
-G.addPoint(M.positionScreen.x,M.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.materials.length;Ta<Ga;){wa=Ca.materials[Ta++];wa.opacity!=0&&Ua(F,M,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace3){F=Ca.v1;M=Ca.v2;D=Ca.v3;F.positionScreen.x*=k;F.positionScreen.y*=m;M.positionScreen.x*=k;M.positionScreen.y*=m;D.positionScreen.x*=k;D.positionScreen.y*=m;if(Ca.overdraw){Oa(F.positionScreen,M.positionScreen);Oa(M.positionScreen,D.positionScreen);Oa(D.positionScreen,F.positionScreen)}G.add3Points(F.positionScreen.x,
-F.positionScreen.y,M.positionScreen.x,M.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}else wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace4){F=Ca.v1;M=Ca.v2;D=Ca.v3;Q=Ca.v4;F.positionScreen.x*=k;F.positionScreen.y*=
+G.addPoint(M.positionScreen.x,M.positionScreen.y);if(p.instersects(G)){Ta=0;for(Ga=Ca.materials.length;Ta<Ga;){wa=Ca.materials[Ta++];wa.opacity!=0&&Ua(F,M,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace3){F=Ca.v1;M=Ca.v2;D=Ca.v3;F.positionScreen.x*=k;F.positionScreen.y*=m;M.positionScreen.x*=k;M.positionScreen.y*=m;D.positionScreen.x*=k;D.positionScreen.y*=m;if(Ca.overdraw){Oa(F.positionScreen,M.positionScreen);Oa(M.positionScreen,D.positionScreen);Oa(D.positionScreen,F.positionScreen)}G.add3Points(F.positionScreen.x,
+F.positionScreen.y,M.positionScreen.x,M.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if(p.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}else wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace4){F=Ca.v1;M=Ca.v2;D=Ca.v3;Q=Ca.v4;F.positionScreen.x*=k;F.positionScreen.y*=
 m;M.positionScreen.x*=k;M.positionScreen.y*=m;D.positionScreen.x*=k;D.positionScreen.y*=m;Q.positionScreen.x*=k;Q.positionScreen.y*=m;R.positionScreen.copy(M.positionScreen);P.positionScreen.copy(Q.positionScreen);if(Ca.overdraw){Oa(F.positionScreen,M.positionScreen);Oa(M.positionScreen,Q.positionScreen);Oa(Q.positionScreen,F.positionScreen);Oa(D.positionScreen,R.positionScreen);Oa(D.positionScreen,P.positionScreen)}G.addPoint(F.positionScreen.x,F.positionScreen.y);G.addPoint(M.positionScreen.x,M.positionScreen.y);
-G.addPoint(D.positionScreen.x,D.positionScreen.y);G.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}else wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}}}C.addRectangle(G)}n.setTransform(1,0,0,1,0,0)}};
+G.addPoint(D.positionScreen.x,D.positionScreen.y);G.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(p.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}else wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}}}C.addRectangle(G)}n.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(ma,W,ia){var Z,S,N,ha;Z=0;for(S=ma.lights.length;Z<S;Z++){N=ma.lights[Z];if(N instanceof THREE.DirectionalLight){ha=W.normalWorld.dot(N.position)*N.intensity;if(ha>0){ia.r+=N.color.r*ha;ia.g+=N.color.g*ha;ia.b+=N.color.b*ha}}else if(N instanceof THREE.PointLight){d.sub(N.position,W.centroidWorld);d.normalize();ha=W.normalWorld.dot(d)*N.intensity;if(ha>0){ia.r+=N.color.r*ha;ia.g+=N.color.g*ha;ia.b+=N.color.b*ha}}}}function c(ma,W,ia,Z,S,N){Y=e(ua++);Y.setAttribute("d",
 "M "+ma.positionScreen.x+" "+ma.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)D.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(M){Q.r=R.r;Q.g=R.g;Q.b=R.b;a(N,Z,Q);D.r=S.color.r*Q.r;D.g=S.color.g*Q.g;D.b=S.color.b*Q.b;D.updateStyleString()}else D.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){$=1-S.__2near/(S.__farPlusNear-
 Z.z*S.__farMinusNear);D.setRGB($,$,$)}else S instanceof THREE.MeshNormalMaterial&&D.setRGB(f(Z.normalWorld.x),f(Z.normalWorld.y),f(Z.normalWorld.z));S.wireframe?Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):Y.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(Y)}function b(ma,W,ia,Z,S,N,ha){Y=
 e(ua++);Y.setAttribute("d","M "+ma.positionScreen.x+" "+ma.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)D.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(M){Q.r=R.r;Q.g=R.g;Q.b=R.b;a(ha,S,Q);D.r=N.color.r*Q.r;D.g=N.color.g*Q.g;D.b=N.color.b*Q.b;D.updateStyleString()}else D.__styleString=N.color.__styleString;
 else if(N instanceof THREE.MeshDepthMaterial){$=1-N.__2near/(N.__farPlusNear-S.z*N.__farMinusNear);D.setRGB($,$,$)}else N instanceof THREE.MeshNormalMaterial&&D.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));N.wireframe?Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+N.wireframeLinewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframeLinecap+"; stroke-linejoin: "+N.wireframeLinejoin):Y.setAttribute("style","fill: "+D.__styleString+
-"; fill-opacity: "+N.opacity);k.appendChild(Y)}function e(ma){if(X[ma]==null){X[ma]=document.createElementNS("http://www.w3.org/2000/svg","path");za==0&&X[ma].setAttribute("shape-rendering","crispEdges")}return X[ma]}function f(ma){return ma<0?Math.min((1+ma)*0.5,0.5):0.5+Math.min(ma*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,p,x,z,y,B,H,I=new THREE.Rectangle,F=new THREE.Rectangle,M=!1,D=new THREE.Color(16777215),Q=new THREE.Color(16777215),
-R=new THREE.Color(0),P=new THREE.Color(0),ka=new THREE.Color(0),$,d=new THREE.Vector3,X=[],da=[],Y,ua,va,za=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ma){switch(ma){case "high":za=1;break;case "low":za=0}};this.setSize=function(ma,W){m=ma;n=W;p=m/2;x=n/2;k.setAttribute("viewBox",-p+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);I.set(-p,-x,p,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(ma,W){var ia,Z,S,N,ha,ra,na,qa;this.autoClear&&this.clear();g=h.projectScene(ma,W,this.sortElements);va=ua=0;if(M=ma.lights.length>0){na=ma.lights;R.setRGB(0,0,0);P.setRGB(0,0,0);ka.setRGB(0,0,0);ia=0;for(Z=na.length;ia<Z;ia++){S=na[ia];N=S.color;if(S instanceof THREE.AmbientLight){R.r+=N.r;R.g+=N.g;R.b+=N.b}else if(S instanceof THREE.DirectionalLight){P.r+=N.r;P.g+=N.g;P.b+=N.b}else if(S instanceof THREE.PointLight){ka.r+=N.r;ka.g+=N.g;ka.b+=N.b}}}ia=0;for(Z=g.length;ia<Z;ia++){na=
-g[ia];F.empty();if(na instanceof THREE.RenderableParticle){z=na;z.x*=p;z.y*=-x;S=0;for(N=na.materials.length;S<N;)S++}else if(na instanceof THREE.RenderableLine){z=na.v1;y=na.v2;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.materials.length;S<N;)if((qa=na.materials[S++])&&qa.opacity!=0){ha=z;ra=y;var xa=va++;if(da[xa]==null){da[xa]=
+"; fill-opacity: "+N.opacity);k.appendChild(Y)}function e(ma){if(X[ma]==null){X[ma]=document.createElementNS("http://www.w3.org/2000/svg","path");za==0&&X[ma].setAttribute("shape-rendering","crispEdges")}return X[ma]}function f(ma){return ma<0?Math.min((1+ma)*0.5,0.5):0.5+Math.min(ma*0.5,0.5)}var g=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,o,x,z,y,B,H,I=new THREE.Rectangle,F=new THREE.Rectangle,M=!1,D=new THREE.Color(16777215),Q=new THREE.Color(16777215),
+R=new THREE.Color(0),P=new THREE.Color(0),ka=new THREE.Color(0),$,d=new THREE.Vector3,X=[],da=[],Y,ua,va,za=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ma){switch(ma){case "high":za=1;break;case "low":za=0}};this.setSize=function(ma,W){m=ma;n=W;o=m/2;x=n/2;k.setAttribute("viewBox",-o+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);I.set(-o,-x,o,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ma,W){var ia,Z,S,N,ha,ra,na,qa;this.autoClear&&this.clear();g=j.projectScene(ma,W,this.sortElements);va=ua=0;if(M=ma.lights.length>0){na=ma.lights;R.setRGB(0,0,0);P.setRGB(0,0,0);ka.setRGB(0,0,0);ia=0;for(Z=na.length;ia<Z;ia++){S=na[ia];N=S.color;if(S instanceof THREE.AmbientLight){R.r+=N.r;R.g+=N.g;R.b+=N.b}else if(S instanceof THREE.DirectionalLight){P.r+=N.r;P.g+=N.g;P.b+=N.b}else if(S instanceof THREE.PointLight){ka.r+=N.r;ka.g+=N.g;ka.b+=N.b}}}ia=0;for(Z=g.length;ia<Z;ia++){na=
+g[ia];F.empty();if(na instanceof THREE.RenderableParticle){z=na;z.x*=o;z.y*=-x;S=0;for(N=na.materials.length;S<N;)S++}else if(na instanceof THREE.RenderableLine){z=na.v1;y=na.v2;z.positionScreen.x*=o;z.positionScreen.y*=-x;y.positionScreen.x*=o;y.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.materials.length;S<N;)if((qa=na.materials[S++])&&qa.opacity!=0){ha=z;ra=y;var xa=va++;if(da[xa]==null){da[xa]=
 document.createElementNS("http://www.w3.org/2000/svg","line");za==0&&da[xa].setAttribute("shape-rendering","crispEdges")}Y=da[xa];Y.setAttribute("x1",ha.positionScreen.x);Y.setAttribute("y1",ha.positionScreen.y);Y.setAttribute("x2",ra.positionScreen.x);Y.setAttribute("y2",ra.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){D.__styleString=qa.color.__styleString;Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+qa.linewidth+"; stroke-opacity: "+qa.opacity+
-"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(Y)}}}}else if(na instanceof THREE.RenderableFace3){z=na.v1;y=na.v2;B=na.v3;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;B.positionScreen.x*=p;B.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(B.positionScreen.x,B.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.meshMaterials.length;S<N;){qa=
-na.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){ha=0;for(ra=na.faceMaterials.length;ha<ra;)(qa=na.faceMaterials[ha++])&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}else qa&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}}}else if(na instanceof THREE.RenderableFace4){z=na.v1;y=na.v2;B=na.v3;H=na.v4;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;B.positionScreen.x*=p;B.positionScreen.y*=-x;H.positionScreen.x*=p;H.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);
+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(Y)}}}}else if(na instanceof THREE.RenderableFace3){z=na.v1;y=na.v2;B=na.v3;z.positionScreen.x*=o;z.positionScreen.y*=-x;y.positionScreen.x*=o;y.positionScreen.y*=-x;B.positionScreen.x*=o;B.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(B.positionScreen.x,B.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.meshMaterials.length;S<N;){qa=
+na.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){ha=0;for(ra=na.faceMaterials.length;ha<ra;)(qa=na.faceMaterials[ha++])&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}else qa&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}}}else if(na instanceof THREE.RenderableFace4){z=na.v1;y=na.v2;B=na.v3;H=na.v4;z.positionScreen.x*=o;z.positionScreen.y*=-x;y.positionScreen.x*=o;y.positionScreen.y*=-x;B.positionScreen.x*=o;B.positionScreen.y*=-x;H.positionScreen.x*=o;H.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);
 F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(B.positionScreen.x,B.positionScreen.y);F.addPoint(H.positionScreen.x,H.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.meshMaterials.length;S<N;){qa=na.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){ha=0;for(ra=na.faceMaterials.length;ha<ra;)(qa=na.faceMaterials[ha++])&&qa.opacity!=0&&b(z,y,B,H,na,qa,ma)}else qa&&qa.opacity!=0&&b(z,y,B,H,na,qa,ma)}}}}}};
 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",
@@ -225,33 +225,33 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(j,t,w){var o,C,G,J=j.vertices,E=J.length,A=j.colors,V=A.length,K=j.__vertexArray,T=j.__colorArray,ja=j.__sortArray,pa=j.__dirtyVertices,sa=j.__dirtyColors;if(w.sortParticles){ha.multiplySelf(w.matrixWorld);for(o=0;o<E;o++){C=J[o].position;qa.copy(C);ha.multiplyVector3(qa);ja[o]=[qa.z,o]}ja.sort(function(Ba,ya){return ya[0]-Ba[0]});for(o=0;o<E;o++){C=J[ja[o][1]].position;G=o*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}for(o=0;o<V;o++){G=o*3;color=A[ja[o][1]];T[G]=color.r;
-T[G+1]=color.g;T[G+2]=color.b}}else{if(pa)for(o=0;o<E;o++){C=J[o].position;G=o*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}if(sa)for(o=0;o<V;o++){color=A[o];G=o*3;T[G]=color.r;T[G+1]=color.g;T[G+2]=color.b}}if(pa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,K,t)}if(sa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,T,t)}}function b(j,t){j.uniforms=Uniforms.clone(t.uniforms);j.vertexShader=t.vertexShader;j.fragmentShader=
-t.fragmentShader}function e(j,t,w,o,C){o.__webglProgram||Y.initMaterial(o,t,w,C);var G=o.program,J=G.uniforms,E=o.uniforms;if(G!=X){d.useProgram(G);X=G}d.uniformMatrix4fv(J.projectionMatrix,!1,ra);if(w&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value=
-w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var A,V,K=0,T=0,ja=0,pa,sa,Ba,ya=xa,Fa=ya.directional.colors,fa=ya.directional.positions,U=ya.point.colors,la=ya.point.positions,Ma=0,Ha=0;w=V=V=0;for(A=t.length;w<A;w++){V=t[w];pa=V.color;sa=V.position;Ba=V.intensity;if(V instanceof THREE.AmbientLight){K+=pa.r;T+=pa.g;ja+=pa.b}else if(V instanceof THREE.DirectionalLight){V=Ma*3;Fa[V]=pa.r*
+THREE.WebGLRenderer=function(a){function c(h,t,w){var p,C,G,J=h.vertices,E=J.length,A=h.colors,V=A.length,K=h.__vertexArray,T=h.__colorArray,ja=h.__sortArray,pa=h.__dirtyVertices,sa=h.__dirtyColors;if(w.sortParticles){ha.multiplySelf(w.matrixWorld);for(p=0;p<E;p++){C=J[p].position;qa.copy(C);ha.multiplyVector3(qa);ja[p]=[qa.z,p]}ja.sort(function(Ba,ya){return ya[0]-Ba[0]});for(p=0;p<E;p++){C=J[ja[p][1]].position;G=p*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}for(p=0;p<V;p++){G=p*3;color=A[ja[p][1]];T[G]=color.r;
+T[G+1]=color.g;T[G+2]=color.b}}else{if(pa)for(p=0;p<E;p++){C=J[p].position;G=p*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}if(sa)for(p=0;p<V;p++){color=A[p];G=p*3;T[G]=color.r;T[G+1]=color.g;T[G+2]=color.b}}if(pa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,K,t)}if(sa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,T,t)}}function b(h,t){h.uniforms=Uniforms.clone(t.uniforms);h.vertexShader=t.vertexShader;h.fragmentShader=
+t.fragmentShader}function e(h,t,w,p,C){p.__webglProgram||Y.initMaterial(p,t,w,C);var G=p.program,J=G.uniforms,E=p.uniforms;if(G!=X){d.useProgram(G);X=G}d.uniformMatrix4fv(J.projectionMatrix,!1,ra);if(w&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value=
+w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var A,V,K=0,T=0,ja=0,pa,sa,Ba,ya=xa,Fa=ya.directional.colors,fa=ya.directional.positions,U=ya.point.colors,la=ya.point.positions,Ma=0,Ha=0;w=V=V=0;for(A=t.length;w<A;w++){V=t[w];pa=V.color;sa=V.position;Ba=V.intensity;if(V instanceof THREE.AmbientLight){K+=pa.r;T+=pa.g;ja+=pa.b}else if(V instanceof THREE.DirectionalLight){V=Ma*3;Fa[V]=pa.r*
 Ba;Fa[V+1]=pa.g*Ba;Fa[V+2]=pa.b*Ba;fa[V]=sa.x;fa[V+1]=sa.y;fa[V+2]=sa.z;Ma+=1}else if(V instanceof THREE.PointLight){V=Ha*3;U[V]=pa.r*Ba;U[V+1]=pa.g*Ba;U[V+2]=pa.b*Ba;la[V]=sa.x;la[V+1]=sa.y;la[V+2]=sa.z;Ha+=1}}for(w=Ma*3;w<Fa.length;w++)Fa[w]=0;for(w=Ha*3;w<U.length;w++)U[w]=0;ya.point.length=Ha;ya.directional.length=Ma;ya.ambient[0]=K;ya.ambient[1]=T;ya.ambient[2]=ja;w=xa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value=
-w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(o.color.r,o.color.g,o.color.b);E.opacity.value=o.opacity;E.map.texture=o.map;E.lightMap.texture=o.lightMap;E.envMap.texture=o.envMap;E.reflectivity.value=o.reflectivity;E.refractionRatio.value=o.refractionRatio;
-E.combine.value=o.combine;E.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.size.value=o.size;E.scale.value=$.height/2;E.map.texture=o.map}else if(o instanceof
-THREE.MeshPhongMaterial){E.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);E.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);E.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)E.opacity.value=o.opacity;for(var fb in E)if(T=G.uniforms[fb]){A=E[fb];K=A.type;w=A.value;if(K=="i")d.uniform1i(T,w);else if(K=="f")d.uniform1f(T,w);else if(K=="fv1")d.uniform1fv(T,
+w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;E.map.texture=p.map;E.lightMap.texture=p.lightMap;E.envMap.texture=p.envMap;E.reflectivity.value=p.reflectivity;E.refractionRatio.value=p.refractionRatio;
+E.combine.value=p.combine;E.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);E.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);E.opacity.value=p.opacity;E.size.value=p.size;E.scale.value=$.height/2;E.map.texture=p.map}else if(p instanceof
+THREE.MeshPhongMaterial){E.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);E.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);E.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){E.mNear.value=h.near;E.mFar.value=h.far;E.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)E.opacity.value=p.opacity;for(var fb in E)if(T=G.uniforms[fb]){A=E[fb];K=A.type;w=A.value;if(K=="i")d.uniform1i(T,w);else if(K=="f")d.uniform1f(T,w);else if(K=="fv1")d.uniform1fv(T,
 w);else if(K=="fv")d.uniform3fv(T,w);else if(K=="v2")d.uniform2f(T,w.x,w.y);else if(K=="v3")d.uniform3f(T,w.x,w.y,w.z);else if(K=="c")d.uniform3f(T,w.r,w.g,w.b);else if(K=="t"){d.uniform1i(T,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image[K])}else{A.image.__webGLTextureCube=
 d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image[K]);A.__wasSetOnce=!0}D(d.TEXTURE_CUBE_MAP,A,A.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube)}}else{if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,
-0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}D(d.TEXTURE_2D,A,A.image);d.bindTexture(d.TEXTURE_2D,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,A.__webGLTexture)}}}d.uniformMatrix4fv(J.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(J.normalMatrix,!1,C._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
-o instanceof THREE.MeshPhongMaterial||o.envMap)&&d.uniform3f(J.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&d.uniformMatrix4fv(J.viewMatrix,!1,na);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j=E.directionalLightDirection.value;j[0]=
--t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;d.uniform3fv(J.directionalLightDirection,j);d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(J.viewMatrix,!1,na)}if(o.skinning){d.uniformMatrix4fv(J.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(J.boneGlobalMatrices,!1,C.boneMatrices)}return G}function f(j,t,w,o,C,G){if(o.opacity!=0){j=e(j,t,w,o,G).attributes;if(o.morphTargets){t=o.program.attributes;G.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[G.morphTargetBase]):
-d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){w=0;for(var J=G.morphTargetForcedOrder,E=G.morphTargetInfluences;w<o.numSupportedMorphTargets&&w<J.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[J[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=E[J[w]];w++}}else{J=[];var A=-1,V=0;E=G.morphTargetInfluences;var K,T=E.length;w=0;for(G.morphTargetBase!==
--1&&(J[G.morphTargetBase]=!0);w<o.numSupportedMorphTargets;){for(K=0;K<T;K++)if(!J[K]&&E[K]>A){V=K;A=E[V]}d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[V]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=A;J[V]=1;A=-1;w++}}d.uniform1fv(o.program.uniforms.morphTargetInfluences,G.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(j.position,3,d.FLOAT,!1,0,0)}if(j.color>=0){d.bindBuffer(d.ARRAY_BUFFER,
-C.__webGLColorBuffer);d.vertexAttribPointer(j.color,3,d.FLOAT,!1,0,0)}if(j.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(j.normal,3,d.FLOAT,!1,0,0)}if(j.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLTangentBuffer);d.vertexAttribPointer(j.tangent,4,d.FLOAT,!1,0,0)}if(j.uv>=0)if(C.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUVBuffer);d.vertexAttribPointer(j.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv)}else d.disableVertexAttribArray(j.uv);if(j.uv2>=
-0)if(C.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUV2Buffer);d.vertexAttribPointer(j.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv2)}else d.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);d.vertexAttribPointer(j.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);d.vertexAttribPointer(j.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,
-C.__webGLSkinIndicesBuffer);d.vertexAttribPointer(j.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);d.vertexAttribPointer(j.skinWeight,4,d.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(o.wireframe){d.lineWidth(o.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);d.drawElements(d.LINES,C.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,
-0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(o.linewidth);d.drawArrays(G,0,C.__webGLLineCount)}else if(G instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webGLParticleCount);else G instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=d.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=d.createBuffer();if(j.hasPos){d.bindBuffer(d.ARRAY_BUFFER,
-j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,j.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(j.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,j.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,j.count);j.count=0}function h(j){if(ua!=j.doubleSided){j.doubleSided?
-d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ua=j.doubleSided}if(va!=j.flipSided){j.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);va=j.flipSided}}function k(j){if(ma!=j){j?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ma=j}}function m(j){N[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);N[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);N[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);N[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);N[4].set(j.n41-j.n31,j.n42-j.n32,
-j.n43-j.n33,j.n44-j.n34);N[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=N[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=N[o].x*t.n14+N[o].y*t.n24+N[o].z*t.n34+N[o].w;if(j<=w)return!1}return!0}function p(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t,w,o=j.object,C=j.opaque,G=j.transparent;G.count=0;j=C.count=
-0;for(t=o.materials.length;j<t;j++){w=o.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(G,w):p(C,w)}}function z(j){var t,w,o,C,G=j.object,J=j.buffer,E=j.opaque,A=j.transparent;A.count=0;j=E.count=0;for(o=G.materials.length;j<o;j++){t=G.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=J.materials.length;t<w;t++)(C=J.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C))}else{C=t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?
-p(A,C):p(E,C)}}}function y(j,t){return t.z-j.z}function B(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function H(j){var t,w,o;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){o=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){var C=d.DYNAMIC_DRAW,
+0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}D(d.TEXTURE_2D,A,A.image);d.bindTexture(d.TEXTURE_2D,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,A.__webGLTexture)}}}d.uniformMatrix4fv(J.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(J.normalMatrix,!1,C._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||
+p instanceof THREE.MeshPhongMaterial||p.envMap)&&d.uniform3f(J.cameraPosition,h.position.x,h.position.y,h.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&d.uniformMatrix4fv(J.viewMatrix,!1,na);if(p instanceof THREE.ShadowVolumeDynamicMaterial){h=E.directionalLightDirection.value;h[0]=
+-t.position.x;h[1]=-t.position.y;h[2]=-t.position.z;d.uniform3fv(J.directionalLightDirection,h);d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(J.viewMatrix,!1,na)}if(p.skinning){d.uniformMatrix4fv(J.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(J.boneGlobalMatrices,!1,C.boneMatrices)}return G}function f(h,t,w,p,C,G){if(p.opacity!=0){h=e(h,t,w,p,G).attributes;if(p.morphTargets){t=p.program.attributes;G.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[G.morphTargetBase]):
+d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){w=0;for(var J=G.morphTargetForcedOrder,E=G.morphTargetInfluences;w<p.numSupportedMorphTargets&&w<J.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[J[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=E[J[w]];w++}}else{J=[];var A=-1,V=0;E=G.morphTargetInfluences;var K,T=E.length;w=0;for(G.morphTargetBase!==
+-1&&(J[G.morphTargetBase]=!0);w<p.numSupportedMorphTargets;){for(K=0;K<T;K++)if(!J[K]&&E[K]>A){V=K;A=E[V]}d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[V]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=A;J[V]=1;A=-1;w++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,G.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(h.position,3,d.FLOAT,!1,0,0)}if(h.color>=0){d.bindBuffer(d.ARRAY_BUFFER,
+C.__webGLColorBuffer);d.vertexAttribPointer(h.color,3,d.FLOAT,!1,0,0)}if(h.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(h.normal,3,d.FLOAT,!1,0,0)}if(h.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLTangentBuffer);d.vertexAttribPointer(h.tangent,4,d.FLOAT,!1,0,0)}if(h.uv>=0)if(C.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUVBuffer);d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(h.uv)}else d.disableVertexAttribArray(h.uv);if(h.uv2>=
+0)if(C.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUV2Buffer);d.vertexAttribPointer(h.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(h.uv2)}else d.disableVertexAttribArray(h.uv2);if(p.skinning&&h.skinVertexA>=0&&h.skinVertexB>=0&&h.skinIndex>=0&&h.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);d.vertexAttribPointer(h.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);d.vertexAttribPointer(h.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,
+C.__webGLSkinIndicesBuffer);d.vertexAttribPointer(h.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);d.vertexAttribPointer(h.skinWeight,4,d.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);d.drawElements(d.LINES,C.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,
+0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(G,0,C.__webGLLineCount)}else if(G instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webGLParticleCount);else G instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webGLVertexCount)}}function g(h,t){if(!h.__webGLVertexBuffer)h.__webGLVertexBuffer=d.createBuffer();if(!h.__webGLNormalBuffer)h.__webGLNormalBuffer=d.createBuffer();if(h.hasPos){d.bindBuffer(d.ARRAY_BUFFER,
+h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,h.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(h.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,h.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,h.count);h.count=0}function j(h){if(ua!=h.doubleSided){h.doubleSided?
+d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ua=h.doubleSided}if(va!=h.flipSided){h.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);va=h.flipSided}}function k(h){if(ma!=h){h?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ma=h}}function m(h){N[0].set(h.n41-h.n11,h.n42-h.n12,h.n43-h.n13,h.n44-h.n14);N[1].set(h.n41+h.n11,h.n42+h.n12,h.n43+h.n13,h.n44+h.n14);N[2].set(h.n41+h.n21,h.n42+h.n22,h.n43+h.n23,h.n44+h.n24);N[3].set(h.n41-h.n21,h.n42-h.n22,h.n43-h.n23,h.n44-h.n24);N[4].set(h.n41-h.n31,h.n42-h.n32,
+h.n43-h.n33,h.n44-h.n34);N[5].set(h.n41+h.n31,h.n42+h.n32,h.n43+h.n33,h.n44+h.n34);var t;for(h=0;h<6;h++){t=N[h];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(h){for(var t=h.matrixWorld,w=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),p=0;p<6;p++){h=N[p].x*t.n14+N[p].y*t.n24+N[p].z*t.n34+N[p].w;if(h<=w)return!1}return!0}function o(h,t){h.list[h.count]=t;h.count+=1}function x(h){var t,w,p=h.object,C=h.opaque,G=h.transparent;G.count=0;h=C.count=
+0;for(t=p.materials.length;h<t;h++){w=p.materials[h];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?o(G,w):o(C,w)}}function z(h){var t,w,p,C,G=h.object,J=h.buffer,E=h.opaque,A=h.transparent;A.count=0;h=E.count=0;for(p=G.materials.length;h<p;h++){t=G.materials[h];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=J.materials.length;t<w;t++)(C=J.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?o(A,C):o(E,C))}else{C=t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?
+o(A,C):o(E,C)}}}function y(h,t){return t.z-h.z}function B(h,t){h._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(h._modelViewMatrix).transposeIntoArray(h._normalMatrixArray)}function H(h){var t,w,p;if(h instanceof THREE.Mesh){w=h.geometry;for(t in w.geometryGroups){p=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){var C=d.DYNAMIC_DRAW,
 G=void 0,J=void 0,E=void 0,A=void 0;E=void 0;var V=void 0,K=void 0,T=void 0,ja=void 0,pa=void 0,sa=void 0,Ba=void 0,ya=void 0,Fa=void 0,fa=void 0,U=void 0,la=void 0,Ma=void 0;K=void 0;T=void 0;A=void 0;ja=void 0;A=void 0;fa=void 0;U=void 0;K=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;A=void 0;ja=void 0;V=void 0;E=void 0;E=void 0;var Ha=void 0,fb=void 0,Ua=void 0,Ja=0,Sa=0,cb=0,eb=0,Qa=0,Va=
-0,Ea=0,Wa=0,Na=0,O=0,Oa=0,Ra=o.__vertexArray,jb=o.__uvArray,Ca=o.__uv2Array,Ta=o.__normalArray,Ga=o.__tangentArray,Pa=o.__colorArray,Ka=o.__skinVertexAArray,wa=o.__skinVertexBArray,L=o.__skinIndexArray,aa=o.__skinWeightArray,oa=o.__morphTargetsArrays,ea=o.__faceArray,ta=o.__lineArray,Aa=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;Ba=o.__normalType;var ga=j.geometry,ca=ga.__dirtyVertices,La=ga.__dirtyElements,Ya=ga.__dirtyUvs,Za=ga.__dirtyNormals,db=ga.__dirtyTangents,hb=ga.__dirtyColors,
-bb=ga.__dirtyMorphTargets,Xa=ga.vertices,ob=o.faces,rb=ga.faces,pb=ga.faceVertexUvs[0],qb=ga.faceVertexUvs[1],lb=ga.skinVerticesA,mb=ga.skinVerticesB,nb=ga.skinIndices,ib=ga.skinWeights,kb=ga.edgeFaces,gb=ga.morphTargets;G=0;for(J=ob.length;G<J;G++){E=ob[G];A=rb[E];pb&&(ya=pb[E]);qb&&(Fa=qb[E]);E=A.vertexNormals;V=A.normal;K=A.vertexColors;T=A.color;ja=A.vertexTangents;if(A instanceof THREE.Face3){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=
+0,Ea=0,Wa=0,Na=0,O=0,Oa=0,Ra=p.__vertexArray,jb=p.__uvArray,Ca=p.__uv2Array,Ta=p.__normalArray,Ga=p.__tangentArray,Pa=p.__colorArray,Ka=p.__skinVertexAArray,wa=p.__skinVertexBArray,L=p.__skinIndexArray,aa=p.__skinWeightArray,oa=p.__morphTargetsArrays,ea=p.__faceArray,ta=p.__lineArray,Aa=p.__needsSmoothNormals;sa=p.__vertexColorType;pa=p.__uvType;Ba=p.__normalType;var ga=h.geometry,ca=ga.__dirtyVertices,La=ga.__dirtyElements,Ya=ga.__dirtyUvs,Za=ga.__dirtyNormals,db=ga.__dirtyTangents,hb=ga.__dirtyColors,
+bb=ga.__dirtyMorphTargets,Xa=ga.vertices,ob=p.faces,rb=ga.faces,pb=ga.faceVertexUvs[0],qb=ga.faceVertexUvs[1],lb=ga.skinVerticesA,mb=ga.skinVerticesB,nb=ga.skinIndices,ib=ga.skinWeights,kb=ga.edgeFaces,gb=ga.morphTargets;G=0;for(J=ob.length;G<J;G++){E=ob[G];A=rb[E];pb&&(ya=pb[E]);qb&&(Fa=qb[E]);E=A.vertexNormals;V=A.normal;K=A.vertexColors;T=A.color;ja=A.vertexTangents;if(A instanceof THREE.Face3){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=
 fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Sa+=9}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ua=oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[Oa+5]=U.z;Ua[Oa+6]=la.x;Ua[Oa+7]=la.y;Ua[Oa+8]=la.z}Oa+=9}if(ib.length){fa=ib[A.a];U=ib[A.b];la=ib[A.c];aa[O]=fa.x;aa[O+1]=fa.y;aa[O+2]=fa.z;aa[O+3]=fa.w;aa[O+4]=U.x;aa[O+5]=U.y;aa[O+6]=U.z;
 aa[O+7]=U.w;aa[O+8]=la.x;aa[O+9]=la.y;aa[O+10]=la.z;aa[O+11]=la.w;fa=nb[A.a];U=nb[A.b];la=nb[A.c];L[O]=fa.x;L[O+1]=fa.y;L[O+2]=fa.z;L[O+3]=fa.w;L[O+4]=U.x;L[O+5]=U.y;L[O+6]=U.z;L[O+7]=U.w;L[O+8]=la.x;L[O+9]=la.y;L[O+10]=la.z;L[O+11]=la.w;fa=lb[A.a];U=lb[A.b];la=lb[A.c];Ka[O]=fa.x;Ka[O+1]=fa.y;Ka[O+2]=fa.z;Ka[O+3]=1;Ka[O+4]=U.x;Ka[O+5]=U.y;Ka[O+6]=U.z;Ka[O+7]=1;Ka[O+8]=la.x;Ka[O+9]=la.y;Ka[O+10]=la.z;Ka[O+11]=1;fa=mb[A.a];U=mb[A.b];la=mb[A.c];wa[O]=fa.x;wa[O+1]=fa.y;wa[O+2]=fa.z;wa[O+3]=1;wa[O+4]=
 U.x;wa[O+5]=U.y;wa[O+6]=U.z;wa[O+7]=1;wa[O+8]=la.x;wa[O+9]=la.y;wa[O+10]=la.z;wa[O+11]=1;O+=12}if(hb&&sa){if(K.length==3&&sa==THREE.VertexColors){A=K[0];fa=K[1];U=K[2]}else U=fa=A=T;Pa[Na]=A.r;Pa[Na+1]=A.g;Pa[Na+2]=A.b;Pa[Na+3]=fa.r;Pa[Na+4]=fa.g;Pa[Na+5]=fa.b;Pa[Na+6]=U.r;Pa[Na+7]=U.g;Pa[Na+8]=U.b;Na+=9}if(db&&ga.hasTangents){K=ja[0];T=ja[1];A=ja[2];Ga[Ea]=K.x;Ga[Ea+1]=K.y;Ga[Ea+2]=K.z;Ga[Ea+3]=K.w;Ga[Ea+4]=T.x;Ga[Ea+5]=T.y;Ga[Ea+6]=T.z;Ga[Ea+7]=T.w;Ga[Ea+8]=A.x;Ga[Ea+9]=A.y;Ga[Ea+10]=A.z;Ga[Ea+
@@ -261,71 +261,71 @@ THREE.Face4){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;M
 L[O+6]=U.z;L[O+7]=U.w;L[O+8]=la.x;L[O+9]=la.y;L[O+10]=la.z;L[O+11]=la.w;L[O+12]=Ma.x;L[O+13]=Ma.y;L[O+14]=Ma.z;L[O+15]=Ma.w;fa=lb[A.a];U=lb[A.b];la=lb[A.c];Ma=lb[A.d];Ka[O]=fa.x;Ka[O+1]=fa.y;Ka[O+2]=fa.z;Ka[O+3]=1;Ka[O+4]=U.x;Ka[O+5]=U.y;Ka[O+6]=U.z;Ka[O+7]=1;Ka[O+8]=la.x;Ka[O+9]=la.y;Ka[O+10]=la.z;Ka[O+11]=1;Ka[O+12]=Ma.x;Ka[O+13]=Ma.y;Ka[O+14]=Ma.z;Ka[O+15]=1;fa=mb[A.a];U=mb[A.b];la=mb[A.c];A=mb[A.d];wa[O]=fa.x;wa[O+1]=fa.y;wa[O+2]=fa.z;wa[O+3]=1;wa[O+4]=U.x;wa[O+5]=U.y;wa[O+6]=U.z;wa[O+7]=1;wa[O+
 8]=la.x;wa[O+9]=la.y;wa[O+10]=la.z;wa[O+11]=1;wa[O+12]=A.x;wa[O+13]=A.y;wa[O+14]=A.z;wa[O+15]=1;O+=16}if(hb&&sa){if(K.length==4&&sa==THREE.VertexColors){A=K[0];fa=K[1];U=K[2];K=K[3]}else K=U=fa=A=T;Pa[Na]=A.r;Pa[Na+1]=A.g;Pa[Na+2]=A.b;Pa[Na+3]=fa.r;Pa[Na+4]=fa.g;Pa[Na+5]=fa.b;Pa[Na+6]=U.r;Pa[Na+7]=U.g;Pa[Na+8]=U.b;Pa[Na+9]=K.r;Pa[Na+10]=K.g;Pa[Na+11]=K.b;Na+=12}if(db&&ga.hasTangents){K=ja[0];T=ja[1];A=ja[2];ja=ja[3];Ga[Ea]=K.x;Ga[Ea+1]=K.y;Ga[Ea+2]=K.z;Ga[Ea+3]=K.w;Ga[Ea+4]=T.x;Ga[Ea+5]=T.y;Ga[Ea+
 6]=T.z;Ga[Ea+7]=T.w;Ga[Ea+8]=A.x;Ga[Ea+9]=A.y;Ga[Ea+10]=A.z;Ga[Ea+11]=A.w;Ga[Ea+12]=ja.x;Ga[Ea+13]=ja.y;Ga[Ea+14]=ja.z;Ga[Ea+15]=ja.w;Ea+=16}if(Za&&Ba)if(E.length==4&&Aa)for(ja=0;ja<4;ja++){V=E[ja];Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}else for(ja=0;ja<4;ja++){Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}if(Ya&&ya!==undefined&&pa)for(ja=0;ja<4;ja++){E=ya[ja];jb[cb]=E.u;jb[cb+1]=E.v;cb+=2}if(Ya&&Fa!==undefined&&pa)for(ja=0;ja<4;ja++){E=Fa[ja];Ca[eb]=E.u;Ca[eb+1]=E.v;eb+=2}if(La){ea[Qa]=Ja;ea[Qa+
-1]=Ja+1;ea[Qa+2]=Ja+3;ea[Qa+3]=Ja+1;ea[Qa+4]=Ja+2;ea[Qa+5]=Ja+3;Qa+=6;ta[Wa]=Ja;ta[Wa+1]=Ja+1;ta[Wa+2]=Ja;ta[Wa+3]=Ja+3;ta[Wa+4]=Ja+1;ta[Wa+5]=Ja+2;ta[Wa+6]=Ja+2;ta[Wa+7]=Ja+3;Wa+=8;Ja+=4}}}if(kb){G=0;for(J=kb.length;G<J;G++){ea[Qa]=kb[G].a;ea[Qa+1]=kb[G].b;ea[Qa+2]=kb[G].c;ea[Qa+3]=kb[G].a;ea[Qa+4]=kb[G].c;ea[Qa+5]=kb[G].d;Qa+=6}}if(ca){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,C)}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLMorphTargetsBuffers[Ha]);
-d.bufferData(d.ARRAY_BUFFER,oa[Ha],C)}}if(hb&&Na>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,C)}if(Za){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ta,C)}if(db&&ga.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ga,C)}if(Ya&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,jb,C)}if(Ya&&eb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,
-Ca,C)}if(La){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,C)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ka,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,wa,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,L,C);d.bindBuffer(d.ARRAY_BUFFER,
-o.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,aa,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+
-1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;
-Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||
-j.sortParticles)&&c(w,d.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(j){function t(ja){var pa=[];w=0;for(o=ja.length;w<o;w++)ja[w]==undefined?pa.push("undefined"):pa.push(ja[w].id);return pa.join("_")}var w,o,C,G,J,E,A,V,K={},T=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};C=0;for(G=j.faces.length;C<G;C++){J=j.faces[C];E=J.materials;A=t(E);K[A]==undefined&&(K[A]={hash:A,counter:0});V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]=
-{faces:[],materials:E,vertices:0,numMorphTargets:T});J=J instanceof THREE.Face3?3:4;if(j.geometryGroups[V].vertices+J>65535){K[A].counter+=1;V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T})}j.geometryGroups[V].faces.push(C);j.geometryGroups[V].vertices+=J}}function F(j,t,w){j.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(j){if(j!=za){switch(j){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=j}}function D(j,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(j,d.TEXTURE_WRAP_S,ka(t.wrapS));
-d.texParameteri(j,d.TEXTURE_WRAP_T,ka(t.wrapT));d.texParameteri(j,d.TEXTURE_MAG_FILTER,ka(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,ka(t.minFilter));d.generateMipmap(j)}else{d.texParameteri(j,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_MAG_FILTER,P(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,P(t.minFilter))}}function Q(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=d.createFramebuffer();j.__webGLRenderbuffer=
-d.createRenderbuffer();j.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,j.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,j.width,j.height);d.bindTexture(d.TEXTURE_2D,j.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ka(j.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ka(j.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,ka(j.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ka(j.minFilter));d.texImage2D(d.TEXTURE_2D,
-0,ka(j.format),j.width,j.height,0,ka(j.format),ka(j.type),null);d.bindFramebuffer(d.FRAMEBUFFER,j.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,j.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,j.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=Z;j=S}if(t!=da){d.bindFramebuffer(d.FRAMEBUFFER,
-t);d.viewport(W,ia,w,j);da=t}}function R(j,t){var w;if(j=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else j=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function P(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ka(j){switch(j){case THREE.RepeatWrapping:return d.REPEAT;
+1]=Ja+1;ea[Qa+2]=Ja+3;ea[Qa+3]=Ja+1;ea[Qa+4]=Ja+2;ea[Qa+5]=Ja+3;Qa+=6;ta[Wa]=Ja;ta[Wa+1]=Ja+1;ta[Wa+2]=Ja;ta[Wa+3]=Ja+3;ta[Wa+4]=Ja+1;ta[Wa+5]=Ja+2;ta[Wa+6]=Ja+2;ta[Wa+7]=Ja+3;Wa+=8;Ja+=4}}}if(kb){G=0;for(J=kb.length;G<J;G++){ea[Qa]=kb[G].a;ea[Qa+1]=kb[G].b;ea[Qa+2]=kb[G].c;ea[Qa+3]=kb[G].a;ea[Qa+4]=kb[G].c;ea[Qa+5]=kb[G].d;Qa+=6}}if(ca){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,C)}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLMorphTargetsBuffers[Ha]);
+d.bufferData(d.ARRAY_BUFFER,oa[Ha],C)}}if(hb&&Na>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,C)}if(Za){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ta,C)}if(db&&ga.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ga,C)}if(Ya&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,jb,C)}if(Ya&&eb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,
+Ca,C)}if(La){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,C)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ka,C);d.bindBuffer(d.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,wa,C);d.bindBuffer(d.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,L,C);d.bindBuffer(d.ARRAY_BUFFER,
+p.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,aa,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=d.DYNAMIC_DRAW;Ba=h.vertices;C=h.colors;ya=Ba.length;G=C.length;Fa=h.__vertexArray;J=h.__colorArray;Ja=h.__dirtyColors;if(h.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;p=pa*3;Fa[p]=sa.x;Fa[p+
+1]=sa.y;Fa[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];p=pa*3;J[p]=color.r;J[p+1]=color.g;J[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Line){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=d.DYNAMIC_DRAW;Ba=h.vertices;C=h.colors;ya=Ba.length;G=C.length;Fa=h.__vertexArray;J=h.__colorArray;
+Ja=h.__dirtyColors;if(h.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;p=pa*3;Fa[p]=sa.x;Fa[p+1]=sa.y;Fa[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];p=pa*3;J[p]=color.r;J[p+1]=color.g;J[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){w=h.geometry;(w.__dirtyVertices||w.__dirtyColors||
+h.sortParticles)&&c(w,d.DYNAMIC_DRAW,h);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(h){function t(ja){var pa=[];w=0;for(p=ja.length;w<p;w++)ja[w]==undefined?pa.push("undefined"):pa.push(ja[w].id);return pa.join("_")}var w,p,C,G,J,E,A,V,K={},T=h.morphTargets!==undefined?h.morphTargets.length:0;h.geometryGroups={};C=0;for(G=h.faces.length;C<G;C++){J=h.faces[C];E=J.materials;A=t(E);K[A]==undefined&&(K[A]={hash:A,counter:0});V=K[A].hash+"_"+K[A].counter;h.geometryGroups[V]==undefined&&(h.geometryGroups[V]=
+{faces:[],materials:E,vertices:0,numMorphTargets:T});J=J instanceof THREE.Face3?3:4;if(h.geometryGroups[V].vertices+J>65535){K[A].counter+=1;V=K[A].hash+"_"+K[A].counter;h.geometryGroups[V]==undefined&&(h.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T})}h.geometryGroups[V].faces.push(C);h.geometryGroups[V].vertices+=J}}function F(h,t,w){h.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(h){if(h!=za){switch(h){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);
+d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=h}}function D(h,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(h,d.TEXTURE_WRAP_S,ka(t.wrapS));
+d.texParameteri(h,d.TEXTURE_WRAP_T,ka(t.wrapT));d.texParameteri(h,d.TEXTURE_MAG_FILTER,ka(t.magFilter));d.texParameteri(h,d.TEXTURE_MIN_FILTER,ka(t.minFilter));d.generateMipmap(h)}else{d.texParameteri(h,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(h,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(h,d.TEXTURE_MAG_FILTER,P(t.magFilter));d.texParameteri(h,d.TEXTURE_MIN_FILTER,P(t.minFilter))}}function Q(h){if(h&&!h.__webGLFramebuffer){h.__webGLFramebuffer=d.createFramebuffer();h.__webGLRenderbuffer=
+d.createRenderbuffer();h.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,h.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,h.width,h.height);d.bindTexture(d.TEXTURE_2D,h.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ka(h.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ka(h.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,ka(h.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ka(h.minFilter));d.texImage2D(d.TEXTURE_2D,
+0,ka(h.format),h.width,h.height,0,ka(h.format),ka(h.type),null);d.bindFramebuffer(d.FRAMEBUFFER,h.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,h.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,h.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var t,w;if(h){t=h.__webGLFramebuffer;w=h.width;h=h.height}else{t=null;w=Z;h=S}if(t!=da){d.bindFramebuffer(d.FRAMEBUFFER,
+t);d.viewport(W,ia,w,h);da=t}}function R(h,t){var w;if(h=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else h=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function P(h){switch(h){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ka(h){switch(h){case THREE.RepeatWrapping:return d.REPEAT;
 case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;
 case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var $=document.createElement("canvas"),
 d,X=null,da=null,Y=this,ua=null,va=null,za=null,ma=null,W=0,ia=0,Z=0,S=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,ra=new Float32Array(16),na=new Float32Array(16),qa=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Da=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Da=a.antialias;a.clearColor!==undefined&&$a.setHex(a.clearColor);
-if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(d=$.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
+if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(h,t,w){try{if(!(d=$.getContext("experimental-webgl",{antialias:h,stencil:!0})))throw"Error creating WebGL context.";}catch(p){console.error(p)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
 d.clearColor(t.r,t.g,t.b,w)})(Da,$a,ab);this.context=d;var Ia={};a=[];Da=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Da[0]=0;Da[1]=1;Da[2]=2;Da[3]=0;Da[4]=2;Da[5]=3;Ia.vertexBuffer=d.createBuffer();Ia.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,new Uint16Array(Da),
-d.STATIC_DRAW);Ia.program=d.createProgram();d.attachShader(Ia.program,R("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ia.program,R("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ia.program);Ia.vertexLocation=d.getAttribLocation(Ia.program,"position");Ia.projectionLocation=d.getUniformLocation(Ia.program,"projectionMatrix");this.setSize=function(j,t){$.width=j;$.height=t;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(j,t,w,o){W=j;ia=t;Z=
-w;S=o;d.viewport(W,ia,Z,S)};this.setScissor=function(j,t,w,o){d.scissor(j,t,w,o)};this.enableScissorTest=function(j){j?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){d.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){d.clearColor(j.r,j.g,j.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial=function(j,t,
-w,o){var C,G,J,E;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof THREE.LineBasicMaterial)b(j,
-THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var A,V,K;A=K=E=0;for(J=t.length;A<J;A++){V=t[A];V instanceof THREE.DirectionalLight&&K++;V instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)t=o.bones.length;J={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,sizeAttenuation:j.sizeAttenuation,
-skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=d.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,J.fog?"#define USE_FOG":"",J.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":
+d.STATIC_DRAW);Ia.program=d.createProgram();d.attachShader(Ia.program,R("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ia.program,R("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ia.program);Ia.vertexLocation=d.getAttribLocation(Ia.program,"position");Ia.projectionLocation=d.getUniformLocation(Ia.program,"projectionMatrix");this.setSize=function(h,t){$.width=h;$.height=t;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(h,t,w,p){W=h;ia=t;Z=
+w;S=p;d.viewport(W,ia,Z,S)};this.setScissor=function(h,t,w,p){d.scissor(h,t,w,p)};this.enableScissorTest=function(h){h?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(h){d.depthMask(h)};this.setClearColorHex=function(h,t){var w=new THREE.Color(h);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(h,t){d.clearColor(h.r,h.g,h.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial=function(h,t,
+w,p){var C,G,J,E;if(h instanceof THREE.MeshDepthMaterial)b(h,THREE.ShaderLib.depth);else if(h instanceof THREE.ShadowVolumeDynamicMaterial)b(h,THREE.ShaderLib.shadowVolumeDynamic);else if(h instanceof THREE.MeshNormalMaterial)b(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)b(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)b(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)b(h,THREE.ShaderLib.phong);else if(h instanceof THREE.LineBasicMaterial)b(h,
+THREE.ShaderLib.basic);else h instanceof THREE.ParticleBasicMaterial&&b(h,THREE.ShaderLib.particle_basic);if(!h.program){var A,V,K;A=K=E=0;for(J=t.length;A<J;A++){V=t[A];V instanceof THREE.DirectionalLight&&K++;V instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)t=p.bones.length;J={fog:w,map:h.map,envMap:h.envMap,lightMap:h.lightMap,vertexColors:h.vertexColors,sizeAttenuation:h.sizeAttenuation,
+skinning:h.skinning,morphTargets:h.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=h.fragmentShader;E=h.vertexShader;t=d.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,J.fog?"#define USE_FOG":"",J.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":
 "","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");J=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,"#define MAX_BONES "+J.maxBones,J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":"",J.skinning?"#define USE_SKINNING":"",J.morphTargets?"#define USE_MORPHTARGETS":"",J.sizeAttenuation?
 "#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-d.attachShader(t,R("fragment",A+w));d.attachShader(t,R("vertex",J+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in j.uniforms)w.push(C);
-C=j.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=d.getUniformLocation(C,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)w.push("morphTarget"+C);for(G in j.attributes)w.push(G);G=j.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];G.attributes[t]=d.getAttribLocation(G,t)}G=j.program.attributes;d.enableVertexAttribArray(G.position);G.color>=0&&d.enableVertexAttribArray(G.color);G.normal>=0&&d.enableVertexAttribArray(G.normal);
-G.tangent>=0&&d.enableVertexAttribArray(G.tangent);if(j.skinning&&G.skinVertexA>=0&&G.skinVertexB>=0&&G.skinIndex>=0&&G.skinWeight>=0){d.enableVertexAttribArray(G.skinVertexA);d.enableVertexAttribArray(G.skinVertexB);d.enableVertexAttribArray(G.skinIndex);d.enableVertexAttribArray(G.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(G.morphTarget0>=0){d.enableVertexAttribArray(G.morphTarget0);j.numSupportedMorphTargets++}if(G.morphTarget1>=0){d.enableVertexAttribArray(G.morphTarget1);
-j.numSupportedMorphTargets++}if(G.morphTarget2>=0){d.enableVertexAttribArray(G.morphTarget2);j.numSupportedMorphTargets++}if(G.morphTarget3>=0){d.enableVertexAttribArray(G.morphTarget3);j.numSupportedMorphTargets++}if(G.morphTarget4>=0){d.enableVertexAttribArray(G.morphTarget4);j.numSupportedMorphTargets++}if(G.morphTarget5>=0){d.enableVertexAttribArray(G.morphTarget5);j.numSupportedMorphTargets++}if(G.morphTarget6>=0){d.enableVertexAttribArray(G.morphTarget6);j.numSupportedMorphTargets++}if(G.morphTarget7>=
-0){d.enableVertexAttribArray(G.morphTarget7);j.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(C=0;C<this.maxMorphTargets;C++)o.__webGLMorphTargetInfluences[C]=0}}j.__webglProgram=!0};this.render=function(j,t,w,o){var C,G,J,E,A,V,K,T,ja=j.lights,pa=j.fog;t.matrixAutoUpdate&&t.updateMatrix();j.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(na);t.projectionMatrix.flattenToArray(ra);ha.multiply(t.projectionMatrix,t.matrixWorldInverse);
-m(ha);this.initWebGLObjects(j);Q(w);(this.autoClear||o)&&this.clear();o=j.__webglObjects.length;for(A=0;A<o;A++){E=j.__webglObjects[A];K=E.object;if(K.visible)if(!(K instanceof THREE.Mesh)||n(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);z(E);E.render=!0;if(this.sortObjects){qa.copy(K.position);ha.multiplyVector3(qa);E.z=qa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&j.__webglObjects.sort(y);V=j.__webglObjectsImmediate.length;for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];
-K=E.object;if(K.visible){K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);x(E)}}M(THREE.NormalBlending);for(A=0;A<o;A++){E=j.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.opaque;h(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.opaque;h(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}for(A=0;A<o;A++){E=
-j.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.transparent;h(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.transparent;h(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}if(j.__webglShadowVolumes.length&&j.lights.length){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);
-d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);V=j.lights.length;T=[];o=j.__webglShadowVolumes.length;for(t=0;t<V;t++){A=j.lights[t];if(A instanceof THREE.DirectionalLight){T[0]=-A.position.x;T[1]=-A.position.y;T[2]=-A.position.z;for(A=0;A<o;A++){K=j.__webglShadowVolumes[A].object;C=j.__webglShadowVolumes[A].buffer;E=K.materials[0];E.program||Y.initMaterial(E,ja,pa,K);G=E.program;E=G.uniforms;
+d.attachShader(t,R("fragment",A+w));d.attachShader(t,R("vertex",J+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};h.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in h.uniforms)w.push(C);
+C=h.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=d.getUniformLocation(C,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)w.push("morphTarget"+C);for(G in h.attributes)w.push(G);G=h.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];G.attributes[t]=d.getAttribLocation(G,t)}G=h.program.attributes;d.enableVertexAttribArray(G.position);G.color>=0&&d.enableVertexAttribArray(G.color);G.normal>=0&&d.enableVertexAttribArray(G.normal);
+G.tangent>=0&&d.enableVertexAttribArray(G.tangent);if(h.skinning&&G.skinVertexA>=0&&G.skinVertexB>=0&&G.skinIndex>=0&&G.skinWeight>=0){d.enableVertexAttribArray(G.skinVertexA);d.enableVertexAttribArray(G.skinVertexB);d.enableVertexAttribArray(G.skinIndex);d.enableVertexAttribArray(G.skinWeight)}if(h.morphTargets){h.numSupportedMorphTargets=0;if(G.morphTarget0>=0){d.enableVertexAttribArray(G.morphTarget0);h.numSupportedMorphTargets++}if(G.morphTarget1>=0){d.enableVertexAttribArray(G.morphTarget1);
+h.numSupportedMorphTargets++}if(G.morphTarget2>=0){d.enableVertexAttribArray(G.morphTarget2);h.numSupportedMorphTargets++}if(G.morphTarget3>=0){d.enableVertexAttribArray(G.morphTarget3);h.numSupportedMorphTargets++}if(G.morphTarget4>=0){d.enableVertexAttribArray(G.morphTarget4);h.numSupportedMorphTargets++}if(G.morphTarget5>=0){d.enableVertexAttribArray(G.morphTarget5);h.numSupportedMorphTargets++}if(G.morphTarget6>=0){d.enableVertexAttribArray(G.morphTarget6);h.numSupportedMorphTargets++}if(G.morphTarget7>=
+0){d.enableVertexAttribArray(G.morphTarget7);h.numSupportedMorphTargets++}p.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(C=0;C<this.maxMorphTargets;C++)p.__webGLMorphTargetInfluences[C]=0}}h.__webglProgram=!0};this.render=function(h,t,w,p){var C,G,J,E,A,V,K,T,ja=h.lights,pa=h.fog;t.matrixAutoUpdate&&t.updateMatrix();h.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(na);t.projectionMatrix.flattenToArray(ra);ha.multiply(t.projectionMatrix,t.matrixWorldInverse);
+m(ha);this.initWebGLObjects(h);Q(w);(this.autoClear||p)&&this.clear();p=h.__webglObjects.length;for(A=0;A<p;A++){E=h.__webglObjects[A];K=E.object;if(K.visible)if(!(K instanceof THREE.Mesh)||n(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);z(E);E.render=!0;if(this.sortObjects){qa.copy(K.position);ha.multiplyVector3(qa);E.z=qa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&h.__webglObjects.sort(y);V=h.__webglObjectsImmediate.length;for(A=0;A<V;A++){E=h.__webglObjectsImmediate[A];
+K=E.object;if(K.visible){K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);x(E)}}M(THREE.NormalBlending);for(A=0;A<p;A++){E=h.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.opaque;j(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=h.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.opaque;j(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}for(A=0;A<p;A++){E=
+h.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.transparent;j(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=h.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.transparent;j(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}if(h.__webglShadowVolumes.length&&h.lights.length){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);
+d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);V=h.lights.length;T=[];p=h.__webglShadowVolumes.length;for(t=0;t<V;t++){A=h.lights[t];if(A instanceof THREE.DirectionalLight){T[0]=-A.position.x;T[1]=-A.position.y;T[2]=-A.position.z;for(A=0;A<p;A++){K=h.__webglShadowVolumes[A].object;C=h.__webglShadowVolumes[A].buffer;E=K.materials[0];E.program||Y.initMaterial(E,ja,pa,K);G=E.program;E=G.uniforms;
 J=G.attributes;if(X!==G){d.useProgram(G);X=G;d.uniformMatrix4fv(E.projectionMatrix,!1,ra);d.uniformMatrix4fv(E.viewMatrix,!1,na);d.uniform3fv(E.directionalLightDirection,T)}K.matrixWorld.flattenToArray(K._objectMatrixArray);d.uniformMatrix4fv(E.objectMatrix,!1,K._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(J.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(J.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
 C.__webGLFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);za="";X=Ia.program;d.useProgram(Ia.program);d.uniformMatrix4fv(Ia.projectionLocation,
 !1,ra);d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.vertexAttribPointer(Ia.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(Ia.vertexLocation);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.disable(d.BLEND);d.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,w.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(j){if(!j.__webglObjects){j.__webglObjects=[];j.__webglObjectsImmediate=[];j.__webglShadowVolumes=[]}for(;j.__objectsAdded.length;){var t=j.__objectsAdded[0],w=j,o=void 0,C=void 0,G=void 0;if(t._modelViewMatrix==undefined){t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}if(t instanceof THREE.Mesh){C=
-t.geometry;C.geometryGroups==undefined&&I(C);for(o in C.geometryGroups){G=C.geometryGroups[o];if(!G.__webGLVertexBuffer){var J=G;J.__webGLVertexBuffer=d.createBuffer();J.__webGLNormalBuffer=d.createBuffer();J.__webGLTangentBuffer=d.createBuffer();J.__webGLColorBuffer=d.createBuffer();J.__webGLUVBuffer=d.createBuffer();J.__webGLUV2Buffer=d.createBuffer();J.__webGLSkinVertexABuffer=d.createBuffer();J.__webGLSkinVertexBBuffer=d.createBuffer();J.__webGLSkinIndicesBuffer=d.createBuffer();J.__webGLSkinWeightsBuffer=
+null)}};this.initWebGLObjects=function(h){if(!h.__webglObjects){h.__webglObjects=[];h.__webglObjectsImmediate=[];h.__webglShadowVolumes=[]}for(;h.__objectsAdded.length;){var t=h.__objectsAdded[0],w=h,p=void 0,C=void 0,G=void 0;if(t._modelViewMatrix==undefined){t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}if(t instanceof THREE.Mesh){C=
+t.geometry;C.geometryGroups==undefined&&I(C);for(p in C.geometryGroups){G=C.geometryGroups[p];if(!G.__webGLVertexBuffer){var J=G;J.__webGLVertexBuffer=d.createBuffer();J.__webGLNormalBuffer=d.createBuffer();J.__webGLTangentBuffer=d.createBuffer();J.__webGLColorBuffer=d.createBuffer();J.__webGLUVBuffer=d.createBuffer();J.__webGLUV2Buffer=d.createBuffer();J.__webGLSkinVertexABuffer=d.createBuffer();J.__webGLSkinVertexBBuffer=d.createBuffer();J.__webGLSkinIndicesBuffer=d.createBuffer();J.__webGLSkinWeightsBuffer=
 d.createBuffer();J.__webGLFaceBuffer=d.createBuffer();J.__webGLLineBuffer=d.createBuffer();if(J.numMorphTargets){var E=void 0,A=void 0;J.__webGLMorphTargetsBuffers=[];E=0;for(A=J.numMorphTargets;E<A;E++)J.__webGLMorphTargetsBuffers.push(d.createBuffer())}J=G;E=t;var V=void 0,K=void 0,T=void 0;T=void 0;var ja=A=0,pa=0;V=void 0;K=void 0;var sa=void 0;K=void 0;var Ba=E.geometry;sa=Ba.faces;var ya=J.faces;V=0;for(K=ya.length;V<K;V++){T=ya[V];T=sa[T];if(T instanceof THREE.Face3){A+=3;ja+=1;pa+=3}else if(T instanceof
 THREE.Face4){A+=4;ja+=2;pa+=4}}V=J;K=E;sa=void 0;ya=void 0;var Fa=void 0,fa=void 0;Fa=void 0;T=[];sa=0;for(ya=K.materials.length;sa<ya;sa++){Fa=K.materials[sa];if(Fa instanceof THREE.MeshFaceMaterial){Fa=0;for(l=V.materials.length;Fa<l;Fa++)(fa=V.materials[Fa])&&T.push(fa)}else(fa=Fa)&&T.push(fa)}K=T;a:{V=void 0;sa=void 0;ya=K.length;for(V=0;V<ya;V++){sa=K[V];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){V=!0;break a}}V=!1}a:{sa=K;ya=void 0;T=void 0;Fa=sa.length;for(ya=0;ya<Fa;ya++){T=
 sa[ya];if(!(T instanceof THREE.MeshBasicMaterial&&!T.envMap||T instanceof THREE.MeshDepthMaterial)){sa=T&&T.shading!=undefined&&T.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{ya=void 0;T=void 0;Fa=K.length;for(ya=0;ya<Fa;ya++){T=K[ya];if(T.vertexColors){K=T.vertexColors;break a}}K=!1}J.__vertexArray=new Float32Array(A*3);if(sa)J.__normalArray=new Float32Array(A*3);if(Ba.hasTangents)J.__tangentArray=new Float32Array(A*4);if(K)J.__colorArray=new Float32Array(A*
 3);if(V){if(Ba.faceUvs.length>0||Ba.faceVertexUvs.length>0)J.__uvArray=new Float32Array(A*2);if(Ba.faceUvs.length>1||Ba.faceVertexUvs.length>1)J.__uv2Array=new Float32Array(A*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){J.__skinVertexAArray=new Float32Array(A*4);J.__skinVertexBArray=new Float32Array(A*4);J.__skinIndexArray=new Float32Array(A*4);J.__skinWeightArray=new Float32Array(A*4)}J.__faceArray=new Uint16Array(ja*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));
 J.__lineArray=new Uint16Array(pa*2);if(J.numMorphTargets){Ba=void 0;ya=void 0;J.__morphTargetsArrays=[];Ba=0;for(ya=J.numMorphTargets;Ba<ya;Ba++)J.__morphTargetsArrays.push(new Float32Array(A*3))}J.__needsSmoothNormals=sa==THREE.SmoothShading;J.__uvType=V;J.__vertexColorType=K;J.__normalType=sa;J.__webGLFaceCount=ja*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);J.__webGLLineCount=pa*2;C.__dirtyVertices=!0;C.__dirtyMorphTargets=!0;C.__dirtyElements=!0;C.__dirtyUvs=!0;C.__dirtyNormals=!0;
-C.__dirtyTangents=!0;C.__dirtyColors=!0}t instanceof THREE.ShadowVolume?F(w.__webglShadowVolumes,G,t):F(w.__webglObjects,G,t)}}else if(t instanceof THREE.Ribbon){C=t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__webGLVertexCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.Line){C=
-t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__webGLLineCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.ParticleSystem){C=t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=
-new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__sortArray=[];o.__webGLParticleCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});j.__objectsAdded.splice(0,1)}for(;j.__objectsRemoved.length;){t=j.__objectsRemoved[0];w=j;C=void 0;o=void 0;for(C=w.__webglObjects.length-1;C>=0;C--){o=w.__webglObjects[C].object;
-t==o&&w.__webglObjects.splice(C,1)}j.__objectsRemoved.splice(0,1)}t=0;for(w=j.__webglObjects.length;t<w;t++)H(j.__webglObjects[t].object,j);t=0;for(w=j.__webglShadowVolumes.length;t<w;t++)H(j.__webglShadowVolumes[t].object,j)};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(j=="back")d.cullFace(d.BACK);else j=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+C.__dirtyTangents=!0;C.__dirtyColors=!0}t instanceof THREE.ShadowVolume?F(w.__webglShadowVolumes,G,t):F(w.__webglObjects,G,t)}}else if(t instanceof THREE.Ribbon){C=t.geometry;if(!C.__webGLVertexBuffer){p=C;p.__webGLVertexBuffer=d.createBuffer();p.__webGLColorBuffer=d.createBuffer();p=C;G=p.vertices.length;p.__vertexArray=new Float32Array(G*3);p.__colorArray=new Float32Array(G*3);p.__webGLVertexCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.Line){C=
+t.geometry;if(!C.__webGLVertexBuffer){p=C;p.__webGLVertexBuffer=d.createBuffer();p.__webGLColorBuffer=d.createBuffer();p=C;G=p.vertices.length;p.__vertexArray=new Float32Array(G*3);p.__colorArray=new Float32Array(G*3);p.__webGLLineCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.ParticleSystem){C=t.geometry;if(!C.__webGLVertexBuffer){p=C;p.__webGLVertexBuffer=d.createBuffer();p.__webGLColorBuffer=d.createBuffer();p=C;G=p.vertices.length;p.__vertexArray=
+new Float32Array(G*3);p.__colorArray=new Float32Array(G*3);p.__sortArray=[];p.__webGLParticleCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});h.__objectsAdded.splice(0,1)}for(;h.__objectsRemoved.length;){t=h.__objectsRemoved[0];w=h;C=void 0;p=void 0;for(C=w.__webglObjects.length-1;C>=0;C--){p=w.__webglObjects[C].object;
+t==p&&w.__webglObjects.splice(C,1)}h.__objectsRemoved.splice(0,1)}t=0;for(w=h.__webglObjects.length;t<w;t++)H(h.__webglObjects[t].object,h);t=0;for(w=h.__webglShadowVolumes.length;t<w;t++)H(h.__webglShadowVolumes[t].object,h)};this.setFaceCulling=function(h,t){if(h){!t||t=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(h=="back")d.cullFace(d.BACK);else h=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
 0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,x=h.length;p<x;p++){var z=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}p=0;for(x=m.length;p<x;p++){h=m[p];var y,B,H=h.vertexNormals;z=h.vertexColors;if(h instanceof THREE.Face3)y=new THREE.Face3(h.a+e,h.b+e,h.c+
-e);else h instanceof THREE.Face4&&(y=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));y.normal.copy(h.normal);b=0;for(g=H.length;b<g;b++){B=H[b];y.vertexNormals.push(B.clone())}y.color.copy(h.color);b=0;for(g=z.length;b<g;b++){B=z[b];y.vertexColors.push(B.clone())}y.materials=h.materials.slice();y.centroid.copy(h.centroid);k.push(y)}p=0;for(x=f.length;p<x;p++){e=f[p];k=[];b=0;for(g=e.length;b<g;b++)k.push(new THREE.UV(e[b].u,e[b].v));n.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
-new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(h){function k(Z,S){return S=="relativeToHTML"?
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,j=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,x=j.length;o<x;o++){var z=new THREE.Vertex(j[o].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}o=0;for(x=m.length;o<x;o++){j=m[o];var y,B,H=j.vertexNormals;z=j.vertexColors;if(j instanceof THREE.Face3)y=new THREE.Face3(j.a+e,j.b+e,j.c+
+e);else j instanceof THREE.Face4&&(y=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));y.normal.copy(j.normal);b=0;for(g=H.length;b<g;b++){B=H[b];y.vertexNormals.push(B.clone())}y.color.copy(j.color);b=0;for(g=z.length;b<g;b++){B=z[b];y.vertexColors.push(B.clone())}y.materials=j.materials.slice();y.centroid.copy(j.centroid);k.push(y)}o=0;for(x=f.length;o<x;o++){e=f[o];k=[];b=0;for(g=e.length;b<g;b++)k.push(new THREE.UV(e[b].u,e[b].v));n.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
+new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(j){function k(Z,S){return S=="relativeToHTML"?
 Z:g+"/"+Z}function m(){for(y in X.objects)if(!W.objects[y]){M=X.objects[y];if(P=W.geometries[M.geometry]){d=[];for(ia=0;ia<M.materials.length;ia++)d[ia]=W.materials[M.materials[ia]];D=M.position;r=M.rotation;q=M.quaternion;s=M.scale;q=0;d.length==0&&(d[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,d);object.position.set(D[0],D[1],D[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
-M.visible;W.scene.addObject(object);W.objects[y]=object}}}function n(Z){return function(S){W.geometries[Z]=S;m();ua-=1;p()}}function p(){e({total_models:za,total_textures:ma,loaded_models:za-ua,loaded_textures:ma-va},W);ua==0&&va==0&&b(W)}var x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d,X,da,Y,ua,va,za,ma,W;X=h.data;da=new THREE.BinaryLoader;Y=new THREE.JSONLoader;va=ua=0;W={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){va-=1;p()};for(H in X.cameras){Q=
+M.visible;W.scene.addObject(object);W.objects[y]=object}}}function n(Z){return function(S){W.geometries[Z]=S;m();ua-=1;o()}}function o(){e({total_models:za,total_textures:ma,loaded_models:za-ua,loaded_textures:ma-va},W);ua==0&&va==0&&b(W)}var x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d,X,da,Y,ua,va,za,ma,W;X=j.data;da=new THREE.BinaryLoader;Y=new THREE.JSONLoader;va=ua=0;W={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){va-=1;o()};for(H in X.cameras){Q=
 X.cameras[H];if(Q.type=="perspective")ka=new THREE.Camera(Q.fov,Q.aspect,Q.near,Q.far);else if(Q.type=="ortho"){ka=new THREE.Camera;ka.projectionMatrix=THREE.Matrix4.makeOrtho(Q.left,Q.right,Q.top,Q.bottom,Q.near,Q.far)}D=Q.position;Q=Q.target;ka.position.set(D[0],D[1],D[2]);ka.target.position.set(Q[0],Q[1],Q[2]);W.cameras[H]=ka}for(B in X.lights){H=X.lights[B];ka=H.color!==undefined?H.color:16777215;Q=H.intensity!==undefined?H.intensity:1;if(H.type=="directional"){D=H.direction;light=new THREE.DirectionalLight(ka,
 Q);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(H.type=="point"){D=H.position;light=new THREE.PointLight(ka,Q);light.position.set(D[0],D[1],D[2])}W.scene.addLight(light);W.lights[B]=light}for(I in X.fogs){B=X.fogs[I];if(B.type=="linear")$=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&($=new THREE.FogExp2(0,B.density));Q=B.color;$.color.setRGB(Q[0],Q[1],Q[2]);W.fogs[I]=$}if(W.cameras&&X.defaults.camera)W.currentCamera=W.cameras[X.defaults.camera];if(W.fogs&&X.defaults.fog)W.scene.fog=
 W.fogs[X.defaults.fog];Q=X.defaults.bgcolor;W.bgColor=new THREE.Color;W.bgColor.setRGB(Q[0],Q[1],Q[2]);W.bgColorAlpha=X.defaults.bgalpha;for(x in X.geometries){I=X.geometries[x];if(I.type=="bin_mesh"||I.type=="ascii_mesh")ua+=1}za=ua;for(x in X.geometries){I=X.geometries[x];if(I.type=="cube"){P=new Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,null,I.flipped,I.sides);W.geometries[x]=P}else if(I.type=="plane"){P=new Plane(I.width,I.height,I.segmentsWidth,I.segmentsHeight);
 W.geometries[x]=P}else if(I.type=="sphere"){P=new Sphere(I.radius,I.segmentsWidth,I.segmentsHeight);W.geometries[x]=P}else if(I.type=="cylinder"){P=new Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset);W.geometries[x]=P}else if(I.type=="torus"){P=new Torus(I.radius,I.tube,I.segmentsR,I.segmentsT);W.geometries[x]=P}else if(I.type=="icosahedron"){P=new Icosahedron(I.subdivisions);W.geometries[x]=P}else if(I.type=="bin_mesh")da.load({model:k(I.url,X.urlBaseType),callback:n(x)});
-else I.type=="ascii_mesh"&&Y.load({model:k(I.url,X.urlBaseType),callback:n(x)})}for(F in X.textures){x=X.textures[F];va+=x.url instanceof Array?x.url.length:1}ma=va;for(F in X.textures){x=X.textures[F];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var ia=0;ia<x.url.length;ia++)I[ia]=k(x.url[ia],X.urlBaseType);I=ImageUtils.loadTextureCube(I,x.mapping,h)}else{I=ImageUtils.loadTexture(k(x.url,X.urlBaseType),x.mapping,h);if(THREE[x.minFilter]!=
+else I.type=="ascii_mesh"&&Y.load({model:k(I.url,X.urlBaseType),callback:n(x)})}for(F in X.textures){x=X.textures[F];va+=x.url instanceof Array?x.url.length:1}ma=va;for(F in X.textures){x=X.textures[F];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var ia=0;ia<x.url.length;ia++)I[ia]=k(x.url[ia],X.urlBaseType);I=ImageUtils.loadTextureCube(I,x.mapping,j)}else{I=ImageUtils.loadTexture(k(x.url,X.urlBaseType),x.mapping,j);if(THREE[x.minFilter]!=
 undefined)I.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)I.magFilter=THREE[x.magFilter]}W.textures[F]=I}for(z in X.materials){F=X.materials[z];for(R in F.parameters)if(R=="envMap"||R=="map"||R=="lightMap")F.parameters[R]=W.textures[F.parameters[R]];else if(R=="shading")F.parameters[R]=F.parameters[R]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(R=="blending")F.parameters[R]=THREE[F.parameters[R]]?THREE[F.parameters[R]]:THREE.NormalBlending;else R=="combine"&&(F.parameters[R]=
-F.parameters[R]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);F=new THREE[F.type](F.parameters);W.materials[z]=F}m();c(W)}},addMesh:function(a,c,b,e,f,g,h,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,
+F.parameters[R]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);F=new THREE[F.type](F.parameters);W.materials[z]=F}m();c(W)}},addMesh:function(a,c,b,e,f,g,j,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,
 uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
 c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
 c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
@@ -339,7 +339,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
-THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -347,76 +347,76 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(n,p,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},B,H=p.getControlPointsArray(),I=p.getLength(),F=H.length,M=0;B=F-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[B]={time:z,pos:H[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<F-1;B++){M=z*I.chunks[B]/I.total;p.keys[B]={time:M,pos:H[B]}}y.hierarchy[0]=p;THREE.AnimationHandler.add(y);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var x,
-z,y=new THREE.Geometry;for(x=0;x<n.points.length*p;x++){z=x/(n.points.length*p);z=n.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function e(n,p){var x=b(p,10),z=b(p,10),y=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,y);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);z=new Sphere(1,
-16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(p.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
+THREE.PathCamera=function(a){function c(n,o,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},B,H=o.getControlPointsArray(),I=o.getLength(),F=H.length,M=0;B=F-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:z,pos:H[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<F-1;B++){M=z*I.chunks[B]/I.total;o.keys[B]={time:M,pos:H[B]}}y.hierarchy[0]=o;THREE.AnimationHandler.add(y);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,o){var x,
+z,y=new THREE.Geometry;for(x=0;x<n.points.length*o;x++){z=x/(n.points.length*o);z=n.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function e(n,o){var x=b(o,10),z=b(o,10),y=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,y);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);z=new Sphere(1,
+16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(o.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,p,x){var z,y;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)*g;this.theta=this.lon*g;z=this.phi%f;this.phi=z>=0?z:z+f;z=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,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;
-var Cube=function(a,c,b,e,f,g,h,k,m){function n(I,F,M,D,Q,R,P,ka){var $,d,X=e||1,da=f||1,Y=Q/2,ua=R/2,va=p.vertices.length;if(I=="x"&&F=="y"||I=="y"&&F=="x")$="z";else if(I=="x"&&F=="z"||I=="z"&&F=="x"){$="y";da=g||1}else if(I=="z"&&F=="y"||I=="y"&&F=="z"){$="x";X=g||1}var za=X+1,ma=da+1;Q/=X;var W=R/da;for(d=0;d<ma;d++)for(R=0;R<za;R++){var ia=new THREE.Vector3;ia[I]=(R*Q-Y)*M;ia[F]=(d*W-ua)*D;ia[$]=P;p.vertices.push(new THREE.Vertex(ia))}for(d=0;d<da;d++)for(R=0;R<X;R++){p.faces.push(new THREE.Face4(R+
-za*d+va,R+za*(d+1)+va,R+1+za*(d+1)+va,R+1+za*d+va,null,null,ka));p.faceVertexUvs[0].push([new THREE.UV(R/X,d/da),new THREE.UV(R/X,(d+1)/da),new THREE.UV((R+1)/X,(d+1)/da),new THREE.UV((R+1)/X,d/da)])}}THREE.Geometry.call(this);var p=this,x=a/2,z=c/2,y=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var H in m)this.sides[H]!=
-undefined&&(this.sides[H]=m[H]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,y,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-y,this.materials[5]);(function(){for(var I=[],F=[],M=0,D=p.vertices.length;M<D;M++){for(var Q=p.vertices[M],R=!1,P=0,ka=I.length;P<ka;P++){var $=
-I[P];if(Q.position.x==$.position.x&&Q.position.y==$.position.y&&Q.position.z==$.position.z){F[M]=P;R=!0;break}}if(!R){F[M]=I.length;I.push(new THREE.Vertex(Q.position.clone()))}}M=0;for(D=p.faces.length;M<D;M++){Q=p.faces[M];Q.a=F[Q.a];Q.b=F[Q.b];Q.c=F[Q.c];Q.d=F[Q.d]}p.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,e,f,g){function h(p,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(p,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-n);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,n);for(e=0;e<a;e++)k.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-n-(g||0));for(e=a;e<a+a/2;e++)k.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,o,x){var z,y;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)*g;this.theta=this.lon*g;z=this.phi%f;this.phi=z>=0?z:z+f;z=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,o,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,j);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,o){return function(){o.apply(n,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;
+var Cube=function(a,c,b,e,f,g,j,k,m){function n(I,F,M,D,Q,R,P,ka){var $,d,X=e||1,da=f||1,Y=Q/2,ua=R/2,va=o.vertices.length;if(I=="x"&&F=="y"||I=="y"&&F=="x")$="z";else if(I=="x"&&F=="z"||I=="z"&&F=="x"){$="y";da=g||1}else if(I=="z"&&F=="y"||I=="y"&&F=="z"){$="x";X=g||1}var za=X+1,ma=da+1;Q/=X;var W=R/da;for(d=0;d<ma;d++)for(R=0;R<za;R++){var ia=new THREE.Vector3;ia[I]=(R*Q-Y)*M;ia[F]=(d*W-ua)*D;ia[$]=P;o.vertices.push(new THREE.Vertex(ia))}for(d=0;d<da;d++)for(R=0;R<X;R++){o.faces.push(new THREE.Face4(R+
+za*d+va,R+za*(d+1)+va,R+1+za*(d+1)+va,R+1+za*d+va,null,null,ka));o.faceVertexUvs[0].push([new THREE.UV(R/X,d/da),new THREE.UV(R/X,(d+1)/da),new THREE.UV((R+1)/X,(d+1)/da),new THREE.UV((R+1)/X,d/da)])}}THREE.Geometry.call(this);var o=this,x=a/2,z=c/2,y=b/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var H in m)this.sides[H]!=
+undefined&&(this.sides[H]=m[H]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,y,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-y,this.materials[5]);(function(){for(var I=[],F=[],M=0,D=o.vertices.length;M<D;M++){for(var Q=o.vertices[M],R=!1,P=0,ka=I.length;P<ka;P++){var $=
+I[P];if(Q.position.x==$.position.x&&Q.position.y==$.position.y&&Q.position.z==$.position.z){F[M]=P;R=!0;break}}if(!R){F[M]=I.length;I.push(new THREE.Vertex(Q.position.clone()))}}M=0;for(D=o.faces.length;M<D;M++){Q=o.faces[M];Q.a=F[Q.a];Q.b=F[Q.b];Q.c=F[Q.c];Q.d=F[Q.d]}o.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,e,f,g){function j(o,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=e/2;for(e=0;e<a;e++)j(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-n);for(e=0;e<a;e++)j(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,n);for(e=0;e<a;e++)k.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){j(0,0,-n-(g||0));for(e=a;e<a+a/2;e++)k.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){j(0,0,n+(f||0));
 for(e=a+a/2;e<2*a;e++)k.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(x,z,y){var B=Math.sqrt(x*x+z*z+y*y);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,z/B,y/B)))-1}function b(x,z,y,B){B.faces.push(new THREE.Face3(x,z,y))}function e(x,z){var y=f.vertices[x].position,B=f.vertices[z].position;return c((y.x+B.x)/2,(y.y+B.y)/2,(y.z+B.z)/2)}var f=this,g=new THREE.Geometry,h;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,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),n=e(g.faces[k].b,g.faces[k].c),p=e(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,p,h);b(g.faces[k].b,n,m,h);b(g.faces[k].c,
-p,n,h);b(m,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));e[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.001;n+=c){for(k=0;k<e.length;k++)if(n<this.angle){e[k]=m.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
+var Icosahedron=function(a){function c(x,z,y){var B=Math.sqrt(x*x+z*z+y*y);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,z/B,y/B)))-1}function b(x,z,y,B){B.faces.push(new THREE.Face3(x,z,y))}function e(x,z){var y=f.vertices[x].position,B=f.vertices[z].position;return c((y.x+B.x)/2,(y.y+B.y)/2,(y.z+B.z)/2)}var f=this,g=new THREE.Geometry,j;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,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),n=e(g.faces[k].b,g.faces[k].c),o=e(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,o,j);b(g.faces[k].b,n,m,j);b(g.faces[k].c,
+o,n,j);b(m,n,o,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],j=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));e[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<e.length;k++)if(n<this.angle){e[k]=m.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));g[k]=this.vertices.length-1}else g=j;n==0&&(j=f);for(k=
 0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(n/b,k/a.length),new THREE.UV(n/b,(k+1)/a.length),new THREE.UV((n-c)/b,(k+1)/a.length),new THREE.UV((n-c)/b,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;e=e||1;var k=b+1,m=e+1;a/=b;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<e;f++)for(c=0;c<b;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/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
+var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,j=c/2;b=b||1;e=e||1;var k=b+1,m=e+1;a/=b;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-j),0)));for(f=0;f<e;f++)for(c=0;c<b;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/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*f),m=a*Math.sin(e*f),n=[],p=0;for(e=0;e<g;e++){var x=2*e/g,z=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==h)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);n.push(p)}c.push(n)}var y,B,H;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){n=e==g-1;h=c[b][n?0:e+1];k=c[b][n?g-1:e];m=c[b-1][n?g-1:e];n=c[b-1][n?
-0:e+1];z=b/(f-1);y=(b-1)/(f-1);B=(e+1)/g;x=e/g;p=new THREE.UV(1-B,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var I=new THREE.UV(1-B,y);if(b<c.length-1){y=this.vertices[h].position.clone();B=this.vertices[k].position.clone();H=this.vertices[m].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,z,x])}if(b>1){y=this.vertices[h].position.clone();
-B=this.vertices[m].position.clone();H=this.vertices[n].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,b||6);c=[];for(b=0;b<j+1;b++){e=b/j;var k=a*Math.cos(e*f),m=a*Math.sin(e*f),n=[],o=0;for(e=0;e<g;e++){var x=2*e/g,z=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==j)&&e>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);n.push(o)}c.push(n)}var y,B,H;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){n=e==g-1;j=c[b][n?0:e+1];k=c[b][n?g-1:e];m=c[b-1][n?g-1:e];n=c[b-1][n?
+0:e+1];z=b/(f-1);y=(b-1)/(f-1);B=(e+1)/g;x=e/g;o=new THREE.UV(1-B,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var I=new THREE.UV(1-B,y);if(b<c.length-1){y=this.vertices[j].position.clone();B=this.vertices[k].position.clone();H=this.vertices[m].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([o,z,x])}if(b>1){y=this.vertices[j].position.clone();
+B=this.vertices[m].position.clone();H=this.vertices[n].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([o,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var 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))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([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]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,e,f,g,h){function k(x,z,y,B,H,I){z=y/B*x;y=Math.cos(z);return new THREE.Vector3(H*(2+y)*0.5*Math.cos(x),H*(2+y)*Math.sin(x)*0.5,I*H*Math.sin(z)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
-a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=k(m,h,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
-0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([p,
+1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,j=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,j));this.faceVertexUvs[0].push([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]),new THREE.UV(a[j][0],a[j][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,c,b,e,f,g,j){function k(x,z,y,B,H,I){z=y/B*x;y=Math.cos(z);return new THREE.Vector3(H*(2+y)*0.5*Math.cos(x),H*(2+y)*Math.sin(x)*0.5,I*H*Math.sin(z)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
+a/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;f=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=m*e.x+j*g.x;f.y+=m*e.y+j*g.y;f.z+=m*e.z+j*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;j=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][j];g=this.grid[g][j];j=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([j,m,n]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([o,
 n,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=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 c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=p;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,p,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;
-e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
+this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,o,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,j;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){j=document.createElement("canvas");g.map=new THREE.Texture(j);g.map.sourceFile=a.mapDiffuse;
+e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){j=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=j;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,h,k,m,n,p,x,z,y,B=a.faces;x=a.vertices;var H=a.normals,I=a.colors,F=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&F++;for(f=0;f<F;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}h=0;for(k=x.length;h<k;){z=new THREE.Vertex;z.position.x=x[h++];z.position.y=x[h++];z.position.z=x[h++];e.vertices.push(z)}h=
-0;for(k=B.length;h<k;){m=B[h++];n=m&1;f=m&2;p=m&4;g=m&8;x=m&16;z=m&32;y=m&64;m&=128;if(n){n=new THREE.Face4;n.a=B[h++];n.b=B[h++];n.c=B[h++];n.d=B[h++];nVertices=4}else{n=new THREE.Face3;n.a=B[h++];n.b=B[h++];n.c=B[h++];nVertices=3}if(f){materialIndex=B[h++];n.materials=e.materials[materialIndex]}if(p)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvIndex=B[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f].push(new THREE.UV(u,v))}if(g)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<nVertices;g++){uvIndex=
-B[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}g=e.faces.length;e.faceVertexUvs[f][g]=uvs}if(x){normalIndex=B[h++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];n.normal=normal}if(z)for(f=0;f<nVertices;f++){normalIndex=B[h++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];n.vertexNormals.push(normal)}if(y){color=new THREE.Color(B[h++]);n.color=color}if(m)for(f=
-0;f<nVertices;f++){colorIndex=B[h++];color=new THREE.Color(I[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,h,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];k=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(h,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];k=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(h,k,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
-undefined){var f,g,h,k;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;h=0;for(k=srcVertices.length;h<k;h+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[h],srcVertices[h+1],srcVertices[h+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,j,k,m,n,o,x,z,y,B=a.faces;x=a.vertices;var H=a.normals,I=a.colors,F=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&F++;for(f=0;f<F;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}k=0;for(m=x.length;k<m;){z=new THREE.Vertex;z.position.x=x[k++];z.position.y=x[k++];z.position.z=x[k++];e.vertices.push(z)}k=
+0;for(m=B.length;k<m;){n=B[k++];o=n&1;j=n&2;f=n&4;g=n&8;x=n&16;z=n&32;y=n&64;n&=128;if(o){o=new THREE.Face4;o.a=B[k++];o.b=B[k++];o.c=B[k++];o.d=B[k++];nVertices=4}else{o=new THREE.Face3;o.a=B[k++];o.b=B[k++];o.c=B[k++];nVertices=3}if(j){materialIndex=B[k++];o.materials=e.materials[materialIndex]}j=e.faces.length;if(f)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvIndex=B[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f][j]=new THREE.UV(u,v)}if(g)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
+nVertices;g++){uvIndex=B[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}e.faceVertexUvs[f][j]=uvs}if(x){normalIndex=B[k++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];o.normal=normal}if(z)for(f=0;f<nVertices;f++){normalIndex=B[k++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];o.vertexNormals.push(normal)}if(y){color=new THREE.Color(B[k++]);o.color=color}if(n)for(f=
+0;f<nVertices;f++){colorIndex=B[k++];color=new THREE.Color(I[colorIndex]);o.vertexColors.push(color)}e.faces.push(o)}}})();(function(){var f,g,j,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){j=a.skinWeights[f];k=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){j=a.skinIndices[f];k=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(j,k,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
+undefined){var f,g,j,k;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;j=0;for(k=srcVertices.length;j<k;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,k=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function h(j,t){var w=p(j,t),o=p(j,t+1),C=p(j,t+2),G=p(j,t+3),J=(G<<1&255|C>>7)-127;w|=(C&127)<<16|o<<8;if(w==0&&J==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,J)}function k(j,t){var w=p(j,t),o=p(j,t+1),C=p(j,t+2);return(p(j,t+3)<<24)+(C<<16)+(o<<8)+w}function m(j,t){var w=p(j,t);return(p(j,t+1)<<8)+w}function n(j,t){var w=p(j,t);return w>127?w-256:w}function p(j,
-t){return j.charCodeAt(t)&255}function x(j){var t,w,o;t=k(a,j);w=k(a,j+P);o=k(a,j+ka);j=m(a,j+$);THREE.BinaryLoader.prototype.f3(F,t,w,o,j)}function z(j){var t,w,o,C,G,J;t=k(a,j);w=k(a,j+P);o=k(a,j+ka);C=m(a,j+$);G=k(a,j+d);J=k(a,j+X);j=k(a,j+da);THREE.BinaryLoader.prototype.f3n(F,Q,t,w,o,C,G,J,j)}function y(j){var t,w,o,C;t=k(a,j);w=k(a,j+Y);o=k(a,j+ua);C=k(a,j+va);j=m(a,j+za);THREE.BinaryLoader.prototype.f4(F,t,w,o,C,j)}function B(j){var t,w,o,C,G,J,E,A;t=k(a,j);w=k(a,j+Y);o=k(a,j+ua);C=k(a,j+va);
-G=m(a,j+za);J=k(a,j+ma);E=k(a,j+W);A=k(a,j+ia);j=k(a,j+Z);THREE.BinaryLoader.prototype.f4n(F,Q,t,w,o,C,G,J,E,A,j)}function H(j){var t,w;t=k(a,j);w=k(a,j+S);j=k(a,j+N);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[j*2],R[j*2+1])}function I(j){var t,w,o;t=k(a,j);w=k(a,j+ha);o=k(a,j+ra);j=k(a,j+na);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[o*2],R[o*2+1],R[j*2],R[j*2+1])}var F=this,M=0,D,Q=[],R=[],P,ka,$,d,X,da,Y,ua,va,
-za,ma,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,e,g);D={signature:a.substr(M,8),header_bytes:p(a,M+8),vertex_coordinate_bytes:p(a,M+9),normal_coordinate_bytes:p(a,M+10),uv_coordinate_bytes:p(a,M+11),vertex_index_bytes:p(a,M+12),normal_index_bytes:p(a,M+13),uv_index_bytes:p(a,M+14),material_index_bytes:p(a,M+15),nvertices:k(a,M+16),nnormals:k(a,M+16+4),nuvs:k(a,M+16+8),ntri_flat:k(a,M+16+12),ntri_smooth:k(a,M+16+16),ntri_flat_uv:k(a,M+16+
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,b,f,e,g)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var j=new XMLHttpRequest,k=e+"/"+a,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(g){m==0&&(m=j.getResponseHeader("Content-Length"));g({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function j(h,t){var w=o(h,t),p=o(h,t+1),C=o(h,t+2),G=o(h,t+3),J=(G<<1&255|C>>7)-127;w|=(C&127)<<16|p<<8;if(w==0&&J==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,J)}function k(h,t){var w=o(h,t),p=o(h,t+1),C=o(h,t+2);return(o(h,t+3)<<24)+(C<<16)+(p<<8)+w}function m(h,t){var w=o(h,t);return(o(h,t+1)<<8)+w}function n(h,t){var w=o(h,t);return w>127?w-256:w}function o(h,
+t){return h.charCodeAt(t)&255}function x(h){var t,w,p;t=k(a,h);w=k(a,h+P);p=k(a,h+ka);h=m(a,h+$);THREE.BinaryLoader.prototype.f3(F,t,w,p,h)}function z(h){var t,w,p,C,G,J;t=k(a,h);w=k(a,h+P);p=k(a,h+ka);C=m(a,h+$);G=k(a,h+d);J=k(a,h+X);h=k(a,h+da);THREE.BinaryLoader.prototype.f3n(F,Q,t,w,p,C,G,J,h)}function y(h){var t,w,p,C;t=k(a,h);w=k(a,h+Y);p=k(a,h+ua);C=k(a,h+va);h=m(a,h+za);THREE.BinaryLoader.prototype.f4(F,t,w,p,C,h)}function B(h){var t,w,p,C,G,J,E,A;t=k(a,h);w=k(a,h+Y);p=k(a,h+ua);C=k(a,h+va);
+G=m(a,h+za);J=k(a,h+ma);E=k(a,h+W);A=k(a,h+ia);h=k(a,h+Z);THREE.BinaryLoader.prototype.f4n(F,Q,t,w,p,C,G,J,E,A,h)}function H(h){var t,w;t=k(a,h);w=k(a,h+S);h=k(a,h+N);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[h*2],R[h*2+1])}function I(h){var t,w,p;t=k(a,h);w=k(a,h+ha);p=k(a,h+ra);h=k(a,h+na);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[p*2],R[p*2+1],R[h*2],R[h*2+1])}var F=this,M=0,D,Q=[],R=[],P,ka,$,d,X,da,Y,ua,va,
+za,ma,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,e,g);D={signature:a.substr(M,8),header_bytes:o(a,M+8),vertex_coordinate_bytes:o(a,M+9),normal_coordinate_bytes:o(a,M+10),uv_coordinate_bytes:o(a,M+11),vertex_index_bytes:o(a,M+12),normal_index_bytes:o(a,M+13),uv_index_bytes:o(a,M+14),material_index_bytes:o(a,M+15),nvertices:k(a,M+16),nnormals:k(a,M+16+4),nuvs:k(a,M+16+8),ntri_flat:k(a,M+16+12),ntri_smooth:k(a,M+16+16),ntri_flat_uv:k(a,M+16+
 20),ntri_smooth_uv:k(a,M+16+24),nquad_flat:k(a,M+16+28),nquad_smooth:k(a,M+16+32),nquad_flat_uv:k(a,M+16+36),nquad_smooth_uv:k(a,M+16+40)};M+=D.header_bytes;P=D.vertex_index_bytes;ka=D.vertex_index_bytes*2;$=D.vertex_index_bytes*3;d=D.vertex_index_bytes*3+D.material_index_bytes;X=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Y=D.vertex_index_bytes;ua=D.vertex_index_bytes*2;va=D.vertex_index_bytes*3;za=D.vertex_index_bytes*
 4;ma=D.vertex_index_bytes*4+D.material_index_bytes;W=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;ia=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;Z=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;S=D.uv_index_bytes;N=D.uv_index_bytes*2;ha=D.uv_index_bytes;ra=D.uv_index_bytes*2;na=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes;Ia=D.vertex_index_bytes*4+D.material_index_bytes;qa=D.ntri_flat*g;xa=D.ntri_smooth*(g+
-D.normal_index_bytes*3);Da=D.ntri_flat_uv*(g+D.uv_index_bytes*3);$a=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);ab=D.nquad_flat*Ia;g=D.nquad_smooth*(Ia+D.normal_index_bytes*4);Ia=D.nquad_flat_uv*(Ia+D.uv_index_bytes*4);M+=function(j){for(var t,w,o,C=D.vertex_coordinate_bytes*3,G=j+D.nvertices*C;j<G;j+=C){t=h(a,j);w=h(a,j+D.vertex_coordinate_bytes);o=h(a,j+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,t,w,o)}return D.nvertices*C}(M);M+=function(j){for(var t,w,o,C=
-D.normal_coordinate_bytes*3,G=j+D.nnormals*C;j<G;j+=C){t=n(a,j);w=n(a,j+D.normal_coordinate_bytes);o=n(a,j+D.normal_coordinate_bytes*2);Q.push(t/127,w/127,o/127)}return D.nnormals*C}(M);M+=function(j){for(var t,w,o=D.uv_coordinate_bytes*2,C=j+D.nuvs*o;j<C;j+=o){t=h(a,j);w=h(a,j+D.uv_coordinate_bytes);R.push(t,w)}return D.nuvs*o}(M);qa=M+qa;xa=qa+xa;Da=xa+Da;$a=Da+$a;ab=$a+ab;g=ab+g;Ia=g+Ia;(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,o=w+D.uv_index_bytes*3,C=j+D.ntri_flat_uv*
-o;for(t=j;t<C;t+=o){x(t);H(t+w)}return C-j})(xa);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,o=w+D.uv_index_bytes*3,C=j+D.ntri_smooth_uv*o;for(t=j;t<C;t+=o){z(t);H(t+w)}return C-j})(Da);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,o=w+D.uv_index_bytes*4,C=j+D.nquad_flat_uv*o;for(t=j;t<C;t+=o){y(t);I(t+w)}return C-j})(g);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,o=w+D.uv_index_bytes*
-4,C=j+D.nquad_smooth_uv*o;for(t=j;t<C;t+=o){B(t);I(t+w)}return C-j})(Ia);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,o=j+D.ntri_flat*w;for(t=j;t<o;t+=w)x(t);return o-j})(M);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,o=j+D.ntri_smooth*w;for(t=j;t<o;t+=w)z(t);return o-j})(qa);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,o=j+D.nquad_flat*w;for(t=j;t<o;t+=w)y(t);return o-j})($a);(function(j){var t,w=D.vertex_index_bytes*
-4+D.material_index_bytes+D.normal_index_bytes*4,o=j+D.nquad_smooth*w;for(t=j;t<o;t+=w)B(t);return o-j})(ab);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,
-c,b,e,f,g,h,k,m){g=a.materials[g];var n=c[k*3],p=c[k*3+1];k=c[k*3+2];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,e,f,g,h,k,m,n,p){h=a.materials[h];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var y=c[n*3],B=c[n*3+1];n=c[n*3+2];var H=c[p*3],I=c[p*3+1];p=c[p*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
-z,m),new THREE.Vector3(y,B,n),new THREE.Vector3(H,I,p)],null,h))},uv3:function(a,c,b,e,f,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,e,f,g,h,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+D.normal_index_bytes*3);Da=D.ntri_flat_uv*(g+D.uv_index_bytes*3);$a=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);ab=D.nquad_flat*Ia;g=D.nquad_smooth*(Ia+D.normal_index_bytes*4);Ia=D.nquad_flat_uv*(Ia+D.uv_index_bytes*4);M+=function(h){for(var t,w,p,C=D.vertex_coordinate_bytes*3,G=h+D.nvertices*C;h<G;h+=C){t=j(a,h);w=j(a,h+D.vertex_coordinate_bytes);p=j(a,h+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,t,w,p)}return D.nvertices*C}(M);M+=function(h){for(var t,w,p,C=
+D.normal_coordinate_bytes*3,G=h+D.nnormals*C;h<G;h+=C){t=n(a,h);w=n(a,h+D.normal_coordinate_bytes);p=n(a,h+D.normal_coordinate_bytes*2);Q.push(t/127,w/127,p/127)}return D.nnormals*C}(M);M+=function(h){for(var t,w,p=D.uv_coordinate_bytes*2,C=h+D.nuvs*p;h<C;h+=p){t=j(a,h);w=j(a,h+D.uv_coordinate_bytes);R.push(t,w)}return D.nuvs*p}(M);qa=M+qa;xa=qa+xa;Da=xa+Da;$a=Da+$a;ab=$a+ab;g=ab+g;Ia=g+Ia;(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,p=w+D.uv_index_bytes*3,C=h+D.ntri_flat_uv*
+p;for(t=h;t<C;t+=p){x(t);H(t+w)}return C-h})(xa);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,p=w+D.uv_index_bytes*3,C=h+D.ntri_smooth_uv*p;for(t=h;t<C;t+=p){z(t);H(t+w)}return C-h})(Da);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,p=w+D.uv_index_bytes*4,C=h+D.nquad_flat_uv*p;for(t=h;t<C;t+=p){y(t);I(t+w)}return C-h})(g);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,p=w+D.uv_index_bytes*
+4,C=h+D.nquad_smooth_uv*p;for(t=h;t<C;t+=p){B(t);I(t+w)}return C-h})(Ia);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,p=h+D.ntri_flat*w;for(t=h;t<p;t+=w)x(t);return p-h})(M);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,p=h+D.ntri_smooth*w;for(t=h;t<p;t+=w)z(t);return p-h})(qa);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,p=h+D.nquad_flat*w;for(t=h;t<p;t+=w)y(t);return p-h})($a);(function(h){var t,w=D.vertex_index_bytes*
+4+D.material_index_bytes+D.normal_index_bytes*4,p=h+D.nquad_smooth*w;for(t=h;t<p;t+=w)B(t);return p-h})(ab);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,
+c,b,e,f,g,j,k,m){g=a.materials[g];var n=c[k*3],o=c[k*3+1];k=c[k*3+2];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,e,f,g,j,k,m,n,o){j=a.materials[j];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var y=c[n*3],B=c[n*3+1];n=c[n*3+2];var H=c[o*3],I=c[o*3+1];o=c[o*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
+z,m),new THREE.Vector3(y,B,n),new THREE.Vector3(H,I,o)],null,j))},uv3:function(a,c,b,e,f,g,j){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));a.push(k)},uv4:function(a,c,b,e,f,g,j,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,j));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k+h*this.delta;e[g+1]=m;e[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m+h*this.delta;e[g+
-2]=n;e=b+this.yd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.VIntZ=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m;e[g+2]=n+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,h,k){var m=g+1,n=g+this.yd,p=g+this.zd,x=m+this.yd,z=m+this.zd,y=g+this.yd+this.zd,B=m+this.yd+this.zd,H=0,I=this.field[g],F=this.field[m],M=this.field[n],D=this.field[x],Q=this.field[p],R=this.field[z],P=this.field[y],ka=this.field[B];I<h&&(H|=1);F<h&&(H|=2);M<h&&(H|=8);D<h&&(H|=4);Q<h&&(H|=16);R<h&&(H|=32);P<h&&(H|=128);ka<h&&(H|=64);var $=THREE.edgeTable[H];if($==0)return 0;
-var d=this.delta,X=b+d,da=e+d;d=f+d;if($&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,I,F)}if($&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,h,X,e,f,F,D)}if($&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,f,M,D)}if($&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,I,M)}if($&16){this.compNorm(p);this.compNorm(z);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,e,
-d,Q,R)}if($&32){this.compNorm(z);this.compNorm(B);this.VIntY(z*3,this.vlist,this.nlist,15,h,X,e,d,R,ka)}if($&64){this.compNorm(y);this.compNorm(B);this.VIntX(y*3,this.vlist,this.nlist,18,h,b,da,d,P,ka)}if($&128){this.compNorm(p);this.compNorm(y);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,e,d,Q,P)}if($&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,I,Q)}if($&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,h,X,e,f,F,R)}if($&1024){this.compNorm(x);
-this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,h,X,da,f,D,ka)}if($&2048){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,f,M,P)}H<<=4;for(h=g=0;THREE.triTable[H+h]!=-1;){b=H+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,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[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,h){var k=this.size*Math.sqrt(g/h),m=f*this.size,n=e*this.size,p=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(n-k);z<1&&(z=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);k=Math.floor(p+k);
-k>this.size-1&&(k=this.size-1);for(var B,H,I,F,M,D;x<m;x++){p=this.size2*x;H=x/this.size-f;M=H*H;for(H=z;H<n;H++){I=p+this.size*H;B=H/this.size-e;D=B*B;for(B=y;B<k;B++){F=B/this.size-b;F=g/(1.0E-6+F*F+D+M)-h;F>0&&(this.field[I+B]+=F)}}}};this.addPlaneX=function(b,e){var f,g,h,k,m,n=this.size,p=this.yd,x=this.zd,z=this.field,y=n*Math.sqrt(b/e);y>n&&(y=n);for(f=0;f<y;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-e;if(k>0)for(g=0;g<n;g++){m=f+g*p;for(h=0;h<n;h++)z[x*h+m]+=k}}};this.addPlaneY=function(b,e){var f,g,
-h,k,m,n,p=this.size,x=this.yd,z=this.zd,y=this.field,B=p*Math.sqrt(b/e);B>p&&(B=p);for(g=0;g<B;g++){f=g/p;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=g*x;for(f=0;f<p;f++){n=m+f;for(h=0;h<p;h++)y[z*h+n]+=k}}}};this.addPlaneZ=function(b,e){var f,g,h,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+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 e,f,g,h,k,m,n,p,x,z=this.size-2;for(h=1;h<z;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<z;g++){p=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;e=p+f;this.polygonize(k,m,n,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(f){var g,h,k,m,n,p,x,z;for(g=
-0;g<f.count;g++){n=g*3;x=n+1;z=n+2;h=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[z];p=new THREE.Vector3(h,k,m);h=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[z];n=new THREE.Vector3(h,k,m);n.normalize();n=new THREE.Vertex(p,n);e.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;z=n+2;p=e.vertices[n].normal;h=e.vertices[x].normal;k=e.vertices[z].normal;n=new THREE.Face3(n,x,z,[p,h,k]);e.faces.push(n)}b+=nfaces;f.count=0});return e};this.init(a)};
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,j,k,m,n,o,x){j=(j-o)/(x-o);o=this.normal_cache;e[g]=k+j*this.delta;e[g+1]=m;e[g+2]=n;f[g]=this.lerp(o[b],o[b+3],j);f[g+1]=this.lerp(o[b+1],o[b+4],j);f[g+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,e,f,g,j,k,m,n,o,x){j=(j-o)/(x-o);o=this.normal_cache;e[g]=k;e[g+1]=m+j*this.delta;e[g+
+2]=n;e=b+this.yd*3;f[g]=this.lerp(o[b],o[e],j);f[g+1]=this.lerp(o[b+1],o[e+1],j);f[g+2]=this.lerp(o[b+2],o[e+2],j)};this.VIntZ=function(b,e,f,g,j,k,m,n,o,x){j=(j-o)/(x-o);o=this.normal_cache;e[g]=k;e[g+1]=m;e[g+2]=n+j*this.delta;e=b+this.zd*3;f[g]=this.lerp(o[b],o[e],j);f[g+1]=this.lerp(o[b+1],o[e+1],j);f[g+2]=this.lerp(o[b+2],o[e+2],j)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,j,k){var m=g+1,n=g+this.yd,o=g+this.zd,x=m+this.yd,z=m+this.zd,y=g+this.yd+this.zd,B=m+this.yd+this.zd,H=0,I=this.field[g],F=this.field[m],M=this.field[n],D=this.field[x],Q=this.field[o],R=this.field[z],P=this.field[y],ka=this.field[B];I<j&&(H|=1);F<j&&(H|=2);M<j&&(H|=8);D<j&&(H|=4);Q<j&&(H|=16);R<j&&(H|=32);P<j&&(H|=128);ka<j&&(H|=64);var $=THREE.edgeTable[H];if($==0)return 0;
+var d=this.delta,X=b+d,da=e+d;d=f+d;if($&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,j,b,e,f,I,F)}if($&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,j,X,e,f,F,D)}if($&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,j,b,da,f,M,D)}if($&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,j,b,e,f,I,M)}if($&16){this.compNorm(o);this.compNorm(z);this.VIntX(o*3,this.vlist,this.nlist,12,j,b,e,
+d,Q,R)}if($&32){this.compNorm(z);this.compNorm(B);this.VIntY(z*3,this.vlist,this.nlist,15,j,X,e,d,R,ka)}if($&64){this.compNorm(y);this.compNorm(B);this.VIntX(y*3,this.vlist,this.nlist,18,j,b,da,d,P,ka)}if($&128){this.compNorm(o);this.compNorm(y);this.VIntY(o*3,this.vlist,this.nlist,21,j,b,e,d,Q,P)}if($&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,e,f,I,Q)}if($&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,j,X,e,f,F,R)}if($&1024){this.compNorm(x);
+this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,j,X,da,f,D,ka)}if($&2048){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,33,j,b,da,f,M,P)}H<<=4;for(j=g=0;THREE.triTable[H+j]!=-1;){b=H+j;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],k);j+=3;g++}return g};this.posnormtriv=function(b,e,f,g,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[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[j];this.normalArray[m+7]=e[j+1];this.normalArray[m+8]=e[j+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,n=e*this.size,o=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(n-k);z<1&&(z=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);k=Math.floor(o+k);
+k>this.size-1&&(k=this.size-1);for(var B,H,I,F,M,D;x<m;x++){o=this.size2*x;H=x/this.size-f;M=H*H;for(H=z;H<n;H++){I=o+this.size*H;B=H/this.size-e;D=B*B;for(B=y;B<k;B++){F=B/this.size-b;F=g/(1.0E-6+F*F+D+M)-j;F>0&&(this.field[I+B]+=F)}}}};this.addPlaneX=function(b,e){var f,g,j,k,m,n=this.size,o=this.yd,x=this.zd,z=this.field,y=n*Math.sqrt(b/e);y>n&&(y=n);for(f=0;f<y;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-e;if(k>0)for(g=0;g<n;g++){m=f+g*o;for(j=0;j<n;j++)z[x*j+m]+=k}}};this.addPlaneY=function(b,e){var f,g,
+j,k,m,n,o=this.size,x=this.yd,z=this.zd,y=this.field,B=o*Math.sqrt(b/e);B>o&&(B=o);for(g=0;g<B;g++){f=g/o;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=g*x;for(f=0;f<o;f++){n=m+f;for(j=0;j<o;j++)y[z*j+n]+=k}}}};this.addPlaneZ=function(b,e){var f,g,j,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(j=0;j<dist;j++){f=j/size;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=zd*j;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+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 e,f,g,j,k,m,n,o,x,z=this.size-2;for(j=1;j<z;j++){x=this.size2*j;n=(j-this.halfsize)/this.halfsize;for(g=1;g<z;g++){o=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;e=o+f;this.polygonize(k,m,n,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(f){var g,j,k,m,n,o,x,z;for(g=
+0;g<f.count;g++){n=g*3;x=n+1;z=n+2;j=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[z];o=new THREE.Vector3(j,k,m);j=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[z];n=new THREE.Vector3(j,k,m);n.normalize();n=new THREE.Vertex(o,n);e.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;z=n+2;o=e.vertices[n].normal;j=e.vertices[x].normal;k=e.vertices[z].normal;n=new THREE.Face3(n,x,z,[o,j,k]);e.faces.push(n)}b+=nfaces;f.count=0});return e};this.init(a)};
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=e*d;this.w=g*f-j*c;this.x=g*c+j*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+d*f+c*j-e*g;this.y=c*a+d*g+e*f-b*j;this.z=e*a+d*j+b*g-c*f;this.w=d*a-b*f-c*g-e*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*d-j*e,l=h*e+j*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-j*d;b.x=i*h+c*-f+l*-j-m*-g;b.y=l*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-l*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

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

+ 73 - 73
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r37 - http://github.com/mrdoob/three.js
-var GeometryUtils={merge:function(a,g){var b=g instanceof THREE.Mesh,c=a.vertices.length,d=b?g.geometry:g,f=a.vertices,e=d.vertices,h=a.faces,l=d.faces,j=a.faceVertexUvs[0];d=d.faceVertexUvs[0];b&&g.matrixAutoUpdate&&g.updateMatrix();for(var k=0,m=e.length;k<m;k++){var p=new THREE.Vertex(e[k].position.clone());b&&g.matrix.multiplyVector3(p.position);f.push(p)}k=0;for(m=l.length;k<m;k++){e=l[k];var w,t,z=e.vertexNormals;p=e.vertexColors;if(e instanceof THREE.Face3)w=new THREE.Face3(e.a+c,e.b+c,e.c+
-c);else e instanceof THREE.Face4&&(w=new THREE.Face4(e.a+c,e.b+c,e.c+c,e.d+c));w.normal.copy(e.normal);b=0;for(f=z.length;b<f;b++){t=z[b];w.vertexNormals.push(t.clone())}w.color.copy(e.color);b=0;for(f=p.length;b<f;b++){t=p[b];w.vertexColors.push(t.clone())}w.materials=e.materials.slice();w.centroid.copy(e.centroid);h.push(w)}k=0;for(m=d.length;k<m;k++){c=d[k];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));j.push(h)}}},ImageUtils={loadTexture:function(a,g,b){var c=new Image,d=
-new THREE.Texture(c,g);c.onload=function(){d.needsUpdate=!0;b&&b(this)};c.src=a;return d},loadTextureCube:function(a,g,b){var c,d=[],f=new THREE.Texture(d,g);g=d.loadCount=0;for(c=a.length;g<c;++g){d[g]=new Image;d[g].onload=function(){d.loadCount+=1;if(d.loadCount==6)f.needsUpdate=!0;b&&b(this)};d[g].src=a[g]}return f}},SceneUtils={loadScene:function(a,g,b,c){var d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(e){function h(X,Y){return Y=="relativeToHTML"?
+var GeometryUtils={merge:function(a,e){var b=e instanceof THREE.Mesh,c=a.vertices.length,d=b?e.geometry:e,f=a.vertices,g=d.vertices,h=a.faces,l=d.faces,k=a.faceVertexUvs[0];d=d.faceVertexUvs[0];b&&e.matrixAutoUpdate&&e.updateMatrix();for(var j=0,m=g.length;j<m;j++){var p=new THREE.Vertex(g[j].position.clone());b&&e.matrix.multiplyVector3(p.position);f.push(p)}j=0;for(m=l.length;j<m;j++){g=l[j];var w,t,z=g.vertexNormals;p=g.vertexColors;if(g instanceof THREE.Face3)w=new THREE.Face3(g.a+c,g.b+c,g.c+
+c);else g instanceof THREE.Face4&&(w=new THREE.Face4(g.a+c,g.b+c,g.c+c,g.d+c));w.normal.copy(g.normal);b=0;for(f=z.length;b<f;b++){t=z[b];w.vertexNormals.push(t.clone())}w.color.copy(g.color);b=0;for(f=p.length;b<f;b++){t=p[b];w.vertexColors.push(t.clone())}w.materials=g.materials.slice();w.centroid.copy(g.centroid);h.push(w)}j=0;for(m=d.length;j<m;j++){c=d[j];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));k.push(h)}}},ImageUtils={loadTexture:function(a,e,b){var c=new Image,d=
+new THREE.Texture(c,e);c.onload=function(){d.needsUpdate=!0;b&&b(this)};c.src=a;return d},loadTextureCube:function(a,e,b){var c,d=[],f=new THREE.Texture(d,e);e=d.loadCount=0;for(c=a.length;e<c;++e){d[e]=new Image;d[e].onload=function(){d.loadCount+=1;if(d.loadCount==6)f.needsUpdate=!0;b&&b(this)};d[e].src=a[e]}return f}},SceneUtils={loadScene:function(a,e,b,c){var d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(g){function h(X,Y){return Y=="relativeToHTML"?
 X:f+"/"+X}function l(){for(w in G.objects)if(!H.objects[w]){C=G.objects[w];if(L=H.geometries[C.geometry]){J=[];for(O=0;O<C.materials.length;O++)J[O]=H.materials[C.materials[O]];n=C.position;r=C.rotation;q=C.quaternion;s=C.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(L,J);object.position.set(n[0],n[1],n[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
-C.visible;H.scene.addObject(object);H.objects[w]=object}}}function j(X){return function(Y){H.geometries[X]=Y;l();R-=1;k()}}function k(){c({total_models:Q,total_textures:T,loaded_models:Q-R,loaded_textures:T-P},H);R==0&&P==0&&b(H)}var m,p,w,t,z,y,A,C,n,E,D,L,M,K,J,G,N,U,R,P,Q,T,H;G=e.data;N=new THREE.BinaryLoader;U=new THREE.JSONLoader;P=R=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){P-=1;k()};for(z in G.cameras){E=G.cameras[z];
+C.visible;H.scene.addObject(object);H.objects[w]=object}}}function k(X){return function(Y){H.geometries[X]=Y;l();R-=1;j()}}function j(){c({total_models:Q,total_textures:T,loaded_models:Q-R,loaded_textures:T-P},H);R==0&&P==0&&b(H)}var m,p,w,t,z,y,A,C,n,E,D,L,M,K,J,G,N,U,R,P,Q,T,H;G=g.data;N=new THREE.BinaryLoader;U=new THREE.JSONLoader;P=R=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};g=function(){P-=1;j()};for(z in G.cameras){E=G.cameras[z];
 if(E.type=="perspective")M=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}n=E.position;E=E.target;M.position.set(n[0],n[1],n[2]);M.target.position.set(E[0],E[1],E[2]);H.cameras[z]=M}for(t in G.lights){z=G.lights[t];M=z.color!==undefined?z.color:16777215;E=z.intensity!==undefined?z.intensity:1;if(z.type=="directional"){n=z.direction;light=new THREE.DirectionalLight(M,E);
 light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(z.type=="point"){n=z.position;light=new THREE.PointLight(M,E);light.position.set(n[0],n[1],n[2])}H.scene.addLight(light);H.lights[t]=light}for(y in G.fogs){t=G.fogs[y];if(t.type=="linear")K=new THREE.Fog(0,t.near,t.far);else t.type=="exp2"&&(K=new THREE.FogExp2(0,t.density));E=t.color;K.color.setRGB(E[0],E[1],E[2]);H.fogs[y]=K}if(H.cameras&&G.defaults.camera)H.currentCamera=H.cameras[G.defaults.camera];if(H.fogs&&G.defaults.fog)H.scene.fog=
 H.fogs[G.defaults.fog];E=G.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(E[0],E[1],E[2]);H.bgColorAlpha=G.defaults.bgalpha;for(m in G.geometries){y=G.geometries[m];if(y.type=="bin_mesh"||y.type=="ascii_mesh")R+=1}Q=R;for(m in G.geometries){y=G.geometries[m];if(y.type=="cube"){L=new Cube(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides);H.geometries[m]=L}else if(y.type=="plane"){L=new Plane(y.width,y.height,y.segmentsWidth,y.segmentsHeight);
-H.geometries[m]=L}else if(y.type=="sphere"){L=new Sphere(y.radius,y.segmentsWidth,y.segmentsHeight);H.geometries[m]=L}else if(y.type=="cylinder"){L=new Cylinder(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset);H.geometries[m]=L}else if(y.type=="torus"){L=new Torus(y.radius,y.tube,y.segmentsR,y.segmentsT);H.geometries[m]=L}else if(y.type=="icosahedron"){L=new Icosahedron(y.subdivisions);H.geometries[m]=L}else if(y.type=="bin_mesh")N.load({model:h(y.url,G.urlBaseType),callback:j(m)});else y.type==
-"ascii_mesh"&&U.load({model:h(y.url,G.urlBaseType),callback:j(m)})}for(A in G.textures){m=G.textures[A];P+=m.url instanceof Array?m.url.length:1}T=P;for(A in G.textures){m=G.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){y=[];for(var O=0;O<m.url.length;O++)y[O]=h(m.url[O],G.urlBaseType);y=ImageUtils.loadTextureCube(y,m.mapping,e)}else{y=ImageUtils.loadTexture(h(m.url,G.urlBaseType),m.mapping,e);if(THREE[m.minFilter]!=undefined)y.minFilter=
+H.geometries[m]=L}else if(y.type=="sphere"){L=new Sphere(y.radius,y.segmentsWidth,y.segmentsHeight);H.geometries[m]=L}else if(y.type=="cylinder"){L=new Cylinder(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset);H.geometries[m]=L}else if(y.type=="torus"){L=new Torus(y.radius,y.tube,y.segmentsR,y.segmentsT);H.geometries[m]=L}else if(y.type=="icosahedron"){L=new Icosahedron(y.subdivisions);H.geometries[m]=L}else if(y.type=="bin_mesh")N.load({model:h(y.url,G.urlBaseType),callback:k(m)});else y.type==
+"ascii_mesh"&&U.load({model:h(y.url,G.urlBaseType),callback:k(m)})}for(A in G.textures){m=G.textures[A];P+=m.url instanceof Array?m.url.length:1}T=P;for(A in G.textures){m=G.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){y=[];for(var O=0;O<m.url.length;O++)y[O]=h(m.url[O],G.urlBaseType);y=ImageUtils.loadTextureCube(y,m.mapping,g)}else{y=ImageUtils.loadTexture(h(m.url,G.urlBaseType),m.mapping,g);if(THREE[m.minFilter]!=undefined)y.minFilter=
 THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)y.magFilter=THREE[m.magFilter]}H.textures[A]=y}for(p in G.materials){A=G.materials[p];for(D in A.parameters)if(D=="envMap"||D=="map"||D=="lightMap")A.parameters[D]=H.textures[A.parameters[D]];else if(D=="shading")A.parameters[D]=A.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")A.parameters[D]=THREE[A.parameters[D]]?THREE[A.parameters[D]]:THREE.NormalBlending;else D=="combine"&&(A.parameters[D]=A.parameters[D]==
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);H.materials[p]=A}l();g(H)}},addMesh:function(a,g,b,c,d,f,e,h,l,j){g=new THREE.Mesh(g,j);g.scale.x=g.scale.y=g.scale.z=b;g.position.x=c;g.position.y=d;g.position.z=f;g.rotation.x=e;g.rotation.y=h;g.rotation.z=l;a.addObject(g);return g},addPanoramaCubeWebGL:function(a,g,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
-uniforms:c.uniforms});g=new THREE.Mesh(new Cube(g,g,g,1,1,1,null,!0),b);a.addObject(g);return g},addPanoramaCube:function(a,g,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
-g=new THREE.Mesh(new Cube(g,g,g,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(g);return g},addPanoramaCubePlanes:function(a,g,b){var c=g/2;g=new Plane(g,g);var d=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,g,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,g,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,g,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
-g,1,0,c,0,f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,g,1,0,-c,0,-f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,g){SceneUtils.traverseHierarchy(a,function(b){b.visible=g})},traverseHierarchy:function(a,g){var b,c,d=a.children.length;for(c=0;c<d;c++){b=a.children[c];g(b);SceneUtils.traverseHierarchy(b,g)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);H.materials[p]=A}l();e(H)}},addMesh:function(a,e,b,c,d,f,g,h,l,k){e=new THREE.Mesh(e,k);e.scale.x=e.scale.y=e.scale.z=b;e.position.x=c;e.position.y=d;e.position.z=f;e.rotation.x=g;e.rotation.y=h;e.rotation.z=l;a.addObject(e);return e},addPanoramaCubeWebGL:function(a,e,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
+uniforms:c.uniforms});e=new THREE.Mesh(new Cube(e,e,e,1,1,1,null,!0),b);a.addObject(e);return e},addPanoramaCube:function(a,e,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
+e=new THREE.Mesh(new Cube(e,e,e,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(e);return e},addPanoramaCubePlanes:function(a,e,b){var c=e/2;e=new Plane(e,e);var d=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,e,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,e,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,e,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
+e,1,0,c,0,f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,e,1,0,-c,0,-f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,e){SceneUtils.traverseHierarchy(a,function(b){b.visible=e})},traverseHierarchy:function(a,e){var b,c,d=a.children.length;for(c=0;c<d;c++){b=a.children[c];e(b);SceneUtils.traverseHierarchy(b,e)}}},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},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
@@ -23,85 +23,85 @@ 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 g,b,c,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(g=c=0;g<f;++g){b[g]=Math.exp(-((g-d)*(g-d))/(2*a*a));c+=b[g]}for(g=0;g<f;++g)b[g]/=c;return b}};
-THREE.QuakeCamera=function(a){function g(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-d)*(e-d))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
+THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
-!1);this.domElement.addEventListener("mousemove",g(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",g(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",g(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",g(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",g(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,g){this.matrix.rotateAxis(g);if(this.noFly)g.y=0;this.position.addSelf(g.multiplyScalar(a));this.target.position.addSelf(g.multiplyScalar(a))};
-THREE.PathCamera=function(a){function g(j,k,m,p){var w={name:m,fps:0.6,length:p,hierarchy:[]},t,z=k.getControlPointsArray(),y=k.getLength(),A=z.length,C=0;t=A-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:p,pos:z[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<A-1;t++){C=p*y.chunks[t]/y.total;k.keys[t]={time:C,pos:z[t]}}w.hierarchy[0]=k;THREE.AnimationHandler.add(w);return new THREE.Animation(j,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(j,k){var m,
-p,w=new THREE.Geometry;for(m=0;m<j.points.length*k;m++){p=m/(j.points.length*k);p=j.getPoint(p);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return w}function c(j,k){var m=b(k,10),p=b(k,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);j.addChild(lineObj);particleObj.scale.set(1,1,1);j.addChild(particleObj);p=new Sphere(1,
-16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,w);m.position.copy(k.points[i]);m.updateMatrix();j.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
+!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(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,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
+THREE.PathCamera=function(a){function e(k,j,m,p){var w={name:m,fps:0.6,length:p,hierarchy:[]},t,z=j.getControlPointsArray(),y=j.getLength(),A=z.length,C=0;t=A-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[t]={time:p,pos:z[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<A-1;t++){C=p*y.chunks[t]/y.total;j.keys[t]={time:C,pos:z[t]}}w.hierarchy[0]=j;THREE.AnimationHandler.add(w);return new THREE.Animation(k,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(k,j){var m,
+p,w=new THREE.Geometry;for(m=0;m<k.points.length*j;m++){p=m/(k.points.length*j);p=k.getPoint(p);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return w}function c(k,j){var m=b(j,10),p=b(j,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);k.addChild(lineObj);particleObj.scale.set(1,1,1);k.addChild(particleObj);p=new Sphere(1,
+16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){m=new THREE.Mesh(p,w);m.position.copy(j.points[i]);m.updateMatrix();k.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(j,k,m){var p,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,j,k,m)};this.onMouseMove=function(j){this.mouseX=j.clientX-this.windowHalfX;this.mouseY=j.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var e=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),l=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(l,e);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(j,k){return function(){k.apply(j,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;
-var Cube=function(a,g,b,c,d,f,e,h,l){function j(y,A,C,n,E,D,L,M){var K,J,G=c||1,N=d||1,U=E/2,R=D/2,P=k.vertices.length;if(y=="x"&&A=="y"||y=="y"&&A=="x")K="z";else if(y=="x"&&A=="z"||y=="z"&&A=="x"){K="y";N=f||1}else if(y=="z"&&A=="y"||y=="y"&&A=="z"){K="x";G=f||1}var Q=G+1,T=N+1;E/=G;var H=D/N;for(J=0;J<T;J++)for(D=0;D<Q;D++){var O=new THREE.Vector3;O[y]=(D*E-U)*C;O[A]=(J*H-R)*n;O[K]=L;k.vertices.push(new THREE.Vertex(O))}for(J=0;J<N;J++)for(D=0;D<G;D++){k.faces.push(new THREE.Face4(D+Q*J+P,D+Q*
-(J+1)+P,D+1+Q*(J+1)+P,D+1+Q*J+P,null,null,M));k.faceVertexUvs[0].push([new THREE.UV(D/G,J/N),new THREE.UV(D/G,(J+1)/N),new THREE.UV((D+1)/G,(J+1)/N),new THREE.UV((D+1)/G,J/N)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=g/2,w=b/2;h=h?-1:1;if(e!==undefined)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=undefined)for(var z in l)this.sides[z]!=undefined&&(this.sides[z]=
-l[z]);this.sides.px&&j("z","y",1*h,-1,b,g,-m,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,b,g,m,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,a,g,w,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,g,-w,this.materials[5]);(function(){for(var y=[],A=[],C=0,n=k.vertices.length;C<n;C++){for(var E=k.vertices[C],D=!1,L=0,M=y.length;L<M;L++){var K=y[L];if(E.position.x==K.position.x&&
-E.position.y==K.position.y&&E.position.z==K.position.z){A[C]=L;D=!0;break}}if(!D){A[C]=y.length;y.push(new THREE.Vertex(E.position.clone()))}}C=0;for(n=k.faces.length;C<n;C++){E=k.faces[C];E.a=A[E.a];E.b=A[E.b];E.c=A[E.c];E.d=A[E.d]}k.vertices=y})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,g,b,c,d,f){function e(k,m,p){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}THREE.Geometry.call(this);var h=this,l=Math.PI,j=c/2;for(c=0;c<a;c++)e(Math.sin(2*l*c/a)*g,Math.cos(2*l*c/a)*g,-j);for(c=0;c<a;c++)e(Math.sin(2*l*c/a)*b,Math.cos(2*l*c/a)*b,j);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){e(0,0,-j-(f||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(g>0){e(0,0,j+(d||0));
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(k,j,m){var p,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,k,j,m)};this.onMouseMove=function(k){this.mouseX=k.clientX-this.windowHalfX;this.mouseY=k.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),l=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(l,g);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(k,j){return function(){j.apply(k,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;
+var Cube=function(a,e,b,c,d,f,g,h,l){function k(y,A,C,n,E,D,L,M){var K,J,G=c||1,N=d||1,U=E/2,R=D/2,P=j.vertices.length;if(y=="x"&&A=="y"||y=="y"&&A=="x")K="z";else if(y=="x"&&A=="z"||y=="z"&&A=="x"){K="y";N=f||1}else if(y=="z"&&A=="y"||y=="y"&&A=="z"){K="x";G=f||1}var Q=G+1,T=N+1;E/=G;var H=D/N;for(J=0;J<T;J++)for(D=0;D<Q;D++){var O=new THREE.Vector3;O[y]=(D*E-U)*C;O[A]=(J*H-R)*n;O[K]=L;j.vertices.push(new THREE.Vertex(O))}for(J=0;J<N;J++)for(D=0;D<G;D++){j.faces.push(new THREE.Face4(D+Q*J+P,D+Q*
+(J+1)+P,D+1+Q*(J+1)+P,D+1+Q*J+P,null,null,M));j.faceVertexUvs[0].push([new THREE.UV(D/G,J/N),new THREE.UV(D/G,(J+1)/N),new THREE.UV((D+1)/G,(J+1)/N),new THREE.UV((D+1)/G,J/N)])}}THREE.Geometry.call(this);var j=this,m=a/2,p=e/2,w=b/2;h=h?-1:1;if(g!==undefined)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(l!=undefined)for(var z in l)this.sides[z]!=undefined&&(this.sides[z]=
+l[z]);this.sides.px&&k("z","y",1*h,-1,b,e,-m,this.materials[0]);this.sides.nx&&k("z","y",-1*h,-1,b,e,m,this.materials[1]);this.sides.py&&k("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&k("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&k("x","y",1*h,-1,a,e,w,this.materials[4]);this.sides.nz&&k("x","y",-1*h,-1,a,e,-w,this.materials[5]);(function(){for(var y=[],A=[],C=0,n=j.vertices.length;C<n;C++){for(var E=j.vertices[C],D=!1,L=0,M=y.length;L<M;L++){var K=y[L];if(E.position.x==K.position.x&&
+E.position.y==K.position.y&&E.position.z==K.position.z){A[C]=L;D=!0;break}}if(!D){A[C]=y.length;y.push(new THREE.Vertex(E.position.clone()))}}C=0;for(n=j.faces.length;C<n;C++){E=j.faces[C];E.a=A[E.a];E.b=A[E.b];E.c=A[E.c];E.d=A[E.d]}j.vertices=y})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,e,b,c,d,f){function g(j,m,p){h.vertices.push(new THREE.Vertex(new THREE.Vector3(j,m,p)))}THREE.Geometry.call(this);var h=this,l=Math.PI,k=c/2;for(c=0;c<a;c++)g(Math.sin(2*l*c/a)*e,Math.cos(2*l*c/a)*e,-k);for(c=0;c<a;c++)g(Math.sin(2*l*c/a)*b,Math.cos(2*l*c/a)*b,k);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){g(0,0,-k-(f||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(e>0){g(0,0,k+(d||0));
 for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function g(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return g((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;g(-1,a,0);g(1,a,0);g(-1,-a,0);g(1,-a,0);g(0,-1,a);g(0,1,a);g(0,-1,-a);g(0,
-1,-a);g(a,0,-1);g(a,0,1);g(-a,0,-1);g(-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++){e=new THREE.Geometry;for(var h in f.faces){var l=c(f.faces[h].a,f.faces[h].b),j=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,l,k,e);b(f.faces[h].b,j,l,e);b(f.faces[h].c,
-k,j,e);b(l,j,k,e)}f.faces=e.faces}d.faces=f.faces;delete f;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,g,b){THREE.Geometry.call(this);this.steps=g||12;this.angle=b||2*Math.PI;g=this.angle/this.steps;for(var c=[],d=[],f=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();d[h]=this.vertices.length-1}for(var l=(new THREE.Matrix4).setRotationZ(g),j=0;j<=this.angle+0.001;j+=g){for(h=0;h<c.length;h++)if(j<this.angle){c[h]=l.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=e;j==0&&(e=d);for(h=
-0;h<d.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h]));this.faceVertexUvs[0].push([new THREE.UV(j/b,h/a.length),new THREE.UV(j/b,(h+1)/a.length),new THREE.UV((j-g)/b,(h+1)/a.length),new THREE.UV((j-g)/b,h/a.length)])}d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,g,b,c){THREE.Geometry.call(this);var d,f=a/2,e=g/2;b=b||1;c=c||1;var h=b+1,l=c+1;a/=b;var j=g/c;for(d=0;d<l;d++)for(g=0;g<h;g++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(g*a-f,-(d*j-e),0)));for(d=0;d<c;d++)for(g=0;g<b;g++){this.faces.push(new THREE.Face4(g+h*d,g+h*(d+1),g+1+h*(d+1),g+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(g/b,d/c),new THREE.UV(g/b,(d+1)/c),new THREE.UV((g+1)/b,(d+1)/c),new THREE.UV((g+1)/b,d/c)])}this.computeCentroids();this.computeFaceNormals()};
+var Icosahedron=function(a){function e(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return e((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
+1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var l=c(f.faces[h].a,f.faces[h].b),k=c(f.faces[h].b,f.faces[h].c),j=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,l,j,g);b(f.faces[h].b,k,l,g);b(f.faces[h].c,
+j,k,g);b(l,k,j,g)}f.faces=g.faces}d.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],d=[],f=[],g=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();d[h]=this.vertices.length-1}for(var l=(new THREE.Matrix4).setRotationZ(e),k=0;k<=this.angle+0.0010;k+=e){for(h=0;h<c.length;h++)if(k<this.angle){c[h]=l.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=g;k==0&&(g=d);for(h=
+0;h<d.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h]));this.faceVertexUvs[0].push([new THREE.UV(k/b,h/a.length),new THREE.UV(k/b,(h+1)/a.length),new THREE.UV((k-e)/b,(h+1)/a.length),new THREE.UV((k-e)/b,h/a.length)])}d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,e,b,c){THREE.Geometry.call(this);var d,f=a/2,g=e/2;b=b||1;c=c||1;var h=b+1,l=c+1;a/=b;var k=e/c;for(d=0;d<l;d++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(d*k-g),0)));for(d=0;d<c;d++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*d,e+h*(d+1),e+1+h*(d+1),e+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(e/b,d/c),new THREE.UV(e/b,(d+1)/c),new THREE.UV((e+1)/b,(d+1)/c),new THREE.UV((e+1)/b,d/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,g,b){THREE.Geometry.call(this);var c,d=Math.PI,f=Math.max(3,g||8),e=Math.max(2,b||6);g=[];for(b=0;b<e+1;b++){c=b/e;var h=a*Math.cos(c*d),l=a*Math.sin(c*d),j=[],k=0;for(c=0;c<f;c++){var m=2*c/f,p=l*Math.sin(m*d);m=l*Math.cos(m*d);(b==0||b==e)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);j.push(k)}g.push(j)}var w,t,z;d=g.length;for(b=0;b<d;b++){f=g[b].length;if(b>0)for(c=0;c<f;c++){j=c==f-1;e=g[b][j?0:c+1];h=g[b][j?f-1:c];l=g[b-1][j?f-1:c];j=g[b-1][j?
-0:c+1];p=b/(d-1);w=(b-1)/(d-1);t=(c+1)/f;m=c/f;k=new THREE.UV(1-t,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,w);var y=new THREE.UV(1-t,w);if(b<g.length-1){w=this.vertices[e].position.clone();t=this.vertices[h].position.clone();z=this.vertices[l].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(e,h,l,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,p,m])}if(b>1){w=this.vertices[e].position.clone();
-t=this.vertices[l].position.clone();z=this.vertices[j].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(e,l,j,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,m,y])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
-var Torus=function(a,g,b,c){this.radius=a||100;this.tube=g||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(g=0;g<=this.segmentsR;++g)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var d=g/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(d))*Math.cos(c),(this.radius+this.tube*Math.cos(d))*Math.sin(c),this.tube*Math.sin(d))));a.push([b/this.segmentsT,1-g/this.segmentsR])}for(g=1;g<=this.segmentsR;++g)for(b=
-1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*g+b;d=(this.segmentsT+1)*g+b-1;var f=(this.segmentsT+1)*(g-1)+b-1,e=(this.segmentsT+1)*(g-1)+b;this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,g,b,c,d,f,e){function h(m,p,w,t,z,y){p=w/t*m;w=Math.cos(p);return new THREE.Vector3(z*(2+w)*0.5*Math.cos(m),z*(2+w)*Math.sin(m)*0.5,y*z*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=g||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=d||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(g=0;g<this.segmentsT;++g){var l=
-a/this.segmentsR*2*this.p*Math.PI;e=g/this.segmentsT*2*Math.PI;d=h(l,e,this.q,this.p,this.radius,this.heightScale);l=h(l+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=l.x-d.x;b.y=l.y-d.y;b.z=l.z-d.z;c.x=l.x+d.x;c.y=l.y+d.y;c.z=l.z+d.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();l=this.tube*Math.cos(e);e=this.tube*Math.sin(e);d.x+=l*c.x+e*f.x;d.y+=l*c.y+e*f.y;d.z+=l*c.z+e*f.z;this.grid[a][g]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z)))-1}}for(a=0;a<this.segmentsR;++a)for(g=
-0;g<this.segmentsT;++g){f=(a+1)%this.segmentsR;e=(g+1)%this.segmentsT;d=this.grid[a][g];b=this.grid[f][g];c=this.grid[a][e];f=this.grid[f][e];e=new THREE.UV(a/this.segmentsR,g/this.segmentsT);l=new THREE.UV((a+1)/this.segmentsR,g/this.segmentsT);var j=new THREE.UV(a/this.segmentsR,(g+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(g+1)/this.segmentsT);this.faces.push(new THREE.Face3(d,b,c));this.faceVertexUvs[0].push([e,l,j]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([k,
-j,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=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 g="Loaded ";g+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=g},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,g,b){a.materials=[];for(var c=0;c<g.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(g[c],b)]},createMaterial:function(a,g){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(h,l){var j=new Image;j.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};j.src=l}var d,f,e;d="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")d="MeshPhongMaterial";else a.shading=="Basic"&&(d="MeshBasicMaterial");if(a.mapDiffuse&&g){e=document.createElement("canvas");f.map=new THREE.Texture(e);f.map.sourceFile=a.mapDiffuse;
-c(f.map,g+"/"+a.mapDiffuse)}else if(a.colorDiffuse){e=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=e;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&g){e=document.createElement("canvas");f.lightMap=new THREE.Texture(e);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,g+"/"+a.mapLightmap)}return new THREE[d](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
-THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var g=this,b=a.model,c=a.callback,d=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){g.createModel(f.data,c,d);g.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,g,b){var c=new THREE.Geometry;this.init_materials(c,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,f,e,h,l,j,k,m,p,w,t=a.faces;m=a.vertices;var z=a.normals,y=a.colors,A=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&A++;for(d=0;d<A;d++){c.faceUvs[d]=[];c.faceVertexUvs[d]=[]}e=0;for(h=m.length;e<h;){p=new THREE.Vertex;p.position.x=m[e++];p.position.y=m[e++];p.position.z=m[e++];c.vertices.push(p)}e=
-0;for(h=t.length;e<h;){l=t[e++];j=l&1;d=l&2;k=l&4;f=l&8;m=l&16;p=l&32;w=l&64;l&=128;if(j){j=new THREE.Face4;j.a=t[e++];j.b=t[e++];j.c=t[e++];j.d=t[e++];nVertices=4}else{j=new THREE.Face3;j.a=t[e++];j.b=t[e++];j.c=t[e++];nVertices=3}if(d){materialIndex=t[e++];j.materials=c.materials[materialIndex]}if(k)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvIndex=t[e++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];c.faceUvs[d].push(new THREE.UV(u,v))}if(f)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvs=[];for(f=0;f<nVertices;f++){uvIndex=
-t[e++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[f]=new THREE.UV(u,v)}f=c.faces.length;c.faceVertexUvs[d][f]=uvs}if(m){normalIndex=t[e++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.normal=normal}if(p)for(d=0;d<nVertices;d++){normalIndex=t[e++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.vertexNormals.push(normal)}if(w){color=new THREE.Color(t[e++]);j.color=color}if(l)for(d=
-0;d<nVertices;d++){colorIndex=t[e++];color=new THREE.Color(y[colorIndex]);j.vertexColors.push(color)}c.faces.push(j)}}})();(function(){var d,f,e,h;if(a.skinWeights){d=0;for(f=a.skinWeights.length;d<f;d+=2){e=a.skinWeights[d];h=a.skinWeights[d+1];c.skinWeights.push(new THREE.Vector4(e,h,0,0))}}if(a.skinIndices){d=0;for(f=a.skinIndices.length;d<f;d+=2){e=a.skinIndices[d];h=a.skinIndices[d+1];c.skinIndices.push(new THREE.Vector4(e,h,0,0))}}c.bones=a.bones;c.animation=a.animation})();(function(){if(a.morphTargets!==
-undefined){var d,f,e,h;d=0;for(f=a.morphTargets.length;d<f;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];dstVertices=c.morphTargets[d].vertices;srcVertices=a.morphTargets[d].vertices;e=0;for(h=srcVertices.length;e<h;e+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[e],srcVertices[e+1],srcVertices[e+2])))}}})();c.computeCentroids();c.computeFaceNormals();g(c)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+var Sphere=function(a,e,b){THREE.Geometry.call(this);var c,d=Math.PI,f=Math.max(3,e||8),g=Math.max(2,b||6);e=[];for(b=0;b<g+1;b++){c=b/g;var h=a*Math.cos(c*d),l=a*Math.sin(c*d),k=[],j=0;for(c=0;c<f;c++){var m=2*c/f,p=l*Math.sin(m*d);m=l*Math.cos(m*d);(b==0||b==g)&&c>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);k.push(j)}e.push(k)}var w,t,z;d=e.length;for(b=0;b<d;b++){f=e[b].length;if(b>0)for(c=0;c<f;c++){k=c==f-1;g=e[b][k?0:c+1];h=e[b][k?f-1:c];l=e[b-1][k?f-1:c];k=e[b-1][k?
+0:c+1];p=b/(d-1);w=(b-1)/(d-1);t=(c+1)/f;m=c/f;j=new THREE.UV(1-t,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,w);var y=new THREE.UV(1-t,w);if(b<e.length-1){w=this.vertices[g].position.clone();t=this.vertices[h].position.clone();z=this.vertices[l].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(g,h,l,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([j,p,m])}if(b>1){w=this.vertices[g].position.clone();
+t=this.vertices[l].position.clone();z=this.vertices[k].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(g,l,k,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([j,m,y])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Torus=function(a,e,b,c){this.radius=a||100;this.tube=e||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(e=0;e<=this.segmentsR;++e)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var d=e/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(d))*Math.cos(c),(this.radius+this.tube*Math.cos(d))*Math.sin(c),this.tube*Math.sin(d))));a.push([b/this.segmentsT,1-e/this.segmentsR])}for(e=1;e<=this.segmentsR;++e)for(b=
+1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*e+b;d=(this.segmentsT+1)*e+b-1;var f=(this.segmentsT+1)*(e-1)+b-1,g=(this.segmentsT+1)*(e-1)+b;this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,e,b,c,d,f,g){function h(m,p,w,t,z,y){p=w/t*m;w=Math.cos(p);return new THREE.Vector3(z*(2+w)*0.5*Math.cos(m),z*(2+w)*Math.sin(m)*0.5,y*z*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=e||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=d||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(e=0;e<this.segmentsT;++e){var l=
+a/this.segmentsR*2*this.p*Math.PI;g=e/this.segmentsT*2*Math.PI;d=h(l,g,this.q,this.p,this.radius,this.heightScale);l=h(l+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=l.x-d.x;b.y=l.y-d.y;b.z=l.z-d.z;c.x=l.x+d.x;c.y=l.y+d.y;c.z=l.z+d.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();l=this.tube*Math.cos(g);g=this.tube*Math.sin(g);d.x+=l*c.x+g*f.x;d.y+=l*c.y+g*f.y;d.z+=l*c.z+g*f.z;this.grid[a][e]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z)))-1}}for(a=0;a<this.segmentsR;++a)for(e=
+0;e<this.segmentsT;++e){f=(a+1)%this.segmentsR;g=(e+1)%this.segmentsT;d=this.grid[a][e];b=this.grid[f][e];c=this.grid[a][g];f=this.grid[f][g];g=new THREE.UV(a/this.segmentsR,e/this.segmentsT);l=new THREE.UV((a+1)/this.segmentsR,e/this.segmentsT);var k=new THREE.UV(a/this.segmentsR,(e+1)/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(e+1)/this.segmentsT);this.faces.push(new THREE.Face3(d,b,c));this.faceVertexUvs[0].push([g,l,k]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([j,
+k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=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 e="Loaded ";e+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,e,b){a.materials=[];for(var c=0;c<e.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(e[c],b)]},createMaterial:function(a,e){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(h,l){var k=new Image;k.onload=function(){if(!b(this.width)||!b(this.height)){var j=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));h.image.width=j;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,j,m)}else h.image=this;h.needsUpdate=!0};k.src=l}var d,f,g;d="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")d="MeshPhongMaterial";else a.shading=="Basic"&&(d="MeshBasicMaterial");if(a.mapDiffuse&&e){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;
+c(f.map,e+"/"+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&&e){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,e+"/"+a.mapLightmap)}return new THREE[d](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
+THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var e=this,b=a.model,c=a.callback,d=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){e.createModel(f.data,c,d);e.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,e,b){var c=new THREE.Geometry;this.init_materials(c,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,f,g,h,l,k,j,m,p,w,t=a.faces;m=a.vertices;var z=a.normals,y=a.colors,A=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&A++;for(d=0;d<A;d++){c.faceUvs[d]=[];c.faceVertexUvs[d]=[]}h=0;for(l=m.length;h<l;){p=new THREE.Vertex;p.position.x=m[h++];p.position.y=m[h++];p.position.z=m[h++];c.vertices.push(p)}h=
+0;for(l=t.length;h<l;){k=t[h++];j=k&1;g=k&2;d=k&4;f=k&8;m=k&16;p=k&32;w=k&64;k&=128;if(j){j=new THREE.Face4;j.a=t[h++];j.b=t[h++];j.c=t[h++];j.d=t[h++];nVertices=4}else{j=new THREE.Face3;j.a=t[h++];j.b=t[h++];j.c=t[h++];nVertices=3}if(g){materialIndex=t[h++];j.materials=c.materials[materialIndex]}g=c.faces.length;if(d)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvIndex=t[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];c.faceUvs[d][g]=new THREE.UV(u,v)}if(f)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvs=[];for(f=0;f<
+nVertices;f++){uvIndex=t[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[f]=new THREE.UV(u,v)}c.faceVertexUvs[d][g]=uvs}if(m){normalIndex=t[h++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.normal=normal}if(p)for(d=0;d<nVertices;d++){normalIndex=t[h++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.vertexNormals.push(normal)}if(w){color=new THREE.Color(t[h++]);j.color=color}if(k)for(d=
+0;d<nVertices;d++){colorIndex=t[h++];color=new THREE.Color(y[colorIndex]);j.vertexColors.push(color)}c.faces.push(j)}}})();(function(){var d,f,g,h;if(a.skinWeights){d=0;for(f=a.skinWeights.length;d<f;d+=2){g=a.skinWeights[d];h=a.skinWeights[d+1];c.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){d=0;for(f=a.skinIndices.length;d<f;d+=2){g=a.skinIndices[d];h=a.skinIndices[d+1];c.skinIndices.push(new THREE.Vector4(g,h,0,0))}}c.bones=a.bones;c.animation=a.animation})();(function(){if(a.morphTargets!==
+undefined){var d,f,g,h;d=0;for(f=a.morphTargets.length;d<f;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];dstVertices=c.morphTargets[d].vertices;srcVertices=a.morphTargets[d].vertices;g=0;for(h=srcVertices.length;g<h;g+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[g],srcVertices[g+1],srcVertices[g+2])))}}})();c.computeCentroids();c.computeFaceNormals();e(c)};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 g=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(g),d=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(g);a=(new Date).getTime();g=new Worker(g);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;g.onmessage=function(e){THREE.BinaryLoader.prototype.loadAjaxBuffers(e.data.buffers,e.data.materials,b,d,c,f)};g.onerror=function(e){alert("worker.onerror: "+e.message+"\n"+e.data);e.preventDefault()};
-g.postMessage(a)},loadAjaxBuffers:function(a,g,b,c,d,f){var e=new XMLHttpRequest,h=c+"/"+a,l=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,d,g):alert("Couldn't load ["+h+"] ["+e.status+"]");else if(e.readyState==3){if(f){l==0&&(l=e.getResponseHeader("Content-Length"));f({total:l,loaded:e.responseText.length})}}else e.readyState==2&&(l=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
-e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,g,b,c){var d=function(f){function e(o,x){var B=k(o,x),F=k(o,x+1),I=k(o,x+2),S=k(o,x+3),V=(S<<1&255|I>>7)-127;B|=(I&127)<<16|F<<8;if(B==0&&V==-127)return 0;return(1-2*(S>>7))*(1+B*Math.pow(2,-23))*Math.pow(2,V)}function h(o,x){var B=k(o,x),F=k(o,x+1),I=k(o,x+2);return(k(o,x+3)<<24)+(I<<16)+(F<<8)+B}function l(o,x){var B=k(o,x);return(k(o,x+1)<<8)+B}function j(o,x){var B=k(o,x);return B>127?B-256:B}function k(o,
+THREE.BinaryLoader.prototype={load:function(a){var e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e),d=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,d,c,f)};e.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
+e.postMessage(a)},loadAjaxBuffers:function(a,e,b,c,d,f){var g=new XMLHttpRequest,h=c+"/"+a,l=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,d,e):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(f){l==0&&(l=g.getResponseHeader("Content-Length"));f({total:l,loaded:g.responseText.length})}}else g.readyState==2&&(l=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,e,b,c){var d=function(f){function g(o,x){var B=j(o,x),F=j(o,x+1),I=j(o,x+2),S=j(o,x+3),V=(S<<1&255|I>>7)-127;B|=(I&127)<<16|F<<8;if(B==0&&V==-127)return 0;return(1-2*(S>>7))*(1+B*Math.pow(2,-23))*Math.pow(2,V)}function h(o,x){var B=j(o,x),F=j(o,x+1),I=j(o,x+2);return(j(o,x+3)<<24)+(I<<16)+(F<<8)+B}function l(o,x){var B=j(o,x);return(j(o,x+1)<<8)+B}function k(o,x){var B=j(o,x);return B>127?B-256:B}function j(o,
 x){return o.charCodeAt(x)&255}function m(o){var x,B,F;x=h(a,o);B=h(a,o+L);F=h(a,o+M);o=l(a,o+K);THREE.BinaryLoader.prototype.f3(A,x,B,F,o)}function p(o){var x,B,F,I,S,V;x=h(a,o);B=h(a,o+L);F=h(a,o+M);I=l(a,o+K);S=h(a,o+J);V=h(a,o+G);o=h(a,o+N);THREE.BinaryLoader.prototype.f3n(A,E,x,B,F,I,S,V,o)}function w(o){var x,B,F,I;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);o=l(a,o+Q);THREE.BinaryLoader.prototype.f4(A,x,B,F,I,o)}function t(o){var x,B,F,I,S,V,da,ea;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);S=l(a,
 o+Q);V=h(a,o+T);da=h(a,o+H);ea=h(a,o+O);o=h(a,o+X);THREE.BinaryLoader.prototype.f4n(A,E,x,B,F,I,S,V,da,ea,o)}function z(o){var x,B;x=h(a,o);B=h(a,o+Y);o=h(a,o+fa);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[o*2],D[o*2+1])}function y(o){var x,B,F;x=h(a,o);B=h(a,o+ga);F=h(a,o+ha);o=h(a,o+ia);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[F*2],D[F*2+1],D[o*2],D[o*2+1])}var A=this,C=0,n,E=[],D=[],L,M,K,J,G,N,U,R,P,Q,T,H,
-O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,c,f);n={signature:a.substr(C,8),header_bytes:k(a,C+8),vertex_coordinate_bytes:k(a,C+9),normal_coordinate_bytes:k(a,C+10),uv_coordinate_bytes:k(a,C+11),vertex_index_bytes:k(a,C+12),normal_index_bytes:k(a,C+13),uv_index_bytes:k(a,C+14),material_index_bytes:k(a,C+15),nvertices:h(a,C+16),nnormals:h(a,C+16+4),nuvs:h(a,C+16+8),ntri_flat:h(a,C+16+12),ntri_smooth:h(a,C+16+16),ntri_flat_uv:h(a,C+16+20),ntri_smooth_uv:h(a,
+O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,c,f);n={signature:a.substr(C,8),header_bytes:j(a,C+8),vertex_coordinate_bytes:j(a,C+9),normal_coordinate_bytes:j(a,C+10),uv_coordinate_bytes:j(a,C+11),vertex_index_bytes:j(a,C+12),normal_index_bytes:j(a,C+13),uv_index_bytes:j(a,C+14),material_index_bytes:j(a,C+15),nvertices:h(a,C+16),nnormals:h(a,C+16+4),nuvs:h(a,C+16+8),ntri_flat:h(a,C+16+12),ntri_smooth:h(a,C+16+16),ntri_flat_uv:h(a,C+16+20),ntri_smooth_uv:h(a,
 C+16+24),nquad_flat:h(a,C+16+28),nquad_smooth:h(a,C+16+32),nquad_flat_uv:h(a,C+16+36),nquad_smooth_uv:h(a,C+16+40)};C+=n.header_bytes;L=n.vertex_index_bytes;M=n.vertex_index_bytes*2;K=n.vertex_index_bytes*3;J=n.vertex_index_bytes*3+n.material_index_bytes;G=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;U=n.vertex_index_bytes;R=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;Q=n.vertex_index_bytes*4;T=n.vertex_index_bytes*
 4+n.material_index_bytes;H=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;X=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;Y=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes;ha=n.uv_index_bytes*2;ia=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;W=n.vertex_index_bytes*4+n.material_index_bytes;Z=n.ntri_flat*f;$=n.ntri_smooth*(f+n.normal_index_bytes*3);aa=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);ba=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ca=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);C+=function(o){for(var x,B,F,I=n.vertex_coordinate_bytes*3,S=o+n.nvertices*I;o<S;o+=I){x=e(a,o);B=e(a,o+n.vertex_coordinate_bytes);F=e(a,o+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,x,B,F)}return n.nvertices*I}(C);C+=function(o){for(var x,B,F,I=n.normal_coordinate_bytes*3,S=o+n.nnormals*I;o<
-S;o+=I){x=j(a,o);B=j(a,o+n.normal_coordinate_bytes);F=j(a,o+n.normal_coordinate_bytes*2);E.push(x/127,B/127,F/127)}return n.nnormals*I}(C);C+=function(o){for(var x,B,F=n.uv_coordinate_bytes*2,I=o+n.nuvs*F;o<I;o+=F){x=e(a,o);B=e(a,o+n.uv_coordinate_bytes);D.push(x,B)}return n.nuvs*F}(C);Z=C+Z;$=Z+$;aa=$+aa;ba=aa+ba;ca=ba+ca;f=ca+f;W=f+W;(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes,F=B+n.uv_index_bytes*3,I=o+n.ntri_flat_uv*F;for(x=o;x<I;x+=F){m(x);z(x+B)}return I-o})($);(function(o){var x,
+(f+n.uv_index_bytes*3);ba=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ca=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);C+=function(o){for(var x,B,F,I=n.vertex_coordinate_bytes*3,S=o+n.nvertices*I;o<S;o+=I){x=g(a,o);B=g(a,o+n.vertex_coordinate_bytes);F=g(a,o+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,x,B,F)}return n.nvertices*I}(C);C+=function(o){for(var x,B,F,I=n.normal_coordinate_bytes*3,S=o+n.nnormals*I;o<
+S;o+=I){x=k(a,o);B=k(a,o+n.normal_coordinate_bytes);F=k(a,o+n.normal_coordinate_bytes*2);E.push(x/127,B/127,F/127)}return n.nnormals*I}(C);C+=function(o){for(var x,B,F=n.uv_coordinate_bytes*2,I=o+n.nuvs*F;o<I;o+=F){x=g(a,o);B=g(a,o+n.uv_coordinate_bytes);D.push(x,B)}return n.nuvs*F}(C);Z=C+Z;$=Z+$;aa=$+aa;ba=aa+ba;ca=ba+ca;f=ca+f;W=f+W;(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes,F=B+n.uv_index_bytes*3,I=o+n.ntri_flat_uv*F;for(x=o;x<I;x+=F){m(x);z(x+B)}return I-o})($);(function(o){var x,
 B=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=B+n.uv_index_bytes*3,I=o+n.ntri_smooth_uv*F;for(x=o;x<I;x+=F){p(x);z(x+B)}return I-o})(aa);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes,F=B+n.uv_index_bytes*4,I=o+n.nquad_flat_uv*F;for(x=o;x<I;x+=F){w(x);y(x+B)}return I-o})(f);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=B+n.uv_index_bytes*4,I=o+n.nquad_smooth_uv*F;for(x=o;x<I;x+=F){t(x);y(x+B)}return I-o})(W);
 (function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes,F=o+n.ntri_flat*B;for(x=o;x<F;x+=B)m(x);return F-o})(C);(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=o+n.ntri_smooth*B;for(x=o;x<F;x+=B)p(x);return F-o})(Z);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes,F=o+n.nquad_flat*B;for(x=o;x<F;x+=B)w(x);return F-o})(ba);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=o+n.nquad_smooth*
-B;for(x=o;x<F;x+=B)t(x);return F-o})(ca);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;g(new d(b))},v:function(a,g,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(g,b,c)))},f3:function(a,g,b,c,d){a.faces.push(new THREE.Face3(g,b,c,null,null,a.materials[d]))},f4:function(a,g,b,c,d,f){a.faces.push(new THREE.Face4(g,b,c,d,null,null,a.materials[f]))},f3n:function(a,g,b,c,d,f,e,h,l){f=a.materials[f];var j=g[h*3],k=g[h*3+1];h=g[h*3+2];
-var m=g[l*3],p=g[l*3+1];l=g[l*3+2];a.faces.push(new THREE.Face3(b,c,d,[new THREE.Vector3(g[e*3],g[e*3+1],g[e*3+2]),new THREE.Vector3(j,k,h),new THREE.Vector3(m,p,l)],null,f))},f4n:function(a,g,b,c,d,f,e,h,l,j,k){e=a.materials[e];var m=g[l*3],p=g[l*3+1];l=g[l*3+2];var w=g[j*3],t=g[j*3+1];j=g[j*3+2];var z=g[k*3],y=g[k*3+1];k=g[k*3+2];a.faces.push(new THREE.Face4(b,c,d,f,[new THREE.Vector3(g[h*3],g[h*3+1],g[h*3+2]),new THREE.Vector3(m,p,l),new THREE.Vector3(w,t,j),new THREE.Vector3(z,y,k)],null,e))},
-uv3:function(a,g,b,c,d,f,e){var h=[];h.push(new THREE.UV(g,b));h.push(new THREE.UV(c,d));h.push(new THREE.UV(f,e));a.push(h)},uv4:function(a,g,b,c,d,f,e,h,l){var j=[];j.push(new THREE.UV(g,b));j.push(new THREE.UV(c,d));j.push(new THREE.UV(f,e));j.push(new THREE.UV(h,l));a.push(j)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
-THREE.MarchingCubes=function(a,g){THREE.Object3D.call(this);this.materials=g instanceof Array?g:[g];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,d){return b+(c-b)*d};this.VIntX=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=l;c[f+2]=j;d[f]=this.lerp(k[b],k[b+3],e);d[f+1]=this.lerp(k[b+1],k[b+4],e);d[f+2]=this.lerp(k[b+2],k[b+5],e)};this.VIntY=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h;c[f+1]=l+e*this.delta;c[f+
-2]=j;c=b+this.yd*3;d[f]=this.lerp(k[b],k[c],e);d[f+1]=this.lerp(k[b+1],k[c+1],e);d[f+2]=this.lerp(k[b+2],k[c+2],e)};this.VIntZ=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h;c[f+1]=l;c[f+2]=j+e*this.delta;c=b+this.zd*3;d[f]=this.lerp(k[b],k[c],e);d[f+1]=this.lerp(k[b+1],k[c+1],e);d[f+2]=this.lerp(k[b+2],k[c+2],e)};this.compNorm=function(b){var c=b*3;if(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,d,f,e,h){var l=f+1,j=f+this.yd,k=f+this.zd,m=l+this.yd,p=l+this.zd,w=f+this.yd+this.zd,t=l+this.yd+this.zd,z=0,y=this.field[f],A=this.field[l],C=this.field[j],n=this.field[m],E=this.field[k],D=this.field[p],L=this.field[w],M=this.field[t];y<e&&(z|=1);A<e&&(z|=2);C<e&&(z|=8);n<e&&(z|=4);E<e&&(z|=16);D<e&&(z|=32);L<e&&(z|=128);M<e&&(z|=64);var K=THREE.edgeTable[z];if(K==0)return 0;
-var J=this.delta,G=b+J,N=c+J;J=d+J;if(K&1){this.compNorm(f);this.compNorm(l);this.VIntX(f*3,this.vlist,this.nlist,0,e,b,c,d,y,A)}if(K&2){this.compNorm(l);this.compNorm(m);this.VIntY(l*3,this.vlist,this.nlist,3,e,G,c,d,A,n)}if(K&4){this.compNorm(j);this.compNorm(m);this.VIntX(j*3,this.vlist,this.nlist,6,e,b,N,d,C,n)}if(K&8){this.compNorm(f);this.compNorm(j);this.VIntY(f*3,this.vlist,this.nlist,9,e,b,c,d,y,C)}if(K&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,e,b,c,J,
-E,D)}if(K&32){this.compNorm(p);this.compNorm(t);this.VIntY(p*3,this.vlist,this.nlist,15,e,G,c,J,D,M)}if(K&64){this.compNorm(w);this.compNorm(t);this.VIntX(w*3,this.vlist,this.nlist,18,e,b,N,J,L,M)}if(K&128){this.compNorm(k);this.compNorm(w);this.VIntY(k*3,this.vlist,this.nlist,21,e,b,c,J,E,L)}if(K&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,e,b,c,d,y,E)}if(K&512){this.compNorm(l);this.compNorm(p);this.VIntZ(l*3,this.vlist,this.nlist,27,e,G,c,d,A,D)}if(K&1024){this.compNorm(m);
-this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,30,e,G,N,d,n,M)}if(K&2048){this.compNorm(j);this.compNorm(w);this.VIntZ(j*3,this.vlist,this.nlist,33,e,b,N,d,C,L)}z<<=4;for(e=f=0;THREE.triTable[z+e]!=-1;){b=z+e;c=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[d],h);e+=3;f++}return f};this.posnormtriv=function(b,c,d,f,e,h){var l=this.count*3;this.positionArray[l]=b[d];this.positionArray[l+1]=b[d+1];this.positionArray[l+2]=b[d+2];this.positionArray[l+
-3]=b[f];this.positionArray[l+4]=b[f+1];this.positionArray[l+5]=b[f+2];this.positionArray[l+6]=b[e];this.positionArray[l+7]=b[e+1];this.positionArray[l+8]=b[e+2];this.normalArray[l]=c[d];this.normalArray[l+1]=c[d+1];this.normalArray[l+2]=c[d+2];this.normalArray[l+3]=c[f];this.normalArray[l+4]=c[f+1];this.normalArray[l+5]=c[f+2];this.normalArray[l+6]=c[e];this.normalArray[l+7]=c[e+1];this.normalArray[l+8]=c[e+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,d,f,e){var h=this.size*Math.sqrt(f/e),l=d*this.size,j=c*this.size,k=b*this.size,m=Math.floor(l-h);m<1&&(m=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var p=Math.floor(j-h);p<1&&(p=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var w=Math.floor(k-h);w<1&&(w=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var t,z,y,A,C,n;m<l;m++){k=this.size2*m;z=m/this.size-d;C=z*z;for(z=p;z<j;z++){y=k+this.size*z;t=z/this.size-c;n=t*t;for(t=w;t<h;t++){A=t/this.size-b;A=f/(1.0E-6+A*A+n+C)-e;A>0&&(this.field[y+t]+=A)}}}};this.addPlaneX=function(b,c){var d,f,e,h,l,j=this.size,k=this.yd,m=this.zd,p=this.field,w=j*Math.sqrt(b/c);w>j&&(w=j);for(d=0;d<w;d++){f=d/j;f*=f;h=b/(1.0E-4+f)-c;if(h>0)for(f=0;f<j;f++){l=d+f*k;for(e=0;e<j;e++)p[m*e+l]+=h}}};this.addPlaneY=function(b,c){var d,f,
-e,h,l,j,k=this.size,m=this.yd,p=this.zd,w=this.field,t=k*Math.sqrt(b/c);t>k&&(t=k);for(f=0;f<t;f++){d=f/k;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=f*m;for(d=0;d<k;d++){j=l+d;for(e=0;e<k;e++)w[p*e+j]+=h}}}};this.addPlaneZ=function(b,c){var d,f,e,h,l,j;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(e=0;e<dist;e++){d=e/size;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=zd*e;for(f=0;f<size;f++){j=l+f*yd;for(d=0;d<size;d++)field[j+d]+=h}}}};this.reset=function(){var b;
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,d,f,e,h,l,j,k,m,p=this.size-2;for(e=1;e<p;e++){m=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=m+this.size*f;l=(f-this.halfsize)/this.halfsize;for(d=1;d<p;d++){h=(d-this.halfsize)/this.halfsize;c=k+d;this.polygonize(h,l,j,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(d){var f,e,h,l,j,k,m,p;for(f=
-0;f<d.count;f++){j=f*3;m=j+1;p=j+2;e=d.positionArray[j];h=d.positionArray[m];l=d.positionArray[p];k=new THREE.Vector3(e,h,l);e=d.normalArray[j];h=d.normalArray[m];l=d.normalArray[p];j=new THREE.Vector3(e,h,l);j.normalize();j=new THREE.Vertex(k,j);c.vertices.push(j)}nfaces=d.count/3;for(f=0;f<nfaces;f++){j=(b+f)*3;m=j+1;p=j+2;k=c.vertices[j].normal;e=c.vertices[m].normal;h=c.vertices[p].normal;j=new THREE.Face3(j,m,p,[k,e,h]);c.faces.push(j)}b+=nfaces;d.count=0});return c};this.init(a)};
+B;for(x=o;x<F;x+=B)t(x);return F-o})(ca);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;e(new d(b))},v:function(a,e,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(e,b,c)))},f3:function(a,e,b,c,d){a.faces.push(new THREE.Face3(e,b,c,null,null,a.materials[d]))},f4:function(a,e,b,c,d,f){a.faces.push(new THREE.Face4(e,b,c,d,null,null,a.materials[f]))},f3n:function(a,e,b,c,d,f,g,h,l){f=a.materials[f];var k=e[h*3],j=e[h*3+1];h=e[h*3+2];
+var m=e[l*3],p=e[l*3+1];l=e[l*3+2];a.faces.push(new THREE.Face3(b,c,d,[new THREE.Vector3(e[g*3],e[g*3+1],e[g*3+2]),new THREE.Vector3(k,j,h),new THREE.Vector3(m,p,l)],null,f))},f4n:function(a,e,b,c,d,f,g,h,l,k,j){g=a.materials[g];var m=e[l*3],p=e[l*3+1];l=e[l*3+2];var w=e[k*3],t=e[k*3+1];k=e[k*3+2];var z=e[j*3],y=e[j*3+1];j=e[j*3+2];a.faces.push(new THREE.Face4(b,c,d,f,[new THREE.Vector3(e[h*3],e[h*3+1],e[h*3+2]),new THREE.Vector3(m,p,l),new THREE.Vector3(w,t,k),new THREE.Vector3(z,y,j)],null,g))},
+uv3:function(a,e,b,c,d,f,g){var h=[];h.push(new THREE.UV(e,b));h.push(new THREE.UV(c,d));h.push(new THREE.UV(f,g));a.push(h)},uv4:function(a,e,b,c,d,f,g,h,l){var k=[];k.push(new THREE.UV(e,b));k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,l));a.push(k)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+THREE.MarchingCubes=function(a,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,d){return b+(c-b)*d};this.VIntX=function(b,c,d,f,g,h,l,k,j,m){g=(g-j)/(m-j);j=this.normal_cache;c[f]=h+g*this.delta;c[f+1]=l;c[f+2]=k;d[f]=this.lerp(j[b],j[b+3],g);d[f+1]=this.lerp(j[b+1],j[b+4],g);d[f+2]=this.lerp(j[b+2],j[b+5],g)};this.VIntY=function(b,c,d,f,g,h,l,k,j,m){g=(g-j)/(m-j);j=this.normal_cache;c[f]=h;c[f+1]=l+g*this.delta;c[f+
+2]=k;c=b+this.yd*3;d[f]=this.lerp(j[b],j[c],g);d[f+1]=this.lerp(j[b+1],j[c+1],g);d[f+2]=this.lerp(j[b+2],j[c+2],g)};this.VIntZ=function(b,c,d,f,g,h,l,k,j,m){g=(g-j)/(m-j);j=this.normal_cache;c[f]=h;c[f+1]=l;c[f+2]=k+g*this.delta;c=b+this.zd*3;d[f]=this.lerp(j[b],j[c],g);d[f+1]=this.lerp(j[b+1],j[c+1],g);d[f+2]=this.lerp(j[b+2],j[c+2],g)};this.compNorm=function(b){var c=b*3;if(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,d,f,g,h){var l=f+1,k=f+this.yd,j=f+this.zd,m=l+this.yd,p=l+this.zd,w=f+this.yd+this.zd,t=l+this.yd+this.zd,z=0,y=this.field[f],A=this.field[l],C=this.field[k],n=this.field[m],E=this.field[j],D=this.field[p],L=this.field[w],M=this.field[t];y<g&&(z|=1);A<g&&(z|=2);C<g&&(z|=8);n<g&&(z|=4);E<g&&(z|=16);D<g&&(z|=32);L<g&&(z|=128);M<g&&(z|=64);var K=THREE.edgeTable[z];if(K==0)return 0;
+var J=this.delta,G=b+J,N=c+J;J=d+J;if(K&1){this.compNorm(f);this.compNorm(l);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,c,d,y,A)}if(K&2){this.compNorm(l);this.compNorm(m);this.VIntY(l*3,this.vlist,this.nlist,3,g,G,c,d,A,n)}if(K&4){this.compNorm(k);this.compNorm(m);this.VIntX(k*3,this.vlist,this.nlist,6,g,b,N,d,C,n)}if(K&8){this.compNorm(f);this.compNorm(k);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,c,d,y,C)}if(K&16){this.compNorm(j);this.compNorm(p);this.VIntX(j*3,this.vlist,this.nlist,12,g,b,c,J,
+E,D)}if(K&32){this.compNorm(p);this.compNorm(t);this.VIntY(p*3,this.vlist,this.nlist,15,g,G,c,J,D,M)}if(K&64){this.compNorm(w);this.compNorm(t);this.VIntX(w*3,this.vlist,this.nlist,18,g,b,N,J,L,M)}if(K&128){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,21,g,b,c,J,E,L)}if(K&256){this.compNorm(f);this.compNorm(j);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,c,d,y,E)}if(K&512){this.compNorm(l);this.compNorm(p);this.VIntZ(l*3,this.vlist,this.nlist,27,g,G,c,d,A,D)}if(K&1024){this.compNorm(m);
+this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,30,g,G,N,d,n,M)}if(K&2048){this.compNorm(k);this.compNorm(w);this.VIntZ(k*3,this.vlist,this.nlist,33,g,b,N,d,C,L)}z<<=4;for(g=f=0;THREE.triTable[z+g]!=-1;){b=z+g;c=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[d],h);g+=3;f++}return f};this.posnormtriv=function(b,c,d,f,g,h){var l=this.count*3;this.positionArray[l]=b[d];this.positionArray[l+1]=b[d+1];this.positionArray[l+2]=b[d+2];this.positionArray[l+
+3]=b[f];this.positionArray[l+4]=b[f+1];this.positionArray[l+5]=b[f+2];this.positionArray[l+6]=b[g];this.positionArray[l+7]=b[g+1];this.positionArray[l+8]=b[g+2];this.normalArray[l]=c[d];this.normalArray[l+1]=c[d+1];this.normalArray[l+2]=c[d+2];this.normalArray[l+3]=c[f];this.normalArray[l+4]=c[f+1];this.normalArray[l+5]=c[f+2];this.normalArray[l+6]=c[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,d,f,g){var h=this.size*Math.sqrt(f/g),l=d*this.size,k=c*this.size,j=b*this.size,m=Math.floor(l-h);m<1&&(m=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var w=Math.floor(j-h);w<1&&(w=1);h=Math.floor(j+h);
+h>this.size-1&&(h=this.size-1);for(var t,z,y,A,C,n;m<l;m++){j=this.size2*m;z=m/this.size-d;C=z*z;for(z=p;z<k;z++){y=j+this.size*z;t=z/this.size-c;n=t*t;for(t=w;t<h;t++){A=t/this.size-b;A=f/(1.0E-6+A*A+n+C)-g;A>0&&(this.field[y+t]+=A)}}}};this.addPlaneX=function(b,c){var d,f,g,h,l,k=this.size,j=this.yd,m=this.zd,p=this.field,w=k*Math.sqrt(b/c);w>k&&(w=k);for(d=0;d<w;d++){f=d/k;f*=f;h=b/(1.0E-4+f)-c;if(h>0)for(f=0;f<k;f++){l=d+f*j;for(g=0;g<k;g++)p[m*g+l]+=h}}};this.addPlaneY=function(b,c){var d,f,
+g,h,l,k,j=this.size,m=this.yd,p=this.zd,w=this.field,t=j*Math.sqrt(b/c);t>j&&(t=j);for(f=0;f<t;f++){d=f/j;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=f*m;for(d=0;d<j;d++){k=l+d;for(g=0;g<j;g++)w[p*g+k]+=h}}}};this.addPlaneZ=function(b,c){var d,f,g,h,l,k;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(g=0;g<dist;g++){d=g/size;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=zd*g;for(f=0;f<size;f++){k=l+f*yd;for(d=0;d<size;d++)field[k+d]+=h}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,d,f,g,h,l,k,j,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++){j=m+this.size*f;l=(f-this.halfsize)/this.halfsize;for(d=1;d<p;d++){h=(d-this.halfsize)/this.halfsize;c=j+d;this.polygonize(h,l,k,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(d){var f,g,h,l,k,j,m,p;for(f=
+0;f<d.count;f++){k=f*3;m=k+1;p=k+2;g=d.positionArray[k];h=d.positionArray[m];l=d.positionArray[p];j=new THREE.Vector3(g,h,l);g=d.normalArray[k];h=d.normalArray[m];l=d.normalArray[p];k=new THREE.Vector3(g,h,l);k.normalize();k=new THREE.Vertex(j,k);c.vertices.push(k)}nfaces=d.count/3;for(f=0;f<nfaces;f++){k=(b+f)*3;m=k+1;p=k+2;j=c.vertices[k].normal;g=c.vertices[m].normal;h=c.vertices[p].normal;k=new THREE.Face3(k,m,p,[j,g,h]);c.faces.push(k)}b+=nfaces;d.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,

+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeWebGL.js

@@ -48,7 +48,7 @@ c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?
 THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,m=g*f;this.w=i*h-m*d;this.x=i*d+m*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,m=a.z;a=a.w;this.x=c*a+f*h+d*m-g*i;this.y=d*a+f*i+g*h-c*m;this.z=g*a+f*m+c*i-d*h;this.w=f*a-c*h-d*i-g*m;return this},
 multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,m=this.z,o=this.w,t=o*d+i*f-m*g,x=o*g+m*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-m*f;c.x=t*o+d*-h+x*-m-y*-i;c.y=x*o+d*-i+y*-h-t*-m;c.z=y*o+d*-m+t*-i-x*-h;return c}};
-THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;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.UV=function(a,c){this.set(a||0,c||0)};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 5 - 4
src/extras/io/JSONLoader.js

@@ -171,6 +171,10 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 			}
 
+			// to get face <=> uv index correspondence
+
+			fi = geometry.faces.length;
+
 			if ( hasFaceUv ) {
 
 				for ( i = 0; i < nUvLayers; i++ ) {
@@ -182,7 +186,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 					u = uvLayer[ uvIndex * 2 ];
 					v = uvLayer[ uvIndex * 2 + 1 ];
 
-					geometry.faceUvs[ i ].push( new THREE.UV( u, v ) );
+					geometry.faceUvs[ i ][ fi ] = new THREE.UV( u, v );
 
 				}
 
@@ -207,9 +211,6 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 					}
 
-					// to get face <=> uv index correspondence
-
-					fi = geometry.faces.length;
 					geometry.faceVertexUvs[ i ][ fi ] = uvs;
 
 				}

+ 266 - 10
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/import_threejs.py

@@ -33,10 +33,254 @@ import mathutils
 from mathutils.geometry import tesselate_polygon
 from io_utils import load_image, unpack_list, unpack_face_list
 
+# #####################################################
+# Generators
+# #####################################################
+
+def create_mesh_object(name, vertices, faces):
+
+    # Create a new mesh
+    
+    me = bpy.data.meshes.new(name)
+    me.from_pydata(vertices, [], faces)
+    me.update()                                 # update the mesh with the new data
+
+    # Create a new object
+    
+    ob = bpy.data.objects.new(name, me) 
+    ob.data = me                                # link the mesh data to the object
+
+    scene = bpy.context.scene                   # get the current scene
+    scene.objects.link(ob)                      # link the object into the scene
+
+    ob.location = scene.cursor_location         # position object at 3d-cursor
+    
+    
+# #####################################################
+# Faces
+# #####################################################
+
+def extract_faces(data):
+    
+    result = {
+    "faces"         : [],
+    "materials"     : [],
+    "faceUvs"       : [],
+    "vertexUvs"     : [],
+    "faceNormals"   : [],
+    "vertexNormals" : [],
+    "faceColors"    : [],
+    "vertexColors"  : []
+    }
+    
+    faces = data.get("faces", [])
+    normals = data.get("normals", [])
+    colors = data.get("colors", [])
+
+    offset = 0
+    zLength = len(faces)
+
+    # disregard empty arrays
+
+    nUvLayers = 0
+
+    for layer in data["uvs"]:
+
+        if len(layer) > 0:
+            nUvLayers += 1
+            result["faceUvs"].append([])
+            result["vertexUvs"].append([])
+
+
+    while ( offset < zLength ):
+
+        type = faces[ offset ]
+        offset += 1
+
+        isQuad          	= isBitSet( type, 0 )
+        hasMaterial         = isBitSet( type, 1 )
+        hasFaceUv           = isBitSet( type, 2 )
+        hasFaceVertexUv     = isBitSet( type, 3 )
+        hasFaceNormal       = isBitSet( type, 4 )
+        hasFaceVertexNormal = isBitSet( type, 5 )
+        hasFaceColor	    = isBitSet( type, 6 )
+        hasFaceVertexColor  = isBitSet( type, 7 )
+
+        #print("type", type, "bits", isQuad, hasMaterial, hasFaceUv, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor)
+
+        # vertices
+        
+        if isQuad:
+
+            a = faces[ offset ]
+            offset += 1
+            
+            b = faces[ offset ]
+            offset += 1
+            
+            c = faces[ offset ]
+            offset += 1
+            
+            d = faces[ offset ]
+            offset += 1
+            
+            face = [a, b, c, d]
+
+            nVertices = 4
+
+        else:
+
+            a = faces[ offset ]
+            offset += 1
+            
+            b = faces[ offset ]
+            offset += 1
+            
+            c = faces[ offset ]
+            offset += 1
+
+            face = [a, b, c]
+            
+            nVertices = 3
+
+        result["faces"].append(face)
+
+        # material
+        
+        if hasMaterial:
+
+            materialIndex = faces[ offset ]
+            offset += 1
+        
+        else:
+
+            materialIndex = -1
+
+        result["materials"].append(materialIndex)
+
+        # uvs
+
+        for i in range(nUvLayers):
+
+            faceUv = None
+            
+            if hasFaceUv:
+                
+                uvLayer = data["uvs"][ i ]
+
+                uvIndex = faces[ offset ]
+                offset += 1
+
+                u = uvLayer[ uvIndex * 2 ]
+                v = uvLayer[ uvIndex * 2 + 1 ]
+
+                faceUv = [u, v]
+                
+            result["faceUvs"][i].append(faceUv)
+
+
+            if hasFaceVertexUv:
+
+                uvLayer = data["uvs"][ i ]
+
+                vertexUvs = []
+
+                for j in range(nVertices):
+
+                    uvIndex = faces[ offset ]
+                    offset += 1
+
+                    u = uvLayer[ uvIndex * 2 ]
+                    v = uvLayer[ uvIndex * 2 + 1 ]
+
+                    vertexUvs.append([u, v])
+
+            result["vertexUvs"][i].append(vertexUvs)
+
+
+        if hasFaceNormal:
+
+            normalIndex = faces[ offset ] * 3
+            offset += 1
+
+            x = normals[ normalIndex ]
+            y = normals[ normalIndex + 1 ]
+            z = normals[ normalIndex + 2 ]
+
+            faceNormal = [x, y, z]
+            
+        else:
+
+            faceNormal = None
+        
+        result["faceNormals"].append(faceNormal)
+
+
+        if hasFaceVertexNormal:
+
+            vertexNormals = []
+            
+            for j in range(nVertices):
+
+                normalIndex = faces[ offset ] * 3
+                offset += 1
+
+                x = normals[ normalIndex ]
+                y = normals[ normalIndex + 1 ]
+                z = normals[ normalIndex + 2 ]
+                
+                vertexNormals.append( [x, y, z] )
+
+
+        else:
+
+            vertexNormals = None
+        
+        result["vertexNormals"].append(vertexNormals)
+
+
+        if hasFaceColor:
+
+            colorIndex = faces[ offset ]
+            offset += 1
+            
+            faceColor = colors[ colorIndex ]
+
+        else:
+            
+            faceColor = None
+
+        result["faceColors"].append(faceColor)
+
+
+        if hasFaceVertexColor:
+
+            vertexColors = []
+
+            for j in range(nVertices):
+
+                colorIndex = faces[ offset ]
+                offset += 1
+
+                color = colors[ colorIndex ]
+                vertexColors.append( color )
+
+        else:
+            
+            vertexColors = None
+            
+        result["vertexColors"].append(vertexColors)
+
+
+    return result
+    
 # #####################################################
 # Utils
 # #####################################################
 
+def isBitSet(value, position):
+    return value & ( 1 << position )
+    
 def splitArray(data, chunkSize):
     result = []
     chunk = []
@@ -58,6 +302,9 @@ def extract_json_string(text):
     end = text.rfind("}", start, end)
     return text[start:end+1].strip()
 
+def get_name(filepath):
+    return os.path.splitext(os.path.basename(filepath))[0]
+    
 # #####################################################
 # Parser
 # #####################################################
@@ -68,8 +315,10 @@ def load(operator, context, filepath):
 
     time_main = time.time()
 
-    verts_loc = []
-    verts_tex = []
+    vertices = []
+    uvs = []
+    normals = []
+    colors = []
     faces = [] 
     materials = []
 
@@ -90,23 +339,30 @@ def load(operator, context, filepath):
     
     time_sub = time_new
 
-    verts_loc = splitArray(data["vertices"], 3)
-    verts_loc[:] = [(v[0], v[2], -v[1]) for v in verts_loc]
+    # flip YZ
+    
+    vertices = splitArray(data["vertices"], 3)
+    vertices[:] = [(v[0], v[2], v[1]) for v in vertices]
+        
+    if data["normals"]:
+        normals = splitArray(data["normals"], 3)
+        normals[:] = [(v[0], v[2], v[1]) for v in normals]
+        
 
+    # extract faces
+    
+    face_data = extract_faces(data)
+    
     # deselect all
 
     bpy.ops.object.select_all(action='DESELECT')
 
-    scene = context.scene
-    new_objects = []
 
-    print('\tbuilding geometry...\n\tverts:%i faces:%i materials: %i ...' % ( len(verts_loc), len(faces), len(materials) ))
+    print('\tbuilding geometry...\n\tfaces:%i, vertices:%i, normals: %i, uvs: %i, colors: %i, materials: %i ...' % ( len(faces), len(vertices), len(normals), len(uvs), len(colors), len(materials) ))
 
     # Create new obj
     
-    for obj in new_objects:
-        base = scene.objects.link(obj)
-        base.select = True
+    create_mesh_object(get_name(filepath), vertices, face_data["faces"])
 
     scene.update()