Browse Source

Fixed more globals in JSONLoader. Also updated ubiquity test includes.

alteredq 14 years ago
parent
commit
a53921fb22
4 changed files with 236 additions and 236 deletions
  1. 152 153
      build/Three.js
  2. 79 80
      build/custom/ThreeExtras.js
  3. 1 1
      examples/misc_ubiquity_test.html
  4. 4 2
      src/extras/io/JSONLoader.js

+ 152 - 153
build/Three.js

@@ -12,21 +12,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
 THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(G,L,V,D){D=D.clone().subSelf(L);V=V.clone().subSelf(L);var M=G.clone().subSelf(L);G=D.dot(D);L=D.dot(V);D=D.dot(M);var O=V.dot(V);V=V.dot(M);M=1/(G*O-L*L);O=(O*D-L*V)*M;G=(G*V-L*D)*M;return O>0&&G>0&&O+G<1}var c,f,g,h,j,k,n,p,o,x,
-A,t=b.geometry,C=t.vertices,E=[];c=0;for(f=t.faces.length;c<f;c++){g=t.faces[c];x=this.origin.clone();A=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(C[g.a].position.clone());j=n.multiplyVector3(C[g.b].position.clone());k=n.multiplyVector3(C[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(C[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=A.dot(p);if(o<0){p=p.dot((new THREE.Vector3).sub(h,x))/o;x=x.addSelf(A.multiplyScalar(p));
-if(g instanceof THREE.Face3){if(d(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};E.push(g)}}else if(g instanceof THREE.Face4&&(d(x,h,j,n)||d(x,j,k,n))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};E.push(g)}}}return E}};
+THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(I,G,U,D){D=D.clone().subSelf(G);U=U.clone().subSelf(G);var M=I.clone().subSelf(G);I=D.dot(D);G=D.dot(U);D=D.dot(M);var O=U.dot(U);U=U.dot(M);M=1/(I*O-G*G);O=(O*D-G*U)*M;I=(I*U-G*D)*M;return O>0&&I>0&&O+I<1}var c,f,g,h,j,k,n,p,o,x,
+A,t=b.geometry,C=t.vertices,F=[];c=0;for(f=t.faces.length;c<f;c++){g=t.faces[c];x=this.origin.clone();A=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(C[g.a].position.clone());j=n.multiplyVector3(C[g.b].position.clone());k=n.multiplyVector3(C[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(C[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=A.dot(p);if(o<0){p=p.dot((new THREE.Vector3).sub(h,x))/o;x=x.addSelf(A.multiplyScalar(p));
+if(g instanceof THREE.Face3){if(d(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(d(x,h,j,n)||d(x,j,k,n))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}}return F}};
 THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,x){k=!1;d=n;c=p;f=o;g=x;b()};this.addPoint=function(n,p){if(k){k=!1;d=n;c=p;f=n;g=p}else{d=d<n?d:n;c=c<p?c:p;f=f>n?f:n;g=g>p?g:p}b()};
 this.add3Points=function(n,p,o,x,A,t){if(k){k=!1;d=n<o?n<A?n:A:o<A?o:A;c=p<x?p<t?p:t:x<t?x:t;f=n>o?n>A?n:A:o>A?o:A;g=p>x?p>t?p:t:x>t?x:t}else{d=n<o?n<A?n<d?n:d:A<d?A:d:o<A?o<d?o:d:A<d?A:d;c=p<x?p<t?p<c?p:c:t<c?t:c:x<t?x<c?x:c:t<c?t:c;f=n>o?n>A?n>f?n:f:A>f?A:f:o>A?o>f?o:f:A>f?A:f;g=p>x?p>t?p>g?p:g:t>g?t:g:x>t?x>g?x:g:t>g?t:g}b()};this.addRectangle=function(n){if(k){k=!1;d=n.getLeft();c=n.getTop();f=n.getRight();g=n.getBottom()}else{d=d<n.getLeft()?d:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
 f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){d-=n;c-=n;f+=n;g+=n;b()};this.minSelf=function(n){d=d>n.getLeft()?d:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();g=g<n.getBottom()?g:n.getBottom();b()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(d,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
-THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,E){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,A||0,t||0,C||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,E){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=x;this.n41=A;this.n42=t;this.n43=C;this.n44=E;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
+THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,A||0,t||0,C||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=x;this.n41=A;this.n42=t;this.n43=C;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,E=b.n42,G=b.n43,L=b.n44,V=d.n11,D=d.n12,M=d.n13,O=d.n14,Q=d.n21,Ia=d.n22,
-ua=d.n23,Aa=d.n24,da=d.n31,e=d.n32,ga=d.n33,Ba=d.n34;this.n11=c*V+f*Q+g*da;this.n12=c*D+f*Ia+g*e;this.n13=c*M+f*ua+g*ga;this.n14=c*O+f*Aa+g*Ba+h;this.n21=j*V+k*Q+n*da;this.n22=j*D+k*Ia+n*e;this.n23=j*M+k*ua+n*ga;this.n24=j*O+k*Aa+n*Ba+p;this.n31=o*V+x*Q+A*da;this.n32=o*D+x*Ia+A*e;this.n33=o*M+x*ua+A*ga;this.n34=o*O+x*Aa+A*Ba+t;this.n41=C*V+E*Q+G*da;this.n42=C*D+E*Ia+G*e;this.n43=C*M+E*ua+G*ga;this.n44=C*O+E*Aa+G*Ba+L;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,F=b.n42,I=b.n43,G=b.n44,U=d.n11,D=d.n12,M=d.n13,O=d.n14,Q=d.n21,Ia=d.n22,
+ua=d.n23,Aa=d.n24,da=d.n31,e=d.n32,ga=d.n33,Ba=d.n34;this.n11=c*U+f*Q+g*da;this.n12=c*D+f*Ia+g*e;this.n13=c*M+f*ua+g*ga;this.n14=c*O+f*Aa+g*Ba+h;this.n21=j*U+k*Q+n*da;this.n22=j*D+k*Ia+n*e;this.n23=j*M+k*ua+n*ga;this.n24=j*O+k*Aa+n*Ba+p;this.n31=o*U+x*Q+A*da;this.n32=o*D+x*Ia+A*e;this.n33=o*M+x*ua+A*ga;this.n34=o*O+x*Aa+A*Ba+t;this.n41=C*U+F*Q+I*da;this.n42=C*D+F*Ia+I*e;this.n43=C*M+F*ua+I*ga;this.n44=C*O+F*Aa+I*Ba+G;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
 this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,x=this.n34,A=this.n41,t=this.n42,C=this.n43,E=this.n44;return f*j*p*A-c*k*p*A-f*h*o*A+d*k*o*A+c*h*x*A-d*j*x*A-f*j*n*t+c*k*n*t+f*g*o*t-b*k*o*t-c*g*x*t+b*j*x*t+f*h*n*C-d*k*n*C-f*g*p*C+b*k*p*C+d*g*x*C-b*h*x*C-c*h*n*E+d*j*n*E+c*g*p*E-b*j*p*E-d*g*o*E+b*h*o*E},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,x=this.n34,A=this.n41,t=this.n42,C=this.n43,F=this.n44;return f*j*p*A-c*k*p*A-f*h*o*A+d*k*o*A+c*h*x*A-d*j*x*A-f*j*n*t+c*k*n*t+f*g*o*t-b*k*o*t-c*g*x*t+b*j*x*t+f*h*n*C-d*k*n*C-f*g*p*C+b*k*p*C+d*g*x*C-b*h*x*C-c*h*n*F+d*j*n*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
@@ -34,8 +34,8 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 1-c,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+c,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+c,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33=
 b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var n=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=d+j;this.n21=n+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,E=b.n42,G=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*t*E-p*A*E+p*x*G-k*t*G-n*x*L+k*A*L;d.n12=h*A*E-g*t*E-h*x*G+f*t*G+g*x*L-f*A*L;d.n13=g*p*E-h*n*E+h*k*G-f*p*G-g*k*L+f*n*L;d.n14=h*n*x-g*p*x-h*k*A+f*p*A+g*k*t-f*n*t;d.n21=p*A*C-n*t*C-p*o*G+j*t*G+n*o*L-j*A*L;d.n22=g*t*C-h*A*C+h*o*G-c*t*G-g*o*L+c*A*L;d.n23=h*n*C-g*p*C-h*j*G+c*p*G+g*j*L-c*n*L;
-d.n24=g*p*o-h*n*o+h*j*A-c*p*A-g*j*t+c*n*t;d.n31=k*t*C-p*x*C+p*o*E-j*t*E-k*o*L+j*x*L;d.n32=h*x*C-f*t*C-h*o*E+c*t*E+f*o*L-c*x*L;d.n33=g*p*C-h*k*C+h*j*E-c*p*E-f*j*L+c*k*L;d.n34=h*k*o-f*p*o-h*j*x+c*p*x+f*j*t-c*k*t;d.n41=n*x*C-k*A*C-n*o*E+j*A*E+k*o*G-j*x*G;d.n42=f*A*C-g*x*C+g*o*E-c*A*E-f*o*G+c*x*G;d.n43=g*k*C-f*n*C-g*j*E+c*n*E+f*j*G-c*k*G;d.n44=f*n*o-g*k*o+g*j*x-c*n*x-f*j*A+c*k*A;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,F=b.n42,I=b.n43,G=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*t*F-p*A*F+p*x*I-k*t*I-n*x*G+k*A*G;d.n12=h*A*F-g*t*F-h*x*I+f*t*I+g*x*G-f*A*G;d.n13=g*p*F-h*n*F+h*k*I-f*p*I-g*k*G+f*n*G;d.n14=h*n*x-g*p*x-h*k*A+f*p*A+g*k*t-f*n*t;d.n21=p*A*C-n*t*C-p*o*I+j*t*I+n*o*G-j*A*G;d.n22=g*t*C-h*A*C+h*o*I-c*t*I-g*o*G+c*A*G;d.n23=h*n*C-g*p*C-h*j*I+c*p*I+g*j*G-c*n*G;
+d.n24=g*p*o-h*n*o+h*j*A-c*p*A-g*j*t+c*n*t;d.n31=k*t*C-p*x*C+p*o*F-j*t*F-k*o*G+j*x*G;d.n32=h*x*C-f*t*C-h*o*F+c*t*F+f*o*G-c*x*G;d.n33=g*p*C-h*k*C+h*j*F-c*p*F-f*j*G+c*k*G;d.n34=h*k*o-f*p*o-h*j*x+c*p*x+f*j*t-c*k*t;d.n41=n*x*C-k*A*C-n*o*F+j*A*F+k*o*I-j*x*I;d.n42=f*A*C-g*x*C+g*o*F-c*A*F-f*o*I+c*x*I;d.n43=g*k*C-f*n*C-g*j*F+c*n*F+f*j*I-c*k*I;d.n44=f*n*o-g*k*o+g*j*x-c*n*x-f*j*A+c*k*A;d.multiplyScalar(1/b.determinant());return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*n;c[6]=b*p;c[7]=b*o;c[8]=b*x;return d};
 THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
 THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=d-b;n=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,15 +56,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);n.sub(d.position,c.position);k.crossSelf(n)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ea,va,Ca,ka,aa,ra,Ga){k=ea.vertices[va].position;n=ea.vertices[Ca].position;p=ea.vertices[ka].position;o=j[aa];x=j[ra];A=j[Ga];t=n.x-k.x;C=p.x-k.x;E=n.y-k.y;G=p.y-k.y;L=n.z-k.z;V=p.z-k.z;D=x.u-o.u;M=A.u-o.u;O=x.v-o.v;Q=A.v-o.v;Ia=1/(D*
-Q-M*O);e.set((Q*t-O*C)*Ia,(Q*E-O*G)*Ia,(Q*L-O*V)*Ia);ga.set((D*C-M*t)*Ia,(D*G-M*E)*Ia,(D*V-M*L)*Ia);Aa[va].addSelf(e);Aa[Ca].addSelf(e);Aa[ka].addSelf(e);da[va].addSelf(ga);da[Ca].addSelf(ga);da[ka].addSelf(ga)}var d,c,f,g,h,j,k,n,p,o,x,A,t,C,E,G,L,V,D,M,O,Q,Ia,ua,Aa=[],da=[],e=new THREE.Vector3,ga=new THREE.Vector3,Ba=new THREE.Vector3,Ja=new THREE.Vector3,Ka=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){Aa[d]=new THREE.Vector3;da[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ea,va,Ca,ka,aa,ra,Ga){k=ea.vertices[va].position;n=ea.vertices[Ca].position;p=ea.vertices[ka].position;o=j[aa];x=j[ra];A=j[Ga];t=n.x-k.x;C=p.x-k.x;F=n.y-k.y;I=p.y-k.y;G=n.z-k.z;U=p.z-k.z;D=x.u-o.u;M=A.u-o.u;O=x.v-o.v;Q=A.v-o.v;Ia=1/(D*
+Q-M*O);e.set((Q*t-O*C)*Ia,(Q*F-O*I)*Ia,(Q*G-O*U)*Ia);ga.set((D*C-M*t)*Ia,(D*I-M*F)*Ia,(D*U-M*G)*Ia);Aa[va].addSelf(e);Aa[Ca].addSelf(e);Aa[ka].addSelf(e);da[va].addSelf(ga);da[Ca].addSelf(ga);da[ka].addSelf(ga)}var d,c,f,g,h,j,k,n,p,o,x,A,t,C,F,I,G,U,D,M,O,Q,Ia,ua,Aa=[],da=[],e=new THREE.Vector3,ga=new THREE.Vector3,Ba=new THREE.Vector3,Ja=new THREE.Vector3,Ka=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){Aa[d]=new THREE.Vector3;da[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
 this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var wa=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Ka.copy(h.vertexNormals[f]);g=h[wa[f]];ua=Aa[g];Ba.copy(ua);Ba.subSelf(Ka.multiplyScalar(Ka.dot(ua))).normalize();Ja.cross(h.vertexNormals[f],ua);g=Ja.dot(da[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(Ba.x,
 Ba.y,Ba.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
 {radius:b}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function d(t,C,E,G,L,V,D){t=(E-t)*0.5;G=(G-C)*0.5;return(2*(C-E)+t+G)*D+(-3*(C-E)-2*t-G)*V+t*L+C}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,x,A;this.initFromArray=function(t){this.points=[];for(var C=0;C<t.length;C++)this.points[C]={x:t[C][0],y:t[C][1],z:t[C][2]}};this.getPoint=function(t){g=(this.points.length-1)*t;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]];
-x=this.points[c[2]];A=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,x.x,A.x,j,k,n);f.y=d(p.y,o.y,x.y,A.y,j,k,n);f.z=d(p.z,o.z,x.z,A.z,j,k,n);return f};this.getControlPointsArray=function(){var t,C,E=this.points.length,G=[];for(t=0;t<E;t++){C=this.points[t];G[t]=[C.x,C.y,C.z]}return G};this.getLength=function(t){var C,E,G=C=C=0,L=new THREE.Vector3,V=new THREE.Vector3,D=[],M=0;D[0]=0;t||(t=100);E=this.points.length*t;L.copy(this.points[0]);for(t=1;t<E;t++){C=t/E;position=this.getPoint(C);V.copy(position);
-M+=V.distanceTo(L);L.copy(position);C*=this.points.length-1;C=Math.floor(C);if(C!=G){D[C]=M;G=C}}D[D.length]=M;return{chunks:D,total:M}};this.reparametrizeByArcLength=function(t){var C,E,G,L,V,D,M=[],O=new THREE.Vector3,Q=this.getLength();M.push(O.copy(this.points[0]).clone());for(C=1;C<this.points.length;C++){E=Q.chunks[C]-Q.chunks[C-1];D=Math.ceil(t*E/Q.total);L=(C-1)/(this.points.length-1);V=C/(this.points.length-1);for(E=1;E<D-1;E++){G=L+E*(1/D)*(V-L);position=this.getPoint(G);M.push(O.copy(position).clone())}M.push(O.copy(this.points[C]).clone())}this.points=
+THREE.Spline=function(b){function d(t,C,F,I,G,U,D){t=(F-t)*0.5;I=(I-C)*0.5;return(2*(C-F)+t+I)*D+(-3*(C-F)-2*t-I)*U+t*G+C}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,x,A;this.initFromArray=function(t){this.points=[];for(var C=0;C<t.length;C++)this.points[C]={x:t[C][0],y:t[C][1],z:t[C][2]}};this.getPoint=function(t){g=(this.points.length-1)*t;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]];
+x=this.points[c[2]];A=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,x.x,A.x,j,k,n);f.y=d(p.y,o.y,x.y,A.y,j,k,n);f.z=d(p.z,o.z,x.z,A.z,j,k,n);return f};this.getControlPointsArray=function(){var t,C,F=this.points.length,I=[];for(t=0;t<F;t++){C=this.points[t];I[t]=[C.x,C.y,C.z]}return I};this.getLength=function(t){var C,F,I=C=C=0,G=new THREE.Vector3,U=new THREE.Vector3,D=[],M=0;D[0]=0;t||(t=100);F=this.points.length*t;G.copy(this.points[0]);for(t=1;t<F;t++){C=t/F;position=this.getPoint(C);U.copy(position);
+M+=U.distanceTo(G);G.copy(position);C*=this.points.length-1;C=Math.floor(C);if(C!=I){D[C]=M;I=C}}D[D.length]=M;return{chunks:D,total:M}};this.reparametrizeByArcLength=function(t){var C,F,I,G,U,D,M=[],O=new THREE.Vector3,Q=this.getLength();M.push(O.copy(this.points[0]).clone());for(C=1;C<this.points.length;C++){F=Q.chunks[C]-Q.chunks[C-1];D=Math.ceil(t*F/Q.total);G=(C-1)/(this.points.length-1);U=C/(this.points.length-1);for(F=1;F<D-1;F++){I=G+F*(1/D)*(U-G);position=this.getPoint(I);M.push(O.copy(position).clone())}M.push(O.copy(this.points[C]).clone())}this.points=
 M}};
 THREE.AnimationHandler=function(){var b=[],d={},c={};c.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};c.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};c.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};c.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<0)g.hierarchy[h].keys[j].time=
 0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
@@ -76,7 +76,7 @@ g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
 THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,n,p,o=this.data.JIT.hierarchy,x,A;this.currentTime+=b*this.timeScale;A=this.currentTime;x=this.currentTime%=this.data.length;p=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,C=this.hierarchy.length;t<C;t++){b=this.hierarchy[t];n=b.animationCache;if(this.JITCompile&&o[t][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var E=0;E<3;E++){c=d[E];j=n.prevKey[c];k=n.nextKey[c];if(k.time<=A){if(x<A)if(this.loop){j=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(c,t,1);k.time<x;){j=k;k=this.getNextKeyWith(c,t,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,t,k.index+1)}while(k.time<
+!1}else{b.matrix=o[t][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var F=0;F<3;F++){c=d[F];j=n.prevKey[c];k=n.nextKey[c];if(k.time<=A){if(x<A)if(this.loop){j=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(c,t,1);k.time<x;){j=k;k=this.getNextKeyWith(c,t,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,t,k.index+1)}while(k.time<
 x)}n.prevKey[c]=j;n.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(x-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",t,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)o[t][p]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
@@ -140,63 +140,63 @@ THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updat
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,x=["a","b","c","d"];for(n=0;n<h;n++){k=d.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);for(k=
 0;k<p;k++){o=b[j[x[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,n,p,o,x,A,t,C,E,G=0,L=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(C=0;C<f;C++){h=d[L[C]];k=b[h];for(E=0;E<g;E++){j=c[L[E]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){p=k;o=n;x=h;A=j;t=L[C]}if(G===2){t+=L[C];return t==="ad"||t==="ac"?{faces:[d,c],vertices:[p,o,n,k],indices:[x,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,n,p,o,x,A,t,C,F,I=0,G=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(C=0;C<f;C++){h=d[G[C]];k=b[h];for(F=0;F<g;F++){j=c[G[F]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){I++;if(I===1){p=k;o=n;x=h;A=j;t=G[C]}if(I===2){t+=G[C];return t==="ad"||t==="ac"?{faces:[d,c],vertices:[p,o,n,k],indices:[x,
 A,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,n,o],indices:[x,h,j,A],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(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
 THREE.Projector=function(){function b(){var e=n[k]=n[k]||new THREE.RenderableVertex;k++;return e}function d(e,ga){return ga.z-e.z}function c(e,ga){var Ba=0,Ja=1,Ka=e.z+e.w,wa=ga.z+ga.w,ea=-e.z+e.w,va=-ga.z+ga.w;if(Ka>=0&&wa>=0&&ea>=0&&va>=0)return!0;else if(Ka<0&&wa<0||ea<0&&va<0)return!1;else{if(Ka<0)Ba=Math.max(Ba,Ka/(Ka-wa));else wa<0&&(Ja=Math.min(Ja,Ka/(Ka-wa)));if(ea<0)Ba=Math.max(Ba,ea/(ea-va));else va<0&&(Ja=Math.min(Ja,ea/(ea-va)));if(Ja<Ba)return!1;else{e.lerpSelf(ga,Ba);ga.lerpSelf(e,1-
-Ja);return!0}}}var f,g,h=[],j,k,n=[],p,o,x=[],A,t=[],C,E,G=[],L,V,D=[],M=new THREE.Vector4,O=new THREE.Vector4,Q=new THREE.Matrix4,Ia=new THREE.Matrix4,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Vector4,da=new THREE.Vector4;this.projectVector=function(e,ga){Q.multiply(ga.projectionMatrix,ga.matrixWorldInverse);Q.multiplyVector3(e);return e};this.unprojectVector=function(e,ga){Q.multiply(ga.matrixWorld,THREE.Matrix4.makeInvert(ga.projectionMatrix));
+Ja);return!0}}}var f,g,h=[],j,k,n=[],p,o,x=[],A,t=[],C,F,I=[],G,U,D=[],M=new THREE.Vector4,O=new THREE.Vector4,Q=new THREE.Matrix4,Ia=new THREE.Matrix4,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Vector4,da=new THREE.Vector4;this.projectVector=function(e,ga){Q.multiply(ga.projectionMatrix,ga.matrixWorldInverse);Q.multiplyVector3(e);return e};this.unprojectVector=function(e,ga){Q.multiply(ga.matrixWorld,THREE.Matrix4.makeInvert(ga.projectionMatrix));
 Q.multiplyVector3(e);return e};this.projectObjects=function(e,ga,Ba){ga=[];var Ja,Ka,wa;g=0;Ka=e.objects;e=0;for(Ja=Ka.length;e<Ja;e++){wa=Ka[e];var ea;if(!(ea=!wa.visible))if(ea=wa instanceof THREE.Mesh){a:{ea=void 0;for(var va=wa.matrixWorld,Ca=-wa.geometry.boundingSphere.radius*Math.max(wa.scale.x,Math.max(wa.scale.y,wa.scale.z)),ka=0;ka<6;ka++){ea=ua[ka].x*va.n14+ua[ka].y*va.n24+ua[ka].z*va.n34+ua[ka].w;if(ea<=Ca){ea=!1;break a}}ea=!0}ea=!ea}if(!ea){ea=h[g]=h[g]||new THREE.RenderableObject;g++;
-f=ea;M.copy(wa.position);Q.multiplyVector3(M);f.object=wa;f.z=M.z;ga.push(f)}}Ba&&ga.sort(d);return ga};this.projectScene=function(e,ga,Ba){var Ja=[],Ka=ga.near,wa=ga.far,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua,N,ca,sa;V=E=A=o=0;ga.matrixAutoUpdate&&ga.updateMatrix();e.update(undefined,!1,ga);Q.multiply(ga.projectionMatrix,ga.matrixWorldInverse);ua[0].set(Q.n41-Q.n11,Q.n42-Q.n12,Q.n43-Q.n13,Q.n44-Q.n14);ua[1].set(Q.n41+Q.n11,Q.n42+Q.n12,Q.n43+Q.n13,Q.n44+Q.n14);ua[2].set(Q.n41+Q.n21,Q.n42+Q.n22,
+f=ea;M.copy(wa.position);Q.multiplyVector3(M);f.object=wa;f.z=M.z;ga.push(f)}}Ba&&ga.sort(d);return ga};this.projectScene=function(e,ga,Ba){var Ja=[],Ka=ga.near,wa=ga.far,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua,N,ca,sa;U=F=A=o=0;ga.matrixAutoUpdate&&ga.updateMatrix();e.update(undefined,!1,ga);Q.multiply(ga.projectionMatrix,ga.matrixWorldInverse);ua[0].set(Q.n41-Q.n11,Q.n42-Q.n12,Q.n43-Q.n13,Q.n44-Q.n14);ua[1].set(Q.n41+Q.n11,Q.n42+Q.n12,Q.n43+Q.n13,Q.n44+Q.n14);ua[2].set(Q.n41+Q.n21,Q.n42+Q.n22,
 Q.n43+Q.n23,Q.n44+Q.n24);ua[3].set(Q.n41-Q.n21,Q.n42-Q.n22,Q.n43-Q.n23,Q.n44-Q.n24);ua[4].set(Q.n41-Q.n31,Q.n42-Q.n32,Q.n43-Q.n33,Q.n44-Q.n34);ua[5].set(Q.n41+Q.n31,Q.n42+Q.n32,Q.n43+Q.n33,Q.n44+Q.n34);for(ea=0;ea<6;ea++){pa=ua[ea];pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z))}pa=this.projectObjects(e,ga,!0);e=0;for(ea=pa.length;e<ea;e++){Ha=pa[e].object;if(Ha.visible){Ta=Ha.matrixWorld;ab=Ha.matrixRotationWorld;Xa=Ha.materials;Ua=Ha.overdraw;k=0;if(Ha instanceof THREE.Mesh){N=Ha.geometry;
 ka=N.vertices;ca=N.faces;N=N.faceVertexUvs;va=0;for(Ca=ka.length;va<Ca;va++){j=b();j.positionWorld.copy(ka[va].position);Ta.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);Q.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ka&&j.positionScreen.z<wa}ka=0;for(va=ca.length;ka<va;ka++){Ca=ca[ka];if(Ca instanceof THREE.Face3){aa=n[Ca.a];ra=n[Ca.b];Ga=n[Ca.c];if(aa.visible&&ra.visible&&Ga.visible&&
 (Ha.doubleSided||Ha.flipSided!=(Ga.positionScreen.x-aa.positionScreen.x)*(ra.positionScreen.y-aa.positionScreen.y)-(Ga.positionScreen.y-aa.positionScreen.y)*(ra.positionScreen.x-aa.positionScreen.x)<0)){la=x[o]=x[o]||new THREE.RenderableFace3;o++;p=la;p.v1.copy(aa);p.v2.copy(ra);p.v3.copy(Ga)}else continue}else if(Ca instanceof THREE.Face4){aa=n[Ca.a];ra=n[Ca.b];Ga=n[Ca.c];la=n[Ca.d];if(aa.visible&&ra.visible&&Ga.visible&&la.visible&&(Ha.doubleSided||Ha.flipSided!=((la.positionScreen.x-aa.positionScreen.x)*
 (ra.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ra.positionScreen.x-aa.positionScreen.x)<0||(ra.positionScreen.x-Ga.positionScreen.x)*(la.positionScreen.y-Ga.positionScreen.y)-(ra.positionScreen.y-Ga.positionScreen.y)*(la.positionScreen.x-Ga.positionScreen.x)<0))){sa=t[A]=t[A]||new THREE.RenderableFace4;A++;p=sa;p.v1.copy(aa);p.v2.copy(ra);p.v3.copy(Ga);p.v4.copy(la)}else continue}p.normalWorld.copy(Ca.normal);ab.multiplyVector3(p.normalWorld);p.centroidWorld.copy(Ca.centroid);
 Ta.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);Q.multiplyVector3(p.centroidScreen);Ga=Ca.vertexNormals;aa=0;for(ra=Ga.length;aa<ra;aa++){la=p.vertexNormalsWorld[aa];la.copy(Ga[aa]);ab.multiplyVector3(la)}aa=0;for(ra=N.length;aa<ra;aa++)if(sa=N[aa][ka]){Ga=0;for(la=sa.length;Ga<la;Ga++)p.uvs[aa][Ga]=sa[Ga]}p.meshMaterials=Xa;p.faceMaterials=Ca.materials;p.overdraw=Ua;p.z=p.centroidScreen.z;Ja.push(p)}}else if(Ha instanceof THREE.Line){Ia.multiply(Q,Ta);ka=Ha.geometry.vertices;
-aa=b();aa.positionScreen.copy(ka[0].position);Ia.multiplyVector4(aa.positionScreen);va=1;for(Ca=ka.length;va<Ca;va++){aa=b();aa.positionScreen.copy(ka[va].position);Ia.multiplyVector4(aa.positionScreen);ra=n[k-2];Aa.copy(aa.positionScreen);da.copy(ra.positionScreen);if(c(Aa,da)){Aa.multiplyScalar(1/Aa.w);da.multiplyScalar(1/da.w);Ta=G[E]=G[E]||new THREE.RenderableLine;E++;C=Ta;C.v1.positionScreen.copy(Aa);C.v2.positionScreen.copy(da);C.z=Math.max(Aa.z,da.z);C.materials=Ha.materials;Ja.push(C)}}}else if(Ha instanceof
-THREE.Particle){O.set(Ha.position.x,Ha.position.y,Ha.position.z,1);Q.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ta=D[V]=D[V]||new THREE.RenderableParticle;V++;L=Ta;L.x=O.x/O.w;L.y=O.y/O.w;L.z=O.z;L.rotation=Ha.rotation.z;L.scale.x=Ha.scale.x*Math.abs(L.x-(O.x+ga.projectionMatrix.n11)/(O.w+ga.projectionMatrix.n14));L.scale.y=Ha.scale.y*Math.abs(L.y-(O.y+ga.projectionMatrix.n22)/(O.w+ga.projectionMatrix.n24));L.materials=Ha.materials;Ja.push(L)}}}}Ba&&Ja.sort(d);return Ja}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var n,p,o,x,A,t,C,E;b=d.projectScene(j,k);n=0;for(p=b.length;n<p;n++){A=b[n];if(A instanceof THREE.RenderableParticle){C=A.x*g+g;E=A.y*h+h;o=0;for(x=A.material.length;o<x;o++){t=A.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=C+"px";t.style.top=E+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(ta){if(t!=ta)o.globalAlpha=t=ta}function d(ta){if(C!=ta){switch(ta){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}C=ta}}function c(ta){if(E!=ta)o.strokeStyle=E=ta}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),x=new THREE.Color(0),A=0,t=1,C=0,
-E=null,G=null,L=null,V=null,D=null,M,O,Q,Ia,ua=new THREE.RenderableVertex,Aa=new THREE.RenderableVertex,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra=new THREE.Color,Ga=new THREE.Color,la=new THREE.Color,pa=new THREE.Color,Ha=new THREE.Color,Ta,ab,Xa,Ua,N,ca,sa,Ea,ia,ma,m=new THREE.Rectangle,B=new THREE.Rectangle,z=new THREE.Rectangle,w=!1,y=new THREE.Color,P=new THREE.Color,H=new THREE.Color,I=new THREE.Color,J=new THREE.Vector3,F,K,X,qa,W,Fa,La=16;F=document.createElement("canvas");F.width=F.height=2;K=
-F.getContext("2d");K.fillStyle="rgba(0,0,0,1)";K.fillRect(0,0,2,2);X=K.getImageData(0,0,2,2);qa=X.data;W=document.createElement("canvas");W.width=W.height=La;Fa=W.getContext("2d");Fa.translate(-La/2,-La/2);Fa.scale(La,La);La--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ta,za){j=ta;k=za;n=j/2;p=k/2;h.width=j;h.height=k;m.set(-n,-p,n,p);t=1;C=0;D=V=L=G=E=null};this.setClearColor=function(ta,za){x=ta;A=za};this.setClearColorHex=function(ta,za){x.setHex(ta);
-A=za};this.clear=function(){o.setTransform(1,0,0,-1,n,p);if(!B.isEmpty()){B.inflate(1);B.minSelf(m);if(x.hex==0&&A==0)o.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{d(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+A+")";o.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(ta,za){function db(T){var ja,na,Y,ya=T.lights;P.setRGB(0,0,0);H.setRGB(0,0,0);I.setRGB(0,0,0);T=0;for(ja=
-ya.length;T<ja;T++){na=ya[T];Y=na.color;if(na instanceof THREE.AmbientLight){P.r+=Y.r;P.g+=Y.g;P.b+=Y.b}else if(na instanceof THREE.DirectionalLight){H.r+=Y.r;H.g+=Y.g;H.b+=Y.b}else if(na instanceof THREE.PointLight){I.r+=Y.r;I.g+=Y.g;I.b+=Y.b}}}function Z(T,ja,na,Y){var ya,xa,ha,U,Ma=T.lights;T=0;for(ya=Ma.length;T<ya;T++){xa=Ma[T];ha=xa.color;if(xa instanceof THREE.DirectionalLight){U=na.dot(xa.position);if(!(U<=0)){U*=xa.intensity;Y.r+=ha.r*U;Y.g+=ha.g*U;Y.b+=ha.b*U}}else if(xa instanceof THREE.PointLight){U=
-na.dot(J.sub(xa.position,ja).normalize());if(!(U<=0)){U*=xa.distance==0?1:1-Math.min(ja.distanceTo(xa.position)/xa.distance,1);if(U!=0){U*=xa.intensity;Y.r+=ha.r*U;Y.g+=ha.g*U;Y.b+=ha.b*U}}}}}function fa(T,ja,na){b(na.opacity);d(na.blending);var Y,ya,xa,ha,U,Ma;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ha=na.map.image;U=ha.width>>1;Ma=ha.height>>1;na=ja.scale.x*n;xa=ja.scale.y*p;Y=na*U;ya=xa*Ma;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);
-o.scale(na,-xa);o.translate(-U,-Ma);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){Y=ja.scale.x*n;ya=ja.scale.y*p;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){c(na.color.__styleString);xa=na.color.__styleString;if(G!=xa)o.fillStyle=G=xa;o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);o.scale(Y,ya);na.program(o);o.restore()}}}function oa(T,ja,na,Y){b(Y.opacity);d(Y.blending);o.beginPath();o.moveTo(T.positionScreen.x,T.positionScreen.y);o.lineTo(ja.positionScreen.x,
-ja.positionScreen.y);o.closePath();if(Y instanceof THREE.LineBasicMaterial){ra.__styleString=Y.color.__styleString;T=Y.linewidth;if(L!=T)o.lineWidth=L=T;T=Y.linecap;if(V!=T)o.lineCap=V=T;T=Y.linejoin;if(D!=T)o.lineJoin=D=T;c(ra.__styleString);o.stroke();z.inflate(Y.linewidth*2)}}function Na(T,ja,na,Y,ya,xa,ha,U,Ma){b(U.opacity);d(U.blending);da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;R(da,e,ga,Ba,Ja,Ka);if(U instanceof
-THREE.MeshBasicMaterial)if(U.map){if(U.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,U.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,Ua[ya].v,Ua[xa].u,Ua[xa].v)}}else if(U.envMap){if(U.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;J.copy(ha.vertexNormalsWorld[0]);N=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;ca=-(J.x*T.n21+J.y*T.n22+J.z*T.n23)*0.5+0.5;J.copy(ha.vertexNormalsWorld[1]);sa=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;Ea=-(J.x*T.n21+J.y*T.n22+
-J.z*T.n23)*0.5+0.5;J.copy(ha.vertexNormalsWorld[2]);ia=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;ma=-(J.x*T.n21+J.y*T.n22+J.z*T.n23)*0.5+0.5;Qa(da,e,ga,Ba,Ja,Ka,U.envMap.image,N,ca,sa,Ea,ia,ma)}}else U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){if(U.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,U.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,
-Ua[ya].v,Ua[xa].u,Ua[xa].v)}d(THREE.SubtractiveBlending)}if(w)if(!U.wireframe&&U.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=la.r=pa.r=P.r;Ga.g=la.g=pa.g=P.g;Ga.b=la.b=pa.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],pa);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else{y.r=P.r;y.g=P.g;
-y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=U.color.r*y.r;ra.g=U.color.g*y.g;ra.b=U.color.b*y.b;ra.updateStyleString();U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-
-gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(na.positionScreen.z,Ta,ab);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}}function $(T,ja,na,Y,ya,xa,ha,U,Ma){b(U.opacity);
-d(U.blending);if(U.map||U.envMap){Na(T,ja,Y,0,1,3,ha,U,Ma);Na(ya,na,xa,1,2,3,ha,U,Ma)}else{da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;wa=Y.positionScreen.x;ea=Y.positionScreen.y;va=ya.positionScreen.x;Ca=ya.positionScreen.y;ka=xa.positionScreen.x;aa=xa.positionScreen.y;if(U instanceof THREE.MeshBasicMaterial){Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,
-U.wireframeLinejoin):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshLambertMaterial)if(w)if(!U.wireframe&&U.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=la.r=pa.r=Ha.r=P.r;Ga.g=la.g=pa.g=Ha.g=P.g;Ga.b=la.b=pa.b=Ha.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v4.positionWorld,ha.vertexNormalsWorld[3],pa);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],Ha);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,
-wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}else{y.r=P.r;y.g=P.g;y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=U.color.r*y.r;ra.g=U.color.g*y.g;ra.b=U.color.b*y.b;ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else{Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):
-Pa(U.color.__styleString)}else if(U instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(Y.positionScreen.z,
-Ta,ab);Ha.r=Ha.g=Ha.b=1-gb(na.positionScreen.z,Ta,ab);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}}}function R(T,ja,na,Y,ya,xa){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(T,ja);o.closePath()}function Sa(T,ja,na,Y,ya,xa,ha,U){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(ha,U);o.lineTo(T,ja);o.closePath()}function fb(T,ja,na,Y){if(L!=ja)o.lineWidth=L=ja;if(V!=na)o.lineCap=
-V=na;if(D!=Y)o.lineJoin=D=Y;c(T);o.stroke();z.inflate(ja*2)}function Pa(T){if(G!=T)o.fillStyle=G=T;o.fill()}function Qa(T,ja,na,Y,ya,xa,ha,U,Ma,Ya,Wa,kb,Za){var hb,ib;hb=ha.width-1;ib=ha.height-1;U*=hb;Ma*=ib;Ya*=hb;Wa*=ib;kb*=hb;Za*=ib;na-=T;Y-=ja;ya-=T;xa-=ja;Ya-=U;Wa-=Ma;kb-=U;Za-=Ma;hb=Ya*Za-kb*Wa;if(hb!=0){ib=1/hb;hb=(Za*na-Wa*ya)*ib;Wa=(Za*Y-Wa*xa)*ib;na=(Ya*ya-kb*na)*ib;Y=(Ya*xa-kb*Y)*ib;T=T-hb*U-na*Ma;ja=ja-Wa*U-Y*Ma;o.save();o.transform(hb,Wa,na,Y,T,ja);o.clip();o.drawImage(ha,0,0);o.restore()}}
-function jb(T,ja,na,Y){var ya=~~(T.r*255),xa=~~(T.g*255);T=~~(T.b*255);var ha=~~(ja.r*255),U=~~(ja.g*255);ja=~~(ja.b*255);var Ma=~~(na.r*255),Ya=~~(na.g*255);na=~~(na.b*255);var Wa=~~(Y.r*255),kb=~~(Y.g*255);Y=~~(Y.b*255);qa[0]=ya<0?0:ya>255?255:ya;qa[1]=xa<0?0:xa>255?255:xa;qa[2]=T<0?0:T>255?255:T;qa[4]=ha<0?0:ha>255?255:ha;qa[5]=U<0?0:U>255?255:U;qa[6]=ja<0?0:ja>255?255:ja;qa[8]=Ma<0?0:Ma>255?255:Ma;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=na<0?0:na>255?255:na;qa[12]=Wa<0?0:Wa>255?255:Wa;qa[13]=kb<0?0:
-kb>255?255:kb;qa[14]=Y<0?0:Y>255?255:Y;K.putImageData(X,0,0);Fa.drawImage(F,0,0);return W}function gb(T,ja,na){T=(T-ja)/(na-ja);return T*T*(3-2*T)}function bb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function cb(T,ja){var na=ja.x-T.x,Y=ja.y-T.y,ya=1/Math.sqrt(na*na+Y*Y);na*=ya;Y*=ya;ja.x+=na;ja.y+=Y;T.x-=na;T.y-=Y}var Oa,eb,Da,S,Ra,Va,lb,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ta,za,this.sortElements);(w=ta.lights.length>0)&&db(ta);Oa=0;for(eb=f.length;Oa<eb;Oa++){Da=
+aa=b();aa.positionScreen.copy(ka[0].position);Ia.multiplyVector4(aa.positionScreen);va=1;for(Ca=ka.length;va<Ca;va++){aa=b();aa.positionScreen.copy(ka[va].position);Ia.multiplyVector4(aa.positionScreen);ra=n[k-2];Aa.copy(aa.positionScreen);da.copy(ra.positionScreen);if(c(Aa,da)){Aa.multiplyScalar(1/Aa.w);da.multiplyScalar(1/da.w);Ta=I[F]=I[F]||new THREE.RenderableLine;F++;C=Ta;C.v1.positionScreen.copy(Aa);C.v2.positionScreen.copy(da);C.z=Math.max(Aa.z,da.z);C.materials=Ha.materials;Ja.push(C)}}}else if(Ha instanceof
+THREE.Particle){O.set(Ha.position.x,Ha.position.y,Ha.position.z,1);Q.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ta=D[U]=D[U]||new THREE.RenderableParticle;U++;G=Ta;G.x=O.x/O.w;G.y=O.y/O.w;G.z=O.z;G.rotation=Ha.rotation.z;G.scale.x=Ha.scale.x*Math.abs(G.x-(O.x+ga.projectionMatrix.n11)/(O.w+ga.projectionMatrix.n14));G.scale.y=Ha.scale.y*Math.abs(G.y-(O.y+ga.projectionMatrix.n22)/(O.w+ga.projectionMatrix.n24));G.materials=Ha.materials;Ja.push(G)}}}}Ba&&Ja.sort(d);return Ja}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var n,p,o,x,A,t,C,F;b=d.projectScene(j,k);n=0;for(p=b.length;n<p;n++){A=b[n];if(A instanceof THREE.RenderableParticle){C=A.x*g+g;F=A.y*h+h;o=0;for(x=A.material.length;o<x;o++){t=A.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=C+"px";t.style.top=F+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(ta){if(t!=ta)o.globalAlpha=t=ta}function d(ta){if(C!=ta){switch(ta){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}C=ta}}function c(ta){if(F!=ta)o.strokeStyle=F=ta}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),x=new THREE.Color(0),A=0,t=1,C=0,
+F=null,I=null,G=null,U=null,D=null,M,O,Q,Ia,ua=new THREE.RenderableVertex,Aa=new THREE.RenderableVertex,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra=new THREE.Color,Ga=new THREE.Color,la=new THREE.Color,pa=new THREE.Color,Ha=new THREE.Color,Ta,ab,Xa,Ua,N,ca,sa,Ea,ia,ma,m=new THREE.Rectangle,B=new THREE.Rectangle,z=new THREE.Rectangle,w=!1,y=new THREE.Color,P=new THREE.Color,H=new THREE.Color,J=new THREE.Color,K=new THREE.Vector3,E,L,X,qa,W,Fa,La=16;E=document.createElement("canvas");E.width=E.height=2;L=
+E.getContext("2d");L.fillStyle="rgba(0,0,0,1)";L.fillRect(0,0,2,2);X=L.getImageData(0,0,2,2);qa=X.data;W=document.createElement("canvas");W.width=W.height=La;Fa=W.getContext("2d");Fa.translate(-La/2,-La/2);Fa.scale(La,La);La--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ta,za){j=ta;k=za;n=j/2;p=k/2;h.width=j;h.height=k;m.set(-n,-p,n,p);t=1;C=0;D=U=G=I=F=null};this.setClearColor=function(ta,za){x=ta;A=za};this.setClearColorHex=function(ta,za){x.setHex(ta);
+A=za};this.clear=function(){o.setTransform(1,0,0,-1,n,p);if(!B.isEmpty()){B.inflate(1);B.minSelf(m);if(x.hex==0&&A==0)o.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{d(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+A+")";o.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(ta,za){function db(T){var ja,na,Y,ya=T.lights;P.setRGB(0,0,0);H.setRGB(0,0,0);J.setRGB(0,0,0);T=0;for(ja=
+ya.length;T<ja;T++){na=ya[T];Y=na.color;if(na instanceof THREE.AmbientLight){P.r+=Y.r;P.g+=Y.g;P.b+=Y.b}else if(na instanceof THREE.DirectionalLight){H.r+=Y.r;H.g+=Y.g;H.b+=Y.b}else if(na instanceof THREE.PointLight){J.r+=Y.r;J.g+=Y.g;J.b+=Y.b}}}function Z(T,ja,na,Y){var ya,xa,ha,V,Ma=T.lights;T=0;for(ya=Ma.length;T<ya;T++){xa=Ma[T];ha=xa.color;if(xa instanceof THREE.DirectionalLight){V=na.dot(xa.position);if(!(V<=0)){V*=xa.intensity;Y.r+=ha.r*V;Y.g+=ha.g*V;Y.b+=ha.b*V}}else if(xa instanceof THREE.PointLight){V=
+na.dot(K.sub(xa.position,ja).normalize());if(!(V<=0)){V*=xa.distance==0?1:1-Math.min(ja.distanceTo(xa.position)/xa.distance,1);if(V!=0){V*=xa.intensity;Y.r+=ha.r*V;Y.g+=ha.g*V;Y.b+=ha.b*V}}}}}function fa(T,ja,na){b(na.opacity);d(na.blending);var Y,ya,xa,ha,V,Ma;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ha=na.map.image;V=ha.width>>1;Ma=ha.height>>1;na=ja.scale.x*n;xa=ja.scale.y*p;Y=na*V;ya=xa*Ma;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);
+o.scale(na,-xa);o.translate(-V,-Ma);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){Y=ja.scale.x*n;ya=ja.scale.y*p;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){c(na.color.__styleString);xa=na.color.__styleString;if(I!=xa)o.fillStyle=I=xa;o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);o.scale(Y,ya);na.program(o);o.restore()}}}function oa(T,ja,na,Y){b(Y.opacity);d(Y.blending);o.beginPath();o.moveTo(T.positionScreen.x,T.positionScreen.y);o.lineTo(ja.positionScreen.x,
+ja.positionScreen.y);o.closePath();if(Y instanceof THREE.LineBasicMaterial){ra.__styleString=Y.color.__styleString;T=Y.linewidth;if(G!=T)o.lineWidth=G=T;T=Y.linecap;if(U!=T)o.lineCap=U=T;T=Y.linejoin;if(D!=T)o.lineJoin=D=T;c(ra.__styleString);o.stroke();z.inflate(Y.linewidth*2)}}function Na(T,ja,na,Y,ya,xa,ha,V,Ma){b(V.opacity);d(V.blending);da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;R(da,e,ga,Ba,Ja,Ka);if(V instanceof
+THREE.MeshBasicMaterial)if(V.map){if(V.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,V.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,Ua[ya].v,Ua[xa].u,Ua[xa].v)}}else if(V.envMap){if(V.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;K.copy(ha.vertexNormalsWorld[0]);N=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;ca=-(K.x*T.n21+K.y*T.n22+K.z*T.n23)*0.5+0.5;K.copy(ha.vertexNormalsWorld[1]);sa=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;Ea=-(K.x*T.n21+K.y*T.n22+
+K.z*T.n23)*0.5+0.5;K.copy(ha.vertexNormalsWorld[2]);ia=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;ma=-(K.x*T.n21+K.y*T.n22+K.z*T.n23)*0.5+0.5;Qa(da,e,ga,Ba,Ja,Ka,V.envMap.image,N,ca,sa,Ea,ia,ma)}}else V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(V.color.__styleString);else if(V instanceof THREE.MeshLambertMaterial){if(V.map&&!V.wireframe){if(V.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,V.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,
+Ua[ya].v,Ua[xa].u,Ua[xa].v)}d(THREE.SubtractiveBlending)}if(w)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=la.r=pa.r=P.r;Ga.g=la.g=pa.g=P.g;Ga.b=la.b=pa.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],pa);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else{y.r=P.r;y.g=P.g;
+y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=V.color.r*y.r;ra.g=V.color.g*y.g;ra.b=V.color.b*y.b;ra.updateStyleString();V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(V.color.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-
+gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(na.positionScreen.z,Ta,ab);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else if(V instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}}function $(T,ja,na,Y,ya,xa,ha,V,Ma){b(V.opacity);
+d(V.blending);if(V.map||V.envMap){Na(T,ja,Y,0,1,3,ha,V,Ma);Na(ya,na,xa,1,2,3,ha,V,Ma)}else{da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;wa=Y.positionScreen.x;ea=Y.positionScreen.y;va=ya.positionScreen.x;Ca=ya.positionScreen.y;ka=xa.positionScreen.x;aa=xa.positionScreen.y;if(V instanceof THREE.MeshBasicMaterial){Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,
+V.wireframeLinejoin):Pa(V.color.__styleString)}else if(V instanceof THREE.MeshLambertMaterial)if(w)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=la.r=pa.r=Ha.r=P.r;Ga.g=la.g=pa.g=Ha.g=P.g;Ga.b=la.b=pa.b=Ha.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v4.positionWorld,ha.vertexNormalsWorld[3],pa);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],Ha);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,
+wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}else{y.r=P.r;y.g=P.g;y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=V.color.r*y.r;ra.g=V.color.g*y.g;ra.b=V.color.b*y.b;ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else{Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):
+Pa(V.color.__styleString)}else if(V instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(Y.positionScreen.z,
+Ta,ab);Ha.r=Ha.g=Ha.b=1-gb(na.positionScreen.z,Ta,ab);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}}}function R(T,ja,na,Y,ya,xa){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(T,ja);o.closePath()}function Sa(T,ja,na,Y,ya,xa,ha,V){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(ha,V);o.lineTo(T,ja);o.closePath()}function fb(T,ja,na,Y){if(G!=ja)o.lineWidth=G=ja;if(U!=na)o.lineCap=
+U=na;if(D!=Y)o.lineJoin=D=Y;c(T);o.stroke();z.inflate(ja*2)}function Pa(T){if(I!=T)o.fillStyle=I=T;o.fill()}function Qa(T,ja,na,Y,ya,xa,ha,V,Ma,Ya,Wa,kb,Za){var hb,ib;hb=ha.width-1;ib=ha.height-1;V*=hb;Ma*=ib;Ya*=hb;Wa*=ib;kb*=hb;Za*=ib;na-=T;Y-=ja;ya-=T;xa-=ja;Ya-=V;Wa-=Ma;kb-=V;Za-=Ma;hb=Ya*Za-kb*Wa;if(hb!=0){ib=1/hb;hb=(Za*na-Wa*ya)*ib;Wa=(Za*Y-Wa*xa)*ib;na=(Ya*ya-kb*na)*ib;Y=(Ya*xa-kb*Y)*ib;T=T-hb*V-na*Ma;ja=ja-Wa*V-Y*Ma;o.save();o.transform(hb,Wa,na,Y,T,ja);o.clip();o.drawImage(ha,0,0);o.restore()}}
+function jb(T,ja,na,Y){var ya=~~(T.r*255),xa=~~(T.g*255);T=~~(T.b*255);var ha=~~(ja.r*255),V=~~(ja.g*255);ja=~~(ja.b*255);var Ma=~~(na.r*255),Ya=~~(na.g*255);na=~~(na.b*255);var Wa=~~(Y.r*255),kb=~~(Y.g*255);Y=~~(Y.b*255);qa[0]=ya<0?0:ya>255?255:ya;qa[1]=xa<0?0:xa>255?255:xa;qa[2]=T<0?0:T>255?255:T;qa[4]=ha<0?0:ha>255?255:ha;qa[5]=V<0?0:V>255?255:V;qa[6]=ja<0?0:ja>255?255:ja;qa[8]=Ma<0?0:Ma>255?255:Ma;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=na<0?0:na>255?255:na;qa[12]=Wa<0?0:Wa>255?255:Wa;qa[13]=kb<0?0:
+kb>255?255:kb;qa[14]=Y<0?0:Y>255?255:Y;L.putImageData(X,0,0);Fa.drawImage(E,0,0);return W}function gb(T,ja,na){T=(T-ja)/(na-ja);return T*T*(3-2*T)}function bb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function cb(T,ja){var na=ja.x-T.x,Y=ja.y-T.y,ya=1/Math.sqrt(na*na+Y*Y);na*=ya;Y*=ya;ja.x+=na;ja.y+=Y;T.x-=na;T.y-=Y}var Oa,eb,Da,S,Ra,Va,lb,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ta,za,this.sortElements);(w=ta.lights.length>0)&&db(ta);Oa=0;for(eb=f.length;Oa<eb;Oa++){Da=
 f[Oa];z.empty();if(Da instanceof THREE.RenderableParticle){M=Da;M.x*=n;M.y*=p;S=0;for(Ra=Da.materials.length;S<Ra;){$a=Da.materials[S++];$a.opacity!=0&&fa(M,Da,$a,ta)}}else if(Da instanceof THREE.RenderableLine){M=Da.v1;O=Da.v2;M.positionScreen.x*=n;M.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;z.addPoint(M.positionScreen.x,M.positionScreen.y);z.addPoint(O.positionScreen.x,O.positionScreen.y);if(m.instersects(z)){S=0;for(Ra=Da.materials.length;S<Ra;){$a=Da.materials[S++];$a.opacity!=
 0&&oa(M,O,Da,$a,ta)}}}else if(Da instanceof THREE.RenderableFace3){M=Da.v1;O=Da.v2;Q=Da.v3;M.positionScreen.x*=n;M.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;Q.positionScreen.x*=n;Q.positionScreen.y*=p;if(Da.overdraw){cb(M.positionScreen,O.positionScreen);cb(O.positionScreen,Q.positionScreen);cb(Q.positionScreen,M.positionScreen)}z.add3Points(M.positionScreen.x,M.positionScreen.y,O.positionScreen.x,O.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y);if(m.instersects(z)){S=
 0;for(Ra=Da.meshMaterials.length;S<Ra;){$a=Da.meshMaterials[S++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(lb=Da.faceMaterials.length;Va<lb;)($a=Da.faceMaterials[Va++])&&$a.opacity!=0&&Na(M,O,Q,0,1,2,Da,$a,ta)}else $a.opacity!=0&&Na(M,O,Q,0,1,2,Da,$a,ta)}}}else if(Da instanceof THREE.RenderableFace4){M=Da.v1;O=Da.v2;Q=Da.v3;Ia=Da.v4;M.positionScreen.x*=n;M.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;Q.positionScreen.x*=n;Q.positionScreen.y*=p;Ia.positionScreen.x*=n;Ia.positionScreen.y*=
 p;ua.positionScreen.copy(O.positionScreen);Aa.positionScreen.copy(Ia.positionScreen);if(Da.overdraw){cb(M.positionScreen,O.positionScreen);cb(O.positionScreen,Ia.positionScreen);cb(Ia.positionScreen,M.positionScreen);cb(Q.positionScreen,ua.positionScreen);cb(Q.positionScreen,Aa.positionScreen)}z.addPoint(M.positionScreen.x,M.positionScreen.y);z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(Q.positionScreen.x,Q.positionScreen.y);z.addPoint(Ia.positionScreen.x,Ia.positionScreen.y);if(m.instersects(z)){S=
 0;for(Ra=Da.meshMaterials.length;S<Ra;){$a=Da.meshMaterials[S++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(lb=Da.faceMaterials.length;Va<lb;)($a=Da.faceMaterials[Va++])&&$a.opacity!=0&&$(M,O,Q,Ia,ua,Aa,Da,$a,ta)}else $a.opacity!=0&&$(M,O,Q,Ia,ua,Aa,Da,$a,ta)}}}B.addRectangle(z)}o.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(wa,ea,va){var Ca,ka,aa,ra;Ca=0;for(ka=wa.lights.length;Ca<ka;Ca++){aa=wa.lights[Ca];if(aa instanceof THREE.DirectionalLight){ra=ea.normalWorld.dot(aa.position)*aa.intensity;if(ra>0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}else if(aa instanceof THREE.PointLight){Aa.sub(aa.position,ea.centroidWorld);Aa.normalize();ra=ea.normalWorld.dot(Aa)*aa.intensity;if(ra>0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}}}function d(wa,ea,
-va,Ca,ka,aa){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(V){M.r=O.r;M.g=O.g;M.b=O.b;b(aa,Ca,M);D.r=ka.color.r*M.r;D.g=ka.color.g*M.g;D.b=ka.color.b*M.b;D.updateStyleString()}else D.__styleString=ka.color.__styleString;else if(ka instanceof
+va,Ca,ka,aa){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(U){M.r=O.r;M.g=O.g;M.b=O.b;b(aa,Ca,M);D.r=ka.color.r*M.r;D.g=ka.color.g*M.g;D.b=ka.color.b*M.b;D.updateStyleString()}else D.__styleString=ka.color.__styleString;else if(ka instanceof
 THREE.MeshDepthMaterial){ua=1-ka.__2near/(ka.__farPlusNear-Ca.z*ka.__farMinusNear);D.setRGB(ua,ua,ua)}else ka instanceof THREE.MeshNormalMaterial&&D.setRGB(g(Ca.normalWorld.x),g(Ca.normalWorld.y),g(Ca.normalWorld.z));ka.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ka.wireframeLinewidth+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+
-ka.opacity);k.appendChild(ga)}function c(wa,ea,va,Ca,ka,aa,ra){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Ca.positionScreen.x+","+Ca.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(V){M.r=O.r;M.g=O.g;M.b=O.b;b(ra,ka,M);D.r=aa.color.r*M.r;D.g=aa.color.g*
+ka.opacity);k.appendChild(ga)}function c(wa,ea,va,Ca,ka,aa,ra){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Ca.positionScreen.x+","+Ca.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(U){M.r=O.r;M.g=O.g;M.b=O.b;b(ra,ka,M);D.r=aa.color.r*M.r;D.g=aa.color.g*
 M.g;D.b=aa.color.b*M.b;D.updateStyleString()}else D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){ua=1-aa.__2near/(aa.__farPlusNear-ka.z*aa.__farMinusNear);D.setRGB(ua,ua,ua)}else aa instanceof THREE.MeshNormalMaterial&&D.setRGB(g(ka.normalWorld.x),g(ka.normalWorld.y),g(ka.normalWorld.z));aa.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
 "; stroke-linejoin: "+aa.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild(ga)}function f(wa){if(da[wa]==null){da[wa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ka==0&&da[wa].setAttribute("shape-rendering","crispEdges")}return da[wa]}function g(wa){return wa<0?Math.min((1+wa)*0.5,0.5):0.5+Math.min(wa*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,x,A,t,
-C,E,G=new THREE.Rectangle,L=new THREE.Rectangle,V=!1,D=new THREE.Color(16777215),M=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),Ia=new THREE.Color(0),ua,Aa=new THREE.Vector3,da=[],e=[],ga,Ba,Ja,Ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(wa){switch(wa){case "high":Ka=1;break;case "low":Ka=0}};this.setSize=function(wa,ea){n=wa;p=ea;o=n/2;x=p/2;k.setAttribute("viewBox",-o+" "+-x+" "+n+" "+p);k.setAttribute("width",
-n);k.setAttribute("height",p);G.set(-o,-x,o,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(wa,ea){var va,Ca,ka,aa,ra,Ga,la,pa;this.autoClear&&this.clear();h=j.projectScene(wa,ea,this.sortElements);Ja=Ba=0;if(V=wa.lights.length>0){la=wa.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);Ia.setRGB(0,0,0);va=0;for(Ca=la.length;va<Ca;va++){ka=la[va];aa=ka.color;if(ka instanceof THREE.AmbientLight){O.r+=aa.r;O.g+=aa.g;O.b+=aa.b}else if(ka instanceof THREE.DirectionalLight){Q.r+=
-aa.r;Q.g+=aa.g;Q.b+=aa.b}else if(ka instanceof THREE.PointLight){Ia.r+=aa.r;Ia.g+=aa.g;Ia.b+=aa.b}}}va=0;for(Ca=h.length;va<Ca;va++){la=h[va];L.empty();if(la instanceof THREE.RenderableParticle){A=la;A.x*=o;A.y*=-x;ka=0;for(aa=la.materials.length;ka<aa;)ka++}else if(la instanceof THREE.RenderableLine){A=la.v1;t=la.v2;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=-x;L.addPoint(A.positionScreen.x,A.positionScreen.y);L.addPoint(t.positionScreen.x,t.positionScreen.y);
-if(G.instersects(L)){ka=0;for(aa=la.materials.length;ka<aa;)if((pa=la.materials[ka++])&&pa.opacity!=0){ra=A;Ga=t;var Ha=Ja++;if(e[Ha]==null){e[Ha]=document.createElementNS("http://www.w3.org/2000/svg","line");Ka==0&&e[Ha].setAttribute("shape-rendering","crispEdges")}ga=e[Ha];ga.setAttribute("x1",ra.positionScreen.x);ga.setAttribute("y1",ra.positionScreen.y);ga.setAttribute("x2",Ga.positionScreen.x);ga.setAttribute("y2",Ga.positionScreen.y);if(pa instanceof THREE.LineBasicMaterial){D.__styleString=
-pa.color.__styleString;ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+pa.linewidth+"; stroke-opacity: "+pa.opacity+"; stroke-linecap: "+pa.linecap+"; stroke-linejoin: "+pa.linejoin);k.appendChild(ga)}}}}else if(la instanceof THREE.RenderableFace3){A=la.v1;t=la.v2;C=la.v3;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=-x;C.positionScreen.x*=o;C.positionScreen.y*=-x;L.addPoint(A.positionScreen.x,A.positionScreen.y);L.addPoint(t.positionScreen.x,
-t.positionScreen.y);L.addPoint(C.positionScreen.x,C.positionScreen.y);if(G.instersects(L)){ka=0;for(aa=la.meshMaterials.length;ka<aa;){pa=la.meshMaterials[ka++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(Ga=la.faceMaterials.length;ra<Ga;)(pa=la.faceMaterials[ra++])&&pa.opacity!=0&&d(A,t,C,la,pa,wa)}else pa&&pa.opacity!=0&&d(A,t,C,la,pa,wa)}}}else if(la instanceof THREE.RenderableFace4){A=la.v1;t=la.v2;C=la.v3;E=la.v4;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=
--x;C.positionScreen.x*=o;C.positionScreen.y*=-x;E.positionScreen.x*=o;E.positionScreen.y*=-x;L.addPoint(A.positionScreen.x,A.positionScreen.y);L.addPoint(t.positionScreen.x,t.positionScreen.y);L.addPoint(C.positionScreen.x,C.positionScreen.y);L.addPoint(E.positionScreen.x,E.positionScreen.y);if(G.instersects(L)){ka=0;for(aa=la.meshMaterials.length;ka<aa;){pa=la.meshMaterials[ka++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(Ga=la.faceMaterials.length;ra<Ga;)(pa=la.faceMaterials[ra++])&&pa.opacity!=
-0&&c(A,t,C,E,la,pa,wa)}else pa&&pa.opacity!=0&&c(A,t,C,E,la,pa,wa)}}}}}};
+C,F,I=new THREE.Rectangle,G=new THREE.Rectangle,U=!1,D=new THREE.Color(16777215),M=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),Ia=new THREE.Color(0),ua,Aa=new THREE.Vector3,da=[],e=[],ga,Ba,Ja,Ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(wa){switch(wa){case "high":Ka=1;break;case "low":Ka=0}};this.setSize=function(wa,ea){n=wa;p=ea;o=n/2;x=p/2;k.setAttribute("viewBox",-o+" "+-x+" "+n+" "+p);k.setAttribute("width",
+n);k.setAttribute("height",p);I.set(-o,-x,o,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(wa,ea){var va,Ca,ka,aa,ra,Ga,la,pa;this.autoClear&&this.clear();h=j.projectScene(wa,ea,this.sortElements);Ja=Ba=0;if(U=wa.lights.length>0){la=wa.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);Ia.setRGB(0,0,0);va=0;for(Ca=la.length;va<Ca;va++){ka=la[va];aa=ka.color;if(ka instanceof THREE.AmbientLight){O.r+=aa.r;O.g+=aa.g;O.b+=aa.b}else if(ka instanceof THREE.DirectionalLight){Q.r+=
+aa.r;Q.g+=aa.g;Q.b+=aa.b}else if(ka instanceof THREE.PointLight){Ia.r+=aa.r;Ia.g+=aa.g;Ia.b+=aa.b}}}va=0;for(Ca=h.length;va<Ca;va++){la=h[va];G.empty();if(la instanceof THREE.RenderableParticle){A=la;A.x*=o;A.y*=-x;ka=0;for(aa=la.materials.length;ka<aa;)ka++}else if(la instanceof THREE.RenderableLine){A=la.v1;t=la.v2;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=-x;G.addPoint(A.positionScreen.x,A.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);
+if(I.instersects(G)){ka=0;for(aa=la.materials.length;ka<aa;)if((pa=la.materials[ka++])&&pa.opacity!=0){ra=A;Ga=t;var Ha=Ja++;if(e[Ha]==null){e[Ha]=document.createElementNS("http://www.w3.org/2000/svg","line");Ka==0&&e[Ha].setAttribute("shape-rendering","crispEdges")}ga=e[Ha];ga.setAttribute("x1",ra.positionScreen.x);ga.setAttribute("y1",ra.positionScreen.y);ga.setAttribute("x2",Ga.positionScreen.x);ga.setAttribute("y2",Ga.positionScreen.y);if(pa instanceof THREE.LineBasicMaterial){D.__styleString=
+pa.color.__styleString;ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+pa.linewidth+"; stroke-opacity: "+pa.opacity+"; stroke-linecap: "+pa.linecap+"; stroke-linejoin: "+pa.linejoin);k.appendChild(ga)}}}}else if(la instanceof THREE.RenderableFace3){A=la.v1;t=la.v2;C=la.v3;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=-x;C.positionScreen.x*=o;C.positionScreen.y*=-x;G.addPoint(A.positionScreen.x,A.positionScreen.y);G.addPoint(t.positionScreen.x,
+t.positionScreen.y);G.addPoint(C.positionScreen.x,C.positionScreen.y);if(I.instersects(G)){ka=0;for(aa=la.meshMaterials.length;ka<aa;){pa=la.meshMaterials[ka++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(Ga=la.faceMaterials.length;ra<Ga;)(pa=la.faceMaterials[ra++])&&pa.opacity!=0&&d(A,t,C,la,pa,wa)}else pa&&pa.opacity!=0&&d(A,t,C,la,pa,wa)}}}else if(la instanceof THREE.RenderableFace4){A=la.v1;t=la.v2;C=la.v3;F=la.v4;A.positionScreen.x*=o;A.positionScreen.y*=-x;t.positionScreen.x*=o;t.positionScreen.y*=
+-x;C.positionScreen.x*=o;C.positionScreen.y*=-x;F.positionScreen.x*=o;F.positionScreen.y*=-x;G.addPoint(A.positionScreen.x,A.positionScreen.y);G.addPoint(t.positionScreen.x,t.positionScreen.y);G.addPoint(C.positionScreen.x,C.positionScreen.y);G.addPoint(F.positionScreen.x,F.positionScreen.y);if(I.instersects(G)){ka=0;for(aa=la.meshMaterials.length;ka<aa;){pa=la.meshMaterials[ka++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(Ga=la.faceMaterials.length;ra<Ga;)(pa=la.faceMaterials[ra++])&&pa.opacity!=
+0&&c(A,t,C,F,la,pa,wa)}else pa&&pa.opacity!=0&&c(A,t,C,F,la,pa,wa)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -222,20 +222,20 @@ 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(b){function d(m,B,z){var w,y,P,H=m.vertices,I=H.length,J=m.colors,F=J.length,K=m.__vertexArray,X=m.__colorArray,qa=m.__sortArray,W=m.__dirtyVertices,Fa=m.__dirtyColors;if(z.sortParticles){Ha.multiplySelf(z.matrixWorld);for(w=0;w<I;w++){y=H[w].position;Xa.copy(y);Ha.multiplyVector3(Xa);qa[w]=[Xa.z,w]}qa.sort(function(La,ta){return ta[0]-La[0]});for(w=0;w<I;w++){y=H[qa[w][1]].position;P=w*3;K[P]=y.x;K[P+1]=y.y;K[P+2]=y.z}for(w=0;w<F;w++){P=w*3;color=J[qa[w][1]];X[P]=color.r;
-X[P+1]=color.g;X[P+2]=color.b}}else{if(W)for(w=0;w<I;w++){y=H[w].position;P=w*3;K[P]=y.x;K[P+1]=y.y;K[P+2]=y.z}if(Fa)for(w=0;w<F;w++){color=J[w];P=w*3;X[P]=color.r;X[P+1]=color.g;X[P+2]=color.b}}if(W||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,K,B)}if(Fa||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,X,B)}}function c(m,B){m.uniforms=Uniforms.clone(B.uniforms);m.vertexShader=B.vertexShader;m.fragmentShader=
-B.fragmentShader}function f(m,B,z,w,y){w.__webglProgram||wa.initMaterial(w,B,z,y);var P=w.program,H=P.uniforms,I=w.uniforms;if(P!=Ba){e.useProgram(P);Ba=P}e.uniformMatrix4fv(H.projectionMatrix,!1,Ta);if(z&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){I.fogColor.value.setHex(z.color.hex);if(z instanceof THREE.Fog){I.fogNear.value=z.near;I.fogFar.value=
-z.far}else if(z instanceof THREE.FogExp2)I.fogDensity.value=z.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w.lights){var J,F,K=0,X=0,qa=0,W,Fa,La,ta,za=Ua,db=za.directional.colors,Z=za.directional.positions,fa=za.point.colors,oa=za.point.positions,Na=za.point.distances,$=0,R=0;z=F=ta=0;for(J=B.length;z<J;z++){F=B[z];W=F.color;Fa=F.position;La=F.intensity;ta=F.distance;if(F instanceof THREE.AmbientLight){K+=W.r;X+=W.g;qa+=W.b}else if(F instanceof THREE.DirectionalLight){ta=
-$*3;db[ta]=W.r*La;db[ta+1]=W.g*La;db[ta+2]=W.b*La;Z[ta]=Fa.x;Z[ta+1]=Fa.y;Z[ta+2]=Fa.z;$+=1}else if(F instanceof THREE.PointLight){F=R*3;fa[F]=W.r*La;fa[F+1]=W.g*La;fa[F+2]=W.b*La;oa[F]=Fa.x;oa[F+1]=Fa.y;oa[F+2]=Fa.z;Na[R]=ta;R+=1}}for(z=$*3;z<db.length;z++)db[z]=0;for(z=R*3;z<fa.length;z++)fa[z]=0;za.point.length=R;za.directional.length=$;za.ambient[0]=K;za.ambient[1]=X;za.ambient[2]=qa;z=Ua;I.enableLighting.value=z.directional.length+z.point.length;I.ambientLightColor.value=z.ambient;I.directionalLightColor.value=
-z.directional.colors;I.directionalLightDirection.value=z.directional.positions;I.pointLightColor.value=z.point.colors;I.pointLightPosition.value=z.point.positions;I.pointLightDistance.value=z.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){I.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);I.opacity.value=w.opacity;I.map.texture=w.map;I.lightMap.texture=w.lightMap;I.envMap.texture=w.envMap;I.reflectivity.value=
-w.reflectivity;I.refractionRatio.value=w.refractionRatio;I.combine.value=w.combine;I.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof THREE.LineBasicMaterial){I.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);I.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){I.psColor.value.setRGB(w.color.r,w.color.g,w.color.b);I.opacity.value=w.opacity;I.size.value=w.size;I.scale.value=ga.height/2;I.map.texture=w.map}else if(w instanceof
-THREE.MeshPhongMaterial){I.ambient.value.setRGB(w.ambient.r,w.ambient.g,w.ambient.b);I.specular.value.setRGB(w.specular.r,w.specular.g,w.specular.b);I.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){I.mNear.value=m.near;I.mFar.value=m.far;I.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)I.opacity.value=w.opacity;for(var Sa in I)if(X=P.uniforms[Sa]){J=I[Sa];K=J.type;z=J.value;if(K=="i")e.uniform1i(X,z);else if(K=="f")e.uniform1f(X,z);else if(K=="fv1")e.uniform1fv(X,
-z);else if(K=="fv")e.uniform3fv(X,z);else if(K=="v2")e.uniform2f(X,z.x,z.y);else if(K=="v3")e.uniform3f(X,z.x,z.y,z.z);else if(K=="v4")e.uniform4f(X,z.x,z.y,z.z,z.w);else if(K=="c")e.uniform3f(X,z.r,z.g,z.b);else if(K=="t"){e.uniform1i(X,z);if(J=J.texture)if(J.image instanceof Array&&J.image.length==6){if(J.image.length==6){if(J.needsUpdate){if(J.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,J.image.__webglTextureCube);for(K=0;K<6;++K)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,e.RGBA,e.UNSIGNED_BYTE,
-J.image[K])}else{J.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,J.image.__webglTextureCube);for(K=0;K<6;++K)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,J.image[K]);J.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,J,J.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);J.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,J.image.__webglTextureCube)}}else Q(J,z)}}e.uniformMatrix4fv(H.modelViewMatrix,!1,y._modelViewMatrixArray);
+THREE.WebGLRenderer=function(b){function d(m,B,z){var w,y,P,H=m.vertices,J=H.length,K=m.colors,E=K.length,L=m.__vertexArray,X=m.__colorArray,qa=m.__sortArray,W=m.__dirtyVertices,Fa=m.__dirtyColors;if(z.sortParticles){Ha.multiplySelf(z.matrixWorld);for(w=0;w<J;w++){y=H[w].position;Xa.copy(y);Ha.multiplyVector3(Xa);qa[w]=[Xa.z,w]}qa.sort(function(La,ta){return ta[0]-La[0]});for(w=0;w<J;w++){y=H[qa[w][1]].position;P=w*3;L[P]=y.x;L[P+1]=y.y;L[P+2]=y.z}for(w=0;w<E;w++){P=w*3;color=K[qa[w][1]];X[P]=color.r;
+X[P+1]=color.g;X[P+2]=color.b}}else{if(W)for(w=0;w<J;w++){y=H[w].position;P=w*3;L[P]=y.x;L[P+1]=y.y;L[P+2]=y.z}if(Fa)for(w=0;w<E;w++){color=K[w];P=w*3;X[P]=color.r;X[P+1]=color.g;X[P+2]=color.b}}if(W||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,L,B)}if(Fa||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,X,B)}}function c(m,B){m.uniforms=Uniforms.clone(B.uniforms);m.vertexShader=B.vertexShader;m.fragmentShader=
+B.fragmentShader}function f(m,B,z,w,y){w.__webglProgram||wa.initMaterial(w,B,z,y);var P=w.program,H=P.uniforms,J=w.uniforms;if(P!=Ba){e.useProgram(P);Ba=P}e.uniformMatrix4fv(H.projectionMatrix,!1,Ta);if(z&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){J.fogColor.value.setHex(z.color.hex);if(z instanceof THREE.Fog){J.fogNear.value=z.near;J.fogFar.value=
+z.far}else if(z instanceof THREE.FogExp2)J.fogDensity.value=z.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w.lights){var K,E,L=0,X=0,qa=0,W,Fa,La,ta,za=Ua,db=za.directional.colors,Z=za.directional.positions,fa=za.point.colors,oa=za.point.positions,Na=za.point.distances,$=0,R=0;z=E=ta=0;for(K=B.length;z<K;z++){E=B[z];W=E.color;Fa=E.position;La=E.intensity;ta=E.distance;if(E instanceof THREE.AmbientLight){L+=W.r;X+=W.g;qa+=W.b}else if(E instanceof THREE.DirectionalLight){ta=
+$*3;db[ta]=W.r*La;db[ta+1]=W.g*La;db[ta+2]=W.b*La;Z[ta]=Fa.x;Z[ta+1]=Fa.y;Z[ta+2]=Fa.z;$+=1}else if(E instanceof THREE.PointLight){E=R*3;fa[E]=W.r*La;fa[E+1]=W.g*La;fa[E+2]=W.b*La;oa[E]=Fa.x;oa[E+1]=Fa.y;oa[E+2]=Fa.z;Na[R]=ta;R+=1}}for(z=$*3;z<db.length;z++)db[z]=0;for(z=R*3;z<fa.length;z++)fa[z]=0;za.point.length=R;za.directional.length=$;za.ambient[0]=L;za.ambient[1]=X;za.ambient[2]=qa;z=Ua;J.enableLighting.value=z.directional.length+z.point.length;J.ambientLightColor.value=z.ambient;J.directionalLightColor.value=
+z.directional.colors;J.directionalLightDirection.value=z.directional.positions;J.pointLightColor.value=z.point.colors;J.pointLightPosition.value=z.point.positions;J.pointLightDistance.value=z.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){J.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);J.opacity.value=w.opacity;J.map.texture=w.map;J.lightMap.texture=w.lightMap;J.envMap.texture=w.envMap;J.reflectivity.value=
+w.reflectivity;J.refractionRatio.value=w.refractionRatio;J.combine.value=w.combine;J.useRefract.value=w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof THREE.LineBasicMaterial){J.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);J.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){J.psColor.value.setRGB(w.color.r,w.color.g,w.color.b);J.opacity.value=w.opacity;J.size.value=w.size;J.scale.value=ga.height/2;J.map.texture=w.map}else if(w instanceof
+THREE.MeshPhongMaterial){J.ambient.value.setRGB(w.ambient.r,w.ambient.g,w.ambient.b);J.specular.value.setRGB(w.specular.r,w.specular.g,w.specular.b);J.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){J.mNear.value=m.near;J.mFar.value=m.far;J.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)J.opacity.value=w.opacity;for(var Sa in J)if(X=P.uniforms[Sa]){K=J[Sa];L=K.type;z=K.value;if(L=="i")e.uniform1i(X,z);else if(L=="f")e.uniform1f(X,z);else if(L=="fv1")e.uniform1fv(X,
+z);else if(L=="fv")e.uniform3fv(X,z);else if(L=="v2")e.uniform2f(X,z.x,z.y);else if(L=="v3")e.uniform3f(X,z.x,z.y,z.z);else if(L=="v4")e.uniform4f(X,z.x,z.y,z.z,z.w);else if(L=="c")e.uniform3f(X,z.r,z.g,z.b);else if(L=="t"){e.uniform1i(X,z);if(K=K.texture)if(K.image instanceof Array&&K.image.length==6){if(K.image.length==6){if(K.needsUpdate){if(K.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,K.image.__webglTextureCube);for(L=0;L<6;++L)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,0,0,0,e.RGBA,e.UNSIGNED_BYTE,
+K.image[L])}else{K.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,K.image.__webglTextureCube);for(L=0;L<6;++L)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,K.image[L]);K.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,K,K.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);K.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,K.image.__webglTextureCube)}}else Q(K,z)}}e.uniformMatrix4fv(H.modelViewMatrix,!1,y._modelViewMatrixArray);
 e.uniformMatrix3fv(H.normalMatrix,!1,y._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(H.cameraPosition,m.position.x,m.position.y,m.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(H.objectMatrix,!1,y._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(H.viewMatrix,
-!1,ab);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=I.directionalLightDirection.value;m[0]=-B.position.x;m[1]=-B.position.y;m[2]=-B.position.z;e.uniform3fv(H.directionalLightDirection,m);e.uniformMatrix4fv(H.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(H.viewMatrix,!1,ab)}if(w.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,ab);e.uniformMatrix4fv(H.boneGlobalMatrices,!1,y.boneMatrices)}return P}function g(m,B,z,w,y,P){if(w.opacity!=0){var H;m=f(m,B,z,w,P).attributes;if(w.morphTargets){B=
-w.program.attributes;P.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[P.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(B.position,3,e.FLOAT,!1,0,0);if(P.morphTargetForcedOrder.length){z=0;for(var I=P.morphTargetForcedOrder,J=P.morphTargetInfluences;z<w.numSupportedMorphTargets&&z<I.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[I[z]]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=
-J[I[z]];z++}}else{I=[];var F=-1,K=0;J=P.morphTargetInfluences;var X,qa=J.length;z=0;for(P.morphTargetBase!==-1&&(I[P.morphTargetBase]=!0);z<w.numSupportedMorphTargets;){for(X=0;X<qa;X++)if(!I[X]&&J[X]>F){K=X;F=J[K]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[K]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=F;I[K]=1;F=-1;z++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,
+!1,ab);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=J.directionalLightDirection.value;m[0]=-B.position.x;m[1]=-B.position.y;m[2]=-B.position.z;e.uniform3fv(H.directionalLightDirection,m);e.uniformMatrix4fv(H.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(H.viewMatrix,!1,ab)}if(w.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,ab);e.uniformMatrix4fv(H.boneGlobalMatrices,!1,y.boneMatrices)}return P}function g(m,B,z,w,y,P){if(w.opacity!=0){var H;m=f(m,B,z,w,P).attributes;if(w.morphTargets){B=
+w.program.attributes;P.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[P.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(B.position,3,e.FLOAT,!1,0,0);if(P.morphTargetForcedOrder.length){z=0;for(var J=P.morphTargetForcedOrder,K=P.morphTargetInfluences;z<w.numSupportedMorphTargets&&z<J.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[J[z]]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=
+K[J[z]];z++}}else{J=[];var E=-1,L=0;K=P.morphTargetInfluences;var X,qa=K.length;z=0;for(P.morphTargetBase!==-1&&(J[P.morphTargetBase]=!0);z<w.numSupportedMorphTargets;){for(X=0;X<qa;X++)if(!J[X]&&K[X]>E){L=X;E=K[L]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[L]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=E;J[L]=1;E=-1;z++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,
 y.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(H in y.__webglCustomAttributes)if(m[H]>=0){B=y.__webglCustomAttributes[H];e.bindBuffer(e.ARRAY_BUFFER,B.buffer);e.vertexAttribPointer(m[H],B.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=
 0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(y.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(y.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);
 if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,
@@ -243,41 +243,41 @@ if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>
 THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else P instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function h(m,B){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.position);e.vertexAttribPointer(B.attributes.position,
 3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.normal);e.vertexAttribPointer(B.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function j(m){if(ea!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ea=m.doubleSided}if(va!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=m.flipSided}}function k(m){if(ka!=
 m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ka=m}}function n(m){pa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);pa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);pa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);pa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);pa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);pa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var B;for(m=0;m<6;m++){B=pa[m];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*
-B.z))}}function p(m){for(var B=m.matrixWorld,z=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=pa[w].x*B.n14+pa[w].y*B.n24+pa[w].z*B.n34+pa[w].w;if(m<=z)return!1}return!0}function o(m,B){m.list[m.count]=B;m.count+=1}function x(m){var B,z,w=m.object,y=m.opaque,P=m.transparent;P.count=0;m=y.count=0;for(B=w.materials.length;m<B;m++){z=w.materials[m];z.transparent?o(P,z):o(y,z)}}function A(m){var B,z,w,y,P=m.object,H=m.buffer,I=m.opaque,J=m.transparent;
-J.count=0;m=I.count=0;for(w=P.materials.length;m<w;m++){B=P.materials[m];if(B instanceof THREE.MeshFaceMaterial){B=0;for(z=H.materials.length;B<z;B++)(y=H.materials[B])&&(y.transparent?o(J,y):o(I,y))}else(y=B)&&(y.transparent?o(J,y):o(I,y))}}function t(m,B){return B.z-m.z}function C(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,
-e.KEEP,e.DECR,e.KEEP);var B,z=m.lights.length,w,y=m.lights,P=[],H,I,J,F,K,X=m.__webglShadowVolumes.length;for(B=0;B<z;B++){w=m.lights[B];if(w instanceof THREE.DirectionalLight){P[0]=-w.position.x;P[1]=-w.position.y;P[2]=-w.position.z;for(K=0;K<X;K++){w=m.__webglShadowVolumes[K].object;H=m.__webglShadowVolumes[K].buffer;I=w.materials[0];I.program||wa.initMaterial(I,y,undefined,w);I=I.program;J=I.uniforms;F=I.attributes;if(Ba!==I){e.useProgram(I);Ba=I;e.uniformMatrix4fv(J.projectionMatrix,!1,Ta);e.uniformMatrix4fv(J.viewMatrix,
-!1,ab);e.uniform3fv(J.directionalLightDirection,P)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(J.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,H.__webglVertexBuffer);e.vertexAttribPointer(F.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,H.__webglNormalBuffer);e.vertexAttribPointer(F.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,H.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,H.__webglFaceCount,e.UNSIGNED_SHORT,
+B.z))}}function p(m){for(var B=m.matrixWorld,z=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=pa[w].x*B.n14+pa[w].y*B.n24+pa[w].z*B.n34+pa[w].w;if(m<=z)return!1}return!0}function o(m,B){m.list[m.count]=B;m.count+=1}function x(m){var B,z,w=m.object,y=m.opaque,P=m.transparent;P.count=0;m=y.count=0;for(B=w.materials.length;m<B;m++){z=w.materials[m];z.transparent?o(P,z):o(y,z)}}function A(m){var B,z,w,y,P=m.object,H=m.buffer,J=m.opaque,K=m.transparent;
+K.count=0;m=J.count=0;for(w=P.materials.length;m<w;m++){B=P.materials[m];if(B instanceof THREE.MeshFaceMaterial){B=0;for(z=H.materials.length;B<z;B++)(y=H.materials[B])&&(y.transparent?o(K,y):o(J,y))}else(y=B)&&(y.transparent?o(K,y):o(J,y))}}function t(m,B){return B.z-m.z}function C(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,
+e.KEEP,e.DECR,e.KEEP);var B,z=m.lights.length,w,y=m.lights,P=[],H,J,K,E,L,X=m.__webglShadowVolumes.length;for(B=0;B<z;B++){w=m.lights[B];if(w instanceof THREE.DirectionalLight){P[0]=-w.position.x;P[1]=-w.position.y;P[2]=-w.position.z;for(L=0;L<X;L++){w=m.__webglShadowVolumes[L].object;H=m.__webglShadowVolumes[L].buffer;J=w.materials[0];J.program||wa.initMaterial(J,y,undefined,w);J=J.program;K=J.uniforms;E=J.attributes;if(Ba!==J){e.useProgram(J);Ba=J;e.uniformMatrix4fv(K.projectionMatrix,!1,Ta);e.uniformMatrix4fv(K.viewMatrix,
+!1,ab);e.uniform3fv(K.directionalLightDirection,P)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(K.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,H.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,H.__webglNormalBuffer);e.vertexAttribPointer(E.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,H.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,H.__webglFaceCount,e.UNSIGNED_SHORT,
 0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,H.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);Ca="";Ba=ia.program;e.useProgram(ia.program);e.uniformMatrix4fv(ia.projectionLocation,!1,Ta);e.uniform1f(ia.darknessLocation,ia.darkness);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.vertexAttribPointer(ia.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ia.vertexLocation);
-e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function E(m,B){var z,w,y,P=m.__webglLensFlares.length,H,I,J;H=new THREE.Vector3;var F=la/Ga;I=Ga*0.5;J=la*0.5;var K=16/la,X=[K*F,K],qa=[1,1,0];K=[1,1];var W,Fa=ma.readBackPixels,La,ta,za=ma.uniforms;z=ma.attributes;e.useProgram(ma.program);Ba=ma.program;Ca="";e.uniform1i(za.map,
+e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function F(m,B){var z,w,y,P=m.__webglLensFlares.length,H,J,K;H=new THREE.Vector3;var E=la/Ga;J=Ga*0.5;K=la*0.5;var L=16/la,X=[L*E,L],qa=[1,1,0];L=[1,1];var W,Fa=ma.readBackPixels,La,ta,za=ma.uniforms;z=ma.attributes;e.useProgram(ma.program);Ba=ma.program;Ca="";e.uniform1i(za.map,
 0);e.activeTexture(e.TEXTURE0);e.uniform1f(za.opacity,1);e.uniform1f(za.rotation,0);e.uniform2fv(za.scale,X);e.bindBuffer(e.ARRAY_BUFFER,ma.vertexBuffer);e.vertexAttribPointer(z.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(z.uv,2,e.FLOAT,!1,16,8);e.bindTexture(e.TEXTURE_2D,ma.tempTexture);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ma.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);for(y=0;y<P;y++){z=m.__webglLensFlares[y].object;H.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34);B.matrixWorldInverse.multiplyVector3(H);
-w=H.z;B.projectionMatrix.multiplyVector3(H);qa[0]=H.x;qa[1]=H.y;qa[2]=H.z;K[0]=qa[0]*I+I;K[1]=qa[1]*J+J;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,K[0]-8,K[1]-8,16,16);e.uniform3fv(za.screenPosition,qa);e.uniform1i(za.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);try{e.readPixels(K[0]-8,K[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ma.readBackPixels)}catch(db){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");
+w=H.z;B.projectionMatrix.multiplyVector3(H);qa[0]=H.x;qa[1]=H.y;qa[2]=H.z;L[0]=qa[0]*J+J;L[1]=qa[1]*K+K;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,L[0]-8,L[1]-8,16,16);e.uniform3fv(za.screenPosition,qa);e.uniform1i(za.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);try{e.readPixels(L[0]-8,L[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ma.readBackPixels)}catch(db){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");
 sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-w,B.far))/B.far),10)+2;w=sampleDistance*4;W=sampleDistance*64;ta=0;La=28-w+(448-W);ma.readBackPixels[La+0]===255&&ma.readBackPixels[La+1]===0&&ma.readBackPixels[La+2]===255&&(ta+=0.2);La=28+w+(448-W);Fa[La+0]===255&&Fa[La+1]===0&&Fa[La+2]===255&&(ta+=0.2);La=28+w+(448+W);Fa[La+0]===255&&Fa[La+1]===0&&Fa[La+2]===255&&(ta+=0.2);La=28-w+(448+W);Fa[La+0]===255&&Fa[La+1]===0&&Fa[La+2]===255&&(ta+=0.2);La=476;Fa[La+0]===255&&Fa[La+1]===0&&Fa[La+2]===255&&
-(ta+=0.2);z.positionScreen.x=qa[0];z.positionScreen.y=qa[1];z.positionScreen.z=qa[2];z.customUpdateCallback?z.customUpdateCallback(ta,z):z.updateLensFlares(ta);e.uniform1i(za.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(y=0;y<P;y++){z=m.__webglLensFlares[y].object;H=0;for(I=z.lensFlares.length;H<I;H++){J=z.lensFlares[H];if(J.opacity>0.0010&&J.scale>0.0010){qa[0]=J.x;qa[1]=J.y;qa[2]=J.z;K=J.size*J.scale/la;X[0]=K*F;X[1]=K;e.uniform3fv(za.screenPosition,
-qa);e.uniform1f(za.rotation,J.rotation);e.uniform2fv(za.scale,X);e.uniform1f(za.opacity,J.opacity);M(J.blending);Q(J.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function G(m,B){m._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var B,z,w,y,P;if(m instanceof THREE.Mesh){z=m.geometry;
-for(B in z.geometryGroups){w=z.geometryGroups[B];P=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){P=!0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var H=void 0,I=void 0,J=void 0,F=void 0;J=void 0;var K=void 0,X=void 0,qa=void 0,W=void 0,Fa=void 0,La=void 0,ta=void 0,za=void 0,db=void 0,Z=void 0,fa=void 0,oa=void 0,Na=void 0;X=void 0;qa=void 0;F=void 0;
-W=void 0;F=void 0;Z=void 0;fa=void 0;X=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;F=void 0;W=void 0;K=void 0;J=void 0;J=void 0;var $=void 0,R=void 0,Sa=void 0,fb=void 0,Pa=0,Qa=0,jb=0,gb=0,bb=0,cb=0,Oa=0,eb=0,Da=0,S=0,Ra=0;$=0;var Va=w.__vertexArray,lb=w.__uvArray,$a=w.__uv2Array,T=w.__normalArray,ja=w.__tangentArray,na=w.__colorArray,Y=w.__skinVertexAArray,ya=w.__skinVertexBArray,xa=w.__skinIndexArray,
-ha=w.__skinWeightArray,U=w.__morphTargetsArrays,Ma=w.__webglCustomAttributes;R=void 0;var Ya=w.__faceArray,Wa=w.__lineArray,kb=w.__needsSmoothNormals;La=w.__vertexColorType;Fa=w.__uvType;ta=w.__normalType;var Za=m.geometry,hb=Za.__dirtyVertices,ib=Za.__dirtyElements,tb=Za.__dirtyUvs,ub=Za.__dirtyNormals,vb=Za.__dirtyTangents,wb=Za.__dirtyColors,xb=Za.__dirtyMorphTargets,pb=Za.vertices,yb=w.faces,Bb=Za.faces,zb=Za.faceVertexUvs[0],Ab=Za.faceVertexUvs[1],qb=Za.skinVerticesA,rb=Za.skinVerticesB,sb=Za.skinIndices,
-nb=Za.skinWeights,ob=Za.edgeFaces,mb=Za.morphTargets;if(Ma)for(fb in Ma)Ma[fb].offset=0;H=0;for(I=yb.length;H<I;H++){J=yb[H];F=Bb[J];zb&&(za=zb[J]);Ab&&(db=Ab[J]);J=F.vertexNormals;K=F.normal;X=F.vertexColors;qa=F.color;W=F.vertexTangents;if(F instanceof THREE.Face3){if(hb){Z=pb[F.a].position;fa=pb[F.b].position;oa=pb[F.c].position;Va[Qa]=Z.x;Va[Qa+1]=Z.y;Va[Qa+2]=Z.z;Va[Qa+3]=fa.x;Va[Qa+4]=fa.y;Va[Qa+5]=fa.z;Va[Qa+6]=oa.x;Va[Qa+7]=oa.y;Va[Qa+8]=oa.z;Qa+=9}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){$=
-R.offset;if(R.size===1){R.array[$+0]=R.value[F.a];R.array[$+1]=R.value[F.b];R.array[$+2]=R.value[F.c];R.offset+=3}else{Z=R.value[F.a];fa=R.value[F.b];oa=R.value[F.c];if(R.size===2){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=fa.x;R.array[$+3]=fa.y;R.array[$+4]=oa.x;R.array[$+5]=oa.y;R.offset+=6}else if(R.size===3){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=fa.x;R.array[$+4]=fa.y;R.array[$+5]=fa.z;R.array[$+6]=oa.x;R.array[$+7]=oa.y;R.array[$+8]=oa.z;R.offset+=9}else{R.array[$+
-0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=Z.w;R.array[$+4]=fa.x;R.array[$+5]=fa.y;R.array[$+6]=fa.z;R.array[$+7]=fa.w;R.array[$+8]=oa.x;R.array[$+9]=oa.y;R.array[$+10]=oa.z;R.array[$+11]=oa.w;R.offset+=12}}}}if(xb){$=0;for(R=mb.length;$<R;$++){Z=mb[$].vertices[F.a].position;fa=mb[$].vertices[F.b].position;oa=mb[$].vertices[F.c].position;Sa=U[$];Sa[Ra+0]=Z.x;Sa[Ra+1]=Z.y;Sa[Ra+2]=Z.z;Sa[Ra+3]=fa.x;Sa[Ra+4]=fa.y;Sa[Ra+5]=fa.z;Sa[Ra+6]=oa.x;Sa[Ra+7]=oa.y;Sa[Ra+8]=oa.z}Ra+=9}if(nb.length){Z=
-nb[F.a];fa=nb[F.b];oa=nb[F.c];ha[S]=Z.x;ha[S+1]=Z.y;ha[S+2]=Z.z;ha[S+3]=Z.w;ha[S+4]=fa.x;ha[S+5]=fa.y;ha[S+6]=fa.z;ha[S+7]=fa.w;ha[S+8]=oa.x;ha[S+9]=oa.y;ha[S+10]=oa.z;ha[S+11]=oa.w;Z=sb[F.a];fa=sb[F.b];oa=sb[F.c];xa[S]=Z.x;xa[S+1]=Z.y;xa[S+2]=Z.z;xa[S+3]=Z.w;xa[S+4]=fa.x;xa[S+5]=fa.y;xa[S+6]=fa.z;xa[S+7]=fa.w;xa[S+8]=oa.x;xa[S+9]=oa.y;xa[S+10]=oa.z;xa[S+11]=oa.w;Z=qb[F.a];fa=qb[F.b];oa=qb[F.c];Y[S]=Z.x;Y[S+1]=Z.y;Y[S+2]=Z.z;Y[S+3]=1;Y[S+4]=fa.x;Y[S+5]=fa.y;Y[S+6]=fa.z;Y[S+7]=1;Y[S+8]=oa.x;Y[S+9]=
-oa.y;Y[S+10]=oa.z;Y[S+11]=1;Z=rb[F.a];fa=rb[F.b];oa=rb[F.c];ya[S]=Z.x;ya[S+1]=Z.y;ya[S+2]=Z.z;ya[S+3]=1;ya[S+4]=fa.x;ya[S+5]=fa.y;ya[S+6]=fa.z;ya[S+7]=1;ya[S+8]=oa.x;ya[S+9]=oa.y;ya[S+10]=oa.z;ya[S+11]=1;S+=12}if(wb&&La){if(X.length==3&&La==THREE.VertexColors){F=X[0];Z=X[1];fa=X[2]}else fa=Z=F=qa;na[Da]=F.r;na[Da+1]=F.g;na[Da+2]=F.b;na[Da+3]=Z.r;na[Da+4]=Z.g;na[Da+5]=Z.b;na[Da+6]=fa.r;na[Da+7]=fa.g;na[Da+8]=fa.b;Da+=9}if(vb&&Za.hasTangents){X=W[0];qa=W[1];F=W[2];ja[Oa]=X.x;ja[Oa+1]=X.y;ja[Oa+2]=X.z;
-ja[Oa+3]=X.w;ja[Oa+4]=qa.x;ja[Oa+5]=qa.y;ja[Oa+6]=qa.z;ja[Oa+7]=qa.w;ja[Oa+8]=F.x;ja[Oa+9]=F.y;ja[Oa+10]=F.z;ja[Oa+11]=F.w;Oa+=12}if(ub&&ta)if(J.length==3&&kb)for(W=0;W<3;W++){K=J[W];T[cb]=K.x;T[cb+1]=K.y;T[cb+2]=K.z;cb+=3}else for(W=0;W<3;W++){T[cb]=K.x;T[cb+1]=K.y;T[cb+2]=K.z;cb+=3}if(tb&&za!==undefined&&Fa)for(W=0;W<3;W++){J=za[W];lb[jb]=J.u;lb[jb+1]=J.v;jb+=2}if(tb&&db!==undefined&&Fa)for(W=0;W<3;W++){J=db[W];$a[gb]=J.u;$a[gb+1]=J.v;gb+=2}if(ib){Ya[bb]=Pa;Ya[bb+1]=Pa+1;Ya[bb+2]=Pa+2;bb+=3;Wa[eb]=
-Pa;Wa[eb+1]=Pa+1;Wa[eb+2]=Pa;Wa[eb+3]=Pa+2;Wa[eb+4]=Pa+1;Wa[eb+5]=Pa+2;eb+=6;Pa+=3}}else if(F instanceof THREE.Face4){if(hb){Z=pb[F.a].position;fa=pb[F.b].position;oa=pb[F.c].position;Na=pb[F.d].position;Va[Qa]=Z.x;Va[Qa+1]=Z.y;Va[Qa+2]=Z.z;Va[Qa+3]=fa.x;Va[Qa+4]=fa.y;Va[Qa+5]=fa.z;Va[Qa+6]=oa.x;Va[Qa+7]=oa.y;Va[Qa+8]=oa.z;Va[Qa+9]=Na.x;Va[Qa+10]=Na.y;Va[Qa+11]=Na.z;Qa+=12}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){$=R.offset;if(R.size===1){R.array[$+0]=R.value[F.a];R.array[$+1]=R.value[F.b];
-R.array[$+2]=R.value[F.c];R.array[$+2]=R.value[F.d];R.offset+=4}else{Z=R.value[F.a];fa=R.value[F.b];oa=R.value[F.c];Na=R.value[F.d];if(R.size===2){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=fa.x;R.array[$+3]=fa.y;R.array[$+4]=oa.x;R.array[$+5]=oa.y;R.array[$+6]=Na.x;R.array[$+7]=Na.y;R.offset+=8}else if(R.size===3){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=fa.x;R.array[$+4]=fa.y;R.array[$+5]=fa.z;R.array[$+6]=oa.x;R.array[$+7]=oa.y;R.array[$+8]=oa.z;R.array[$+9]=Na.x;R.array[$+
-10]=Na.y;R.array[$+11]=Na.z;R.offset+=12}else{R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=Z.w;R.array[$+4]=fa.x;R.array[$+5]=fa.y;R.array[$+6]=fa.z;R.array[$+7]=fa.w;R.array[$+8]=oa.x;R.array[$+9]=oa.y;R.array[$+10]=oa.z;R.array[$+11]=oa.w;R.array[$+12]=Na.x;R.array[$+13]=Na.y;R.array[$+14]=Na.z;R.array[$+15]=Na.w;R.offset+=16}}}}if(xb){$=0;for(R=mb.length;$<R;$++){Z=mb[$].vertices[F.a].position;fa=mb[$].vertices[F.b].position;oa=mb[$].vertices[F.c].position;Na=mb[$].vertices[F.d].position;
-Sa=U[$];Sa[Ra+0]=Z.x;Sa[Ra+1]=Z.y;Sa[Ra+2]=Z.z;Sa[Ra+3]=fa.x;Sa[Ra+4]=fa.y;Sa[Ra+5]=fa.z;Sa[Ra+6]=oa.x;Sa[Ra+7]=oa.y;Sa[Ra+8]=oa.z;Sa[Ra+9]=Na.x;Sa[Ra+10]=Na.y;Sa[Ra+11]=Na.z}Ra+=12}if(nb.length){Z=nb[F.a];fa=nb[F.b];oa=nb[F.c];Na=nb[F.d];ha[S]=Z.x;ha[S+1]=Z.y;ha[S+2]=Z.z;ha[S+3]=Z.w;ha[S+4]=fa.x;ha[S+5]=fa.y;ha[S+6]=fa.z;ha[S+7]=fa.w;ha[S+8]=oa.x;ha[S+9]=oa.y;ha[S+10]=oa.z;ha[S+11]=oa.w;ha[S+12]=Na.x;ha[S+13]=Na.y;ha[S+14]=Na.z;ha[S+15]=Na.w;Z=sb[F.a];fa=sb[F.b];oa=sb[F.c];Na=sb[F.d];xa[S]=Z.x;xa[S+
-1]=Z.y;xa[S+2]=Z.z;xa[S+3]=Z.w;xa[S+4]=fa.x;xa[S+5]=fa.y;xa[S+6]=fa.z;xa[S+7]=fa.w;xa[S+8]=oa.x;xa[S+9]=oa.y;xa[S+10]=oa.z;xa[S+11]=oa.w;xa[S+12]=Na.x;xa[S+13]=Na.y;xa[S+14]=Na.z;xa[S+15]=Na.w;Z=qb[F.a];fa=qb[F.b];oa=qb[F.c];Na=qb[F.d];Y[S]=Z.x;Y[S+1]=Z.y;Y[S+2]=Z.z;Y[S+3]=1;Y[S+4]=fa.x;Y[S+5]=fa.y;Y[S+6]=fa.z;Y[S+7]=1;Y[S+8]=oa.x;Y[S+9]=oa.y;Y[S+10]=oa.z;Y[S+11]=1;Y[S+12]=Na.x;Y[S+13]=Na.y;Y[S+14]=Na.z;Y[S+15]=1;Z=rb[F.a];fa=rb[F.b];oa=rb[F.c];F=rb[F.d];ya[S]=Z.x;ya[S+1]=Z.y;ya[S+2]=Z.z;ya[S+3]=
-1;ya[S+4]=fa.x;ya[S+5]=fa.y;ya[S+6]=fa.z;ya[S+7]=1;ya[S+8]=oa.x;ya[S+9]=oa.y;ya[S+10]=oa.z;ya[S+11]=1;ya[S+12]=F.x;ya[S+13]=F.y;ya[S+14]=F.z;ya[S+15]=1;S+=16}if(wb&&La){if(X.length==4&&La==THREE.VertexColors){F=X[0];Z=X[1];fa=X[2];X=X[3]}else X=fa=Z=F=qa;na[Da]=F.r;na[Da+1]=F.g;na[Da+2]=F.b;na[Da+3]=Z.r;na[Da+4]=Z.g;na[Da+5]=Z.b;na[Da+6]=fa.r;na[Da+7]=fa.g;na[Da+8]=fa.b;na[Da+9]=X.r;na[Da+10]=X.g;na[Da+11]=X.b;Da+=12}if(vb&&Za.hasTangents){X=W[0];qa=W[1];F=W[2];W=W[3];ja[Oa]=X.x;ja[Oa+1]=X.y;ja[Oa+
-2]=X.z;ja[Oa+3]=X.w;ja[Oa+4]=qa.x;ja[Oa+5]=qa.y;ja[Oa+6]=qa.z;ja[Oa+7]=qa.w;ja[Oa+8]=F.x;ja[Oa+9]=F.y;ja[Oa+10]=F.z;ja[Oa+11]=F.w;ja[Oa+12]=W.x;ja[Oa+13]=W.y;ja[Oa+14]=W.z;ja[Oa+15]=W.w;Oa+=16}if(ub&&ta)if(J.length==4&&kb)for(W=0;W<4;W++){K=J[W];T[cb]=K.x;T[cb+1]=K.y;T[cb+2]=K.z;cb+=3}else for(W=0;W<4;W++){T[cb]=K.x;T[cb+1]=K.y;T[cb+2]=K.z;cb+=3}if(tb&&za!==undefined&&Fa)for(W=0;W<4;W++){J=za[W];lb[jb]=J.u;lb[jb+1]=J.v;jb+=2}if(tb&&db!==undefined&&Fa)for(W=0;W<4;W++){J=db[W];$a[gb]=J.u;$a[gb+1]=J.v;
-gb+=2}if(ib){Ya[bb]=Pa;Ya[bb+1]=Pa+1;Ya[bb+2]=Pa+3;Ya[bb+3]=Pa+1;Ya[bb+4]=Pa+2;Ya[bb+5]=Pa+3;bb+=6;Wa[eb]=Pa;Wa[eb+1]=Pa+1;Wa[eb+2]=Pa;Wa[eb+3]=Pa+3;Wa[eb+4]=Pa+1;Wa[eb+5]=Pa+2;Wa[eb+6]=Pa+2;Wa[eb+7]=Pa+3;eb+=8;Pa+=4}}}if(ob){H=0;for(I=ob.length;H<I;H++){Ya[bb]=ob[H].a;Ya[bb+1]=ob[H].b;Ya[bb+2]=ob[H].c;Ya[bb+3]=ob[H].a;Ya[bb+4]=ob[H].c;Ya[bb+5]=ob[H].d;bb+=6}}if(hb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Va,P)}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,
-R.buffer);e.bufferData(e.ARRAY_BUFFER,R.array,P);R.needsUpdate=!1}}if(xb){$=0;for(R=mb.length;$<R;$++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[$]);e.bufferData(e.ARRAY_BUFFER,U[$],P)}}if(wb&&Da>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,P)}if(vb&&Za.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ja,P)}if(tb&&
+(ta+=0.2);z.positionScreen.x=qa[0];z.positionScreen.y=qa[1];z.positionScreen.z=qa[2];z.customUpdateCallback?z.customUpdateCallback(ta,z):z.updateLensFlares(ta);e.uniform1i(za.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(y=0;y<P;y++){z=m.__webglLensFlares[y].object;H=0;for(J=z.lensFlares.length;H<J;H++){K=z.lensFlares[H];if(K.opacity>0.0010&&K.scale>0.0010){qa[0]=K.x;qa[1]=K.y;qa[2]=K.z;L=K.size*K.scale/la;X[0]=L*E;X[1]=L;e.uniform3fv(za.screenPosition,
+qa);e.uniform1f(za.rotation,K.rotation);e.uniform2fv(za.scale,X);e.uniform1f(za.opacity,K.opacity);M(K.blending);Q(K.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function I(m,B){m._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var B,z,w,y,P;if(m instanceof THREE.Mesh){z=m.geometry;
+for(B in z.geometryGroups){w=z.geometryGroups[B];P=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){P=!0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var H=void 0,J=void 0,K=void 0,E=void 0;K=void 0;var L=void 0,X=void 0,qa=void 0,W=void 0,Fa=void 0,La=void 0,ta=void 0,za=void 0,db=void 0,Z=void 0,fa=void 0,oa=void 0,Na=void 0;X=void 0;qa=void 0;E=void 0;
+W=void 0;E=void 0;Z=void 0;fa=void 0;X=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;E=void 0;W=void 0;L=void 0;K=void 0;K=void 0;var $=void 0,R=void 0,Sa=void 0,fb=void 0,Pa=0,Qa=0,jb=0,gb=0,bb=0,cb=0,Oa=0,eb=0,Da=0,S=0,Ra=0;$=0;var Va=w.__vertexArray,lb=w.__uvArray,$a=w.__uv2Array,T=w.__normalArray,ja=w.__tangentArray,na=w.__colorArray,Y=w.__skinVertexAArray,ya=w.__skinVertexBArray,xa=w.__skinIndexArray,
+ha=w.__skinWeightArray,V=w.__morphTargetsArrays,Ma=w.__webglCustomAttributes;R=void 0;var Ya=w.__faceArray,Wa=w.__lineArray,kb=w.__needsSmoothNormals;La=w.__vertexColorType;Fa=w.__uvType;ta=w.__normalType;var Za=m.geometry,hb=Za.__dirtyVertices,ib=Za.__dirtyElements,tb=Za.__dirtyUvs,ub=Za.__dirtyNormals,vb=Za.__dirtyTangents,wb=Za.__dirtyColors,xb=Za.__dirtyMorphTargets,pb=Za.vertices,yb=w.faces,Bb=Za.faces,zb=Za.faceVertexUvs[0],Ab=Za.faceVertexUvs[1],qb=Za.skinVerticesA,rb=Za.skinVerticesB,sb=Za.skinIndices,
+nb=Za.skinWeights,ob=Za.edgeFaces,mb=Za.morphTargets;if(Ma)for(fb in Ma)Ma[fb].offset=0;H=0;for(J=yb.length;H<J;H++){K=yb[H];E=Bb[K];zb&&(za=zb[K]);Ab&&(db=Ab[K]);K=E.vertexNormals;L=E.normal;X=E.vertexColors;qa=E.color;W=E.vertexTangents;if(E instanceof THREE.Face3){if(hb){Z=pb[E.a].position;fa=pb[E.b].position;oa=pb[E.c].position;Va[Qa]=Z.x;Va[Qa+1]=Z.y;Va[Qa+2]=Z.z;Va[Qa+3]=fa.x;Va[Qa+4]=fa.y;Va[Qa+5]=fa.z;Va[Qa+6]=oa.x;Va[Qa+7]=oa.y;Va[Qa+8]=oa.z;Qa+=9}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){$=
+R.offset;if(R.size===1){R.array[$+0]=R.value[E.a];R.array[$+1]=R.value[E.b];R.array[$+2]=R.value[E.c];R.offset+=3}else{Z=R.value[E.a];fa=R.value[E.b];oa=R.value[E.c];if(R.size===2){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=fa.x;R.array[$+3]=fa.y;R.array[$+4]=oa.x;R.array[$+5]=oa.y;R.offset+=6}else if(R.size===3){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=fa.x;R.array[$+4]=fa.y;R.array[$+5]=fa.z;R.array[$+6]=oa.x;R.array[$+7]=oa.y;R.array[$+8]=oa.z;R.offset+=9}else{R.array[$+
+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=Z.w;R.array[$+4]=fa.x;R.array[$+5]=fa.y;R.array[$+6]=fa.z;R.array[$+7]=fa.w;R.array[$+8]=oa.x;R.array[$+9]=oa.y;R.array[$+10]=oa.z;R.array[$+11]=oa.w;R.offset+=12}}}}if(xb){$=0;for(R=mb.length;$<R;$++){Z=mb[$].vertices[E.a].position;fa=mb[$].vertices[E.b].position;oa=mb[$].vertices[E.c].position;Sa=V[$];Sa[Ra+0]=Z.x;Sa[Ra+1]=Z.y;Sa[Ra+2]=Z.z;Sa[Ra+3]=fa.x;Sa[Ra+4]=fa.y;Sa[Ra+5]=fa.z;Sa[Ra+6]=oa.x;Sa[Ra+7]=oa.y;Sa[Ra+8]=oa.z}Ra+=9}if(nb.length){Z=
+nb[E.a];fa=nb[E.b];oa=nb[E.c];ha[S]=Z.x;ha[S+1]=Z.y;ha[S+2]=Z.z;ha[S+3]=Z.w;ha[S+4]=fa.x;ha[S+5]=fa.y;ha[S+6]=fa.z;ha[S+7]=fa.w;ha[S+8]=oa.x;ha[S+9]=oa.y;ha[S+10]=oa.z;ha[S+11]=oa.w;Z=sb[E.a];fa=sb[E.b];oa=sb[E.c];xa[S]=Z.x;xa[S+1]=Z.y;xa[S+2]=Z.z;xa[S+3]=Z.w;xa[S+4]=fa.x;xa[S+5]=fa.y;xa[S+6]=fa.z;xa[S+7]=fa.w;xa[S+8]=oa.x;xa[S+9]=oa.y;xa[S+10]=oa.z;xa[S+11]=oa.w;Z=qb[E.a];fa=qb[E.b];oa=qb[E.c];Y[S]=Z.x;Y[S+1]=Z.y;Y[S+2]=Z.z;Y[S+3]=1;Y[S+4]=fa.x;Y[S+5]=fa.y;Y[S+6]=fa.z;Y[S+7]=1;Y[S+8]=oa.x;Y[S+9]=
+oa.y;Y[S+10]=oa.z;Y[S+11]=1;Z=rb[E.a];fa=rb[E.b];oa=rb[E.c];ya[S]=Z.x;ya[S+1]=Z.y;ya[S+2]=Z.z;ya[S+3]=1;ya[S+4]=fa.x;ya[S+5]=fa.y;ya[S+6]=fa.z;ya[S+7]=1;ya[S+8]=oa.x;ya[S+9]=oa.y;ya[S+10]=oa.z;ya[S+11]=1;S+=12}if(wb&&La){if(X.length==3&&La==THREE.VertexColors){E=X[0];Z=X[1];fa=X[2]}else fa=Z=E=qa;na[Da]=E.r;na[Da+1]=E.g;na[Da+2]=E.b;na[Da+3]=Z.r;na[Da+4]=Z.g;na[Da+5]=Z.b;na[Da+6]=fa.r;na[Da+7]=fa.g;na[Da+8]=fa.b;Da+=9}if(vb&&Za.hasTangents){X=W[0];qa=W[1];E=W[2];ja[Oa]=X.x;ja[Oa+1]=X.y;ja[Oa+2]=X.z;
+ja[Oa+3]=X.w;ja[Oa+4]=qa.x;ja[Oa+5]=qa.y;ja[Oa+6]=qa.z;ja[Oa+7]=qa.w;ja[Oa+8]=E.x;ja[Oa+9]=E.y;ja[Oa+10]=E.z;ja[Oa+11]=E.w;Oa+=12}if(ub&&ta)if(K.length==3&&kb)for(W=0;W<3;W++){L=K[W];T[cb]=L.x;T[cb+1]=L.y;T[cb+2]=L.z;cb+=3}else for(W=0;W<3;W++){T[cb]=L.x;T[cb+1]=L.y;T[cb+2]=L.z;cb+=3}if(tb&&za!==undefined&&Fa)for(W=0;W<3;W++){K=za[W];lb[jb]=K.u;lb[jb+1]=K.v;jb+=2}if(tb&&db!==undefined&&Fa)for(W=0;W<3;W++){K=db[W];$a[gb]=K.u;$a[gb+1]=K.v;gb+=2}if(ib){Ya[bb]=Pa;Ya[bb+1]=Pa+1;Ya[bb+2]=Pa+2;bb+=3;Wa[eb]=
+Pa;Wa[eb+1]=Pa+1;Wa[eb+2]=Pa;Wa[eb+3]=Pa+2;Wa[eb+4]=Pa+1;Wa[eb+5]=Pa+2;eb+=6;Pa+=3}}else if(E instanceof THREE.Face4){if(hb){Z=pb[E.a].position;fa=pb[E.b].position;oa=pb[E.c].position;Na=pb[E.d].position;Va[Qa]=Z.x;Va[Qa+1]=Z.y;Va[Qa+2]=Z.z;Va[Qa+3]=fa.x;Va[Qa+4]=fa.y;Va[Qa+5]=fa.z;Va[Qa+6]=oa.x;Va[Qa+7]=oa.y;Va[Qa+8]=oa.z;Va[Qa+9]=Na.x;Va[Qa+10]=Na.y;Va[Qa+11]=Na.z;Qa+=12}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){$=R.offset;if(R.size===1){R.array[$+0]=R.value[E.a];R.array[$+1]=R.value[E.b];
+R.array[$+2]=R.value[E.c];R.array[$+2]=R.value[E.d];R.offset+=4}else{Z=R.value[E.a];fa=R.value[E.b];oa=R.value[E.c];Na=R.value[E.d];if(R.size===2){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=fa.x;R.array[$+3]=fa.y;R.array[$+4]=oa.x;R.array[$+5]=oa.y;R.array[$+6]=Na.x;R.array[$+7]=Na.y;R.offset+=8}else if(R.size===3){R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=fa.x;R.array[$+4]=fa.y;R.array[$+5]=fa.z;R.array[$+6]=oa.x;R.array[$+7]=oa.y;R.array[$+8]=oa.z;R.array[$+9]=Na.x;R.array[$+
+10]=Na.y;R.array[$+11]=Na.z;R.offset+=12}else{R.array[$+0]=Z.x;R.array[$+1]=Z.y;R.array[$+2]=Z.z;R.array[$+3]=Z.w;R.array[$+4]=fa.x;R.array[$+5]=fa.y;R.array[$+6]=fa.z;R.array[$+7]=fa.w;R.array[$+8]=oa.x;R.array[$+9]=oa.y;R.array[$+10]=oa.z;R.array[$+11]=oa.w;R.array[$+12]=Na.x;R.array[$+13]=Na.y;R.array[$+14]=Na.z;R.array[$+15]=Na.w;R.offset+=16}}}}if(xb){$=0;for(R=mb.length;$<R;$++){Z=mb[$].vertices[E.a].position;fa=mb[$].vertices[E.b].position;oa=mb[$].vertices[E.c].position;Na=mb[$].vertices[E.d].position;
+Sa=V[$];Sa[Ra+0]=Z.x;Sa[Ra+1]=Z.y;Sa[Ra+2]=Z.z;Sa[Ra+3]=fa.x;Sa[Ra+4]=fa.y;Sa[Ra+5]=fa.z;Sa[Ra+6]=oa.x;Sa[Ra+7]=oa.y;Sa[Ra+8]=oa.z;Sa[Ra+9]=Na.x;Sa[Ra+10]=Na.y;Sa[Ra+11]=Na.z}Ra+=12}if(nb.length){Z=nb[E.a];fa=nb[E.b];oa=nb[E.c];Na=nb[E.d];ha[S]=Z.x;ha[S+1]=Z.y;ha[S+2]=Z.z;ha[S+3]=Z.w;ha[S+4]=fa.x;ha[S+5]=fa.y;ha[S+6]=fa.z;ha[S+7]=fa.w;ha[S+8]=oa.x;ha[S+9]=oa.y;ha[S+10]=oa.z;ha[S+11]=oa.w;ha[S+12]=Na.x;ha[S+13]=Na.y;ha[S+14]=Na.z;ha[S+15]=Na.w;Z=sb[E.a];fa=sb[E.b];oa=sb[E.c];Na=sb[E.d];xa[S]=Z.x;xa[S+
+1]=Z.y;xa[S+2]=Z.z;xa[S+3]=Z.w;xa[S+4]=fa.x;xa[S+5]=fa.y;xa[S+6]=fa.z;xa[S+7]=fa.w;xa[S+8]=oa.x;xa[S+9]=oa.y;xa[S+10]=oa.z;xa[S+11]=oa.w;xa[S+12]=Na.x;xa[S+13]=Na.y;xa[S+14]=Na.z;xa[S+15]=Na.w;Z=qb[E.a];fa=qb[E.b];oa=qb[E.c];Na=qb[E.d];Y[S]=Z.x;Y[S+1]=Z.y;Y[S+2]=Z.z;Y[S+3]=1;Y[S+4]=fa.x;Y[S+5]=fa.y;Y[S+6]=fa.z;Y[S+7]=1;Y[S+8]=oa.x;Y[S+9]=oa.y;Y[S+10]=oa.z;Y[S+11]=1;Y[S+12]=Na.x;Y[S+13]=Na.y;Y[S+14]=Na.z;Y[S+15]=1;Z=rb[E.a];fa=rb[E.b];oa=rb[E.c];E=rb[E.d];ya[S]=Z.x;ya[S+1]=Z.y;ya[S+2]=Z.z;ya[S+3]=
+1;ya[S+4]=fa.x;ya[S+5]=fa.y;ya[S+6]=fa.z;ya[S+7]=1;ya[S+8]=oa.x;ya[S+9]=oa.y;ya[S+10]=oa.z;ya[S+11]=1;ya[S+12]=E.x;ya[S+13]=E.y;ya[S+14]=E.z;ya[S+15]=1;S+=16}if(wb&&La){if(X.length==4&&La==THREE.VertexColors){E=X[0];Z=X[1];fa=X[2];X=X[3]}else X=fa=Z=E=qa;na[Da]=E.r;na[Da+1]=E.g;na[Da+2]=E.b;na[Da+3]=Z.r;na[Da+4]=Z.g;na[Da+5]=Z.b;na[Da+6]=fa.r;na[Da+7]=fa.g;na[Da+8]=fa.b;na[Da+9]=X.r;na[Da+10]=X.g;na[Da+11]=X.b;Da+=12}if(vb&&Za.hasTangents){X=W[0];qa=W[1];E=W[2];W=W[3];ja[Oa]=X.x;ja[Oa+1]=X.y;ja[Oa+
+2]=X.z;ja[Oa+3]=X.w;ja[Oa+4]=qa.x;ja[Oa+5]=qa.y;ja[Oa+6]=qa.z;ja[Oa+7]=qa.w;ja[Oa+8]=E.x;ja[Oa+9]=E.y;ja[Oa+10]=E.z;ja[Oa+11]=E.w;ja[Oa+12]=W.x;ja[Oa+13]=W.y;ja[Oa+14]=W.z;ja[Oa+15]=W.w;Oa+=16}if(ub&&ta)if(K.length==4&&kb)for(W=0;W<4;W++){L=K[W];T[cb]=L.x;T[cb+1]=L.y;T[cb+2]=L.z;cb+=3}else for(W=0;W<4;W++){T[cb]=L.x;T[cb+1]=L.y;T[cb+2]=L.z;cb+=3}if(tb&&za!==undefined&&Fa)for(W=0;W<4;W++){K=za[W];lb[jb]=K.u;lb[jb+1]=K.v;jb+=2}if(tb&&db!==undefined&&Fa)for(W=0;W<4;W++){K=db[W];$a[gb]=K.u;$a[gb+1]=K.v;
+gb+=2}if(ib){Ya[bb]=Pa;Ya[bb+1]=Pa+1;Ya[bb+2]=Pa+3;Ya[bb+3]=Pa+1;Ya[bb+4]=Pa+2;Ya[bb+5]=Pa+3;bb+=6;Wa[eb]=Pa;Wa[eb+1]=Pa+1;Wa[eb+2]=Pa;Wa[eb+3]=Pa+3;Wa[eb+4]=Pa+1;Wa[eb+5]=Pa+2;Wa[eb+6]=Pa+2;Wa[eb+7]=Pa+3;eb+=8;Pa+=4}}}if(ob){H=0;for(J=ob.length;H<J;H++){Ya[bb]=ob[H].a;Ya[bb+1]=ob[H].b;Ya[bb+2]=ob[H].c;Ya[bb+3]=ob[H].a;Ya[bb+4]=ob[H].c;Ya[bb+5]=ob[H].d;bb+=6}}if(hb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Va,P)}if(Ma)for(fb in Ma){R=Ma[fb];if(R.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,
+R.buffer);e.bufferData(e.ARRAY_BUFFER,R.array,P);R.needsUpdate=!1}}if(xb){$=0;for(R=mb.length;$<R;$++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[$]);e.bufferData(e.ARRAY_BUFFER,V[$],P)}}if(wb&&Da>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,P)}if(vb&&Za.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ja,P)}if(tb&&
 jb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,lb,P)}if(tb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,$a,P)}if(ib){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,P);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,P)}if(S>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Y,P);e.bindBuffer(e.ARRAY_BUFFER,
 w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,xa,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,P)}}}z.__dirtyVertices=!1;z.__dirtyMorphTargets=!1;z.__dirtyElements=!1;z.__dirtyUvs=!1;z.__dirtyNormals=!1;z.__dirtyTangents=!1;z.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;B=e.DYNAMIC_DRAW;La=m.vertices;
-w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(I=0;I<ta;I++){Fa=La[I].position;y=I*3;za[y]=Fa.x;za[y+1]=Fa.y;za[y+2]=Fa.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,za,B)}if(db){for(I=0;I<P;I++){color=w[I];y=I*3;H[y]=color.r;H[y+1]=color.g;H[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,B)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(m instanceof
-THREE.Line){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;B=e.DYNAMIC_DRAW;La=m.vertices;w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(I=0;I<ta;I++){Fa=La[I].position;y=I*3;za[y]=Fa.x;za[y+1]=Fa.y;za[y+2]=Fa.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,za,B)}if(db){for(I=0;I<P;I++){color=w[I];y=I*3;H[y]=color.r;H[y+1]=color.g;H[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);
-e.bufferData(e.ARRAY_BUFFER,H,B)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){z=m.geometry;(z.__dirtyVertices||z.__dirtyColors||m.sortParticles)&&d(z,e.DYNAMIC_DRAW,m);z.__dirtyVertices=!1;z.__dirtyColors=!1}}function V(m){function B(qa){var W=[];z=0;for(w=qa.length;z<w;z++)qa[z]==undefined?W.push("undefined"):W.push(qa[z].id);return W.join("_")}var z,w,y,P,H,I,J,F,K={},X=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};y=0;for(P=m.faces.length;y<
-P;y++){H=m.faces[y];I=H.materials;J=B(I);K[J]==undefined&&(K[J]={hash:J,counter:0});F=K[J].hash+"_"+K[J].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:I,vertices:0,numMorphTargets:X});H=H instanceof THREE.Face3?3:4;if(m.geometryGroups[F].vertices+H>65535){K[J].counter+=1;F=K[J].hash+"_"+K[J].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:I,vertices:0,numMorphTargets:X})}m.geometryGroups[F].faces.push(y);m.geometryGroups[F].vertices+=
+w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(J=0;J<ta;J++){Fa=La[J].position;y=J*3;za[y]=Fa.x;za[y+1]=Fa.y;za[y+2]=Fa.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,za,B)}if(db){for(J=0;J<P;J++){color=w[J];y=J*3;H[y]=color.r;H[y+1]=color.g;H[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,B)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(m instanceof
+THREE.Line){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;B=e.DYNAMIC_DRAW;La=m.vertices;w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(J=0;J<ta;J++){Fa=La[J].position;y=J*3;za[y]=Fa.x;za[y+1]=Fa.y;za[y+2]=Fa.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,za,B)}if(db){for(J=0;J<P;J++){color=w[J];y=J*3;H[y]=color.r;H[y+1]=color.g;H[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);
+e.bufferData(e.ARRAY_BUFFER,H,B)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){z=m.geometry;(z.__dirtyVertices||z.__dirtyColors||m.sortParticles)&&d(z,e.DYNAMIC_DRAW,m);z.__dirtyVertices=!1;z.__dirtyColors=!1}}function U(m){function B(qa){var W=[];z=0;for(w=qa.length;z<w;z++)qa[z]==undefined?W.push("undefined"):W.push(qa[z].id);return W.join("_")}var z,w,y,P,H,J,K,E,L={},X=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};y=0;for(P=m.faces.length;y<
+P;y++){H=m.faces[y];J=H.materials;K=B(J);L[K]==undefined&&(L[K]={hash:K,counter:0});E=L[K].hash+"_"+L[K].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:J,vertices:0,numMorphTargets:X});H=H instanceof THREE.Face3?3:4;if(m.geometryGroups[E].vertices+H>65535){L[K].counter+=1;E=L[K].hash+"_"+L[K].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:J,vertices:0,numMorphTargets:X})}m.geometryGroups[E].faces.push(y);m.geometryGroups[E].vertices+=
 H}}function D(m,B,z){m.push({buffer:B,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(m){if(m!=Ca){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,
 e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}Ca=m}}function O(m,B,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,da(B.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,da(B.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,da(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,da(B.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,
 Aa(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Aa(B.minFilter))}}function Q(m,B){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+
@@ -295,31 +295,31 @@ e.linkProgram(ia.program);ia.vertexLocation=e.getAttribLocation(ia.program,"posi
 e.bufferData(e.ELEMENT_ARRAY_BUFFER,ma.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ma.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ma.program=e.createProgram();e.attachShader(ma.program,ua("fragment",THREE.ShaderLib.lensFlare.fragmentShader));
 e.attachShader(ma.program,ua("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ma.program);ma.attributes={};ma.uniforms={};ma.attributes.vertex=e.getAttribLocation(ma.program,"position");ma.attributes.uv=e.getAttribLocation(ma.program,"UV");ma.uniforms.map=e.getUniformLocation(ma.program,"map");ma.uniforms.opacity=e.getUniformLocation(ma.program,"opacity");ma.uniforms.scale=e.getUniformLocation(ma.program,"scale");ma.uniforms.rotation=e.getUniformLocation(ma.program,"rotation");ma.uniforms.screenPosition=
 e.getUniformLocation(ma.program,"screenPosition");ma.uniforms.renderPink=e.getUniformLocation(ma.program,"renderPink");this.setSize=function(m,B){ga.width=m;ga.height=B;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(m,B,z,w){aa=m;ra=B;Ga=z;la=w;e.viewport(aa,ra,Ga,la)};this.setScissor=function(m,B,z,w){e.scissor(m,B,z,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ka=m;e.depthMask(m)};this.setClearColorHex=
-function(m,B){var z=new THREE.Color(m);e.clearColor(z.r,z.g,z.b,B)};this.setClearColor=function(m,B){e.clearColor(m.r,m.g,m.b,B)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ia.darkness=m};this.initMaterial=function(m,B,z,w){var y,P,H,I;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof
-THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var J,F,K;J=K=I=0;for(H=B.length;J<H;J++){F=B[J];F instanceof
-THREE.DirectionalLight&&K++;F instanceof THREE.PointLight&&I++}if(I+K<=4)B=K;else{B=Math.ceil(4*K/(I+K));I=4-B}I={directional:B,point:I};B=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)B=w.bones.length;H={map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,fog:z,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:I.directional,maxPointLights:I.point,maxBones:B};z=m.fragmentShader;I=m.vertexShader;B=e.createProgram();J=["#ifdef GL_ES\nprecision highp float;\n#endif",
+function(m,B){var z=new THREE.Color(m);e.clearColor(z.r,z.g,z.b,B)};this.setClearColor=function(m,B){e.clearColor(m.r,m.g,m.b,B)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ia.darkness=m};this.initMaterial=function(m,B,z,w){var y,P,H,J;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof
+THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var K,E,L;K=L=J=0;for(H=B.length;K<H;K++){E=B[K];E instanceof
+THREE.DirectionalLight&&L++;E instanceof THREE.PointLight&&J++}if(J+L<=4)B=L;else{B=Math.ceil(4*L/(J+L));J=4-B}J={directional:B,point:J};B=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)B=w.bones.length;H={map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,fog:z,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:J.directional,maxPointLights:J.point,maxBones:B};z=m.fragmentShader;J=m.vertexShader;B=e.createProgram();K=["#ifdef GL_ES\nprecision highp float;\n#endif",
 "#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+
 H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e.attachShader(B,ua("fragment",J+z));e.attachShader(B,ua("vertex",H+I));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};m.program=B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in m.uniforms)z.push(y);
-y=m.program;I=0;for(B=z.length;I<B;I++){J=z[I];y.uniforms[J]=e.getUniformLocation(y,J)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<this.maxMorphTargets;y++)z.push("morphTarget"+y);for(P in m.attributes)z.push(P);y=m.program;I=0;for(B=z.length;I<B;I++){J=z[I];y.attributes[J]=e.getAttribLocation(y,J)}y=m.program.attributes;e.enableVertexAttribArray(y.position);y.color>=0&&e.enableVertexAttribArray(y.color);y.normal>=0&&e.enableVertexAttribArray(y.normal);
+e.attachShader(B,ua("fragment",K+z));e.attachShader(B,ua("vertex",H+J));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};m.program=B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in m.uniforms)z.push(y);
+y=m.program;J=0;for(B=z.length;J<B;J++){K=z[J];y.uniforms[K]=e.getUniformLocation(y,K)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<this.maxMorphTargets;y++)z.push("morphTarget"+y);for(P in m.attributes)z.push(P);y=m.program;J=0;for(B=z.length;J<B;J++){K=z[J];y.attributes[K]=e.getAttribLocation(y,K)}y=m.program.attributes;e.enableVertexAttribArray(y.position);y.color>=0&&e.enableVertexAttribArray(y.color);y.normal>=0&&e.enableVertexAttribArray(y.normal);
 y.tangent>=0&&e.enableVertexAttribArray(y.tangent);if(m.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){e.enableVertexAttribArray(y.skinVertexA);e.enableVertexAttribArray(y.skinVertexB);e.enableVertexAttribArray(y.skinIndex);e.enableVertexAttribArray(y.skinWeight)}for(P in m.attributes)y[P]>=0&&e.enableVertexAttribArray(y[P]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(y.morphTarget0>=0){e.enableVertexAttribArray(y.morphTarget0);m.numSupportedMorphTargets++}if(y.morphTarget1>=
 0){e.enableVertexAttribArray(y.morphTarget1);m.numSupportedMorphTargets++}if(y.morphTarget2>=0){e.enableVertexAttribArray(y.morphTarget2);m.numSupportedMorphTargets++}if(y.morphTarget3>=0){e.enableVertexAttribArray(y.morphTarget3);m.numSupportedMorphTargets++}if(y.morphTarget4>=0){e.enableVertexAttribArray(y.morphTarget4);m.numSupportedMorphTargets++}if(y.morphTarget5>=0){e.enableVertexAttribArray(y.morphTarget5);m.numSupportedMorphTargets++}if(y.morphTarget6>=0){e.enableVertexAttribArray(y.morphTarget6);
-m.numSupportedMorphTargets++}if(y.morphTarget7>=0){e.enableVertexAttribArray(y.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);y=0;for(P=this.maxMorphTargets;y<P;y++)w.__webglMorphTargetInfluences[y]=0}}m.__webglProgram=!0};this.render=function(m,B,z,w){var y,P,H,I,J,F,K,X,qa=m.lights,W=m.fog;B.matrixAutoUpdate&&B.updateMatrix();m.update(undefined,!1,B);B.matrixWorldInverse.flattenToArray(ab);B.projectionMatrix.flattenToArray(Ta);Ha.multiply(B.projectionMatrix,
-B.matrixWorldInverse);n(Ha);this.initWebGLObjects(m);Ia(z);(this.autoClear||w)&&this.clear();J=m.__webglObjects.length;for(w=0;w<J;w++){y=m.__webglObjects[w];K=y.object;if(K.visible)if(!(K instanceof THREE.Mesh)||p(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);G(K,B);A(y);y.render=!0;if(this.sortObjects){Xa.copy(K.position);Ha.multiplyVector3(Xa);y.z=Xa.z}}else y.render=!1;else y.render=!1}this.sortObjects&&m.__webglObjects.sort(t);F=m.__webglObjectsImmediate.length;for(w=0;w<F;w++){y=m.__webglObjectsImmediate[w];
-K=y.object;if(K.visible){K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray);G(K,B);x(y)}}M(THREE.NormalBlending);for(w=0;w<J;w++){y=m.__webglObjects[w];if(y.render){K=y.object;X=y.buffer;H=y.opaque;j(K);for(y=0;y<H.count;y++){I=H.list[y];k(I.depthTest);g(B,qa,W,I,X,K)}}}for(w=0;w<F;w++){y=m.__webglObjectsImmediate[w];K=y.object;if(K.visible){H=y.opaque;j(K);for(y=0;y<H.count;y++){I=H.list[y];k(I.depthTest);P=f(B,qa,W,I,K);K.render(function(Fa){h(Fa,P)})}}}for(w=0;w<J;w++){y=m.__webglObjects[w];
-if(y.render){K=y.object;X=y.buffer;H=y.transparent;j(K);for(y=0;y<H.count;y++){I=H.list[y];M(I.blending);k(I.depthTest);g(B,qa,W,I,X,K)}}}for(w=0;w<F;w++){y=m.__webglObjectsImmediate[w];K=y.object;if(K.visible){H=y.transparent;j(K);for(y=0;y<H.count;y++){I=H.list[y];M(I.blending);k(I.depthTest);P=f(B,qa,W,I,K);K.render(function(Fa){h(Fa,P)})}}}N&&m.__webglShadowVolumes.length&&m.lights.length&&C(m);m.__webglLensFlares.length&&E(m,B);if(z&&z.minFilter!==THREE.NearestFilter&&z.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,
+m.numSupportedMorphTargets++}if(y.morphTarget7>=0){e.enableVertexAttribArray(y.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);y=0;for(P=this.maxMorphTargets;y<P;y++)w.__webglMorphTargetInfluences[y]=0}}m.__webglProgram=!0};this.render=function(m,B,z,w){var y,P,H,J,K,E,L,X,qa=m.lights,W=m.fog;B.matrixAutoUpdate&&B.updateMatrix();m.update(undefined,!1,B);B.matrixWorldInverse.flattenToArray(ab);B.projectionMatrix.flattenToArray(Ta);Ha.multiply(B.projectionMatrix,
+B.matrixWorldInverse);n(Ha);this.initWebGLObjects(m);Ia(z);(this.autoClear||w)&&this.clear();K=m.__webglObjects.length;for(w=0;w<K;w++){y=m.__webglObjects[w];L=y.object;if(L.visible)if(!(L instanceof THREE.Mesh)||p(L)){L.matrixWorld.flattenToArray(L._objectMatrixArray);I(L,B);A(y);y.render=!0;if(this.sortObjects){Xa.copy(L.position);Ha.multiplyVector3(Xa);y.z=Xa.z}}else y.render=!1;else y.render=!1}this.sortObjects&&m.__webglObjects.sort(t);E=m.__webglObjectsImmediate.length;for(w=0;w<E;w++){y=m.__webglObjectsImmediate[w];
+L=y.object;if(L.visible){L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray);I(L,B);x(y)}}M(THREE.NormalBlending);for(w=0;w<K;w++){y=m.__webglObjects[w];if(y.render){L=y.object;X=y.buffer;H=y.opaque;j(L);for(y=0;y<H.count;y++){J=H.list[y];k(J.depthTest);g(B,qa,W,J,X,L)}}}for(w=0;w<E;w++){y=m.__webglObjectsImmediate[w];L=y.object;if(L.visible){H=y.opaque;j(L);for(y=0;y<H.count;y++){J=H.list[y];k(J.depthTest);P=f(B,qa,W,J,L);L.render(function(Fa){h(Fa,P)})}}}for(w=0;w<K;w++){y=m.__webglObjects[w];
+if(y.render){L=y.object;X=y.buffer;H=y.transparent;j(L);for(y=0;y<H.count;y++){J=H.list[y];M(J.blending);k(J.depthTest);g(B,qa,W,J,X,L)}}}for(w=0;w<E;w++){y=m.__webglObjectsImmediate[w];L=y.object;if(L.visible){H=y.transparent;j(L);for(y=0;y<H.count;y++){J=H.list[y];M(J.blending);k(J.depthTest);P=f(B,qa,W,J,L);L.render(function(Fa){h(Fa,P)})}}}N&&m.__webglShadowVolumes.length&&m.lights.length&&C(m);m.__webglLensFlares.length&&F(m,B);if(z&&z.minFilter!==THREE.NearestFilter&&z.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,
 z.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[]}for(;m.__objectsAdded.length;){var B=m.__objectsAdded[0],z=m,w=void 0,y=void 0,P=void 0;if(B._modelViewMatrix==undefined){B._modelViewMatrix=new THREE.Matrix4;B._normalMatrixArray=new Float32Array(9);B._modelViewMatrixArray=new Float32Array(16);B._objectMatrixArray=
-new Float32Array(16);B.matrixWorld.flattenToArray(B._objectMatrixArray)}if(B instanceof THREE.Mesh){y=B.geometry;y.geometryGroups==undefined&&V(y);for(w in y.geometryGroups){P=y.geometryGroups[w];if(!P.__webglVertexBuffer){var H=P;H.__webglVertexBuffer=e.createBuffer();H.__webglNormalBuffer=e.createBuffer();H.__webglTangentBuffer=e.createBuffer();H.__webglColorBuffer=e.createBuffer();H.__webglUVBuffer=e.createBuffer();H.__webglUV2Buffer=e.createBuffer();H.__webglSkinVertexABuffer=e.createBuffer();
-H.__webglSkinVertexBBuffer=e.createBuffer();H.__webglSkinIndicesBuffer=e.createBuffer();H.__webglSkinWeightsBuffer=e.createBuffer();H.__webglFaceBuffer=e.createBuffer();H.__webglLineBuffer=e.createBuffer();if(H.numMorphTargets){var I=void 0,J=void 0;H.__webglMorphTargetsBuffers=[];I=0;for(J=H.numMorphTargets;I<J;I++)H.__webglMorphTargetsBuffers.push(e.createBuffer())}H=P;I=B;var F=void 0,K=void 0,X=void 0;X=void 0;var qa=void 0,W=void 0,Fa=void 0,La=Fa=J=0;K=void 0;X=void 0;var ta=void 0;F=void 0;
-K=void 0;qa=I.geometry;ta=qa.faces;W=H.faces;F=0;for(K=W.length;F<K;F++){X=W[F];X=ta[X];if(X instanceof THREE.Face3){J+=3;Fa+=1;La+=3}else if(X instanceof THREE.Face4){J+=4;Fa+=2;La+=4}}F=H;K=I;ta=void 0;W=void 0;var za=void 0,db=void 0;za=void 0;X=[];ta=0;for(W=K.materials.length;ta<W;ta++){za=K.materials[ta];if(za instanceof THREE.MeshFaceMaterial){za=0;for(l=F.materials.length;za<l;za++)(db=F.materials[za])&&X.push(db)}else(db=za)&&X.push(db)}F=X;a:{K=void 0;ta=void 0;W=F.length;for(K=0;K<W;K++){ta=
-F[K];if(ta.map||ta.lightMap||ta instanceof THREE.MeshShaderMaterial){K=!0;break a}}K=!1}a:{ta=F;W=void 0;X=void 0;za=ta.length;for(W=0;W<za;W++){X=ta[W];if(!(X instanceof THREE.MeshBasicMaterial&&!X.envMap||X instanceof THREE.MeshDepthMaterial)){ta=X&&X.shading!=undefined&&X.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ta=!1}a:{W=void 0;X=void 0;za=F.length;for(W=0;W<za;W++){X=F[W];if(X.vertexColors){X=X.vertexColors;break a}}X=!1}H.__vertexArray=new Float32Array(J*
-3);if(ta)H.__normalArray=new Float32Array(J*3);if(qa.hasTangents)H.__tangentArray=new Float32Array(J*4);if(X)H.__colorArray=new Float32Array(J*3);if(K){if(qa.faceUvs.length>0||qa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(J*2);if(qa.faceUvs.length>1||qa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(J*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(J*4);H.__skinVertexBArray=new Float32Array(J*4);H.__skinIndexArray=new Float32Array(J*
-4);H.__skinWeightArray=new Float32Array(J*4)}H.__faceArray=new Uint16Array(Fa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(La*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];qa=0;for(W=H.numMorphTargets;qa<W;qa++)H.__morphTargetsArrays.push(new Float32Array(J*3))}H.__needsSmoothNormals=ta==THREE.SmoothShading;H.__uvType=K;H.__vertexColorType=X;H.__normalType=ta;H.__webglFaceCount=Fa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0);H.__webglLineCount=
-La*2;qa=0;for(W=F.length;qa<W;qa++)if(F[qa].attributes){H.__webglCustomAttributes={};for(a in F[qa].attributes){K=F[qa].attributes[a];Fa=1;if(K.type==="v2")Fa=2;else if(K.type==="v3")Fa=3;else if(K.type==="v4")Fa=4;else K.type==="c"&&(Fa=3);K.size=Fa;K.needsUpdate=!0;K.array=new Float32Array(J*Fa);K.buffer=e.createBuffer();H.__webglCustomAttributes[a]=K}}y.__dirtyVertices=!0;y.__dirtyMorphTargets=!0;y.__dirtyElements=!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}B instanceof
+new Float32Array(16);B.matrixWorld.flattenToArray(B._objectMatrixArray)}if(B instanceof THREE.Mesh){y=B.geometry;y.geometryGroups==undefined&&U(y);for(w in y.geometryGroups){P=y.geometryGroups[w];if(!P.__webglVertexBuffer){var H=P;H.__webglVertexBuffer=e.createBuffer();H.__webglNormalBuffer=e.createBuffer();H.__webglTangentBuffer=e.createBuffer();H.__webglColorBuffer=e.createBuffer();H.__webglUVBuffer=e.createBuffer();H.__webglUV2Buffer=e.createBuffer();H.__webglSkinVertexABuffer=e.createBuffer();
+H.__webglSkinVertexBBuffer=e.createBuffer();H.__webglSkinIndicesBuffer=e.createBuffer();H.__webglSkinWeightsBuffer=e.createBuffer();H.__webglFaceBuffer=e.createBuffer();H.__webglLineBuffer=e.createBuffer();if(H.numMorphTargets){var J=void 0,K=void 0;H.__webglMorphTargetsBuffers=[];J=0;for(K=H.numMorphTargets;J<K;J++)H.__webglMorphTargetsBuffers.push(e.createBuffer())}H=P;J=B;var E=void 0,L=void 0,X=void 0;X=void 0;var qa=void 0,W=void 0,Fa=void 0,La=Fa=K=0;L=void 0;X=void 0;var ta=void 0;E=void 0;
+L=void 0;qa=J.geometry;ta=qa.faces;W=H.faces;E=0;for(L=W.length;E<L;E++){X=W[E];X=ta[X];if(X instanceof THREE.Face3){K+=3;Fa+=1;La+=3}else if(X instanceof THREE.Face4){K+=4;Fa+=2;La+=4}}E=H;L=J;ta=void 0;W=void 0;var za=void 0,db=void 0;za=void 0;X=[];ta=0;for(W=L.materials.length;ta<W;ta++){za=L.materials[ta];if(za instanceof THREE.MeshFaceMaterial){za=0;for(l=E.materials.length;za<l;za++)(db=E.materials[za])&&X.push(db)}else(db=za)&&X.push(db)}E=X;a:{L=void 0;ta=void 0;W=E.length;for(L=0;L<W;L++){ta=
+E[L];if(ta.map||ta.lightMap||ta instanceof THREE.MeshShaderMaterial){L=!0;break a}}L=!1}a:{ta=E;W=void 0;X=void 0;za=ta.length;for(W=0;W<za;W++){X=ta[W];if(!(X instanceof THREE.MeshBasicMaterial&&!X.envMap||X instanceof THREE.MeshDepthMaterial)){ta=X&&X.shading!=undefined&&X.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ta=!1}a:{W=void 0;X=void 0;za=E.length;for(W=0;W<za;W++){X=E[W];if(X.vertexColors){X=X.vertexColors;break a}}X=!1}H.__vertexArray=new Float32Array(K*
+3);if(ta)H.__normalArray=new Float32Array(K*3);if(qa.hasTangents)H.__tangentArray=new Float32Array(K*4);if(X)H.__colorArray=new Float32Array(K*3);if(L){if(qa.faceUvs.length>0||qa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(K*2);if(qa.faceUvs.length>1||qa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(K*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(K*4);H.__skinVertexBArray=new Float32Array(K*4);H.__skinIndexArray=new Float32Array(K*
+4);H.__skinWeightArray=new Float32Array(K*4)}H.__faceArray=new Uint16Array(Fa*3+(J.geometry.edgeFaces?J.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(La*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];qa=0;for(W=H.numMorphTargets;qa<W;qa++)H.__morphTargetsArrays.push(new Float32Array(K*3))}H.__needsSmoothNormals=ta==THREE.SmoothShading;H.__uvType=L;H.__vertexColorType=X;H.__normalType=ta;H.__webglFaceCount=Fa*3+(J.geometry.edgeFaces?J.geometry.edgeFaces.length*6:0);H.__webglLineCount=
+La*2;qa=0;for(W=E.length;qa<W;qa++)if(E[qa].attributes){H.__webglCustomAttributes={};for(a in E[qa].attributes){L=E[qa].attributes[a];Fa=1;if(L.type==="v2")Fa=2;else if(L.type==="v3")Fa=3;else if(L.type==="v4")Fa=4;else L.type==="c"&&(Fa=3);L.size=Fa;L.needsUpdate=!0;L.array=new Float32Array(K*Fa);L.buffer=e.createBuffer();H.__webglCustomAttributes[a]=L}}y.__dirtyVertices=!0;y.__dirtyMorphTargets=!0;y.__dirtyElements=!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}B instanceof
 THREE.ShadowVolume?D(z.__webglShadowVolumes,P,B):D(z.__webglObjects,P,B)}}else if(B instanceof THREE.LensFlare)D(z.__webglLensFlares,undefined,B);else if(B instanceof THREE.Ribbon){y=B.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;P=w.vertices.length;w.__vertexArray=new Float32Array(P*3);w.__colorArray=new Float32Array(P*3);w.__webglVertexCount=P;y.__dirtyVertices=!0;y.__dirtyColors=!0}D(z.__webglObjects,y,B)}else if(B instanceof
 THREE.Line){y=B.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;P=w.vertices.length;w.__vertexArray=new Float32Array(P*3);w.__colorArray=new Float32Array(P*3);w.__webglLineCount=P;y.__dirtyVertices=!0;y.__dirtyColors=!0}D(z.__webglObjects,y,B)}else if(B instanceof THREE.ParticleSystem){y=B.geometry;if(!y.__webglVertexBuffer){w=y;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=y;P=w.vertices.length;
 w.__vertexArray=new Float32Array(P*3);w.__colorArray=new Float32Array(P*3);w.__sortArray=[];w.__webglParticleCount=P;y.__dirtyVertices=!0;y.__dirtyColors=!0}D(z.__webglObjects,y,B)}else THREE.MarchingCubes!==undefined&&B instanceof THREE.MarchingCubes&&z.__webglObjectsImmediate.push({object:B,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){B=m.__objectsRemoved[0];z=m;y=void 0;w=void 0;for(y=z.__webglObjects.length-1;y>=0;y--){w=
-z.__webglObjects[y].object;B==w&&z.__webglObjects.splice(y,1)}m.__objectsRemoved.splice(0,1)}B=0;for(z=m.__webglObjects.length;B<z;B++)L(m.__webglObjects[B].object,m);B=0;for(z=m.__webglShadowVolumes.length;B<z;B++)L(m.__webglShadowVolumes[B].object,m);B=0;for(z=m.__webglLensFlares.length;B<z;B++)L(m.__webglLensFlares[B].object,m)};this.setFaceCulling=function(m,B){if(m){!B||B=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
+z.__webglObjects[y].object;B==w&&z.__webglObjects.splice(y,1)}m.__objectsRemoved.splice(0,1)}B=0;for(z=m.__webglObjects.length;B<z;B++)G(m.__webglObjects[B].object,m);B=0;for(z=m.__webglShadowVolumes.length;B<z;B++)G(m.__webglShadowVolumes[B].object,m);B=0;for(z=m.__webglLensFlares.length;B<z;B++)G(m.__webglLensFlares[B].object,m)};this.setFaceCulling=function(m,B){if(m){!B||B=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
 e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
@@ -327,18 +327,18 @@ THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.posi
 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(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var o=0,x=j.length;o<x;o++){var A=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(A.position);h.push(A)}o=0;for(x=n.length;o<x;o++){j=n[o];var t,C,E=j.vertexNormals;A=j.vertexColors;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(t=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));t.normal.copy(j.normal);c=0;for(h=E.length;c<h;c++){C=E[c];t.vertexNormals.push(C.clone())}t.color.copy(j.color);c=0;for(h=A.length;c<h;c++){C=A[c];t.vertexColors.push(C.clone())}t.materials=j.materials.slice();t.centroid.copy(j.centroid);k.push(t)}o=0;for(x=g.length;o<x;o++){f=g[o];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));p.push(k)}}},ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=
+var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var o=0,x=j.length;o<x;o++){var A=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(A.position);h.push(A)}o=0;for(x=n.length;o<x;o++){j=n[o];var t,C,F=j.vertexNormals;A=j.vertexColors;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(t=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));t.normal.copy(j.normal);c=0;for(h=F.length;c<h;c++){C=F[c];t.vertexNormals.push(C.clone())}t.color.copy(j.color);c=0;for(h=A.length;c<h;c++){C=A[c];t.vertexColors.push(C.clone())}t.materials=j.materials.slice();t.centroid.copy(j.centroid);k.push(t)}o=0;for(x=g.length;o<x;o++){f=g[o];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));p.push(k)}}},ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=
 new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}},SceneUtils={loadScene:function(b,d,c,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(Ca,ka){return ka=="relativeToHTML"?
-Ca:h+"/"+Ca}function n(){for(t in da.objects)if(!ea.objects[t]){V=da.objects[t];if(Q=ea.geometries[V.geometry]){Aa=[];for(va=0;va<V.materials.length;va++)Aa[va]=ea.materials[V.materials[va]];D=V.position;r=V.rotation;q=V.quaternion;s=V.scale;q=0;Aa.length==0&&(Aa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(Q,Aa);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=V.visible;ea.scene.addObject(object);ea.objects[t]=object}}}function p(Ca){return function(ka){ea.geometries[Ca]=ka;n();Ba-=1;o()}}function o(){f({total_models:Ka,total_textures:wa,loaded_models:Ka-Ba,loaded_textures:wa-Ja},ea);Ba==0&&Ja==0&&c(ea)}var x,A,t,C,E,G,L,V,D,M,O,Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea;da=j.data;e=new THREE.BinaryLoader;ga=new THREE.JSONLoader;Ja=Ba=0;ea={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Ja-=
-1;o()};for(E in da.cameras){M=da.cameras[E];if(M.type=="perspective")Ia=new THREE.Camera(M.fov,M.aspect,M.near,M.far);else if(M.type=="ortho"){Ia=new THREE.Camera;Ia.projectionMatrix=THREE.Matrix4.makeOrtho(M.left,M.right,M.top,M.bottom,M.near,M.far)}D=M.position;M=M.target;Ia.position.set(D[0],D[1],D[2]);Ia.target.position.set(M[0],M[1],M[2]);ea.cameras[E]=Ia}for(C in da.lights){E=da.lights[C];Ia=E.color!==undefined?E.color:16777215;M=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){D=
-E.direction;light=new THREE.DirectionalLight(Ia,M);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(E.type=="point"){D=E.position;light=new THREE.PointLight(Ia,M);light.position.set(D[0],D[1],D[2])}ea.scene.addLight(light);ea.lights[C]=light}for(G in da.fogs){C=da.fogs[G];if(C.type=="linear")ua=new THREE.Fog(0,C.near,C.far);else C.type=="exp2"&&(ua=new THREE.FogExp2(0,C.density));M=C.color;ua.color.setRGB(M[0],M[1],M[2]);ea.fogs[G]=ua}if(ea.cameras&&da.defaults.camera)ea.currentCamera=
-ea.cameras[da.defaults.camera];if(ea.fogs&&da.defaults.fog)ea.scene.fog=ea.fogs[da.defaults.fog];M=da.defaults.bgcolor;ea.bgColor=new THREE.Color;ea.bgColor.setRGB(M[0],M[1],M[2]);ea.bgColorAlpha=da.defaults.bgalpha;for(x in da.geometries){G=da.geometries[x];if(G.type=="bin_mesh"||G.type=="ascii_mesh")Ba+=1}Ka=Ba;for(x in da.geometries){G=da.geometries[x];if(G.type=="cube"){Q=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);ea.geometries[x]=
-Q}else if(G.type=="plane"){Q=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);ea.geometries[x]=Q}else if(G.type=="sphere"){Q=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);ea.geometries[x]=Q}else if(G.type=="cylinder"){Q=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);ea.geometries[x]=Q}else if(G.type=="torus"){Q=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);ea.geometries[x]=Q}else if(G.type=="icosahedron"){Q=new Icosahedron(G.subdivisions);ea.geometries[x]=
-Q}else if(G.type=="bin_mesh")e.load({model:k(G.url,da.urlBaseType),callback:p(x)});else G.type=="ascii_mesh"&&ga.load({model:k(G.url,da.urlBaseType),callback:p(x)})}for(L in da.textures){x=da.textures[L];Ja+=x.url instanceof Array?x.url.length:1}wa=Ja;for(L in da.textures){x=da.textures[L];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){G=[];for(var va=0;va<x.url.length;va++)G[va]=k(x.url[va],da.urlBaseType);G=ImageUtils.loadTextureCube(G,
-x.mapping,j)}else{G=ImageUtils.loadTexture(k(x.url,da.urlBaseType),x.mapping,j);if(THREE[x.minFilter]!=undefined)G.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)G.magFilter=THREE[x.magFilter]}ea.textures[L]=G}for(A in da.materials){L=da.materials[A];for(O in L.parameters)if(O=="envMap"||O=="map"||O=="lightMap")L.parameters[O]=ea.textures[L.parameters[O]];else if(O=="shading")L.parameters[O]=L.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")L.parameters[O]=
-THREE[L.parameters[O]]?THREE[L.parameters[O]]:THREE.NormalBlending;else O=="combine"&&(L.parameters[O]=L.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);L=new THREE[L.type](L.parameters);ea.materials[A]=L}n();d(ea)}},addMesh:function(b,d,c,f,g,h,j,k,n,p){d=new THREE.Mesh(d,p);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=n;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=ShaderUtils.lib.cube;
+Ca:h+"/"+Ca}function n(){for(t in da.objects)if(!ea.objects[t]){U=da.objects[t];if(Q=ea.geometries[U.geometry]){Aa=[];for(va=0;va<U.materials.length;va++)Aa[va]=ea.materials[U.materials[va]];D=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;Aa.length==0&&(Aa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(Q,Aa);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=U.visible;ea.scene.addObject(object);ea.objects[t]=object}}}function p(Ca){return function(ka){ea.geometries[Ca]=ka;n();Ba-=1;o()}}function o(){f({total_models:Ka,total_textures:wa,loaded_models:Ka-Ba,loaded_textures:wa-Ja},ea);Ba==0&&Ja==0&&c(ea)}var x,A,t,C,F,I,G,U,D,M,O,Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea;da=j.data;e=new THREE.BinaryLoader;ga=new THREE.JSONLoader;Ja=Ba=0;ea={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Ja-=
+1;o()};for(F in da.cameras){M=da.cameras[F];if(M.type=="perspective")Ia=new THREE.Camera(M.fov,M.aspect,M.near,M.far);else if(M.type=="ortho"){Ia=new THREE.Camera;Ia.projectionMatrix=THREE.Matrix4.makeOrtho(M.left,M.right,M.top,M.bottom,M.near,M.far)}D=M.position;M=M.target;Ia.position.set(D[0],D[1],D[2]);Ia.target.position.set(M[0],M[1],M[2]);ea.cameras[F]=Ia}for(C in da.lights){F=da.lights[C];Ia=F.color!==undefined?F.color:16777215;M=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){D=
+F.direction;light=new THREE.DirectionalLight(Ia,M);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(F.type=="point"){D=F.position;light=new THREE.PointLight(Ia,M);light.position.set(D[0],D[1],D[2])}ea.scene.addLight(light);ea.lights[C]=light}for(I in da.fogs){C=da.fogs[I];if(C.type=="linear")ua=new THREE.Fog(0,C.near,C.far);else C.type=="exp2"&&(ua=new THREE.FogExp2(0,C.density));M=C.color;ua.color.setRGB(M[0],M[1],M[2]);ea.fogs[I]=ua}if(ea.cameras&&da.defaults.camera)ea.currentCamera=
+ea.cameras[da.defaults.camera];if(ea.fogs&&da.defaults.fog)ea.scene.fog=ea.fogs[da.defaults.fog];M=da.defaults.bgcolor;ea.bgColor=new THREE.Color;ea.bgColor.setRGB(M[0],M[1],M[2]);ea.bgColorAlpha=da.defaults.bgalpha;for(x in da.geometries){I=da.geometries[x];if(I.type=="bin_mesh"||I.type=="ascii_mesh")Ba+=1}Ka=Ba;for(x in da.geometries){I=da.geometries[x];if(I.type=="cube"){Q=new Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,null,I.flipped,I.sides);ea.geometries[x]=
+Q}else if(I.type=="plane"){Q=new Plane(I.width,I.height,I.segmentsWidth,I.segmentsHeight);ea.geometries[x]=Q}else if(I.type=="sphere"){Q=new Sphere(I.radius,I.segmentsWidth,I.segmentsHeight);ea.geometries[x]=Q}else if(I.type=="cylinder"){Q=new Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset);ea.geometries[x]=Q}else if(I.type=="torus"){Q=new Torus(I.radius,I.tube,I.segmentsR,I.segmentsT);ea.geometries[x]=Q}else if(I.type=="icosahedron"){Q=new Icosahedron(I.subdivisions);ea.geometries[x]=
+Q}else if(I.type=="bin_mesh")e.load({model:k(I.url,da.urlBaseType),callback:p(x)});else I.type=="ascii_mesh"&&ga.load({model:k(I.url,da.urlBaseType),callback:p(x)})}for(G in da.textures){x=da.textures[G];Ja+=x.url instanceof Array?x.url.length:1}wa=Ja;for(G in da.textures){x=da.textures[G];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var va=0;va<x.url.length;va++)I[va]=k(x.url[va],da.urlBaseType);I=ImageUtils.loadTextureCube(I,
+x.mapping,j)}else{I=ImageUtils.loadTexture(k(x.url,da.urlBaseType),x.mapping,j);if(THREE[x.minFilter]!=undefined)I.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)I.magFilter=THREE[x.magFilter]}ea.textures[G]=I}for(A in da.materials){G=da.materials[A];for(O in G.parameters)if(O=="envMap"||O=="map"||O=="lightMap")G.parameters[O]=ea.textures[G.parameters[O]];else if(O=="shading")G.parameters[O]=G.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")G.parameters[O]=
+THREE[G.parameters[O]]?THREE[G.parameters[O]]:THREE.NormalBlending;else O=="combine"&&(G.parameters[O]=G.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);G=new THREE[G.type](G.parameters);ea.materials[A]=G}n();d(ea)}},addMesh:function(b,d,c,f,g,h,j,k,n,p){d=new THREE.Mesh(d,p);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=n;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=ShaderUtils.lib.cube;
 f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));
 f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,f,!0),new THREE.MeshFaceMaterial);b.addObject(d);return d},addPanoramaCubePlanes:function(b,d,c){var f=d/2;d=new Plane(d,d);var g=Math.PI,h=Math.PI/2;SceneUtils.addMesh(b,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(b,d,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));
 SceneUtils.addMesh(b,d,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(b,d,1,0,f,0,h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));SceneUtils.addMesh(b,d,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(b,d){SceneUtils.traverseHierarchy(b,function(c){c.visible=d})},traverseHierarchy:function(b,d){var c,f,g=b.children.length;for(f=0;f<g;f++){c=b.children[f];d(c);SceneUtils.traverseHierarchy(c,
@@ -360,7 +360,7 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;c=this.target.position;var f=this.position;c.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=f.y+100*Math.cos(this.phi);c.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
-THREE.PathCamera=function(b){function d(p,o,x,A){var t={name:x,fps:0.6,length:A,hierarchy:[]},C,E=o.getControlPointsArray(),G=o.getLength(),L=E.length,V=0;C=L-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[C]={time:A,pos:E[C],rot:[0,0,0,1],scl:[1,1,1]};for(C=1;C<L-1;C++){V=A*G.chunks[C]/G.total;o.keys[C]={time:V,pos:E[C]}}t.hierarchy[0]=o;THREE.AnimationHandler.add(t);return new THREE.Animation(p,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var x,
+THREE.PathCamera=function(b){function d(p,o,x,A){var t={name:x,fps:0.6,length:A,hierarchy:[]},C,F=o.getControlPointsArray(),I=o.getLength(),G=F.length,U=0;C=G-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[C]={time:A,pos:F[C],rot:[0,0,0,1],scl:[1,1,1]};for(C=1;C<G-1;C++){U=A*I.chunks[C]/I.total;o.keys[C]={time:U,pos:F[C]}}t.hierarchy[0]=o;THREE.AnimationHandler.add(t);return new THREE.Animation(p,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var x,
 A,t=new THREE.Geometry;for(x=0;x<p.points.length*o;x++){A=x/(p.points.length*o);A=p.getPoint(A);t.vertices[x]=new THREE.Vertex(new THREE.Vector3(A.x,A.y,A.z))}return t}function f(p,o){var x=c(o,10),A=c(o,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,t);particleObj=new THREE.ParticleSystem(A,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);A=new Sphere(1,
 16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){x=new THREE.Mesh(A,t);x.position.copy(o.points[i]);x.updateMatrix();p.addChild(x)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
@@ -369,10 +369,10 @@ this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.win
 this.phi=(this.phi-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.target.position;A.x=100*Math.sin(this.phi)*Math.cos(this.theta);A.y=100*Math.cos(this.phi);A.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,x)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
 d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(b,d,c,f,g,h,j,k,n){function p(G,L,V,D,M,O,Q,Ia){var ua,Aa,da=f||1,e=g||1,ga=M/2,Ba=O/2,Ja=o.vertices.length;if(G=="x"&&L=="y"||G=="y"&&L=="x")ua="z";else if(G=="x"&&L=="z"||G=="z"&&L=="x"){ua="y";e=h||1}else if(G=="z"&&L=="y"||G=="y"&&L=="z"){ua="x";da=h||1}var Ka=da+1,wa=e+1;M/=da;var ea=O/e;for(Aa=0;Aa<wa;Aa++)for(O=0;O<Ka;O++){var va=new THREE.Vector3;va[G]=(O*M-ga)*V;va[L]=(Aa*ea-Ba)*D;va[ua]=Q;o.vertices.push(new THREE.Vertex(va))}for(Aa=0;Aa<e;Aa++)for(O=0;O<da;O++){o.faces.push(new THREE.Face4(O+
-Ka*Aa+Ja,O+Ka*(Aa+1)+Ja,O+1+Ka*(Aa+1)+Ja,O+1+Ka*Aa+Ja,null,null,Ia));o.faceVertexUvs[0].push([new THREE.UV(O/da,Aa/e),new THREE.UV(O/da,(Aa+1)/e),new THREE.UV((O+1)/da,(Aa+1)/e),new THREE.UV((O+1)/da,Aa/e)])}}THREE.Geometry.call(this);var o=this,x=b/2,A=d/2,t=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var C=0;C<6;C++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var E in n)this.sides[E]!=
-undefined&&(this.sides[E]=n[E]);this.sides.px&&p("z","y",1*k,-1,c,d,-x,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,x,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,c,A,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,c,-A,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,d,t,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-t,this.materials[5]);(function(){for(var G=[],L=[],V=0,D=o.vertices.length;V<D;V++){for(var M=o.vertices[V],O=!1,Q=0,Ia=G.length;Q<Ia;Q++){var ua=
-G[Q];if(M.position.x==ua.position.x&&M.position.y==ua.position.y&&M.position.z==ua.position.z){L[V]=Q;O=!0;break}}if(!O){L[V]=G.length;G.push(new THREE.Vertex(M.position.clone()))}}V=0;for(D=o.faces.length;V<D;V++){M=o.faces[V];M.a=L[M.a];M.b=L[M.b];M.c=L[M.c];M.d=L[M.d]}o.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cube=function(b,d,c,f,g,h,j,k,n){function p(I,G,U,D,M,O,Q,Ia){var ua,Aa,da=f||1,e=g||1,ga=M/2,Ba=O/2,Ja=o.vertices.length;if(I=="x"&&G=="y"||I=="y"&&G=="x")ua="z";else if(I=="x"&&G=="z"||I=="z"&&G=="x"){ua="y";e=h||1}else if(I=="z"&&G=="y"||I=="y"&&G=="z"){ua="x";da=h||1}var Ka=da+1,wa=e+1;M/=da;var ea=O/e;for(Aa=0;Aa<wa;Aa++)for(O=0;O<Ka;O++){var va=new THREE.Vector3;va[I]=(O*M-ga)*U;va[G]=(Aa*ea-Ba)*D;va[ua]=Q;o.vertices.push(new THREE.Vertex(va))}for(Aa=0;Aa<e;Aa++)for(O=0;O<da;O++){o.faces.push(new THREE.Face4(O+
+Ka*Aa+Ja,O+Ka*(Aa+1)+Ja,O+1+Ka*(Aa+1)+Ja,O+1+Ka*Aa+Ja,null,null,Ia));o.faceVertexUvs[0].push([new THREE.UV(O/da,Aa/e),new THREE.UV(O/da,(Aa+1)/e),new THREE.UV((O+1)/da,(Aa+1)/e),new THREE.UV((O+1)/da,Aa/e)])}}THREE.Geometry.call(this);var o=this,x=b/2,A=d/2,t=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var C=0;C<6;C++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var F in n)this.sides[F]!=
+undefined&&(this.sides[F]=n[F]);this.sides.px&&p("z","y",1*k,-1,c,d,-x,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,x,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,c,A,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,c,-A,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,d,t,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-t,this.materials[5]);(function(){for(var I=[],G=[],U=0,D=o.vertices.length;U<D;U++){for(var M=o.vertices[U],O=!1,Q=0,Ia=I.length;Q<Ia;Q++){var ua=
+I[Q];if(M.position.x==ua.position.x&&M.position.y==ua.position.y&&M.position.z==ua.position.z){G[U]=Q;O=!0;break}}if(!O){G[U]=I.length;I.push(new THREE.Vertex(M.position.clone()))}}U=0;for(D=o.faces.length;U<D;U++){M=o.faces[U];M.a=G[M.a];M.b=G[M.b];M.c=G[M.c];M.d=G[M.d]}o.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 var Cylinder=function(b,d,c,f,g,h){function j(o,x,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,x,A)))}THREE.Geometry.call(this);var k=this,n=Math.PI,p=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,-p);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,p);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(c>0){j(0,0,-p-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(d>0){j(0,0,p+(g||0));
 for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Icosahedron=function(b){function d(x,A,t){var C=Math.sqrt(x*x+A*A+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/C,A/C,t/C)))-1}function c(x,A,t,C){C.faces.push(new THREE.Face3(x,A,t))}function f(x,A){var t=g.vertices[x].position,C=g.vertices[A].position;return d((t.x+C.x)/2,(t.y+C.y)/2,(t.z+C.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
@@ -382,12 +382,12 @@ function Lathe(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2
 0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(p/c,k/b.length),new THREE.UV(p/c,(k+1)/b.length),new THREE.UV((p-d)/c,(k+1)/b.length),new THREE.UV((p-d)/c,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,n=f+1;b/=c;var p=d/f;for(g=0;g<n;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var x=2*f/h,A=n*Math.sin(x*g);x=n*Math.cos(x*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,A)))-1);p.push(o)}d.push(p)}var t,C,E;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){p=f==h-1;j=d[c][p?0:f+1];k=d[c][p?h-1:f];n=d[c-1][p?h-1:f];p=d[c-1][p?
-0:f+1];A=c/(g-1);t=(c-1)/(g-1);C=(f+1)/h;x=f/h;o=new THREE.UV(1-C,A);A=new THREE.UV(1-x,A);x=new THREE.UV(1-x,t);var G=new THREE.UV(1-C,t);if(c<d.length-1){t=this.vertices[j].position.clone();C=this.vertices[k].position.clone();E=this.vertices[n].position.clone();t.normalize();C.normalize();E.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([o,A,x])}if(c>1){t=this.vertices[j].position.clone();
-C=this.vertices[n].position.clone();E=this.vertices[p].position.clone();t.normalize();C.normalize();E.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([o,x,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var x=2*f/h,A=n*Math.sin(x*g);x=n*Math.cos(x*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,A)))-1);p.push(o)}d.push(p)}var t,C,F;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){p=f==h-1;j=d[c][p?0:f+1];k=d[c][p?h-1:f];n=d[c-1][p?h-1:f];p=d[c-1][p?
+0:f+1];A=c/(g-1);t=(c-1)/(g-1);C=(f+1)/h;x=f/h;o=new THREE.UV(1-C,A);A=new THREE.UV(1-x,A);x=new THREE.UV(1-x,t);var I=new THREE.UV(1-C,t);if(c<d.length-1){t=this.vertices[j].position.clone();C=this.vertices[k].position.clone();F=this.vertices[n].position.clone();t.normalize();C.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,A,x])}if(c>1){t=this.vertices[j].position.clone();
+C=this.vertices[n].position.clone();F=this.vertices[p].position.clone();t.normalize();C.normalize();F.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(b,d,c,f){this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(b,d,c,f,g,h,j){function k(x,A,t,C,E,G){A=t/C*x;t=Math.cos(A);return new THREE.Vector3(E*(2+t)*0.5*Math.cos(x),E*(2+t)*Math.sin(x)*0.5,G*E*Math.sin(A)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var n=
+var TorusKnot=function(b,d,c,f,g,h,j){function k(x,A,t,C,F,I){A=t/C*x;t=Math.cos(A);return new THREE.Vector3(F*(2+t)*0.5*Math.cos(x),F*(2+t)*Math.sin(x)*0.5,I*F*Math.sin(A)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var n=
 b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(n,j,this.q,this.p,this.radius,this.heightScale);n=k(n+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=n.x-g.x;c.y=n.y-g.y;c.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();n=this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
 0;d<this.segmentsT;++d){h=(b+1)%this.segmentsR;j=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[h][d];f=this.grid[b][j];h=this.grid[h][j];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var p=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,c,f));this.faceVertexUvs[0].push([j,n,p]);this.faces.push(new THREE.Face3(h,f,c));this.faceVertexUvs[0].push([o,
 p,n])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
@@ -396,38 +396,37 @@ this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.p
 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};p.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:b.vertexColors?THREE.VertexColors:!1,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;
 f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,x,A,t,C,E=b.faces;p=b.vertices;var G=b.normals,L=b.colors,V=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&V++;for(g=0;g<V;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=p.length;k<n;){C=new THREE.Vertex;C.position.x=p[k++];C.position.y=p[k++];C.position.z=p[k++];
-f.vertices.push(C)}k=0;for(n=E.length;k<n;){A=E[k++];t=A&1;j=A&2;g=A&4;h=A&8;o=A&16;p=A&32;C=A&64;A&=128;if(t){t=new THREE.Face4;t.a=E[k++];t.b=E[k++];t.c=E[k++];t.d=E[k++];nVertices=4}else{t=new THREE.Face3;t.a=E[k++];t.b=E[k++];t.c=E[k++];nVertices=3}if(j){j=E[k++];t.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<V;g++){uvLayer=b.uvs[g];x=E[k++];u=uvLayer[x*2];v=uvLayer[x*2+1];f.faceUvs[g][j]=new THREE.UV(u,v)}if(h)for(g=0;g<V;g++){uvLayer=b.uvs[g];uvs=[];for(h=0;h<nVertices;h++){x=E[k++];
-u=uvLayer[x*2];v=uvLayer[x*2+1];uvs[h]=new THREE.UV(u,v)}f.faceVertexUvs[g][j]=uvs}if(o){o=E[k++]*3;normal=new THREE.Vector3;normal.x=G[o++];normal.y=G[o++];normal.z=G[o];t.normal=normal}if(p)for(g=0;g<nVertices;g++){o=E[k++]*3;normal=new THREE.Vector3;normal.x=G[o++];normal.y=G[o++];normal.z=G[o];t.vertexNormals.push(normal)}if(C){color=new THREE.Color(E[k++]);t.color=color}if(A)for(g=0;g<nVertices;g++){p=E[k++];color=new THREE.Color(L[p]);t.vertexColors.push(color)}f.faces.push(t)}}})();(function(){var g,
-h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;
-f.morphTargets[g].vertices=[];dstVertices=f.morphTargets[g].vertices;srcVertices=b.morphTargets[g].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])))}}})();f.computeCentroids();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,x,A,t,C,F,I,G=b.faces;p=b.vertices;var U=b.normals,D=b.colors,M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=p.length;k<n;){C=new THREE.Vertex;C.position.x=p[k++];C.position.y=p[k++];C.position.z=p[k++];
+f.vertices.push(C)}k=0;for(n=G.length;k<n;){A=G[k++];t=A&1;j=A&2;g=A&4;h=A&8;o=A&16;p=A&32;C=A&64;A&=128;if(t){t=new THREE.Face4;t.a=G[k++];t.b=G[k++];t.c=G[k++];t.d=G[k++];nVertices=4}else{t=new THREE.Face3;t.a=G[k++];t.b=G[k++];t.c=G[k++];nVertices=3}if(j){j=G[k++];t.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<M;g++){F=b.uvs[g];x=G[k++];u=F[x*2];v=F[x*2+1];f.faceUvs[g][j]=new THREE.UV(u,v)}if(h)for(g=0;g<M;g++){F=b.uvs[g];I=[];for(h=0;h<nVertices;h++){x=G[k++];u=F[x*2];v=F[x*2+1];I[h]=
+new THREE.UV(u,v)}f.faceVertexUvs[g][j]=I}if(o){o=G[k++]*3;h=new THREE.Vector3;h.x=U[o++];h.y=U[o++];h.z=U[o];t.normal=h}if(p)for(g=0;g<nVertices;g++){o=G[k++]*3;h=new THREE.Vector3;h.x=U[o++];h.y=U[o++];h.z=U[o];t.vertexNormals.push(h)}if(C){p=new THREE.Color(G[k++]);t.color=p}if(A)for(g=0;g<nVertices;g++){p=G[k++];p=new THREE.Color(D[p]);t.vertexColors.push(p)}f.faces.push(t)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];k=b.skinWeights[g+
+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];dstVertices=f.morphTargets[g].vertices;srcVertices=b.morphTargets[g].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])))}}})();f.computeCentroids();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(N,ca){var sa=o(N,ca),Ea=o(N,ca+1),ia=o(N,ca+2),ma=o(N,ca+3),m=(ma<<1&255|ia>>7)-127;sa|=(ia&127)<<16|Ea<<8;if(sa==0&&m==-127)return 0;return(1-2*(ma>>7))*(1+sa*Math.pow(2,-23))*Math.pow(2,m)}function k(N,ca){var sa=o(N,ca),Ea=o(N,ca+1),ia=o(N,ca+2);return(o(N,ca+3)<<24)+(ia<<16)+(Ea<<8)+sa}function n(N,ca){var sa=o(N,ca);return(o(N,ca+1)<<8)+sa}function p(N,ca){var sa=o(N,ca);
-return sa>127?sa-256:sa}function o(N,ca){return N.charCodeAt(ca)&255}function x(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);N=n(b,N+ua);THREE.BinaryLoader.prototype.f3(L,ca,sa,Ea,N)}function A(N){var ca,sa,Ea,ia,ma,m;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);ia=n(b,N+ua);ma=k(b,N+Aa);m=k(b,N+da);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(L,M,ca,sa,Ea,ia,ma,m,N)}function t(N){var ca,sa,Ea,ia;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);N=n(b,N+Ka);THREE.BinaryLoader.prototype.f4(L,ca,sa,Ea,ia,
-N)}function C(N){var ca,sa,Ea,ia,ma,m,B,z;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);ma=n(b,N+Ka);m=k(b,N+wa);B=k(b,N+ea);z=k(b,N+va);N=k(b,N+Ca);THREE.BinaryLoader.prototype.f4n(L,M,ca,sa,Ea,ia,ma,m,B,z,N)}function E(N){var ca,sa;ca=k(b,N);sa=k(b,N+ka);N=k(b,N+aa);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[N*2],O[N*2+1])}function G(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+ra);Ea=k(b,N+Ga);N=k(b,N+la);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0],
-O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[Ea*2],O[Ea*2+1],O[N*2],O[N*2+1])}var L=this,V=0,D,M=[],O=[],Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);D={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15),
-nvertices:k(b,V+16),nnormals:k(b,V+16+4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=D.header_bytes;Q=D.vertex_index_bytes;Ia=D.vertex_index_bytes*2;ua=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;e=D.vertex_index_bytes*
+return sa>127?sa-256:sa}function o(N,ca){return N.charCodeAt(ca)&255}function x(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);N=n(b,N+ua);THREE.BinaryLoader.prototype.f3(G,ca,sa,Ea,N)}function A(N){var ca,sa,Ea,ia,ma,m;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);ia=n(b,N+ua);ma=k(b,N+Aa);m=k(b,N+da);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(G,M,ca,sa,Ea,ia,ma,m,N)}function t(N){var ca,sa,Ea,ia;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);N=n(b,N+Ka);THREE.BinaryLoader.prototype.f4(G,ca,sa,Ea,ia,
+N)}function C(N){var ca,sa,Ea,ia,ma,m,B,z;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);ma=n(b,N+Ka);m=k(b,N+wa);B=k(b,N+ea);z=k(b,N+va);N=k(b,N+Ca);THREE.BinaryLoader.prototype.f4n(G,M,ca,sa,Ea,ia,ma,m,B,z,N)}function F(N){var ca,sa;ca=k(b,N);sa=k(b,N+ka);N=k(b,N+aa);THREE.BinaryLoader.prototype.uv3(G.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[N*2],O[N*2+1])}function I(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+ra);Ea=k(b,N+Ga);N=k(b,N+la);THREE.BinaryLoader.prototype.uv4(G.faceVertexUvs[0],
+O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[Ea*2],O[Ea*2+1],O[N*2],O[N*2+1])}var G=this,U=0,D,M=[],O=[],Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(G,f,h);D={signature:b.substr(U,8),header_bytes:o(b,U+8),vertex_coordinate_bytes:o(b,U+9),normal_coordinate_bytes:o(b,U+10),uv_coordinate_bytes:o(b,U+11),vertex_index_bytes:o(b,U+12),normal_index_bytes:o(b,U+13),uv_index_bytes:o(b,U+14),material_index_bytes:o(b,U+15),
+nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=D.header_bytes;Q=D.vertex_index_bytes;Ia=D.vertex_index_bytes*2;ua=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;e=D.vertex_index_bytes*
 3+D.material_index_bytes+D.normal_index_bytes*2;ga=D.vertex_index_bytes;Ba=D.vertex_index_bytes*2;Ja=D.vertex_index_bytes*3;Ka=D.vertex_index_bytes*4;wa=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;va=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;Ca=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ka=D.uv_index_bytes;aa=D.uv_index_bytes*2;ra=D.uv_index_bytes;Ga=D.uv_index_bytes*2;la=D.uv_index_bytes*
-3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ua=D.vertex_index_bytes*4+D.material_index_bytes;pa=D.ntri_flat*h;Ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ta=D.ntri_flat_uv*(h+D.uv_index_bytes*3);ab=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Xa=D.nquad_flat*Ua;h=D.nquad_smooth*(Ua+D.normal_index_bytes*4);Ua=D.nquad_flat_uv*(Ua+D.uv_index_bytes*4);V+=function(N){for(var ca,sa,Ea,ia=D.vertex_coordinate_bytes*3,ma=N+D.nvertices*ia;N<ma;N+=ia){ca=j(b,N);sa=j(b,N+D.vertex_coordinate_bytes);
-Ea=j(b,N+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(L,ca,sa,Ea)}return D.nvertices*ia}(V);V+=function(N){for(var ca,sa,Ea,ia=D.normal_coordinate_bytes*3,ma=N+D.nnormals*ia;N<ma;N+=ia){ca=p(b,N);sa=p(b,N+D.normal_coordinate_bytes);Ea=p(b,N+D.normal_coordinate_bytes*2);M.push(ca/127,sa/127,Ea/127)}return D.nnormals*ia}(V);V+=function(N){for(var ca,sa,Ea=D.uv_coordinate_bytes*2,ia=N+D.nuvs*Ea;N<ia;N+=Ea){ca=j(b,N);sa=j(b,N+D.uv_coordinate_bytes);O.push(ca,sa)}return D.nuvs*Ea}(V);pa=
-V+pa;Ha=pa+Ha;Ta=Ha+Ta;ab=Ta+ab;Xa=ab+Xa;h=Xa+h;Ua=h+Ua;(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes,Ea=sa+D.uv_index_bytes*3,ia=N+D.ntri_flat_uv*Ea;for(ca=N;ca<ia;ca+=Ea){x(ca);E(ca+sa)}return ia-N})(Ha);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ea=sa+D.uv_index_bytes*3,ia=N+D.ntri_smooth_uv*Ea;for(ca=N;ca<ia;ca+=Ea){A(ca);E(ca+sa)}return ia-N})(Ta);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes,Ea=sa+
-D.uv_index_bytes*4,ia=N+D.nquad_flat_uv*Ea;for(ca=N;ca<ia;ca+=Ea){t(ca);G(ca+sa)}return ia-N})(h);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Ea=sa+D.uv_index_bytes*4,ia=N+D.nquad_smooth_uv*Ea;for(ca=N;ca<ia;ca+=Ea){C(ca);G(ca+sa)}return ia-N})(Ua);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes,Ea=N+D.ntri_flat*sa;for(ca=N;ca<Ea;ca+=sa)x(ca);return Ea-N})(V);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*
+3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ua=D.vertex_index_bytes*4+D.material_index_bytes;pa=D.ntri_flat*h;Ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ta=D.ntri_flat_uv*(h+D.uv_index_bytes*3);ab=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Xa=D.nquad_flat*Ua;h=D.nquad_smooth*(Ua+D.normal_index_bytes*4);Ua=D.nquad_flat_uv*(Ua+D.uv_index_bytes*4);U+=function(N){for(var ca,sa,Ea,ia=D.vertex_coordinate_bytes*3,ma=N+D.nvertices*ia;N<ma;N+=ia){ca=j(b,N);sa=j(b,N+D.vertex_coordinate_bytes);
+Ea=j(b,N+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(G,ca,sa,Ea)}return D.nvertices*ia}(U);U+=function(N){for(var ca,sa,Ea,ia=D.normal_coordinate_bytes*3,ma=N+D.nnormals*ia;N<ma;N+=ia){ca=p(b,N);sa=p(b,N+D.normal_coordinate_bytes);Ea=p(b,N+D.normal_coordinate_bytes*2);M.push(ca/127,sa/127,Ea/127)}return D.nnormals*ia}(U);U+=function(N){for(var ca,sa,Ea=D.uv_coordinate_bytes*2,ia=N+D.nuvs*Ea;N<ia;N+=Ea){ca=j(b,N);sa=j(b,N+D.uv_coordinate_bytes);O.push(ca,sa)}return D.nuvs*Ea}(U);pa=
+U+pa;Ha=pa+Ha;Ta=Ha+Ta;ab=Ta+ab;Xa=ab+Xa;h=Xa+h;Ua=h+Ua;(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes,Ea=sa+D.uv_index_bytes*3,ia=N+D.ntri_flat_uv*Ea;for(ca=N;ca<ia;ca+=Ea){x(ca);F(ca+sa)}return ia-N})(Ha);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ea=sa+D.uv_index_bytes*3,ia=N+D.ntri_smooth_uv*Ea;for(ca=N;ca<ia;ca+=Ea){A(ca);F(ca+sa)}return ia-N})(Ta);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes,Ea=sa+
+D.uv_index_bytes*4,ia=N+D.nquad_flat_uv*Ea;for(ca=N;ca<ia;ca+=Ea){t(ca);I(ca+sa)}return ia-N})(h);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Ea=sa+D.uv_index_bytes*4,ia=N+D.nquad_smooth_uv*Ea;for(ca=N;ca<ia;ca+=Ea){C(ca);I(ca+sa)}return ia-N})(Ua);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes,Ea=N+D.ntri_flat*sa;for(ca=N;ca<Ea;ca+=sa)x(ca);return Ea-N})(U);(function(N){var ca,sa=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*
 3,Ea=N+D.ntri_smooth*sa;for(ca=N;ca<Ea;ca+=sa)A(ca);return Ea-N})(pa);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes,Ea=N+D.nquad_flat*sa;for(ca=N;ca<Ea;ca+=sa)t(ca);return Ea-N})(ab);(function(N){var ca,sa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Ea=N+D.nquad_smooth*sa;for(ca=N;ca<Ea;ca+=sa)C(ca);return Ea-N})(Xa);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,
 d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,n){h=b.materials[h];var p=d[k*3],o=d[k*3+1];k=d[k*3+2];var x=d[n*3],A=d[n*3+1];n=d[n*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(x,A,n)],null,h))},
-f4n:function(b,d,c,f,g,h,j,k,n,p,o){j=b.materials[j];var x=d[n*3],A=d[n*3+1];n=d[n*3+2];var t=d[p*3],C=d[p*3+1];p=d[p*3+2];var E=d[o*3],G=d[o*3+1];o=d[o*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*3],d[k*3+1],d[k*3+2]),new THREE.Vector3(x,A,n),new THREE.Vector3(t,C,p),new THREE.Vector3(E,G,o)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(d,
+f4n:function(b,d,c,f,g,h,j,k,n,p,o){j=b.materials[j];var x=d[n*3],A=d[n*3+1];n=d[n*3+2];var t=d[p*3],C=d[p*3+1];p=d[p*3+2];var F=d[o*3],I=d[o*3+1];o=d[o*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*3],d[k*3+1],d[k*3+2]),new THREE.Vector3(x,A,n),new THREE.Vector3(t,C,p),new THREE.Vector3(F,I,o)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(d,
 c));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,n));b.push(p)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[c],o[c+3],j);g[h+1]=this.lerp(o[c+1],o[c+4],j);g[h+2]=this.lerp(o[c+2],o[c+5],j)};this.VIntY=function(c,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
 2]=p;f=c+this.yd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,x=n+this.yd,A=n+this.zd,t=h+this.yd+this.zd,C=n+this.yd+this.zd,E=0,G=this.field[h],L=this.field[n],V=this.field[p],D=this.field[x],M=this.field[o],O=this.field[A],Q=this.field[t],Ia=this.field[C];G<j&&(E|=1);L<j&&(E|=2);V<j&&(E|=8);D<j&&(E|=4);M<j&&(E|=16);O<j&&(E|=32);Q<j&&(E|=128);Ia<j&&(E|=64);var ua=THREE.edgeTable[E];if(ua==0)return 0;
-var Aa=this.delta,da=c+Aa,e=f+Aa;Aa=g+Aa;if(ua&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,G,L)}if(ua&2){this.compNorm(n);this.compNorm(x);this.VIntY(n*3,this.vlist,this.nlist,3,j,da,f,g,L,D)}if(ua&4){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,e,g,V,D)}if(ua&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,G,V)}if(ua&16){this.compNorm(o);this.compNorm(A);this.VIntX(o*3,this.vlist,this.nlist,
-12,j,c,f,Aa,M,O)}if(ua&32){this.compNorm(A);this.compNorm(C);this.VIntY(A*3,this.vlist,this.nlist,15,j,da,f,Aa,O,Ia)}if(ua&64){this.compNorm(t);this.compNorm(C);this.VIntX(t*3,this.vlist,this.nlist,18,j,c,e,Aa,Q,Ia)}if(ua&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,j,c,f,Aa,M,Q)}if(ua&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,G,M)}if(ua&512){this.compNorm(n);this.compNorm(A);this.VIntZ(n*3,this.vlist,this.nlist,27,j,da,
-f,g,L,O)}if(ua&1024){this.compNorm(x);this.compNorm(C);this.VIntZ(x*3,this.vlist,this.nlist,30,j,da,e,g,D,Ia)}if(ua&2048){this.compNorm(p);this.compNorm(t);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,e,g,V,Q)}E<<=4;for(j=h=0;THREE.triTable[E+j]!=-1;){c=E+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=c[g];this.positionArray[n+1]=c[g+
+this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,x=n+this.yd,A=n+this.zd,t=h+this.yd+this.zd,C=n+this.yd+this.zd,F=0,I=this.field[h],G=this.field[n],U=this.field[p],D=this.field[x],M=this.field[o],O=this.field[A],Q=this.field[t],Ia=this.field[C];I<j&&(F|=1);G<j&&(F|=2);U<j&&(F|=8);D<j&&(F|=4);M<j&&(F|=16);O<j&&(F|=32);Q<j&&(F|=128);Ia<j&&(F|=64);var ua=THREE.edgeTable[F];if(ua==0)return 0;
+var Aa=this.delta,da=c+Aa,e=f+Aa;Aa=g+Aa;if(ua&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,I,G)}if(ua&2){this.compNorm(n);this.compNorm(x);this.VIntY(n*3,this.vlist,this.nlist,3,j,da,f,g,G,D)}if(ua&4){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,e,g,U,D)}if(ua&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,I,U)}if(ua&16){this.compNorm(o);this.compNorm(A);this.VIntX(o*3,this.vlist,this.nlist,
+12,j,c,f,Aa,M,O)}if(ua&32){this.compNorm(A);this.compNorm(C);this.VIntY(A*3,this.vlist,this.nlist,15,j,da,f,Aa,O,Ia)}if(ua&64){this.compNorm(t);this.compNorm(C);this.VIntX(t*3,this.vlist,this.nlist,18,j,c,e,Aa,Q,Ia)}if(ua&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,j,c,f,Aa,M,Q)}if(ua&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,I,M)}if(ua&512){this.compNorm(n);this.compNorm(A);this.VIntZ(n*3,this.vlist,this.nlist,27,j,da,
+f,g,G,O)}if(ua&1024){this.compNorm(x);this.compNorm(C);this.VIntZ(x*3,this.vlist,this.nlist,30,j,da,e,g,D,Ia)}if(ua&2048){this.compNorm(p);this.compNorm(t);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,e,g,U,Q)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=c[g];this.positionArray[n+1]=c[g+
 1];this.positionArray[n+2]=c[g+2];this.positionArray[n+3]=c[h];this.positionArray[n+4]=c[h+1];this.positionArray[n+5]=c[h+2];this.positionArray[n+6]=c[j];this.positionArray[n+7]=c[j+1];this.positionArray[n+8]=c[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
 this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=c*this.size,x=Math.floor(n-k);x<1&&(x=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var A=Math.floor(p-k);A<1&&(A=1);p=Math.floor(p+k);p>this.size-1&&(p=
-this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var C,E,G,L,V,D;x<n;x++){o=this.size2*x;E=x/this.size-g;V=E*E;for(E=A;E<p;E++){G=o+this.size*E;C=E/this.size-f;D=C*C;for(C=t;C<k;C++){L=C/this.size-c;L=h/(1.0E-6+L*L+D+V)-j;L>0&&(this.field[G+C]+=L)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,A=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g<t;g++){h=g/p;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
+this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var C,F,I,G,U,D;x<n;x++){o=this.size2*x;F=x/this.size-g;U=F*F;for(F=A;F<p;F++){I=o+this.size*F;C=F/this.size-f;D=C*C;for(C=t;C<k;C++){G=C/this.size-c;G=h/(1.0E-6+G*G+D+U)-j;G>0&&(this.field[I+C]+=G)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,A=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g<t;g++){h=g/p;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
 0;j<p;j++)A[x*j+n]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,n,p,o=this.size,x=this.yd,A=this.zd,t=this.field,C=o*Math.sqrt(c/f);C>o&&(C=o);for(h=0;h<C;h++){g=h/o;g*=g;k=c/(1.0E-4+g)-f;if(k>0){n=h*x;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)t[A*j+p]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
 for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,n,p,o,x,A=this.size-2;for(j=1;j<A;j++){x=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<A;h++){o=x+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<A;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry;
 this.render(function(g){var h,j,k,n,p,o,x,A;for(h=0;h<g.count;h++){p=h*3;x=p+1;A=p+2;j=g.positionArray[p];k=g.positionArray[x];n=g.positionArray[A];o=new THREE.Vector3(j,k,n);j=g.normalArray[p];k=g.normalArray[x];n=g.normalArray[A];p=new THREE.Vector3(j,k,n);p.normalize();p=new THREE.Vertex(o,p);f.vertices.push(p)}nfaces=g.count/3;for(h=0;h<nfaces;h++){p=(c+h)*3;x=p+1;A=p+2;o=f.vertices[p].normal;j=f.vertices[x].normal;k=f.vertices[A].normal;p=new THREE.Face3(p,x,A,[o,j,k]);f.faces.push(p)}c+=nfaces;

+ 79 - 80
build/custom/ThreeExtras.js

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

@@ -57,7 +57,6 @@
 		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/Texture.js"></script>
-		<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
 		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
 		<script type="text/javascript" src="../src/objects/Particle.js"></script>
 		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
@@ -78,6 +77,7 @@
 		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
 		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLRenderTarget.js"></script>
 		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>

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

@@ -77,7 +77,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		offset, zLength,
 		
 		colorIndex, normalIndex, uvIndex, materialIndex,
-
+		
 		type,
 		isQuad, 
 		hasMaterial, 
@@ -85,7 +85,9 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		hasFaceNormal, hasFaceVertexNormal,
 		hasFaceColor, hasFaceVertexColor,
 
-		vertex, face,
+		vertex, face, color, normal,
+		
+		uvLayer, uvs,
 
 		faces = json.faces,
 		vertices = json.vertices,