Sfoglia il codice sorgente

Updated OBJ converter to create new JSON model format.

Not tested yet, as the rest of the engine doesn't work yet.
alteredq 14 anni fa
parent
commit
bdc19a15c2

+ 253 - 271
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r36 - http://github.com/mrdoob/three.js
 // Three.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,f,g,h,m,j;if(b==0)d=f=g=0;else{h=Math.floor(a*6);m=a*6-h;a=b*(1-c);j=b*(1-c*m);c=b*(1-c*(1-m));switch(h){case 1:d=j;f=b;g=a;break;case 2:d=a;f=b;g=c;break;case 3:d=a;f=j;g=b;break;case 4:d=c;f=a;g=b;break;case 5:d=b;f=a;g=j;break;case 6:case 0:d=b;f=c;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,c){this.set(a||0,c||0)};
 THREE.Vector2=function(a,c){this.set(a||0,c||0)};
 THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,83 +12,85 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(F,x,G,y){y=y.clone().subSelf(x);G=G.clone().subSelf(x);var L=F.clone().subSelf(x);F=y.dot(y);x=y.dot(G);y=y.dot(L);var J=G.dot(G);G=G.dot(L);L=1/(F*J-x*x);J=(J*y-x*G)*L;F=(F*G-x*y)*L;return J>0&&F>0&&J+F<1}var b,d,e,g,h,j,k,m,t,w,
-u,o=a.geometry,v=o.vertices,B=[];b=0;for(d=o.faces.length;b<d;b++){e=o.faces[b];w=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(v[e.a].position.clone());h=k.multiplyVector3(v[e.b].position.clone());j=k.multiplyVector3(v[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(v[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=u.dot(m);if(t<0){m=m.dot((new THREE.Vector3).sub(g,w))/t;w=w.addSelf(u.multiplyScalar(m));
-if(e instanceof THREE.Face3){if(c(w,g,h,j)){e={distance:this.origin.distanceTo(w),point:w,face:e,object:a};B.push(e)}}else if(e instanceof THREE.Face4&&(c(w,g,h,k)||c(w,h,j,k))){e={distance:this.origin.distanceTo(w),point:w,face:e,object:a};B.push(e)}}}return B}};
-THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,m,t,w){j=!1;c=k;b=m;d=t;e=w;a()};this.addPoint=function(k,m){if(j){j=!1;c=k;b=m;d=k;e=m}else{c=c<k?c:k;b=b<m?b:m;d=d>k?d:k;e=e>m?e:m}a()};
-this.add3Points=function(k,m,t,w,u,o){if(j){j=!1;c=k<t?k<u?k:u:t<u?t:u;b=m<w?m<o?m:o:w<o?w:o;d=k>t?k>u?k:u:t>u?t:u;e=m>w?m>o?m:o:w>o?w:o}else{c=k<t?k<u?k<c?k:c:u<c?u:c:t<u?t<c?t:c:u<c?u:c;b=m<w?m<o?m<b?m:b:o<b?o:b:w<o?w<b?w:b:o<b?o:b;d=k>t?k>u?k>d?k:d:u>d?u:d:t>u?t>d?t:d:u>d?u:d;e=m>w?m>o?m>e?m:e:o>e?o:e:w>o?w>e?w:e:o>e?o:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
-d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,f=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(E,w,M,J){J=J.clone().subSelf(w);M=M.clone().subSelf(w);var N=E.clone().subSelf(w);E=J.dot(J);w=J.dot(M);J=J.dot(N);var R=M.dot(M);M=M.dot(N);N=1/(E*R-w*w);R=(R*J-w*M)*N;E=(E*M-w*J)*N;return R>0&&E>0&&R+E<1}var b,d,f,g,h,m,j,n,p,v,
+u,o=a.geometry,x=o.vertices,B=[];b=0;for(d=o.faces.length;b<d;b++){f=o.faces[b];v=this.origin.clone();u=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());m=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=u.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,v))/p;v=v.addSelf(u.multiplyScalar(n));
+if(f instanceof THREE.Face3){if(c(v,g,h,m)){f={distance:this.origin.distanceTo(v),point:v,face:f,object:a};B.push(f)}}else if(f instanceof THREE.Face4&&(c(v,g,h,j)||c(v,h,m,j))){f={distance:this.origin.distanceTo(v),point:v,face:f,object:a};B.push(f)}}}return B}};
+THREE.Rectangle=function(){function a(){g=d-c;h=f-b}var c,b,d,f,g,h,m=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,n,p,v){m=!1;c=j;b=n;d=p;f=v;a()};this.addPoint=function(j,n){if(m){m=!1;c=j;b=n;d=j;f=n}else{c=c<j?c:j;b=b<n?b:n;d=d>j?d:j;f=f>n?f:n}a()};
+this.add3Points=function(j,n,p,v,u,o){if(m){m=!1;c=j<p?j<u?j:u:p<u?p:u;b=n<v?n<o?n:o:v<o?v:o;d=j>p?j>u?j:u:p>u?p:u;f=n>v?n>o?n:o:v>o?v:o}else{c=j<p?j<u?j<c?j:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;b=n<v?n<o?n<b?n:b:o<b?o:b:v<o?v<b?v:b:o<b?o:b;d=j>p?j>u?j>d?j:d:u>d?u:d:p>u?p>d?p:d:u>d?u:d;f=n>v?n>o?n>f?n:f:o>f?o:f:v>o?v>f?v:f:o>f?o:f}a()};this.addRectangle=function(j){if(m){m=!1;c=j.getLeft();b=j.getTop();d=j.getRight();f=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();b=b<j.getTop()?b:j.getTop();d=d>j.getRight()?
+d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){c-=j;b-=j;d+=j;f+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();b=b>j.getTop()?b:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(b,j.getTop())>=0};this.empty=function(){m=!0;f=d=b=c=0;a()};this.isEmpty=function(){return m}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,t,w,u,o,v,B){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,t||1,w||0,u||0,o||0,v||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,t,w,u,o,v,B){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=t;this.n34=w;this.n41=u;this.n42=o;this.n43=v;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
-d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,x=a.n44,G=c.n11,y=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22,
-f=c.n23,X=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+e*R;this.n12=b*y+d*N+e*da;this.n13=b*L+d*f+e*ga;this.n14=b*J+d*X+e*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*y+j*N+k*da;this.n23=h*L+j*f+k*ga;this.n24=h*J+j*X+k*I+m;this.n31=t*G+w*Y+u*R;this.n32=t*y+w*N+u*da;this.n33=t*L+w*f+u*ga;this.n34=t*J+w*X+u*I+o;this.n41=v*G+B*Y+F*R;this.n42=v*y+B*N+F*da;this.n43=v*L+B*f+F*ga;this.n44=v*J+B*X+F*I+x;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
-b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,t=this.n33,w=this.n34,u=this.n41,o=this.n42,v=this.n43,B=this.n44;return d*h*m*u-b*j*m*u-d*g*t*u+c*j*t*u+b*g*w*u-c*h*w*u-d*h*k*o+b*j*k*o+d*e*t*o-a*j*t*o-b*e*w*o+a*h*w*o+d*g*k*v-c*j*k*v-d*e*m*v+a*j*m*v+c*e*w*v-a*g*w*v-b*g*k*B+c*h*k*B+b*e*m*B-a*h*m*B-c*e*t*B+a*g*t*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
-this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
-this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
-this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,
-c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=a.z,k=e*g,m=e*h;this.set(k*
-g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+b,m*j-d*g,0,k*j-d*h,m*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
-a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var m=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(m+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,x=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*B-m*u*B+m*w*F-j*o*F-k*w*x+j*u*x;c.n12=g*u*B-e*o*B-g*w*F+d*o*F+e*w*x-d*u*x;c.n13=e*m*B-g*k*B+g*j*F-d*m*F-e*j*x+d*k*x;c.n14=g*k*w-e*m*w-g*j*u+d*m*u+e*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*t*F+h*o*F+k*t*x-h*u*x;c.n22=e*o*v-g*u*v+g*t*F-b*o*F-e*t*x+b*u*x;c.n23=g*k*v-e*m*v-g*h*F+b*m*F+e*h*x-b*k*x;
-c.n24=e*m*t-g*k*t+g*h*u-b*m*u-e*h*o+b*k*o;c.n31=j*o*v-m*w*v+m*t*B-h*o*B-j*t*x+h*w*x;c.n32=g*w*v-d*o*v-g*t*B+b*o*B+d*t*x-b*w*x;c.n33=e*m*v-g*j*v+g*h*B-b*m*B-d*h*x+b*j*x;c.n34=g*j*t-d*m*t-g*h*w+b*m*w+d*h*o-b*j*o;c.n41=k*w*v-j*u*v-k*t*B+h*u*B+j*t*F-h*w*F;c.n42=d*u*v-e*w*v+e*t*B-b*u*B-d*t*F+b*w*F;c.n43=e*j*v-d*k*v-e*h*B+b*k*B+d*h*F-b*j*F;c.n44=d*k*t-e*j*t+e*h*w-b*k*w-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*t;b[8]=a*w;return c};
-THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,m;h=new THREE.Matrix4;j=c-a;k=b-d;m=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4=function(a,c,b,d,f,g,h,m,j,n,p,v,u,o,x,B){this.set(a||1,c||0,b||0,d||0,f||0,g||1,h||0,m||0,j||0,n||0,p||1,v||0,u||0,o||0,x||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,h,m,j,n,p,v,u,o,x,B){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=m;this.n31=j;this.n32=n;this.n33=p;this.n34=v;this.n41=u;this.n42=o;this.n43=x;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
+f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,f=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
+d+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,m=a.n22,j=a.n23,n=a.n24,p=a.n31,v=a.n32,u=a.n33,o=a.n34,x=a.n41,B=a.n42,E=a.n43,w=a.n44,M=c.n11,J=c.n12,N=c.n13,R=c.n14,da=c.n21,O=c.n22,
+e=c.n23,Y=c.n24,V=c.n31,ma=c.n32,ka=c.n33,K=c.n34;this.n11=b*M+d*da+f*V;this.n12=b*J+d*O+f*ma;this.n13=b*N+d*e+f*ka;this.n14=b*R+d*Y+f*K+g;this.n21=h*M+m*da+j*V;this.n22=h*J+m*O+j*ma;this.n23=h*N+m*e+j*ka;this.n24=h*R+m*Y+j*K+n;this.n31=p*M+v*da+u*V;this.n32=p*J+v*O+u*ma;this.n33=p*N+v*e+u*ka;this.n34=p*R+v*Y+u*K+o;this.n41=x*M+B*da+E*V;this.n42=x*J+B*O+E*ma;this.n43=x*N+B*e+E*ka;this.n44=x*R+B*Y+E*K+w;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=
+this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,m=this.n24,j=this.n31,n=this.n32,p=this.n33,v=this.n34,u=this.n41,o=this.n42,x=this.n43,B=this.n44;return d*h*n*u-b*m*n*u-d*g*p*u+c*m*p*u+b*g*v*u-c*h*v*u-d*h*j*o+b*m*j*o+d*f*p*o-a*m*p*o-b*f*v*o+a*h*v*o+d*g*j*x-c*m*j*x-d*f*n*x+a*m*n*x+c*f*v*x-a*g*v*x-b*g*j*B+c*h*j*B+b*f*n*B-a*h*n*B-c*f*p*B+a*g*p*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
+a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
+this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
+a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
+setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),f=1-b,g=a.x,h=a.y,m=
+a.z,j=f*g,n=f*h;this.set(j*g+b,j*h-d*m,j*m+d*h,0,j*h+d*m,n*h+b,n*m-d*g,0,j*m-d*h,n*m+d*g,f*m*m+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,m=c*b;this.n11=f*g;this.n12=-f*d;this.n13=b;this.n21=m*g+a*d;this.n22=-m*d+a*g;this.n23=-c*f;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*f;return this},
+setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,f=a.w,g=c+c,h=b+b,m=d+d;a=c*g;var j=c*h;c*=m;var n=b*h;b*=m;d*=m;g*=f;h*=f;f*=m;this.n11=1-(n+d);this.n12=j-f;this.n13=c+h;this.n21=j+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,m=a.n22,j=a.n23,n=a.n24,p=a.n31,v=a.n32,u=a.n33,o=a.n34,x=a.n41,B=a.n42,E=a.n43,w=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*o*B-n*u*B+n*v*E-m*o*E-j*v*w+m*u*w;c.n12=g*u*B-f*o*B-g*v*E+d*o*E+f*v*w-d*u*w;c.n13=f*n*B-g*j*B+g*m*E-d*n*E-f*m*w+d*j*w;c.n14=g*j*v-f*n*v-g*m*u+d*n*u+f*m*o-d*j*o;c.n21=n*u*x-j*o*x-n*p*E+h*o*E+j*p*w-h*u*w;c.n22=f*o*x-g*u*x+g*p*E-b*o*E-f*p*w+b*u*w;c.n23=g*j*x-f*n*x-g*h*E+b*n*E+f*h*w-b*j*w;
+c.n24=f*n*p-g*j*p+g*h*u-b*n*u-f*h*o+b*j*o;c.n31=m*o*x-n*v*x+n*p*B-h*o*B-m*p*w+h*v*w;c.n32=g*v*x-d*o*x-g*p*B+b*o*B+d*p*w-b*v*w;c.n33=f*n*x-g*m*x+g*h*B-b*n*B-d*h*w+b*m*w;c.n34=g*m*p-d*n*p-g*h*v+b*n*v+d*h*o-b*m*o;c.n41=j*v*x-m*u*x-j*p*B+h*u*B+m*p*E-h*v*E;c.n42=d*u*x-f*v*x+f*p*B-b*u*B-d*p*E+b*v*E;c.n43=f*m*x-d*j*x-f*h*B+b*j*B+d*h*E-b*m*E;c.n44=d*j*p-f*m*p+f*h*v-b*j*v-d*h*u+b*m*u;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*m;b[5]=a*j;b[6]=a*n;b[7]=a*p;b[8]=a*v;return c};
+THREE.Matrix4.makeFrustum=function(a,c,b,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,d)};
+THREE.Matrix4.makeOrtho=function(a,c,b,d,f,g){var h,m,j,n;h=new THREE.Matrix4;m=c-a;j=b-d;n=g-f;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+a)/m);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((b+d)/j);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
 c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
 c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,t=k*d+j*b-g*e,w=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+t*-j-w*-h;c.y=t*k+b*-h+w*-g-m*-j;c.z=w*k+b*-j+m*-h-t*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
+THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,f=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,m=d*f;this.w=h*g-m*b;this.x=h*b+m*g;this.y=d*c*g+a*f*b;this.z=a*f*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,f=this.w,g=a.x,h=a.y,m=a.z;a=a.w;this.x=c*a+f*g+b*m-d*h;this.y=b*a+f*h+d*g-c*m;this.z=d*a+f*m+c*h-b*g;this.w=f*a-c*g-b*h-d*m;return this},
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,h=this.y,m=this.z,j=this.w,n=j*b+h*f-m*d,p=j*d+m*b-g*f,v=j*f+g*d-h*b;b=-g*b-h*d-m*f;c.x=n*j+b*-g+p*-m-v*-h;c.y=p*j+b*-h+v*-g-n*-m;c.z=v*j+b*-m+n*-h-p*-g;return c}};
+THREE.Quaternion.slerp=function(a,c,b,d){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*f+c.w*d;b.x=a.x*f+c.x*d;b.y=a.y*f+c.y*d;b.z=a.z*f+c.z*d;return b};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
-THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Face3=function(a,c,b,d,f,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,c,b,d,f,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
-b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,f,g,h,m=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){m.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)m.addSelf(g.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];m.sub(h.position,
+b.position);j.sub(c.position,b.position);m.crossSelf(j)}m.isZero()||m.normalize();g.normal.copy(m)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,za,ea,xa,ja,ha){g=I.vertices[ca].position;h=I.vertices[za].position;j=I.vertices[ea].position;k=e[xa];m=e[ja];t=e[ha];w=h.x-g.x;u=j.x-g.x;o=h.y-g.y;
-v=j.y-g.y;B=h.z-g.z;F=j.z-g.z;x=m.u-k.u;G=t.u-k.u;y=m.v-k.v;L=t.v-k.v;J=1/(x*L-G*y);f.set((L*w-y*u)*J,(L*o-y*v)*J,(L*B-y*F)*J);X.set((x*u-G*w)*J,(x*v-G*o)*J,(x*F-G*B)*J);Y[ca].addSelf(f);Y[za].addSelf(f);Y[ea].addSelf(f);N[ca].addSelf(X);N[za].addSelf(X);N[ea].addSelf(X)}var c,b,d,e,g,h,j,k,m,t,w,u,o,v,B,F,x,G,y,L,J,Y=[],N=[],f=new THREE.Vector3,X=new THREE.Vector3,R=new THREE.Vector3,da=new THREE.Vector3,ga=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Y[c]=new THREE.Vector3;N[c]=new THREE.Vector3}c=
-0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ga.copy(this.vertices[c].normal);d=Y[c];R.copy(d);R.subSelf(ga.multiplyScalar(ga.dot(d))).normalize();da.cross(this.vertices[c].normal,d);d=da.dot(N[c]);d=d<0?-1:1;this.vertices[c].tangent.set(R.x,R.y,R.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(K,ea,Ha,fa,Ca,na,ja){g=K.vertices[ea].position;h=K.vertices[Ha].position;m=K.vertices[fa].position;j=f[Ca];n=f[na];p=f[ja];v=h.x-g.x;u=m.x-g.x;o=h.y-g.y;
+x=m.y-g.y;B=h.z-g.z;E=m.z-g.z;w=n.u-j.u;M=p.u-j.u;J=n.v-j.v;N=p.v-j.v;R=1/(w*N-M*J);e.set((N*v-J*u)*R,(N*o-J*x)*R,(N*B-J*E)*R);Y.set((w*u-M*v)*R,(w*x-M*o)*R,(w*E-M*B)*R);da[ea].addSelf(e);da[Ha].addSelf(e);da[fa].addSelf(e);O[ea].addSelf(Y);O[Ha].addSelf(Y);O[fa].addSelf(Y)}var c,b,d,f,g,h,m,j,n,p,v,u,o,x,B,E,w,M,J,N,R,da=[],O=[],e=new THREE.Vector3,Y=new THREE.Vector3,V=new THREE.Vector3,ma=new THREE.Vector3,ka=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){da[c]=new THREE.Vector3;O[c]=
+new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];f=this.faceVertexUvs[c][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ka.copy(this.vertices[c].normal);d=da[c];V.copy(d);V.subSelf(ka.multiplyScalar(ka.dot(d))).normalize();ma.cross(this.vertices[c].normal,d);d=ma.dot(O[c]);d=d<0?-1:1;this.vertices[c].tangent.set(V.x,V.y,V.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(o,v,B,F,x,G,y){o=(B-o)*0.5;F=(F-v)*0.5;return(2*(v-B)+o+F)*y+(-3*(v-B)-2*o-F)*G+o*x+v}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,m,t,w,u;this.initFromArray=function(o){this.points=[];for(var v=0;v<o.length;v++)this.points[v]={x:o[v][0],y:o[v][1],z:o[v][2]}};this.getPoint=function(o){e=(this.points.length-1)*o;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];t=this.points[b[1]];
-w=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,t.x,w.x,u.x,h,j,k);d.y=c(m.y,t.y,w.y,u.y,h,j,k);d.z=c(m.z,t.z,w.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,B=this.points.length,F=[];for(o=0;o<B;o++){v=this.points[o];F[o]=[v.x,v.y,v.z]}return F};this.getLength=function(o){var v,B,F=v=v=0,x=new THREE.Vector3,G=new THREE.Vector3,y=[],L=0;y[0]=0;o||(o=100);B=this.points.length*o;x.copy(this.points[0]);for(o=1;o<B;o++){v=o/B;position=this.getPoint(v);G.copy(position);
-L+=G.distanceTo(x);x.copy(position);v*=this.points.length-1;v=Math.floor(v);if(v!=F){y[v]=L;F=v}}y[y.length]=L;return{chunks:y,total:L}};this.reparametrizeByArcLength=function(o){var v,B,F,x,G,y,L=[],J=new THREE.Vector3,Y=this.getLength();L.push(J.copy(this.points[0]).clone());for(v=1;v<this.points.length;v++){B=Y.chunks[v]-Y.chunks[v-1];y=Math.ceil(o*B/Y.total);x=(v-1)/(this.points.length-1);G=v/(this.points.length-1);for(B=1;B<y-1;B++){F=x+B*(1/y)*(G-x);position=this.getPoint(F);L.push(J.copy(position).clone())}L.push(J.copy(this.points[v]).clone())}this.points=
-L}};
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
-0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++){var m=e.hierarchy[g].keys[h].morphTargets[k];j[m]=-1}e.hierarchy[g].usedMorphTargets=j;for(h=0;h<e.hierarchy[g].keys.length;h++){var t=
-{};for(m in j){for(k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++)if(e.hierarchy[g].keys[h].morphTargets[k]===m){t[m]=e.hierarchy[g].keys[h].morphTargetsInfluences[k];break}k===e.hierarchy[g].keys[h].morphTargets.length&&(t[m]=0)}e.hierarchy[g].keys[h].morphTargetsInfluences=t}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=
+THREE.Spline=function(a){function c(o,x,B,E,w,M,J){o=(B-o)*0.5;E=(E-x)*0.5;return(2*(x-B)+o+E)*J+(-3*(x-B)-2*o-E)*M+o*w+x}this.points=a;var b=[],d={x:0,y:0,z:0},f,g,h,m,j,n,p,v,u;this.initFromArray=function(o){this.points=[];for(var x=0;x<o.length;x++)this.points[x]={x:o[x][0],y:o[x][1],z:o[x][2]}};this.getPoint=function(o){f=(this.points.length-1)*o;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
+v=this.points[b[2]];u=this.points[b[3]];m=h*h;j=h*m;d.x=c(n.x,p.x,v.x,u.x,h,m,j);d.y=c(n.y,p.y,v.y,u.y,h,m,j);d.z=c(n.z,p.z,v.z,u.z,h,m,j);return d};this.getControlPointsArray=function(){var o,x,B=this.points.length,E=[];for(o=0;o<B;o++){x=this.points[o];E[o]=[x.x,x.y,x.z]}return E};this.getLength=function(o){var x,B,E=x=x=0,w=new THREE.Vector3,M=new THREE.Vector3,J=[],N=0;J[0]=0;o||(o=100);B=this.points.length*o;w.copy(this.points[0]);for(o=1;o<B;o++){x=o/B;position=this.getPoint(x);M.copy(position);
+N+=M.distanceTo(w);w.copy(position);x*=this.points.length-1;x=Math.floor(x);if(x!=E){J[x]=N;E=x}}J[J.length]=N;return{chunks:J,total:N}};this.reparametrizeByArcLength=function(o){var x,B,E,w,M,J,N=[],R=new THREE.Vector3,da=this.getLength();N.push(R.copy(this.points[0]).clone());for(x=1;x<this.points.length;x++){B=da.chunks[x]-da.chunks[x-1];J=Math.ceil(o*B/da.total);w=(x-1)/(this.points.length-1);M=x/(this.points.length-1);for(B=1;B<J-1;B++){E=w+B*(1/J)*(M-w);position=this.getPoint(E);N.push(R.copy(position).clone())}N.push(R.copy(this.points[x]).clone())}this.points=
+N}};
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
+0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var m=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){m={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var j=0;j<f.hierarchy[g].keys[h].morphTargets.length;j++){var n=f.hierarchy[g].keys[h].morphTargets[j];m[n]=-1}f.hierarchy[g].usedMorphTargets=m;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
+{};for(n in m){for(j=0;j<f.hierarchy[g].keys[h].morphTargets.length;j++)if(f.hierarchy[g].keys[h].morphTargets[j]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[j];break}j===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else d(f,g);return g};var d=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)d(f.children[h],g)};b.LINEAR=
 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,m,t=this.data.JIT.hierarchy,w,u;this.currentTime+=a*this.timeScale;u=this.currentTime;w=this.currentTime%=this.data.length;m=parseInt(Math.min(w*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,v=this.hierarchy.length;o<v;o++){a=this.hierarchy[o];k=a.animationCache;if(this.JITCompile&&t[o][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=t[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var B=0;B<3;B++){b=c[B];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(w<u)if(this.loop){h=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<w;){h=j;j=this.getNextKeyWith(b,o,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,o,j.index+1)}while(j.time<
-w)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(w-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&t[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)t[o][m]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,m;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],m[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],m[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],m[2],e,b,h);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,h,m,j,n,p=this.data.JIT.hierarchy,v,u;this.currentTime+=a*this.timeScale;u=this.currentTime;v=this.currentTime%=this.data.length;n=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,x=this.hierarchy.length;o<x;o++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&p[o][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var B=0;B<3;B++){b=c[B];h=j.prevKey[b];m=j.nextKey[b];if(m.time<=u){if(v<u)if(this.loop){h=this.data.hierarchy[o].keys[0];for(m=this.getNextKeyWith(b,o,1);m.time<v;){h=m;m=this.getNextKeyWith(b,o,m.index+1)}}else{this.stop();return}else{do{h=m;m=this.getNextKeyWith(b,o,m.index+1)}while(m.time<
+v)}j.prevKey[b]=h;j.nextKey[b]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(v-h.time)/(m.time-h.time);f=h[b];g=m[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,m.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)p[o][n]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,h,m,j,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];m=a[b[1]];j=a[b[2]];n=a[b[3]];b=f*f;h=f*b;d[0]=this.interpolate(g[0],m[0],j[0],n[0],f,b,h);d[1]=this.interpolate(g[1],m[1],j[1],n[1],f,b,h);d[2]=this.interpolate(g[2],m[2],j[2],n[2],f,b,h);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
-THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,c,b,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
@@ -112,27 +114,27 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
+THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,c,b,d,f,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
 THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,b,d,e={};for(c in a){e[c]={};for(b in a[c]){d=a[c][b];e[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return e},merge:function(a){var c,b,d,e={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)e[b]=d[b]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+var Uniforms={clone:function(a){var c,b,d,f={};for(c in a){f[c]={};for(b in a[c]){d=a[c][b];f[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var c,b,d,f={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)f[b]=d[b]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
 THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
 c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
 c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,g,h,j;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];g=e.pos;h=e.rotq;j=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
-d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,f,g,h,m;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;m=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;m!==undefined?d.scale.set(m[0],m[1],m[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
+d=this.bones[b];f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
-d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
+d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
 THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
 THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
@@ -142,53 +144,53 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(N,f){return f.z-N.z}function c(N,f){var X=0,R=1,da=N.z+N.w,ga=f.z+f.w,I=-N.z+N.w,ca=-f.z+f.w;if(da>=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)X=Math.max(X,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)X=Math.max(X,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(R<X)return!1;else{N.lerpSelf(f,X);f.lerpSelf(N,1-R);return!0}}}var b,d,e=[],g,h,j,k=[],m,t,w=[],u,o,v=[],B=new THREE.Vector4,F=new THREE.Vector4,x=new THREE.Matrix4,
-G=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,J=new THREE.Vector4,Y;this.projectObjects=function(N,f,X){f=[];var R,da,ga;d=0;da=N.objects;N=0;for(R=da.length;N<R;N++){ga=da[N];var I;if(!(I=!ga.visible))if(I=ga instanceof THREE.Mesh){a:{I=void 0;for(var ca=ga.matrixWorld,za=-ga.geometry.boundingSphere.radius*Math.max(ga.scale.x,Math.max(ga.scale.y,ga.scale.z)),ea=0;ea<6;ea++){I=y[ea].x*ca.n14+
-y[ea].y*ca.n24+y[ea].z*ca.n34+y[ea].w;if(I<=za){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;B.copy(ga.position);x.multiplyVector3(B);b.object=ga;b.z=B.z;f.push(b);d++}}X&&f.sort(a);return f};this.projectScene=function(N,f,X){var R=[],da=f.near,ga=f.far,I,ca,za,ea,xa,ja,ha,va,Aa,ia,aa,qa,ra,Q,ma,ta;j=t=o=0;f.matrixAutoUpdate&&f.updateMatrix();N.update(undefined,!1,f);x.multiply(f.projectionMatrix,f.matrixWorldInverse);y[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);
-y[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);y[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);y[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);y[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);y[5].set(x.n41+x.n31,x.n42+x.n32,x.n43+x.n33,x.n44+x.n34);for(I=0;I<6;I++){ja=y[I];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(N,f,!0);N=0;for(I=ja.length;N<I;N++){ha=ja[N].object;if(ha.visible){va=ha.matrixWorld;aa=ha.matrixRotationWorld;
-Aa=ha.materials;ia=ha.overdraw;if(ha instanceof THREE.Mesh){qa=ha.geometry;ra=qa.vertices;ca=0;for(za=ra.length;ca<za;ca++){Q=ra[ca];Q.positionWorld.copy(Q.position);va.multiplyVector3(Q.positionWorld);ea=Q.positionScreen;ea.copy(Q.positionWorld);x.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;Q.__visible=ea.z>da&&ea.z<ga}qa=qa.faces;ca=0;for(za=qa.length;ca<za;ca++){Q=qa[ca];if(Q instanceof THREE.Face3){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];if(ea.__visible&&xa.__visible&&ma.__visible&&(ha.doubleSided||ha.flipSided!=
-(ma.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ma.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ma.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ma.positionScreen);g.normalWorld.copy(Q.normal);aa.multiplyVector3(g.normalWorld);
-g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);x.multiplyVector3(g.centroidScreen);ma=Q.vertexNormals;Y=g.vertexNormalsWorld;ea=0;for(xa=ma.length;ea<xa;ea++){ta=Y[ea]=Y[ea]||new THREE.Vector3;ta.copy(ma[ea]);aa.multiplyVector3(ta)}g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][2]}R.push(g);
-j++}}else if(Q instanceof THREE.Face4){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];ta=ra[Q.d];if(ea.__visible&&xa.__visible&&ma.__visible&&ta.__visible&&(ha.doubleSided||ha.flipSided!=((ta.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ta.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0||(xa.positionScreen.x-ma.positionScreen.x)*(ta.positionScreen.y-ma.positionScreen.y)-(xa.positionScreen.y-ma.positionScreen.y)*(ta.positionScreen.x-ma.positionScreen.x)<
-0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ta.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ta.positionScreen);g.normalWorld.copy(Q.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);x.multiplyVector3(g.centroidScreen);
-g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][3]}R.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(xa.positionWorld);h.v2.positionWorld.copy(ma.positionWorld);h.v3.positionWorld.copy(ta.positionWorld);h.v1.positionScreen.copy(xa.positionScreen);h.v2.positionScreen.copy(ma.positionScreen);h.v3.positionScreen.copy(ta.positionScreen);
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Aa;h.faceMaterials=Q.materials;h.overdraw=ia;if(ha.geometry.uvs[ca]){h.uvs[0]=ha.geometry.uvs[ca][1];h.uvs[1]=ha.geometry.uvs[ca][2];h.uvs[2]=ha.geometry.uvs[ca][3]}R.push(h);j++}}}}else if(ha instanceof THREE.Line){G.multiply(x,va);ra=ha.geometry.vertices;Q=ra[0];Q.positionScreen.copy(Q.position);G.multiplyVector4(Q.positionScreen);ca=1;for(za=ra.length;ca<
-za;ca++){ea=ra[ca];ea.positionScreen.copy(ea.position);G.multiplyVector4(ea.positionScreen);xa=ra[ca-1];L.copy(ea.positionScreen);J.copy(xa.positionScreen);if(c(L,J)){L.multiplyScalar(1/L.w);J.multiplyScalar(1/J.w);m=w[t]=w[t]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(J);m.z=Math.max(L.z,J.z);m.materials=ha.materials;R.push(m);t++}}}else if(ha instanceof THREE.Particle){F.set(ha.position.x,ha.position.y,ha.position.z,1);x.multiplyVector4(F);F.z/=F.w;if(F.z>0&&
-F.z<1){u=v[o]=v[o]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24));u.materials=ha.materials;R.push(u);o++}}}}X&&R.sort(a);return R};this.unprojectVector=function(N,f){var X=f.matrixWorld.clone();X.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));X.multiplyVector3(N);
-return N}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,m,t,w,u,o,v,B;a=c.projectScene(h,j);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){v=u.x*e+e;B=u.y*g+g;t=0;for(w=u.material.length;t<w;t++){o=u.material[t];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=v+"px";o.style.top=B+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)m.globalAlpha=u=ka}function c(ka){if(o!=ka){switch(ka){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}o=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,m=e.getContext("2d"),t=new THREE.Color(0),w=0,u=1,o=0,v=null,B=null,F=1,x,G,y,L,J,Y,N,f,X,R=new THREE.Color,
-da=new THREE.Color,ga=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,za,ea,xa,ja,ha,va,Aa,ia,aa,qa=new THREE.Rectangle,ra=new THREE.Rectangle,Q=new THREE.Rectangle,ma=!1,ta=new THREE.Color,l=new THREE.Color,z=new THREE.Color,p=new THREE.Color,n=Math.PI*2,q=new THREE.Vector3,C,A,D,P,U,E,Z=16;C=document.createElement("canvas");C.width=C.height=2;A=C.getContext("2d");A.fillStyle="rgba(0,0,0,1)";A.fillRect(0,0,2,2);D=A.getImageData(0,0,2,2);P=D.data;U=document.createElement("canvas");U.width=U.height=
-Z;E=U.getContext("2d");E.translate(-Z/2,-Z/2);E.scale(Z,Z);Z--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,na){g=ka;h=na;j=g/2;k=h/2;e.width=g;e.height=h;qa.set(-j,-k,j,k);u=1;o=0;B=v=null;F=1};this.setClearColor=function(ka,na){t=ka;w=na};this.setClearColorHex=function(ka,na){t.setHex(ka);w=na};this.clear=function(){m.setTransform(1,0,0,-1,j,k);if(!ra.isEmpty()){ra.inflate(1);ra.minSelf(qa);if(t.hex==0&&w==0)m.clearRect(ra.getX(),ra.getY(),
-ra.getWidth(),ra.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+w+")";m.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())}ra.empty()}};this.render=function(ka,na){function wa(O){var oa,$,K,T=O.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);p.setRGB(0,0,0);O=0;for(oa=T.length;O<oa;O++){$=T[O];K=$.color;if($ instanceof THREE.AmbientLight){l.r+=K.r;l.g+=K.g;l.b+=K.b}else if($ instanceof THREE.DirectionalLight){z.r+=
-K.r;z.g+=K.g;z.b+=K.b}else if($ instanceof THREE.PointLight){p.r+=K.r;p.g+=K.g;p.b+=K.b}}}function la(O,oa,$,K){var T,fa,pa,sa,ua=O.lights;O=0;for(T=ua.length;O<T;O++){fa=ua[O];pa=fa.color;sa=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=$.dot(fa.position)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){q.sub(fa.position,oa);q.normalize();fa=$.dot(q)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}}}function Ca(O,oa,$){if($.opacity!=0){a($.opacity);
-c($.blending);var K,T,fa,pa,sa,ua;if($ instanceof THREE.ParticleBasicMaterial){if($.map){pa=$.map.image;sa=pa.width>>1;ua=pa.height>>1;T=oa.scale.x*j;fa=oa.scale.y*k;$=T*sa;K=fa*ua;Q.set(O.x-$,O.y-K,O.x+$,O.y+K);if(qa.instersects(Q)){m.save();m.translate(O.x,O.y);m.rotate(-oa.rotation);m.scale(T,-fa);m.translate(-sa,-ua);m.drawImage(pa,0,0);m.restore()}}}else if($ instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+z.r+p.r;ta.g=l.g+z.g+p.g;ta.b=l.b+z.b+p.b;R.r=$.color.r*ta.r;R.g=$.color.g*ta.g;
-R.b=$.color.b*ta.b;R.updateStyleString()}else R.__styleString=$.color.__styleString;$=oa.scale.x*j;K=oa.scale.y*k;Q.set(O.x-$,O.y-K,O.x+$,O.y+K);if(qa.instersects(Q)){T=R.__styleString;if(B!=T)m.fillStyle=B=T;m.save();m.translate(O.x,O.y);m.rotate(-oa.rotation);m.scale($,K);m.beginPath();m.arc(0,0,1,0,n,!0);m.closePath();m.fill();m.restore()}}}}function Da(O,oa,$,K){if(K.opacity!=0){a(K.opacity);c(K.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);m.lineTo(oa.positionScreen.x,
-oa.positionScreen.y);m.closePath();if(K instanceof THREE.LineBasicMaterial){R.__styleString=K.color.__styleString;O=K.linewidth;if(F!=O)m.lineWidth=F=O;O=R.__styleString;if(v!=O)m.strokeStyle=v=O;m.stroke();Q.inflate(K.linewidth*2)}}}function Pa(O,oa,$,K,T,fa){if(T.opacity!=0){a(T.opacity);c(T.blending);L=O.positionScreen.x;J=O.positionScreen.y;Y=oa.positionScreen.x;N=oa.positionScreen.y;f=$.positionScreen.x;X=$.positionScreen.y;m.beginPath();m.moveTo(L,J);m.lineTo(Y,N);m.lineTo(f,X);m.lineTo(L,J);
-m.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,X,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){O=na.matrixWorldInverse;q.copy(K.vertexNormalsWorld[0]);ja=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;ha=-(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;q.copy(K.vertexNormalsWorld[1]);va=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;Aa=
--(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;q.copy(K.vertexNormalsWorld[2]);ia=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;aa=-(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;Ia(L,J,Y,N,f,X,T.envMap.image,ja,ha,va,Aa,ia,aa)}}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,X,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);
-c(THREE.SubtractiveBlending)}if(ma)if(!T.wireframe&&T.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=ga.r=I.r=l.r;da.g=ga.g=I.g=l.g;da.b=ga.b=I.b=l.b;la(fa,K.v1.positionWorld,K.vertexNormalsWorld[0],da);la(fa,K.v2.positionWorld,K.vertexNormalsWorld[1],ga);la(fa,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,X,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;la(fa,K.centroidWorld,K.normalWorld,
-ta);R.r=T.color.r*ta.r;R.g=T.color.g*ta.g;R.b=T.color.b*ta.b;R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){za=na.near;ea=na.far;da.r=da.g=da.b=1-S(O.positionScreen.z,za,ea);ga.r=ga.g=ga.b=1-S(oa.positionScreen.z,za,ea);I.r=I.g=I.b=1-S($.positionScreen.z,za,ea);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;
-xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,X,xa,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=V(K.normalWorld.x);R.g=V(K.normalWorld.y);R.b=V(K.normalWorld.z);R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}}}function M(O,oa){if(v!=O)m.strokeStyle=v=O;if(F!=oa)m.lineWidth=F=oa;m.stroke();Q.inflate(oa*2)}function Na(O){if(B!=O)m.fillStyle=B=O;m.fill()}function Ia(O,oa,$,K,T,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*=
-Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;$-=O;K-=oa;T-=O;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*$-La*T)*Sa;La=(Wa*K-La*fa)*Sa;$=(Ra*T-Ka*$)*Sa;K=(Ra*fa-Ka*K)*Sa;O=O-Ea*sa-$*ua;oa=oa-La*sa-K*ua;m.save();m.transform(Ea,La,$,K,O,oa);m.clip();m.drawImage(pa,0,0);m.restore()}}function Oa(O,oa,$,K){var T=~~(O.r*255),fa=~~(O.g*255);O=~~(O.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~($.r*255),Ra=~~($.g*255);$=~~($.b*255);var La=~~(K.r*255),Ka=~~(K.g*255);
-K=~~(K.b*255);P[0]=T<0?0:T>255?255:T;P[1]=fa<0?0:fa>255?255:fa;P[2]=O<0?0:O>255?255:O;P[4]=pa<0?0:pa>255?255:pa;P[5]=sa<0?0:sa>255?255:sa;P[6]=oa<0?0:oa>255?255:oa;P[8]=ua<0?0:ua>255?255:ua;P[9]=Ra<0?0:Ra>255?255:Ra;P[10]=$<0?0:$>255?255:$;P[12]=La<0?0:La>255?255:La;P[13]=Ka<0?0:Ka>255?255:Ka;P[14]=K<0?0:K>255?255:K;A.putImageData(D,0,0);E.drawImage(C,0,0);return U}function S(O,oa,$){O=(O-oa)/($-oa);return O*O*(3-2*O)}function V(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function W(O,oa){var $=oa.x-O.x,
-K=oa.y-O.y,T=1/Math.sqrt($*$+K*K);$*=T;K*=T;oa.x+=$;oa.y+=K;O.x-=$;O.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya<Ma;ya++){Fa=b[ya];Q.empty();if(Fa instanceof THREE.RenderableParticle){x=Fa;x.x*=j;x.y*=k;Ba=0;for(Ga=Fa.materials.length;Ba<Ga;Ba++)Ca(x,Fa,Fa.materials[Ba],ka)}else if(Fa instanceof THREE.RenderableLine){x=Fa.v1;G=Fa.v2;x.positionScreen.x*=j;x.positionScreen.y*=
-k;G.positionScreen.x*=j;G.positionScreen.y*=k;Q.addPoint(x.positionScreen.x,x.positionScreen.y);Q.addPoint(G.positionScreen.x,G.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.materials.length;Ba<Ga;)Da(x,G,Fa,Fa.materials[Ba++],ka)}}else if(Fa instanceof THREE.RenderableFace3){x=Fa.v1;G=Fa.v2;y=Fa.v3;x.positionScreen.x*=j;x.positionScreen.y*=k;G.positionScreen.x*=j;G.positionScreen.y*=k;y.positionScreen.x*=j;y.positionScreen.y*=k;if(Fa.overdraw){W(x.positionScreen,G.positionScreen);W(G.positionScreen,
-y.positionScreen);W(y.positionScreen,x.positionScreen)}Q.add3Points(x.positionScreen.x,x.positionScreen.y,G.positionScreen.x,G.positionScreen.y,y.positionScreen.x,y.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.meshMaterials.length;Ba<Ga;){Ha=Fa.meshMaterials[Ba++];if(Ha instanceof THREE.MeshFaceMaterial){H=0;for(Ja=Fa.faceMaterials.length;H<Ja;)(Ha=Fa.faceMaterials[H++])&&Pa(x,G,y,Fa,Ha,ka)}else Pa(x,G,y,Fa,Ha,ka)}}}ra.addRectangle(Q)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ja,ha,va){var Aa,ia,aa,qa;Aa=0;for(ia=ja.lights.length;Aa<ia;Aa++){aa=ja.lights[Aa];if(aa instanceof THREE.DirectionalLight){qa=ha.normalWorld.dot(aa.position)*aa.intensity;if(qa>0){va.r+=aa.color.r*qa;va.g+=aa.color.g*qa;va.b+=aa.color.b*qa}}else if(aa instanceof THREE.PointLight){X.sub(aa.position,ha.centroidWorld);X.normalize();qa=ha.normalWorld.dot(X)*aa.intensity;if(qa>0){va.r+=aa.color.r*qa;va.g+=aa.color.g*qa;va.b+=aa.color.b*qa}}}}function c(ja,ha,va,
-Aa,ia,aa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(aa,Aa,L);y.r=ia.color.r*L.r;y.g=ia.color.g*L.g;y.b=ia.color.b*L.b;y.updateStyleString()}else y.__styleString=ia.color.__styleString;else if(ia instanceof
-THREE.MeshDepthMaterial){f=1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);y.setRGB(f,f,f)}else ia instanceof THREE.MeshNormalMaterial&&y.setRGB(e(Aa.normalWorld.x),e(Aa.normalWorld.y),e(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+
-ia.opacity);j.appendChild(I)}function b(ja,ha,va,Aa,ia,aa,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)y.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);y.r=aa.color.r*L.r;y.g=aa.color.g*L.g;
-y.b=aa.color.b*L.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ia.z*aa.__farMinusNear);y.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&y.setRGB(e(ia.normalWorld.x),e(ia.normalWorld.y),e(ia.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
-"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,t,w,u,o,v,B,F=
-new THREE.Rectangle,x=new THREE.Rectangle,G=!1,y=new THREE.Color(16777215),L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),f,X=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;t=k/2;w=m/2;j.setAttribute("viewBox",-t+" "+-w+" "+k+" "+m);j.setAttribute("width",
-k);j.setAttribute("height",m);F.set(-t,-w,t,w)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,aa,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(G=ja.lights.length>0){Q=ja.lights;J.setRGB(0,0,0);Y.setRGB(0,0,0);N.setRGB(0,0,0);va=0;for(Aa=Q.length;va<Aa;va++){ia=Q[va];aa=ia.color;if(ia instanceof THREE.AmbientLight){J.r+=aa.r;J.g+=aa.g;J.b+=aa.b}else if(ia instanceof THREE.DirectionalLight){Y.r+=
-aa.r;Y.g+=aa.g;Y.b+=aa.b}else if(ia instanceof THREE.PointLight){N.r+=aa.r;N.g+=aa.g;N.b+=aa.b}}}va=0;for(Aa=g.length;va<Aa;va++){Q=g[va];x.empty();if(Q instanceof THREE.RenderableParticle){u=Q;u.x*=t;u.y*=-w;ia=0;for(aa=Q.materials.length;ia<aa;ia++)if(ma=Q.materials[ia]){qa=u;ra=Q;var ta=za++;if(da[ta]==null){da[ta]=document.createElementNS("http://www.w3.org/2000/svg","circle");xa==0&&da[ta].setAttribute("shape-rendering","crispEdges")}I=da[ta];I.setAttribute("cx",qa.x);I.setAttribute("cy",qa.y);
-I.setAttribute("r",ra.scale.x*t);if(ma instanceof THREE.ParticleCircleMaterial){if(G){L.r=J.r+Y.r+N.r;L.g=J.g+Y.g+N.g;L.b=J.b+Y.b+N.b;y.r=ma.color.r*L.r;y.g=ma.color.g*L.g;y.b=ma.color.b*L.b;y.updateStyleString()}else y=ma.color;I.setAttribute("style","fill: "+y.__styleString)}j.appendChild(I)}}else if(Q instanceof THREE.RenderableLine){u=Q.v1;o=Q.v2;u.positionScreen.x*=t;u.positionScreen.y*=-w;o.positionScreen.x*=t;o.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(o.positionScreen.x,
-o.positionScreen.y);if(F.instersects(x)){ia=0;for(aa=Q.materials.length;ia<aa;)if(ma=Q.materials[ia++]){qa=u;ra=o;ta=ea++;if(ga[ta]==null){ga[ta]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&ga[ta].setAttribute("shape-rendering","crispEdges")}I=ga[ta];I.setAttribute("x1",qa.positionScreen.x);I.setAttribute("y1",qa.positionScreen.y);I.setAttribute("x2",ra.positionScreen.x);I.setAttribute("y2",ra.positionScreen.y);if(ma instanceof THREE.LineBasicMaterial){y.__styleString=ma.color.__styleString;
-I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ma.linewidth+"; stroke-opacity: "+ma.opacity+"; stroke-linecap: "+ma.linecap+"; stroke-linejoin: "+ma.linejoin);j.appendChild(I)}}}}else if(Q instanceof THREE.RenderableFace3){u=Q.v1;o=Q.v2;v=Q.v3;u.positionScreen.x*=t;u.positionScreen.y*=-w;o.positionScreen.x*=t;o.positionScreen.y*=-w;v.positionScreen.x*=t;v.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(o.positionScreen.x,o.positionScreen.y);
-x.addPoint(v.positionScreen.x,v.positionScreen.y);if(F.instersects(x)){ia=0;for(aa=Q.meshMaterials.length;ia<aa;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&c(u,o,v,Q,ma,ja)}else ma&&c(u,o,v,Q,ma,ja)}}}else if(Q instanceof THREE.RenderableFace4){u=Q.v1;o=Q.v2;v=Q.v3;B=Q.v4;u.positionScreen.x*=t;u.positionScreen.y*=-w;o.positionScreen.x*=t;o.positionScreen.y*=-w;v.positionScreen.x*=t;v.positionScreen.y*=-w;
-B.positionScreen.x*=t;B.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(o.positionScreen.x,o.positionScreen.y);x.addPoint(v.positionScreen.x,v.positionScreen.y);x.addPoint(B.positionScreen.x,B.positionScreen.y);if(F.instersects(x)){ia=0;for(aa=Q.meshMaterials.length;ia<aa;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&b(u,o,v,B,Q,ma,ja)}else ma&&b(u,o,v,B,Q,ma,ja)}}}}}};
+THREE.Projector=function(){function a(O,e){return e.z-O.z}function c(O,e){var Y=0,V=1,ma=O.z+O.w,ka=e.z+e.w,K=-O.z+O.w,ea=-e.z+e.w;if(ma>=0&&ka>=0&&K>=0&&ea>=0)return!0;else if(ma<0&&ka<0||K<0&&ea<0)return!1;else{if(ma<0)Y=Math.max(Y,ma/(ma-ka));else ka<0&&(V=Math.min(V,ma/(ma-ka)));if(K<0)Y=Math.max(Y,K/(K-ea));else ea<0&&(V=Math.min(V,K/(K-ea)));if(V<Y)return!1;else{O.lerpSelf(e,Y);e.lerpSelf(O,1-V);return!0}}}var b,d,f=[],g,h,m,j=[],n,p,v=[],u,o,x=[],B=new THREE.Vector4,E=new THREE.Vector4,w=new THREE.Matrix4,
+M=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,R=new THREE.Vector4,da;this.projectObjects=function(O,e,Y){e=[];var V,ma,ka;d=0;ma=O.objects;O=0;for(V=ma.length;O<V;O++){ka=ma[O];var K;if(!(K=!ka.visible))if(K=ka instanceof THREE.Mesh){a:{K=void 0;for(var ea=ka.matrixWorld,Ha=-ka.geometry.boundingSphere.radius*Math.max(ka.scale.x,Math.max(ka.scale.y,ka.scale.z)),fa=0;fa<6;fa++){K=J[fa].x*ea.n14+
+J[fa].y*ea.n24+J[fa].z*ea.n34+J[fa].w;if(K<=Ha){K=!1;break a}}K=!0}K=!K}if(!K){b=f[d]=f[d]||new THREE.RenderableObject;B.copy(ka.position);w.multiplyVector3(B);b.object=ka;b.z=B.z;e.push(b);d++}}Y&&e.sort(a);return e};this.projectScene=function(O,e,Y){var V=[],ma=e.near,ka=e.far,K,ea,Ha,fa,Ca,na,ja,wa,Ga,la,aa,ta,xa,U,qa,Ba;m=p=o=0;e.matrixAutoUpdate&&e.updateMatrix();O.update(undefined,!1,e);w.multiply(e.projectionMatrix,e.matrixWorldInverse);J[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);
+J[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);J[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);J[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);J[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);J[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(K=0;K<6;K++){na=J[K];na.divideScalar(Math.sqrt(na.x*na.x+na.y*na.y+na.z*na.z))}na=this.projectObjects(O,e,!0);O=0;for(K=na.length;O<K;O++){ja=na[O].object;if(ja.visible){wa=ja.matrixWorld;aa=ja.matrixRotationWorld;
+Ga=ja.materials;la=ja.overdraw;if(ja instanceof THREE.Mesh){ta=ja.geometry;xa=ta.vertices;ea=0;for(Ha=xa.length;ea<Ha;ea++){U=xa[ea];U.positionWorld.copy(U.position);wa.multiplyVector3(U.positionWorld);fa=U.positionScreen;fa.copy(U.positionWorld);w.multiplyVector4(fa);fa.x/=fa.w;fa.y/=fa.w;U.__visible=fa.z>ma&&fa.z<ka}ta=ta.faces;ea=0;for(Ha=ta.length;ea<Ha;ea++){U=ta[ea];if(U instanceof THREE.Face3){fa=xa[U.a];Ca=xa[U.b];qa=xa[U.c];if(fa.__visible&&Ca.__visible&&qa.__visible&&(ja.doubleSided||ja.flipSided!=
+(qa.positionScreen.x-fa.positionScreen.x)*(Ca.positionScreen.y-fa.positionScreen.y)-(qa.positionScreen.y-fa.positionScreen.y)*(Ca.positionScreen.x-fa.positionScreen.x)<0)){g=j[m]=j[m]||new THREE.RenderableFace3;g.v1.positionWorld.copy(fa.positionWorld);g.v2.positionWorld.copy(Ca.positionWorld);g.v3.positionWorld.copy(qa.positionWorld);g.v1.positionScreen.copy(fa.positionScreen);g.v2.positionScreen.copy(Ca.positionScreen);g.v3.positionScreen.copy(qa.positionScreen);g.normalWorld.copy(U.normal);aa.multiplyVector3(g.normalWorld);
+g.centroidWorld.copy(U.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);qa=U.vertexNormals;da=g.vertexNormalsWorld;fa=0;for(Ca=qa.length;fa<Ca;fa++){Ba=da[fa]=da[fa]||new THREE.Vector3;Ba.copy(qa[fa]);aa.multiplyVector3(Ba)}g.z=g.centroidScreen.z;g.meshMaterials=Ga;g.faceMaterials=U.materials;g.overdraw=la;if(ja.geometry.uvs[ea]){g.uvs[0]=ja.geometry.uvs[ea][0];g.uvs[1]=ja.geometry.uvs[ea][1];g.uvs[2]=ja.geometry.uvs[ea][2]}V.push(g);
+m++}}else if(U instanceof THREE.Face4){fa=xa[U.a];Ca=xa[U.b];qa=xa[U.c];Ba=xa[U.d];if(fa.__visible&&Ca.__visible&&qa.__visible&&Ba.__visible&&(ja.doubleSided||ja.flipSided!=((Ba.positionScreen.x-fa.positionScreen.x)*(Ca.positionScreen.y-fa.positionScreen.y)-(Ba.positionScreen.y-fa.positionScreen.y)*(Ca.positionScreen.x-fa.positionScreen.x)<0||(Ca.positionScreen.x-qa.positionScreen.x)*(Ba.positionScreen.y-qa.positionScreen.y)-(Ca.positionScreen.y-qa.positionScreen.y)*(Ba.positionScreen.x-qa.positionScreen.x)<
+0))){g=j[m]=j[m]||new THREE.RenderableFace3;g.v1.positionWorld.copy(fa.positionWorld);g.v2.positionWorld.copy(Ca.positionWorld);g.v3.positionWorld.copy(Ba.positionWorld);g.v1.positionScreen.copy(fa.positionScreen);g.v2.positionScreen.copy(Ca.positionScreen);g.v3.positionScreen.copy(Ba.positionScreen);g.normalWorld.copy(U.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(U.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);
+g.z=g.centroidScreen.z;g.meshMaterials=Ga;g.faceMaterials=U.materials;g.overdraw=la;if(ja.geometry.uvs[ea]){g.uvs[0]=ja.geometry.uvs[ea][0];g.uvs[1]=ja.geometry.uvs[ea][1];g.uvs[2]=ja.geometry.uvs[ea][3]}V.push(g);m++;h=j[m]=j[m]||new THREE.RenderableFace3;h.v1.positionWorld.copy(Ca.positionWorld);h.v2.positionWorld.copy(qa.positionWorld);h.v3.positionWorld.copy(Ba.positionWorld);h.v1.positionScreen.copy(Ca.positionScreen);h.v2.positionScreen.copy(qa.positionScreen);h.v3.positionScreen.copy(Ba.positionScreen);
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Ga;h.faceMaterials=U.materials;h.overdraw=la;if(ja.geometry.uvs[ea]){h.uvs[0]=ja.geometry.uvs[ea][1];h.uvs[1]=ja.geometry.uvs[ea][2];h.uvs[2]=ja.geometry.uvs[ea][3]}V.push(h);m++}}}}else if(ja instanceof THREE.Line){M.multiply(w,wa);xa=ja.geometry.vertices;U=xa[0];U.positionScreen.copy(U.position);M.multiplyVector4(U.positionScreen);ea=1;for(Ha=xa.length;ea<
+Ha;ea++){fa=xa[ea];fa.positionScreen.copy(fa.position);M.multiplyVector4(fa.positionScreen);Ca=xa[ea-1];N.copy(fa.positionScreen);R.copy(Ca.positionScreen);if(c(N,R)){N.multiplyScalar(1/N.w);R.multiplyScalar(1/R.w);n=v[p]=v[p]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(R);n.z=Math.max(N.z,R.z);n.materials=ja.materials;V.push(n);p++}}}else if(ja instanceof THREE.Particle){E.set(ja.position.x,ja.position.y,ja.position.z,1);w.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
+E.z<1){u=x[o]=x[o]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=ja.rotation.z;u.scale.x=ja.scale.x*Math.abs(u.x-(E.x+e.projectionMatrix.n11)/(E.w+e.projectionMatrix.n14));u.scale.y=ja.scale.y*Math.abs(u.y-(E.y+e.projectionMatrix.n22)/(E.w+e.projectionMatrix.n24));u.materials=ja.materials;V.push(u);o++}}}}Y&&V.sort(a);return V};this.unprojectVector=function(O,e){var Y=e.matrixWorld.clone();Y.multiplySelf(THREE.Matrix4.makeInvert(e.projectionMatrix));Y.multiplyVector3(O);
+return O}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,m){b=h;d=m;f=b/2;g=d/2};this.render=function(h,m){var j,n,p,v,u,o,x,B;a=c.projectScene(h,m);j=0;for(n=a.length;j<n;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;B=u.y*g+g;p=0;for(v=u.material.length;p<v;p++){o=u.material[p];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=x+"px";o.style.top=B+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(oa){if(u!=oa)n.globalAlpha=u=oa}function c(oa){if(o!=oa){switch(oa){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}o=oa}}var b=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,m,j,n=f.getContext("2d"),p=new THREE.Color(0),v=0,u=1,o=0,x=null,B=null,E=1,w,M,J,N,R,da,O,e,Y,V=new THREE.Color,
+ma=new THREE.Color,ka=new THREE.Color,K=new THREE.Color,ea=new THREE.Color,Ha,fa,Ca,na,ja,wa,Ga,la,aa,ta=new THREE.Rectangle,xa=new THREE.Rectangle,U=new THREE.Rectangle,qa=!1,Ba=new THREE.Color,k=new THREE.Color,y=new THREE.Color,z=new THREE.Color,q=Math.PI*2,t=new THREE.Vector3,D,A,C,S,G,H,ia=16;D=document.createElement("canvas");D.width=D.height=2;A=D.getContext("2d");A.fillStyle="rgba(0,0,0,1)";A.fillRect(0,0,2,2);C=A.getImageData(0,0,2,2);S=C.data;G=document.createElement("canvas");G.width=G.height=
+ia;H=G.getContext("2d");H.translate(-ia/2,-ia/2);H.scale(ia,ia);ia--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(oa,W){g=oa;h=W;m=g/2;j=h/2;f.width=g;f.height=h;ta.set(-m,-j,m,j);u=1;o=0;B=x=null;E=1};this.setClearColor=function(oa,W){p=oa;v=W};this.setClearColorHex=function(oa,W){p.setHex(oa);v=W};this.clear=function(){n.setTransform(1,0,0,-1,m,j);if(!xa.isEmpty()){xa.inflate(1);xa.minSelf(ta);if(p.hex==0&&v==0)n.clearRect(xa.getX(),xa.getY(),
+xa.getWidth(),xa.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+v+")";n.fillRect(xa.getX(),xa.getY(),xa.getWidth(),xa.getHeight())}xa.empty()}};this.render=function(oa,W){function ha(I){var $,ga,Q,X=I.lights;k.setRGB(0,0,0);y.setRGB(0,0,0);z.setRGB(0,0,0);I=0;for($=X.length;I<$;I++){ga=X[I];Q=ga.color;if(ga instanceof THREE.AmbientLight){k.r+=Q.r;k.g+=Q.g;k.b+=Q.b}else if(ga instanceof THREE.DirectionalLight){y.r+=
+Q.r;y.g+=Q.g;y.b+=Q.b}else if(ga instanceof THREE.PointLight){z.r+=Q.r;z.g+=Q.g;z.b+=Q.b}}}function pa(I,$,ga,Q){var X,ca,va,sa,ua=I.lights;I=0;for(X=ua.length;I<X;I++){ca=ua[I];va=ca.color;sa=ca.intensity;if(ca instanceof THREE.DirectionalLight){ca=ga.dot(ca.position)*sa;if(ca>0){Q.r+=va.r*ca;Q.g+=va.g*ca;Q.b+=va.b*ca}}else if(ca instanceof THREE.PointLight){t.sub(ca.position,$);t.normalize();ca=ga.dot(t)*sa;if(ca>0){Q.r+=va.r*ca;Q.g+=va.g*ca;Q.b+=va.b*ca}}}}function za(I,$,ga){if(ga.opacity!=0){a(ga.opacity);
+c(ga.blending);var Q,X,ca,va,sa,ua;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map){va=ga.map.image;sa=va.width>>1;ua=va.height>>1;X=$.scale.x*m;ca=$.scale.y*j;ga=X*sa;Q=ca*ua;U.set(I.x-ga,I.y-Q,I.x+ga,I.y+Q);if(ta.instersects(U)){n.save();n.translate(I.x,I.y);n.rotate(-$.rotation);n.scale(X,-ca);n.translate(-sa,-ua);n.drawImage(va,0,0);n.restore()}}}else if(ga instanceof THREE.ParticleCircleMaterial){if(qa){Ba.r=k.r+y.r+z.r;Ba.g=k.g+y.g+z.g;Ba.b=k.b+y.b+z.b;V.r=ga.color.r*Ba.r;V.g=ga.color.g*
+Ba.g;V.b=ga.color.b*Ba.b;V.updateStyleString()}else V.__styleString=ga.color.__styleString;ga=$.scale.x*m;Q=$.scale.y*j;U.set(I.x-ga,I.y-Q,I.x+ga,I.y+Q);if(ta.instersects(U)){X=V.__styleString;if(B!=X)n.fillStyle=B=X;n.save();n.translate(I.x,I.y);n.rotate(-$.rotation);n.scale(ga,Q);n.beginPath();n.arc(0,0,1,0,q,!0);n.closePath();n.fill();n.restore()}}}}function Ea(I,$,ga,Q){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);n.beginPath();n.moveTo(I.positionScreen.x,I.positionScreen.y);n.lineTo($.positionScreen.x,
+$.positionScreen.y);n.closePath();if(Q instanceof THREE.LineBasicMaterial){V.__styleString=Q.color.__styleString;I=Q.linewidth;if(E!=I)n.lineWidth=E=I;I=V.__styleString;if(x!=I)n.strokeStyle=x=I;n.stroke();U.inflate(Q.linewidth*2)}}}function ra(I,$,ga,Q,X,ca){if(X.opacity!=0){a(X.opacity);c(X.blending);N=I.positionScreen.x;R=I.positionScreen.y;da=$.positionScreen.x;O=$.positionScreen.y;e=ga.positionScreen.x;Y=ga.positionScreen.y;n.beginPath();n.moveTo(N,R);n.lineTo(da,O);n.lineTo(e,Y);n.lineTo(N,
+R);n.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&Ma(N,R,da,O,e,Y,X.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){I=W.matrixWorldInverse;t.copy(Q.vertexNormalsWorld[0]);na=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;ja=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;t.copy(Q.vertexNormalsWorld[1]);wa=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;
+Ga=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;t.copy(Q.vertexNormalsWorld[2]);la=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;aa=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;Ma(N,R,da,O,e,Y,X.envMap.image,na,ja,wa,Ga,la,aa)}}else X.wireframe?Na(X.color.__styleString,X.wireframeLinewidth):L(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof THREE.UVMapping&&Ma(N,R,da,O,e,Y,X.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);
+c(THREE.SubtractiveBlending)}if(qa)if(!X.wireframe&&X.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){ma.r=ka.r=K.r=k.r;ma.g=ka.g=K.g=k.g;ma.b=ka.b=K.b=k.b;pa(ca,Q.v1.positionWorld,Q.vertexNormalsWorld[0],ma);pa(ca,Q.v2.positionWorld,Q.vertexNormalsWorld[1],ka);pa(ca,Q.v3.positionWorld,Q.vertexNormalsWorld[2],K);ea.r=(ka.r+K.r)*0.5;ea.g=(ka.g+K.g)*0.5;ea.b=(ka.b+K.b)*0.5;Ca=La(ma,ka,K,ea);Ma(N,R,da,O,e,Y,Ca,0,0,1,0,0,1)}else{Ba.r=k.r;Ba.g=k.g;Ba.b=k.b;pa(ca,Q.centroidWorld,Q.normalWorld,
+Ba);V.r=X.color.r*Ba.r;V.g=X.color.g*Ba.g;V.b=X.color.b*Ba.b;V.updateStyleString();X.wireframe?Na(V.__styleString,X.wireframeLinewidth):L(V.__styleString)}else X.wireframe?Na(X.color.__styleString,X.wireframeLinewidth):L(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Ha=W.near;fa=W.far;ma.r=ma.g=ma.b=1-Fa(I.positionScreen.z,Ha,fa);ka.r=ka.g=ka.b=1-Fa($.positionScreen.z,Ha,fa);K.r=K.g=K.b=1-Fa(ga.positionScreen.z,Ha,fa);ea.r=(ka.r+K.r)*0.5;ea.g=(ka.g+K.g)*0.5;ea.b=(ka.b+K.b)*
+0.5;Ca=La(ma,ka,K,ea);Ma(N,R,da,O,e,Y,Ca,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){V.r=Pa(Q.normalWorld.x);V.g=Pa(Q.normalWorld.y);V.b=Pa(Q.normalWorld.z);V.updateStyleString();X.wireframe?Na(V.__styleString,X.wireframeLinewidth):L(V.__styleString)}}}function Na(I,$){if(x!=I)n.strokeStyle=x=I;if(E!=$)n.lineWidth=E=$;n.stroke();U.inflate($*2)}function L(I){if(B!=I)n.fillStyle=B=I;n.fill()}function Ma(I,$,ga,Q,X,ca,va,sa,ua,Da,ya,Ta,Qa){var Ja,Ua;Ja=va.width-1;Ua=va.height-1;sa*=Ja;
+ua*=Ua;Da*=Ja;ya*=Ua;Ta*=Ja;Qa*=Ua;ga-=I;Q-=$;X-=I;ca-=$;Da-=sa;ya-=ua;Ta-=sa;Qa-=ua;Ja=Da*Qa-Ta*ya;if(Ja!=0){Ua=1/Ja;Ja=(Qa*ga-ya*X)*Ua;ya=(Qa*Q-ya*ca)*Ua;ga=(Da*X-Ta*ga)*Ua;Q=(Da*ca-Ta*Q)*Ua;I=I-Ja*sa-ga*ua;$=$-ya*sa-Q*ua;n.save();n.transform(Ja,ya,ga,Q,I,$);n.clip();n.drawImage(va,0,0);n.restore()}}function La(I,$,ga,Q){var X=~~(I.r*255),ca=~~(I.g*255);I=~~(I.b*255);var va=~~($.r*255),sa=~~($.g*255);$=~~($.b*255);var ua=~~(ga.r*255),Da=~~(ga.g*255);ga=~~(ga.b*255);var ya=~~(Q.r*255),Ta=~~(Q.g*
+255);Q=~~(Q.b*255);S[0]=X<0?0:X>255?255:X;S[1]=ca<0?0:ca>255?255:ca;S[2]=I<0?0:I>255?255:I;S[4]=va<0?0:va>255?255:va;S[5]=sa<0?0:sa>255?255:sa;S[6]=$<0?0:$>255?255:$;S[8]=ua<0?0:ua>255?255:ua;S[9]=Da<0?0:Da>255?255:Da;S[10]=ga<0?0:ga>255?255:ga;S[12]=ya<0?0:ya>255?255:ya;S[13]=Ta<0?0:Ta>255?255:Ta;S[14]=Q<0?0:Q>255?255:Q;A.putImageData(C,0,0);H.drawImage(D,0,0);return G}function Fa(I,$,ga){I=(I-$)/(ga-$);return I*I*(3-2*I)}function Pa(I){I=(I+1)*0.5;return I<0?0:I>1?1:I}function Ra(I,$){var ga=$.x-
+I.x,Q=$.y-I.y,X=1/Math.sqrt(ga*ga+Q*Q);ga*=X;Q*=X;$.x+=ga;$.y+=Q;I.x-=ga;I.y-=Q}var T,Z,P,Aa,Ia,Va,Ka,F;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,j);b=d.projectScene(oa,W,this.sortElements);(qa=oa.lights.length>0)&&ha(oa);T=0;for(Z=b.length;T<Z;T++){P=b[T];U.empty();if(P instanceof THREE.RenderableParticle){w=P;w.x*=m;w.y*=j;Aa=0;for(Ia=P.materials.length;Aa<Ia;Aa++)za(w,P,P.materials[Aa],oa)}else if(P instanceof THREE.RenderableLine){w=P.v1;M=P.v2;w.positionScreen.x*=m;w.positionScreen.y*=
+j;M.positionScreen.x*=m;M.positionScreen.y*=j;U.addPoint(w.positionScreen.x,w.positionScreen.y);U.addPoint(M.positionScreen.x,M.positionScreen.y);if(ta.instersects(U)){Aa=0;for(Ia=P.materials.length;Aa<Ia;)Ea(w,M,P,P.materials[Aa++],oa)}}else if(P instanceof THREE.RenderableFace3){w=P.v1;M=P.v2;J=P.v3;w.positionScreen.x*=m;w.positionScreen.y*=j;M.positionScreen.x*=m;M.positionScreen.y*=j;J.positionScreen.x*=m;J.positionScreen.y*=j;if(P.overdraw){Ra(w.positionScreen,M.positionScreen);Ra(M.positionScreen,
+J.positionScreen);Ra(J.positionScreen,w.positionScreen)}U.add3Points(w.positionScreen.x,w.positionScreen.y,M.positionScreen.x,M.positionScreen.y,J.positionScreen.x,J.positionScreen.y);if(ta.instersects(U)){Aa=0;for(Ia=P.meshMaterials.length;Aa<Ia;){F=P.meshMaterials[Aa++];if(F instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=P.faceMaterials.length;Va<Ka;)(F=P.faceMaterials[Va++])&&ra(w,M,J,P,F,oa)}else ra(w,M,J,P,F,oa)}}}xa.addRectangle(U)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(na,ja,wa){var Ga,la,aa,ta;Ga=0;for(la=na.lights.length;Ga<la;Ga++){aa=na.lights[Ga];if(aa instanceof THREE.DirectionalLight){ta=ja.normalWorld.dot(aa.position)*aa.intensity;if(ta>0){wa.r+=aa.color.r*ta;wa.g+=aa.color.g*ta;wa.b+=aa.color.b*ta}}else if(aa instanceof THREE.PointLight){Y.sub(aa.position,ja.centroidWorld);Y.normalize();ta=ja.normalWorld.dot(Y)*aa.intensity;if(ta>0){wa.r+=aa.color.r*ta;wa.g+=aa.color.g*ta;wa.b+=aa.color.b*ta}}}}function c(na,ja,wa,
+Ga,la,aa){K=d(ea++);K.setAttribute("d","M "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(la instanceof THREE.MeshBasicMaterial)J.__styleString=la.color.__styleString;else if(la instanceof THREE.MeshLambertMaterial)if(M){N.r=R.r;N.g=R.g;N.b=R.b;a(aa,Ga,N);J.r=la.color.r*N.r;J.g=la.color.g*N.g;J.b=la.color.b*N.b;J.updateStyleString()}else J.__styleString=la.color.__styleString;else if(la instanceof
+THREE.MeshDepthMaterial){e=1-la.__2near/(la.__farPlusNear-Ga.z*la.__farMinusNear);J.setRGB(e,e,e)}else la instanceof THREE.MeshNormalMaterial&&J.setRGB(f(Ga.normalWorld.x),f(Ga.normalWorld.y),f(Ga.normalWorld.z));la.wireframe?K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+la.wireframeLinewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.wireframeLinecap+"; stroke-linejoin: "+la.wireframeLinejoin):K.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+
+la.opacity);m.appendChild(K)}function b(na,ja,wa,Ga,la,aa,ta){K=d(ea++);K.setAttribute("d","M "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+" L "+Ga.positionScreen.x+","+Ga.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)J.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(M){N.r=R.r;N.g=R.g;N.b=R.b;a(ta,la,N);J.r=aa.color.r*N.r;J.g=aa.color.g*N.g;
+J.b=aa.color.b*N.b;J.updateStyleString()}else J.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){e=1-aa.__2near/(aa.__farPlusNear-la.z*aa.__farMinusNear);J.setRGB(e,e,e)}else aa instanceof THREE.MeshNormalMaterial&&J.setRGB(f(la.normalWorld.x),f(la.normalWorld.y),f(la.normalWorld.z));aa.wireframe?K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
+"; stroke-linejoin: "+aa.wireframeLinejoin):K.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+aa.opacity);m.appendChild(K)}function d(na){if(V[na]==null){V[na]=document.createElementNS("http://www.w3.org/2000/svg","path");Ca==0&&V[na].setAttribute("shape-rendering","crispEdges")}return V[na]}function f(na){return na<0?Math.min((1+na)*0.5,0.5):0.5+Math.min(na*0.5,0.5)}var g=null,h=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,n,p,v,u,o,x,B,E=
+new THREE.Rectangle,w=new THREE.Rectangle,M=!1,J=new THREE.Color(16777215),N=new THREE.Color(16777215),R=new THREE.Color(0),da=new THREE.Color(0),O=new THREE.Color(0),e,Y=new THREE.Vector3,V=[],ma=[],ka=[],K,ea,Ha,fa,Ca=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(na){switch(na){case "high":Ca=1;break;case "low":Ca=0}};this.setSize=function(na,ja){j=na;n=ja;p=j/2;v=n/2;m.setAttribute("viewBox",-p+" "+-v+" "+j+" "+n);m.setAttribute("width",
+j);m.setAttribute("height",n);E.set(-p,-v,p,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(na,ja){var wa,Ga,la,aa,ta,xa,U,qa;this.autoClear&&this.clear();g=h.projectScene(na,ja,this.sortElements);fa=Ha=ea=0;if(M=na.lights.length>0){U=na.lights;R.setRGB(0,0,0);da.setRGB(0,0,0);O.setRGB(0,0,0);wa=0;for(Ga=U.length;wa<Ga;wa++){la=U[wa];aa=la.color;if(la instanceof THREE.AmbientLight){R.r+=aa.r;R.g+=aa.g;R.b+=aa.b}else if(la instanceof THREE.DirectionalLight){da.r+=
+aa.r;da.g+=aa.g;da.b+=aa.b}else if(la instanceof THREE.PointLight){O.r+=aa.r;O.g+=aa.g;O.b+=aa.b}}}wa=0;for(Ga=g.length;wa<Ga;wa++){U=g[wa];w.empty();if(U instanceof THREE.RenderableParticle){u=U;u.x*=p;u.y*=-v;la=0;for(aa=U.materials.length;la<aa;la++)if(qa=U.materials[la]){ta=u;xa=U;var Ba=Ha++;if(ma[Ba]==null){ma[Ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");Ca==0&&ma[Ba].setAttribute("shape-rendering","crispEdges")}K=ma[Ba];K.setAttribute("cx",ta.x);K.setAttribute("cy",ta.y);
+K.setAttribute("r",xa.scale.x*p);if(qa instanceof THREE.ParticleCircleMaterial){if(M){N.r=R.r+da.r+O.r;N.g=R.g+da.g+O.g;N.b=R.b+da.b+O.b;J.r=qa.color.r*N.r;J.g=qa.color.g*N.g;J.b=qa.color.b*N.b;J.updateStyleString()}else J=qa.color;K.setAttribute("style","fill: "+J.__styleString)}m.appendChild(K)}}else if(U instanceof THREE.RenderableLine){u=U.v1;o=U.v2;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,
+o.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.materials.length;la<aa;)if(qa=U.materials[la++]){ta=u;xa=o;Ba=fa++;if(ka[Ba]==null){ka[Ba]=document.createElementNS("http://www.w3.org/2000/svg","line");Ca==0&&ka[Ba].setAttribute("shape-rendering","crispEdges")}K=ka[Ba];K.setAttribute("x1",ta.positionScreen.x);K.setAttribute("y1",ta.positionScreen.y);K.setAttribute("x2",xa.positionScreen.x);K.setAttribute("y2",xa.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){J.__styleString=qa.color.__styleString;
+K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);m.appendChild(K)}}}}else if(U instanceof THREE.RenderableFace3){u=U.v1;o=U.v2;x=U.v3;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;x.positionScreen.x*=p;x.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);
+w.addPoint(x.positionScreen.x,x.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.meshMaterials.length;la<aa;){qa=U.meshMaterials[la++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(xa=U.faceMaterials.length;ta<xa;)(qa=U.faceMaterials[ta++])&&c(u,o,x,U,qa,na)}else qa&&c(u,o,x,U,qa,na)}}}else if(U instanceof THREE.RenderableFace4){u=U.v1;o=U.v2;x=U.v3;B=U.v4;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;x.positionScreen.x*=p;x.positionScreen.y*=-v;
+B.positionScreen.x*=p;B.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(B.positionScreen.x,B.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.meshMaterials.length;la<aa;){qa=U.meshMaterials[la++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(xa=U.faceMaterials.length;ta<xa;)(qa=U.faceMaterials[ta++])&&b(u,o,x,B,U,qa,na)}else qa&&b(u,o,x,B,U,qa,na)}}}}}};
 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",
 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_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",
 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",
@@ -213,98 +215,100 @@ 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,
 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.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.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(l,z,p){var n,q,C,A=l.vertices,D=A.length,P=l.colors,U=P.length,E=l.__vertexArray,Z=l.__colorArray,ka=l.__sortArray,na=l.__dirtyVertices,wa=l.__dirtyColors;if(p.sortParticles){Aa.multiplySelf(p.matrixWorld);for(n=0;n<D;n++){q=A[n].position;qa.copy(q);Aa.multiplyVector3(qa);ka[n]=[qa.z,n]}ka.sort(function(la,Ca){return Ca[0]-la[0]});for(n=0;n<D;n++){q=A[ka[n][1]].position;C=n*3;E[C]=q.x;E[C+1]=q.y;E[C+2]=q.z}for(n=0;n<U;n++){C=n*3;color=P[ka[n][1]];Z[C]=color.r;
-Z[C+1]=color.g;Z[C+2]=color.b}}else{if(na)for(n=0;n<D;n++){q=A[n].position;C=n*3;E[C]=q.x;E[C+1]=q.y;E[C+2]=q.z}if(wa)for(n=0;n<U;n++){color=P[n];C=n*3;Z[C]=color.r;Z[C+1]=color.g;Z[C+2]=color.b}}if(na||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,E,z)}if(wa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Z,z)}}function b(l,z){l.fragmentShader=z.fragmentShader;l.vertexShader=z.vertexShader;l.uniforms=
-Uniforms.clone(z.uniforms)}function d(l,z,p,n,q){n.program||da.initMaterial(n,z,p,q);var C=n.program,A=C.uniforms,D=n.uniforms;if(C!=X){f.useProgram(C);X=C}f.uniformMatrix4fv(A.projectionMatrix,!1,ia);if(p&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){D.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){D.fogNear.value=p.near;D.fogFar.value=
-p.far}else if(p instanceof THREE.FogExp2)D.fogDensity.value=p.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n.lights){var P,U,E=0,Z=0,ka=0,na,wa,la,Ca=ra,Da=Ca.directional.colors,Pa=Ca.directional.positions,M=Ca.point.colors,Na=Ca.point.positions,Ia=0,Oa=0;p=U=U=0;for(P=z.length;p<P;p++){U=z[p];na=U.color;wa=U.position;la=U.intensity;if(U instanceof THREE.AmbientLight){E+=na.r;Z+=na.g;ka+=na.b}else if(U instanceof THREE.DirectionalLight){U=Ia*3;Da[U]=na.r*
-la;Da[U+1]=na.g*la;Da[U+2]=na.b*la;Pa[U]=wa.x;Pa[U+1]=wa.y;Pa[U+2]=wa.z;Ia+=1}else if(U instanceof THREE.PointLight){U=Oa*3;M[U]=na.r*la;M[U+1]=na.g*la;M[U+2]=na.b*la;Na[U]=wa.x;Na[U+1]=wa.y;Na[U+2]=wa.z;Oa+=1}}for(p=Ia*3;p<Da.length;p++)Da[p]=0;for(p=Oa*3;p<M.length;p++)M[p]=0;Ca.point.length=Oa;Ca.directional.length=Ia;Ca.ambient[0]=E;Ca.ambient[1]=Z;Ca.ambient[2]=ka;z=ra;D.enableLighting.value=z.directional.length+z.point.length;D.ambientLightColor.value=z.ambient;D.directionalLightColor.value=
-z.directional.colors;D.directionalLightDirection.value=z.directional.positions;D.pointLightColor.value=z.point.colors;D.pointLightPosition.value=z.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){D.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);D.opacity.value=n.opacity;D.map.texture=n.map;D.lightMap.texture=n.lightMap;D.envMap.texture=n.envMap;D.reflectivity.value=n.reflectivity;
-D.refractionRatio.value=n.refractionRatio;D.combine.value=n.combine;D.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){D.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);D.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){D.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);D.opacity.value=n.opacity;D.size.value=n.size;D.scale.value=N.height/
-2;D.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){D.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);D.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);D.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){D.mNear.value=l.near;D.mFar.value=l.far;D.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)D.opacity.value=n.opacity;for(var S in D)if(E=C.uniforms[S]){p=D[S];P=p.type;z=p.value;if(P=="i")f.uniform1i(E,z);else if(P==
-"f")f.uniform1f(E,z);else if(P=="fv1")f.uniform1fv(E,z);else if(P=="fv")f.uniform3fv(E,z);else if(P=="v2")f.uniform2f(E,z.x,z.y);else if(P=="v3")f.uniform3f(E,z.x,z.y,z.z);else if(P=="c")f.uniform3f(E,z.r,z.g,z.b);else if(P=="t"){f.uniform1i(E,z);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(P=0;P<6;++P)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+P,0,0,0,f.RGBA,
-f.UNSIGNED_BYTE,p.image[P])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(P=0;P<6;++P)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+P,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[P]);p.__wasSetOnce=!0}G(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
-p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}G(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(A.modelViewMatrix,!1,q._modelViewMatrixArray);f.uniformMatrix3fv(A.normalMatrix,
-!1,q._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&f.uniform3f(A.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&f.uniformMatrix4fv(A.objectMatrix,!1,q._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&f.uniformMatrix4fv(A.viewMatrix,!1,aa);if(n.skinning){f.uniformMatrix4fv(A.cameraInverseMatrix,
-!1,aa);f.uniformMatrix4fv(A.boneGlobalMatrices,!1,q.boneMatrices)}return C}function e(l,z,p,n,q,C){if(n.opacity!=0){l=d(l,z,p,n,C).attributes;if(n.morphTargets){z=n.program.attributes;C.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[C.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(z.position,3,f.FLOAT,!1,0,0);if(C.morphTargetForcedOrder.length){p=0;for(var A=C.morphTargetForcedOrder,D=C.morphTargetInfluences;p<n.numSupportedMorphTargets&&
-p<A.length;){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A[p]]);f.vertexAttribPointer(z["morphTarget"+p],3,f.FLOAT,!1,0,0);C.__webGLMorphTargetInfluences[p]=D[A[p]];p++}}else{A=[];var P=-1,U=0;D=C.morphTargetInfluences;var E,Z=D.length;p=0;for(C.morphTargetBase!==-1&&(A[C.morphTargetBase]=!0);p<n.numSupportedMorphTargets;){for(E=0;E<Z;E++)if(!A[E]&&D[E]>P){U=E;P=D[U]}f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[U]);f.vertexAttribPointer(z["morphTarget"+p],3,f.FLOAT,!1,0,0);
-C.__webGLMorphTargetInfluences[p]=P;A[U]=1;P=-1;p++}}f.uniform1fv(n.program.uniforms.morphTargetInfluences,C.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0)}if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLColorBuffer);f.vertexAttribPointer(l.color,3,f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
-q.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(q.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(q.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(n.skinning&&l.skinVertexA>=0&&
-l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);f.vertexAttribPointer(l.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);f.vertexAttribPointer(l.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);f.vertexAttribPointer(l.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);f.vertexAttribPointer(l.skinWeight,4,f.FLOAT,!1,0,0)}if(C instanceof
-THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);f.drawElements(f.LINES,q.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,q.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(C,0,q.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,
-0,q.__webGLParticleCount);else C instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
-l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ga=l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(za!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
-za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,p=-l.geometry.boundingSphere.radius*
-Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=p)return!1}return!0}function t(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,p,n=l.object,q=l.opaque,C=l.transparent;C.count=0;l=q.count=0;for(z=n.materials.length;l<z;l++){p=n.materials[l];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(C,p):t(q,p)}}function u(l){var z,p,n,q,C=l.object,A=l.buffer,D=l.opaque,P=l.transparent;P.count=0;l=D.count=0;for(n=C.materials.length;l<
-n;l++){z=C.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(p=A.materials.length;z<p;z++)(q=A.materials[z])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?t(P,q):t(D,q))}else{q=z;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?t(P,q):t(D,q)}}}function o(l,z){return z.z-l.z}function v(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
-function B(l){function z(ka){var na=[];p=0;for(n=ka.length;p<n;p++)ka[p]==undefined?na.push("undefined"):na.push(ka[p].id);return na.join("_")}var p,n,q,C,A,D,P,U,E={},Z=l.morphTargets!==undefined?l.morphTargets.length:0;l.geometryGroups={};q=0;for(C=l.faces.length;q<C;q++){A=l.faces[q];D=A.materials;P=z(D);E[P]==undefined&&(E[P]={hash:P,counter:0});U=E[P].hash+"_"+E[P].counter;l.geometryGroups[U]==undefined&&(l.geometryGroups[U]={faces:[],materials:D,vertices:0,numMorphTargets:Z});A=A instanceof
-THREE.Face3?3:4;if(l.geometryGroups[U].vertices+A>65535){E[P].counter+=1;U=E[P].hash+"_"+E[P].counter;l.geometryGroups[U]==undefined&&(l.geometryGroups[U]={faces:[],materials:D,vertices:0,numMorphTargets:Z})}l.geometryGroups[U].faces.push(q);l.geometryGroups[U].vertices+=A}}function F(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function x(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
-f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function G(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Y(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Y(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,
-Y(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,Y(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,J(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,J(z.minFilter))}}function y(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
-l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Y(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Y(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Y(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Y(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
-l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,p;if(l){z=l.__webGLFramebuffer;p=l.width;l=l.height}else{z=null;p=ja;l=ha}if(z!=R){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,xa,p,l);R=z}}function L(l,z){var p;if(l=="fragment")p=
-f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,z);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));return null}return p}function J(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT;
-case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;
-case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),
-f,X=null,R=null,da=this,ga=null,I=null,ca=null,za=null,ea=0,xa=0,ja=0,ha=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,ia=new Float32Array(16),aa=new Float32Array(16),qa=new THREE.Vector4,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Q=!0,ma=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)Q=a.antialias;a.clearColor!==undefined&&ma.setHex(a.clearColor);
-if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.maxMorphTargets=8;this.domElement=N;this.autoClear=!0;this.sortObjects=!0;(function(l,z,p){try{if(!(f=N.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,p);_cullEnabled=
-!0})(Q,ma,ta);this.context=f;this.setSize=function(l,z){N.width=l;N.height=z;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(l,z,p,n){ea=l;xa=z;ja=p;ha=n;f.viewport(ea,xa,ja,ha)};this.setScissor=function(l,z,p,n){f.scissor(l,z,p,n)};this.enableScissorTest=function(l){l?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){f.depthMask(l)};this.setClearColorHex=function(l,z){var p=new THREE.Color(l);f.clearColor(p.r,p.g,p.b,z)};this.setClearColor=
-function(l,z){f.clearColor(l.r,l.g,l.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,p,n){var q,C,A;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong);
-else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);var D,P,U,E;A=U=E=0;for(D=z.length;A<D;A++){P=z[A];P instanceof THREE.DirectionalLight&&U++;P instanceof THREE.PointLight&&E++}if(E+U<=4)z=U;else{z=Math.ceil(4*U/(E+U));E=4-z}A={directional:z,point:E};D=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)D=n.bones.length;E=l.fragmentShader;z=l.vertexShader;D={fog:p,map:l.map,envMap:l.envMap,lightMap:l.lightMap,
-vertexColors:l.vertexColors,sizeAttenuation:l.sizeAttenuation,skinning:l.skinning,morphTargets:l.morphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:D};p=f.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,D.fog?"#define USE_FOG":"",D.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":
-"",D.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");D=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,"#define MAX_BONES "+D.maxBones,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"",D.morphTargets?"#define USE_MORPHTARGETS":
-"",D.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-f.attachShader(p,L("fragment",A+E));f.attachShader(p,L("vertex",D+z));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};l.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in l.uniforms)p.push(q);
-q=l.program;E=0;for(z=p.length;E<z;E++){A=p[E];q.uniforms[A]=f.getUniformLocation(q,A)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)p.push("morphTarget"+q);for(C in l.attributes)p.push(C);C=l.program;q=p;p=0;for(E=q.length;p<E;p++){z=q[p];C.attributes[z]=f.getAttribLocation(C,z)}C=l.program.attributes;f.enableVertexAttribArray(C.position);C.color>=0&&f.enableVertexAttribArray(C.color);C.normal>=0&&f.enableVertexAttribArray(C.normal);
-C.tangent>=0&&f.enableVertexAttribArray(C.tangent);if(l.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0){f.enableVertexAttribArray(C.skinVertexA);f.enableVertexAttribArray(C.skinVertexB);f.enableVertexAttribArray(C.skinIndex);f.enableVertexAttribArray(C.skinWeight)}if(l.morphTargets){l.numSupportedMorphTargets=0;if(C.morphTarget0>=0){f.enableVertexAttribArray(C.morphTarget0);l.numSupportedMorphTargets++}if(C.morphTarget1>=0){f.enableVertexAttribArray(C.morphTarget1);
-l.numSupportedMorphTargets++}if(C.morphTarget2>=0){f.enableVertexAttribArray(C.morphTarget2);l.numSupportedMorphTargets++}if(C.morphTarget3>=0){f.enableVertexAttribArray(C.morphTarget3);l.numSupportedMorphTargets++}if(C.morphTarget4>=0){f.enableVertexAttribArray(C.morphTarget4);l.numSupportedMorphTargets++}if(C.morphTarget5>=0){f.enableVertexAttribArray(C.morphTarget5);l.numSupportedMorphTargets++}if(C.morphTarget6>=0){f.enableVertexAttribArray(C.morphTarget6);l.numSupportedMorphTargets++}if(C.morphTarget7>=
-0){f.enableVertexAttribArray(C.morphTarget7);l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)n.__webGLMorphTargetInfluences[q]=0}};this.render=function(l,z,p,n){var q,C,A,D,P,U,E,Z,ka=l.lights,na=l.fog;z.matrixAutoUpdate&&z.updateMatrix();l.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ia);Aa.multiply(z.projectionMatrix,z.matrixWorldInverse);k(Aa);this.initWebGLObjects(l);
-y(p);(this.autoClear||n)&&this.clear();P=l.__webglObjects.length;for(n=0;n<P;n++){q=l.__webglObjects[n];E=q.object;if(E.visible)if(!(E instanceof THREE.Mesh)||m(E)){E.matrixWorld.flattenToArray(E._objectMatrixArray);v(E,z);u(q);q.render=!0;if(this.sortObjects){qa.copy(E.position);Aa.multiplyVector3(qa);q.z=qa.z}}else q.render=!1;else q.render=!1}this.sortObjects&&l.__webglObjects.sort(o);U=l.__webglObjectsImmediate.length;for(n=0;n<U;n++){q=l.__webglObjectsImmediate[n];E=q.object;if(E.visible){E.matrixAutoUpdate&&
-E.matrixWorld.flattenToArray(E._objectMatrixArray);v(E,z);w(q)}}x(THREE.NormalBlending);for(n=0;n<P;n++){q=l.__webglObjects[n];if(q.render){E=q.object;Z=q.buffer;A=q.opaque;h(E);for(q=0;q<A.count;q++){D=A.list[q];j(D.depthTest);e(z,ka,na,D,Z,E)}}}for(n=0;n<U;n++){q=l.__webglObjectsImmediate[n];E=q.object;if(E.visible){A=q.opaque;h(E);for(q=0;q<A.count;q++){D=A.list[q];j(D.depthTest);C=d(z,ka,na,D,E);E.render(function(wa){g(wa,C)})}}}for(n=0;n<P;n++){q=l.__webglObjects[n];if(q.render){E=q.object;Z=
-q.buffer;A=q.transparent;h(E);for(q=0;q<A.count;q++){D=A.list[q];x(D.blending);j(D.depthTest);e(z,ka,na,D,Z,E)}}}for(n=0;n<U;n++){q=l.__webglObjectsImmediate[n];E=q.object;if(E.visible){A=q.transparent;h(E);for(q=0;q<A.count;q++){D=A.list[q];x(D.blending);j(D.depthTest);C=d(z,ka,na,D,E);E.render(function(wa){g(wa,C)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};
-this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var z=l.__objectsAdded[0],p=l,n=void 0,q=void 0,C=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){q=z.geometry;q.geometryGroups==
-undefined&&B(q);for(n in q.geometryGroups){C=q.geometryGroups[n];if(!C.__webGLVertexBuffer){var A=C;A.__webGLVertexBuffer=f.createBuffer();A.__webGLNormalBuffer=f.createBuffer();A.__webGLTangentBuffer=f.createBuffer();A.__webGLColorBuffer=f.createBuffer();A.__webGLUVBuffer=f.createBuffer();A.__webGLUV2Buffer=f.createBuffer();A.__webGLSkinVertexABuffer=f.createBuffer();A.__webGLSkinVertexBBuffer=f.createBuffer();A.__webGLSkinIndicesBuffer=f.createBuffer();A.__webGLSkinWeightsBuffer=f.createBuffer();
-A.__webGLFaceBuffer=f.createBuffer();A.__webGLLineBuffer=f.createBuffer();if(A.numMorphTargets){var D=void 0,P=void 0;A.__webGLMorphTargetsBuffers=[];D=0;for(P=A.numMorphTargets;D<P;D++)A.__webGLMorphTargetsBuffers.push(f.createBuffer())}A=C;var U=z,E=void 0,Z=void 0,ka=P=D=0,na=U.geometry.faces,wa=A.faces;E=0;for(Z=wa.length;E<Z;E++){fi=wa[E];face=na[fi];if(face instanceof THREE.Face3){D+=3;P+=1;ka+=3}else if(face instanceof THREE.Face4){D+=4;P+=2;ka+=4}}A.__vertexArray=new Float32Array(D*3);A.__normalArray=
-new Float32Array(D*3);A.__tangentArray=new Float32Array(D*4);A.__colorArray=new Float32Array(D*3);A.__uvArray=new Float32Array(D*2);A.__uv2Array=new Float32Array(D*2);A.__skinVertexAArray=new Float32Array(D*4);A.__skinVertexBArray=new Float32Array(D*4);A.__skinIndexArray=new Float32Array(D*4);A.__skinWeightArray=new Float32Array(D*4);A.__faceArray=new Uint16Array(P*3);A.__lineArray=new Uint16Array(ka*2);Z=E=A;na=void 0;wa=void 0;var la=void 0,Ca=void 0;la=void 0;var Da=!1;na=0;for(wa=U.materials.length;na<
-wa;na++){la=U.materials[na];if(la instanceof THREE.MeshFaceMaterial){la=0;for(Ca=Z.materials.length;la<Ca;la++)if(Z.materials[la]&&Z.materials[la].shading!=undefined&&Z.materials[la].shading==THREE.SmoothShading){Da=!0;break}}else if(la&&la.shading!=undefined&&la.shading==THREE.SmoothShading){Da=!0;break}if(Da)break}E.__needsSmoothNormals=Da;A.__webGLFaceCount=P*3;A.__webGLLineCount=ka*2;if(A.numMorphTargets){P=void 0;ka=void 0;A.__morphTargetsArrays=[];P=0;for(ka=A.numMorphTargets;P<ka;P++)A.__morphTargetsArrays.push(new Float32Array(D*
-3))}q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}F(p.__webglObjects,C,z)}}else if(z instanceof THREE.Ribbon){q=z.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=q;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=new Float32Array(C*3);n.__webGLVertexCount=C;q.__dirtyVertices=!0;q.__dirtyColors=!0}F(p.__webglObjects,
-q,z)}else if(z instanceof THREE.Line){q=z.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=q;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=new Float32Array(C*3);n.__webGLLineCount=C;q.__dirtyVertices=!0;q.__dirtyColors=!0}F(p.__webglObjects,q,z)}else if(z instanceof THREE.ParticleSystem){q=z.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();
-n=q;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=new Float32Array(C*3);n.__sortArray=[];n.__webGLParticleCount=C;q.__dirtyVertices=!0;q.__dirtyColors=!0}F(p.__webglObjects,q,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}for(;l.__objectsRemoved.length;){z=l.__objectsRemoved[0];p=l;q=void 0;n=void 0;for(q=p.__webglObjects.length-
-1;q>=0;q--){n=p.__webglObjects[q].object;z==n&&p.__webglObjects.splice(q,1)}l.__objectsRemoved.splice(0,1)}z=0;for(p=l.__webglObjects.length;z<p;z++){n=l.__webglObjects[z].object;C=void 0;q=void 0;A=void 0;if(n instanceof THREE.Mesh){q=n.geometry;for(C in q.geometryGroups){A=q.geometryGroups[C];if(q.__dirtyVertices||q.__dirtyMorphTargets||q.__dirtyElements||q.__dirtyUvs||q.__dirtyNormals||q.__dirtyColors||q.__dirtyTangents){D=f.DYNAMIC_DRAW;P=void 0;ka=void 0;var Pa=void 0,M=void 0,Na=void 0,Ia=void 0,
-Oa=void 0;Pa=void 0;var S=void 0,V=void 0,W=void 0,ya=void 0;S=void 0;V=void 0;W=void 0;M=void 0;S=void 0;V=void 0;W=void 0;ya=void 0;S=void 0;V=void 0;W=void 0;ya=void 0;S=void 0;V=void 0;W=void 0;ya=void 0;S=void 0;V=void 0;W=void 0;ya=void 0;S=void 0;V=void 0;W=void 0;ya=void 0;M=void 0;Ia=void 0;Na=void 0;Oa=void 0;var Ma=void 0,Fa=void 0,Ba=void 0,Ga=Ca=la=Da=wa=na=U=Z=E=0,H=0,Ja=0,Ha=A.__vertexArray,O=A.__uvArray,oa=A.__uv2Array,$=A.__normalArray,K=A.__tangentArray,T=A.__colorArray,fa=A.__skinVertexAArray,
-pa=A.__skinVertexBArray,sa=A.__skinIndexArray,ua=A.__skinWeightArray,Ra=A.__morphTargetsArrays,La=A.__faceArray,Ka=A.__lineArray,Wa=A.__needsSmoothNormals,Ea=n.geometry,Sa=Ea.__dirtyVertices,ab=Ea.__dirtyElements,$a=Ea.__dirtyUvs,bb=Ea.__dirtyNormals,cb=Ea.__dirtyTangents,db=Ea.__dirtyColors,eb=Ea.__dirtyMorphTargets,Qa=Ea.vertices,fb=A.faces,gb=Ea.faces,hb=Ea.uvs,ib=Ea.uvs2,Ta=Ea.colors,Xa=Ea.skinVerticesA,Ya=Ea.skinVerticesB,Za=Ea.skinIndices,Va=Ea.skinWeights,Ua=Ea.morphTargets;P=0;for(ka=fb.length;P<
-ka;P++){Pa=fb[P];M=gb[Pa];Oa=hb[Pa];Pa=ib[Pa];Na=M.vertexNormals;Ia=M.normal;if(M instanceof THREE.Face3){if(Sa){S=Qa[M.a].position;V=Qa[M.b].position;W=Qa[M.c].position;Ha[Z]=S.x;Ha[Z+1]=S.y;Ha[Z+2]=S.z;Ha[Z+3]=V.x;Ha[Z+4]=V.y;Ha[Z+5]=V.z;Ha[Z+6]=W.x;Ha[Z+7]=W.y;Ha[Z+8]=W.z;Z+=9}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){S=Ua[Ma].vertices[M.a].position;V=Ua[Ma].vertices[M.b].position;W=Ua[Ma].vertices[M.c].position;Ba=Ra[Ma];Ba[Ja+0]=S.x;Ba[Ja+1]=S.y;Ba[Ja+2]=S.z;Ba[Ja+3]=V.x;Ba[Ja+4]=V.y;Ba[Ja+5]=
-V.z;Ba[Ja+6]=W.x;Ba[Ja+7]=W.y;Ba[Ja+8]=W.z}Ja+=9}if(Va.length){S=Va[M.a];V=Va[M.b];W=Va[M.c];ua[H]=S.x;ua[H+1]=S.y;ua[H+2]=S.z;ua[H+3]=S.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;S=Za[M.a];V=Za[M.b];W=Za[M.c];sa[H]=S.x;sa[H+1]=S.y;sa[H+2]=S.z;sa[H+3]=S.w;sa[H+4]=V.x;sa[H+5]=V.y;sa[H+6]=V.z;sa[H+7]=V.w;sa[H+8]=W.x;sa[H+9]=W.y;sa[H+10]=W.z;sa[H+11]=W.w;S=Xa[M.a];V=Xa[M.b];W=Xa[M.c];fa[H]=S.x;fa[H+1]=S.y;fa[H+2]=S.z;fa[H+3]=1;fa[H+4]=V.x;fa[H+
-5]=V.y;fa[H+6]=V.z;fa[H+7]=1;fa[H+8]=W.x;fa[H+9]=W.y;fa[H+10]=W.z;fa[H+11]=1;S=Ya[M.a];V=Ya[M.b];W=Ya[M.c];pa[H]=S.x;pa[H+1]=S.y;pa[H+2]=S.z;pa[H+3]=1;pa[H+4]=V.x;pa[H+5]=V.y;pa[H+6]=V.z;pa[H+7]=1;pa[H+8]=W.x;pa[H+9]=W.y;pa[H+10]=W.z;pa[H+11]=1;H+=12}if(db&&Ta.length){S=Ta[M.a];V=Ta[M.b];W=Ta[M.c];T[Ga]=S.r;T[Ga+1]=S.g;T[Ga+2]=S.b;T[Ga+3]=V.r;T[Ga+4]=V.g;T[Ga+5]=V.b;T[Ga+6]=W.r;T[Ga+7]=W.g;T[Ga+8]=W.b;Ga+=9}if(cb&&Ea.hasTangents){S=Qa[M.a].tangent;V=Qa[M.b].tangent;W=Qa[M.c].tangent;K[la]=S.x;K[la+
-1]=S.y;K[la+2]=S.z;K[la+3]=S.w;K[la+4]=V.x;K[la+5]=V.y;K[la+6]=V.z;K[la+7]=V.w;K[la+8]=W.x;K[la+9]=W.y;K[la+10]=W.z;K[la+11]=W.w;la+=12}if(bb)if(Na.length==3&&Wa)for(M=0;M<3;M++){Ia=Na[M];$[Da]=Ia.x;$[Da+1]=Ia.y;$[Da+2]=Ia.z;Da+=3}else for(M=0;M<3;M++){$[Da]=Ia.x;$[Da+1]=Ia.y;$[Da+2]=Ia.z;Da+=3}if($a&&Oa)for(M=0;M<3;M++){Na=Oa[M];O[U]=Na.u;O[U+1]=Na.v;U+=2}if($a&&Pa)for(M=0;M<3;M++){Oa=Pa[M];oa[na]=Oa.u;oa[na+1]=Oa.v;na+=2}if(ab){La[wa]=E;La[wa+1]=E+1;La[wa+2]=E+2;wa+=3;Ka[Ca]=E;Ka[Ca+1]=E+1;Ka[Ca+
-2]=E;Ka[Ca+3]=E+2;Ka[Ca+4]=E+1;Ka[Ca+5]=E+2;Ca+=6;E+=3}}else if(M instanceof THREE.Face4){if(Sa){S=Qa[M.a].position;V=Qa[M.b].position;W=Qa[M.c].position;ya=Qa[M.d].position;Ha[Z]=S.x;Ha[Z+1]=S.y;Ha[Z+2]=S.z;Ha[Z+3]=V.x;Ha[Z+4]=V.y;Ha[Z+5]=V.z;Ha[Z+6]=W.x;Ha[Z+7]=W.y;Ha[Z+8]=W.z;Ha[Z+9]=ya.x;Ha[Z+10]=ya.y;Ha[Z+11]=ya.z;Z+=12}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){S=Ua[Ma].vertices[M.a].position;V=Ua[Ma].vertices[M.b].position;W=Ua[Ma].vertices[M.c].position;ya=Ua[Ma].vertices[M.d].position;Ba=Ra[Ma];
-Ba[Ja+0]=S.x;Ba[Ja+1]=S.y;Ba[Ja+2]=S.z;Ba[Ja+3]=V.x;Ba[Ja+4]=V.y;Ba[Ja+5]=V.z;Ba[Ja+6]=W.x;Ba[Ja+7]=W.y;Ba[Ja+8]=W.z;Ba[Ja+9]=ya.x;Ba[Ja+10]=ya.y;Ba[Ja+11]=ya.z}Ja+=12}if(Va.length){S=Va[M.a];V=Va[M.b];W=Va[M.c];ya=Va[M.d];ua[H]=S.x;ua[H+1]=S.y;ua[H+2]=S.z;ua[H+3]=S.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;ua[H+12]=ya.x;ua[H+13]=ya.y;ua[H+14]=ya.z;ua[H+15]=ya.w;S=Za[M.a];V=Za[M.b];W=Za[M.c];ya=Za[M.d];sa[H]=S.x;sa[H+1]=S.y;sa[H+2]=S.z;sa[H+
-3]=S.w;sa[H+4]=V.x;sa[H+5]=V.y;sa[H+6]=V.z;sa[H+7]=V.w;sa[H+8]=W.x;sa[H+9]=W.y;sa[H+10]=W.z;sa[H+11]=W.w;sa[H+12]=ya.x;sa[H+13]=ya.y;sa[H+14]=ya.z;sa[H+15]=ya.w;S=Xa[M.a];V=Xa[M.b];W=Xa[M.c];ya=Xa[M.d];fa[H]=S.x;fa[H+1]=S.y;fa[H+2]=S.z;fa[H+3]=1;fa[H+4]=V.x;fa[H+5]=V.y;fa[H+6]=V.z;fa[H+7]=1;fa[H+8]=W.x;fa[H+9]=W.y;fa[H+10]=W.z;fa[H+11]=1;fa[H+12]=ya.x;fa[H+13]=ya.y;fa[H+14]=ya.z;fa[H+15]=1;S=Ya[M.a];V=Ya[M.b];W=Ya[M.c];ya=Ya[M.d];pa[H]=S.x;pa[H+1]=S.y;pa[H+2]=S.z;pa[H+3]=1;pa[H+4]=V.x;pa[H+5]=V.y;
-pa[H+6]=V.z;pa[H+7]=1;pa[H+8]=W.x;pa[H+9]=W.y;pa[H+10]=W.z;pa[H+11]=1;pa[H+12]=ya.x;pa[H+13]=ya.y;pa[H+14]=ya.z;pa[H+15]=1;H+=16}if(db&&Ta.length){S=Ta[M.a];V=Ta[M.b];W=Ta[M.c];ya=Ta[M.d];T[Ga]=S.r;T[Ga+1]=S.g;T[Ga+2]=S.b;T[Ga+3]=V.r;T[Ga+4]=V.g;T[Ga+5]=V.b;T[Ga+6]=W.r;T[Ga+7]=W.g;T[Ga+8]=W.b;T[Ga+9]=ya.r;T[Ga+10]=ya.g;T[Ga+11]=ya.b;Ga+=12}if(cb&&Ea.hasTangents){S=Qa[M.a].tangent;V=Qa[M.b].tangent;W=Qa[M.c].tangent;M=Qa[M.d].tangent;K[la]=S.x;K[la+1]=S.y;K[la+2]=S.z;K[la+3]=S.w;K[la+4]=V.x;K[la+5]=
-V.y;K[la+6]=V.z;K[la+7]=V.w;K[la+8]=W.x;K[la+9]=W.y;K[la+10]=W.z;K[la+11]=W.w;K[la+12]=M.x;K[la+13]=M.y;K[la+14]=M.z;K[la+15]=M.w;la+=16}if(bb)if(Na.length==4&&Wa)for(M=0;M<4;M++){Ia=Na[M];$[Da]=Ia.x;$[Da+1]=Ia.y;$[Da+2]=Ia.z;Da+=3}else for(M=0;M<4;M++){$[Da]=Ia.x;$[Da+1]=Ia.y;$[Da+2]=Ia.z;Da+=3}if($a&&Oa)for(M=0;M<4;M++){Na=Oa[M];O[U]=Na.u;O[U+1]=Na.v;U+=2}if($a&&Pa)for(M=0;M<4;M++){Oa=Pa[M];oa[na]=Oa.u;oa[na+1]=Oa.v;na+=2}if(ab){La[wa]=E;La[wa+1]=E+1;La[wa+2]=E+2;La[wa+3]=E;La[wa+4]=E+2;La[wa+5]=
-E+3;wa+=6;Ka[Ca]=E;Ka[Ca+1]=E+1;Ka[Ca+2]=E;Ka[Ca+3]=E+3;Ka[Ca+4]=E+1;Ka[Ca+5]=E+2;Ka[Ca+6]=E+2;Ka[Ca+7]=E+3;Ca+=8;E+=4}}}if(Sa){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,D)}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[Ma]);f.bufferData(f.ARRAY_BUFFER,Ra[Ma],D)}}if(db&&Ta.length){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,T,D)}if(bb){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLNormalBuffer);
-f.bufferData(f.ARRAY_BUFFER,$,D)}if(cb&&Ea.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,K,D)}if($a&&U>0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,O,D)}if($a&&na>0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,oa,D)}if(ab){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,La,D);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,
-Ka,D)}if(H>0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,fa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,pa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,sa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,ua,D)}}}q.__dirtyVertices=!1;q.__dirtyMorphTargets=!1;q.__dirtyElements=!1;q.__dirtyUvs=!1;q.__dirtyNormals=!1;q.__dirtyTangents=!1;q.__dirtyColors=
-!1}else if(n instanceof THREE.Ribbon){q=n.geometry;if(q.__dirtyVertices||q.__dirtyColors){n=q;C=f.DYNAMIC_DRAW;E=void 0;E=void 0;Z=void 0;A=void 0;U=n.vertices;D=n.colors;na=U.length;P=D.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(E=0;E<na;E++){Z=U[E].position;A=E*3;wa[A]=Z.x;wa[A+1]=Z.y;wa[A+2]=Z.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,wa,C)}if(Da){for(E=0;E<P;E++){color=D[E];A=E*3;ka[A]=color.r;ka[A+1]=color.g;
-ka[A+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ka,C)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(n instanceof THREE.Line){q=n.geometry;if(q.__dirtyVertices||q.__dirtyColors){n=q;C=f.DYNAMIC_DRAW;E=void 0;E=void 0;Z=void 0;A=void 0;U=n.vertices;D=n.colors;na=U.length;P=D.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(E=0;E<na;E++){Z=U[E].position;A=E*3;wa[A]=Z.x;wa[A+1]=Z.y;wa[A+2]=Z.z}f.bindBuffer(f.ARRAY_BUFFER,
-n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,wa,C)}if(Da){for(E=0;E<P;E++){color=D[E];A=E*3;ka[A]=color.r;ka[A+1]=color.g;ka[A+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ka,C)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){q=n.geometry;(q.__dirtyVertices||q.__dirtyColors||n.sortParticles)&&c(q,f.DYNAMIC_DRAW,n);q.__dirtyVertices=!1;q.__dirtyColors=!1}}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?f.frontFace(f.CCW):
-f.frontFace(f.CW);if(l=="back")f.cullFace(f.BACK);else l=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.WebGLRenderer=function(a){function c(k,y,z){var q,t,D,A=k.vertices,C=A.length,S=k.colors,G=S.length,H=k.__vertexArray,ia=k.__colorArray,oa=k.__sortArray,W=k.__dirtyVertices,ha=k.__dirtyColors;if(z.sortParticles){Ga.multiplySelf(z.matrixWorld);for(q=0;q<C;q++){t=A[q].position;ta.copy(t);Ga.multiplyVector3(ta);oa[q]=[ta.z,q]}oa.sort(function(pa,za){return za[0]-pa[0]});for(q=0;q<C;q++){t=A[oa[q][1]].position;D=q*3;H[D]=t.x;H[D+1]=t.y;H[D+2]=t.z}for(q=0;q<G;q++){D=q*3;color=S[oa[q][1]];ia[D]=color.r;
+ia[D+1]=color.g;ia[D+2]=color.b}}else{if(W)for(q=0;q<C;q++){t=A[q].position;D=q*3;H[D]=t.x;H[D+1]=t.y;H[D+2]=t.z}if(ha)for(q=0;q<G;q++){color=S[q];D=q*3;ia[D]=color.r;ia[D+1]=color.g;ia[D+2]=color.b}}if(W||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,H,y)}if(ha||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ia,y)}}function b(k,y){k.fragmentShader=y.fragmentShader;k.vertexShader=y.vertexShader;k.uniforms=
+Uniforms.clone(y.uniforms)}function d(k,y,z,q,t){q.program||ma.initMaterial(q,y,z,t);var D=q.program,A=D.uniforms,C=q.uniforms;if(D!=Y){e.useProgram(D);Y=D}e.uniformMatrix4fv(A.projectionMatrix,!1,la);if(z&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){C.fogColor.value.setHex(z.color.hex);if(z instanceof THREE.Fog){C.fogNear.value=z.near;C.fogFar.value=
+z.far}else if(z instanceof THREE.FogExp2)C.fogDensity.value=z.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q.lights){var S,G,H=0,ia=0,oa=0,W,ha,pa,za=xa,Ea=za.directional.colors,ra=za.directional.positions,Na=za.point.colors,L=za.point.positions,Ma=0,La=0;z=G=G=0;for(S=y.length;z<S;z++){G=y[z];W=G.color;ha=G.position;pa=G.intensity;if(G instanceof THREE.AmbientLight){H+=W.r;ia+=W.g;oa+=W.b}else if(G instanceof THREE.DirectionalLight){G=Ma*3;Ea[G]=W.r*pa;
+Ea[G+1]=W.g*pa;Ea[G+2]=W.b*pa;ra[G]=ha.x;ra[G+1]=ha.y;ra[G+2]=ha.z;Ma+=1}else if(G instanceof THREE.PointLight){G=La*3;Na[G]=W.r*pa;Na[G+1]=W.g*pa;Na[G+2]=W.b*pa;L[G]=ha.x;L[G+1]=ha.y;L[G+2]=ha.z;La+=1}}for(z=Ma*3;z<Ea.length;z++)Ea[z]=0;for(z=La*3;z<Na.length;z++)Na[z]=0;za.point.length=La;za.directional.length=Ma;za.ambient[0]=H;za.ambient[1]=ia;za.ambient[2]=oa;y=xa;C.enableLighting.value=y.directional.length+y.point.length;C.ambientLightColor.value=y.ambient;C.directionalLightColor.value=y.directional.colors;
+C.directionalLightDirection.value=y.directional.positions;C.pointLightColor.value=y.point.colors;C.pointLightPosition.value=y.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){C.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity;C.map.texture=q.map;C.lightMap.texture=q.lightMap;C.envMap.texture=q.envMap;C.reflectivity.value=q.reflectivity;C.refractionRatio.value=
+q.refractionRatio;C.combine.value=q.combine;C.useRefract.value=q.envMap&&q.envMap.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){C.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){C.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity;C.size.value=q.size;C.scale.value=O.height/2;C.map.texture=q.map}else if(q instanceof
+THREE.MeshPhongMaterial){C.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);C.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);C.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){C.mNear.value=k.near;C.mFar.value=k.far;C.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)C.opacity.value=q.opacity;for(var Fa in C)if(H=D.uniforms[Fa]){z=C[Fa];S=z.type;y=z.value;if(S=="i")e.uniform1i(H,y);else if(S=="f")e.uniform1f(H,y);else if(S=="fv1")e.uniform1fv(H,
+y);else if(S=="fv")e.uniform3fv(H,y);else if(S=="v2")e.uniform2f(H,y.x,y.y);else if(S=="v3")e.uniform3f(H,y.x,y.y,y.z);else if(S=="c")e.uniform3f(H,y.r,y.g,y.b);else if(S=="t"){e.uniform1i(H,y);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__wasSetOnce){e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube);for(S=0;S<6;++S)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,e.RGBA,e.UNSIGNED_BYTE,z.image[S])}else{z.image.__webGLTextureCube=
+e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube);for(S=0;S<6;++S)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,z.image[S]);z.__wasSetOnce=!0}M(e.TEXTURE_CUBE_MAP,z,z.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube)}}else{if(z.needsUpdate){if(z.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,z.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,
+0,0,0,e.RGBA,e.UNSIGNED_BYTE,z.image)}else{z.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,z.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,z.image);z.__wasSetOnce=!0}M(e.TEXTURE_2D,z,z.image);e.bindTexture(e.TEXTURE_2D,null);z.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_2D,z.__webGLTexture)}}}e.uniformMatrix4fv(A.modelViewMatrix,!1,t._modelViewMatrixArray);e.uniformMatrix3fv(A.normalMatrix,!1,t._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||
+q instanceof THREE.MeshPhongMaterial||q.envMap)&&e.uniform3f(A.cameraPosition,k.position.x,k.position.y,k.position.z);(q instanceof THREE.MeshShaderMaterial||q.envMap||q.skinning)&&e.uniformMatrix4fv(A.objectMatrix,!1,t._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&e.uniformMatrix4fv(A.viewMatrix,!1,aa);if(q.skinning){e.uniformMatrix4fv(A.cameraInverseMatrix,!1,aa);e.uniformMatrix4fv(A.boneGlobalMatrices,
+!1,t.boneMatrices)}return D}function f(k,y,z,q,t,D){if(q.opacity!=0){k=d(k,y,z,q,D).attributes;if(q.morphTargets){y=q.program.attributes;D.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,t.__webGLMorphTargetsBuffers[D.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(y.position,3,e.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){z=0;for(var A=D.morphTargetForcedOrder,C=D.morphTargetInfluences;z<q.numSupportedMorphTargets&&z<A.length;){e.bindBuffer(e.ARRAY_BUFFER,
+t.__webGLMorphTargetsBuffers[A[z]]);e.vertexAttribPointer(y["morphTarget"+z],3,e.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[z]=C[A[z]];z++}}else{A=[];var S=-1,G=0;C=D.morphTargetInfluences;var H,ia=C.length;z=0;for(D.morphTargetBase!==-1&&(A[D.morphTargetBase]=!0);z<q.numSupportedMorphTargets;){for(H=0;H<ia;H++)if(!A[H]&&C[H]>S){G=H;S=C[G]}e.bindBuffer(e.ARRAY_BUFFER,t.__webGLMorphTargetsBuffers[G]);e.vertexAttribPointer(y["morphTarget"+z],3,e.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[z]=S;A[G]=
+1;S=-1;z++}}e.uniform1fv(q.program.uniforms.morphTargetInfluences,D.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(k.position,3,e.FLOAT,!1,0,0)}if(k.color>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLColorBuffer);e.vertexAttribPointer(k.color,3,e.FLOAT,!1,0,0)}if(k.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLNormalBuffer);e.vertexAttribPointer(k.normal,3,e.FLOAT,!1,0,0)}if(k.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLTangentBuffer);
+e.vertexAttribPointer(k.tangent,4,e.FLOAT,!1,0,0)}if(k.uv>=0)if(t.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUVBuffer);e.vertexAttribPointer(k.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(k.uv)}else e.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(t.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUV2Buffer);e.vertexAttribPointer(k.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(k.uv2)}else e.disableVertexAttribArray(k.uv2);if(q.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=
+0&&k.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexABuffer);e.vertexAttribPointer(k.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexBBuffer);e.vertexAttribPointer(k.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinIndicesBuffer);e.vertexAttribPointer(k.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinWeightsBuffer);e.vertexAttribPointer(k.skinWeight,4,e.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(q.wireframe){e.lineWidth(q.wireframeLinewidth);
+e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(q.linewidth);e.drawArrays(D,0,t.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else D instanceof THREE.Ribbon&&
+e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}}function g(k,y){if(!k.__webGLVertexBuffer)k.__webGLVertexBuffer=e.createBuffer();if(!k.__webGLNormalBuffer)k.__webGLNormalBuffer=e.createBuffer();if(k.hasPos){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,k.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.position);e.vertexAttribPointer(y.attributes.position,3,e.FLOAT,!1,0,0)}if(k.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLNormalBuffer);
+e.bufferData(e.ARRAY_BUFFER,k.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.normal);e.vertexAttribPointer(y.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,k.count);k.count=0}function h(k){if(ka!=k.doubleSided){k.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ka=k.doubleSided}if(K!=k.flipSided){k.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);K=k.flipSided}}function m(k){if(Ha!=k){k?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Ha=k}}function j(k){wa[0].set(k.n41-
+k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);wa[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);wa[2].set(k.n41+k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);wa[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);wa[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);wa[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var y;for(k=0;k<6;k++){y=wa[k];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}function n(k){for(var y=k.matrixWorld,z=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,
+Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++){k=wa[q].x*y.n14+wa[q].y*y.n24+wa[q].z*y.n34+wa[q].w;if(k<=z)return!1}return!0}function p(k,y){k.list[k.count]=y;k.count+=1}function v(k){var y,z,q=k.object,t=k.opaque,D=k.transparent;D.count=0;k=t.count=0;for(y=q.materials.length;k<y;k++){z=q.materials[k];z.opacity&&z.opacity<1||z.blending!=THREE.NormalBlending?p(D,z):p(t,z)}}function u(k){var y,z,q,t,D=k.object,A=k.buffer,C=k.opaque,S=k.transparent;S.count=0;k=C.count=0;for(q=D.materials.length;k<q;k++){y=
+D.materials[k];if(y instanceof THREE.MeshFaceMaterial){y=0;for(z=A.materials.length;y<z;y++)(t=A.materials[y])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?p(S,t):p(C,t))}else{t=y;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?p(S,t):p(C,t)}}}function o(k,y){return y.z-k.z}function x(k,y){k._modelViewMatrix.multiplyToArray(y.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function B(k){function y(oa){var W=
+[];z=0;for(q=oa.length;z<q;z++)oa[z]==undefined?W.push("undefined"):W.push(oa[z].id);return W.join("_")}var z,q,t,D,A,C,S,G,H={},ia=k.morphTargets!==undefined?k.morphTargets.length:0;k.geometryGroups={};t=0;for(D=k.faces.length;t<D;t++){A=k.faces[t];C=A.materials;S=y(C);H[S]==undefined&&(H[S]={hash:S,counter:0});G=H[S].hash+"_"+H[S].counter;k.geometryGroups[G]==undefined&&(k.geometryGroups[G]={faces:[],materials:C,vertices:0,numMorphTargets:ia});A=A instanceof THREE.Face3?3:4;if(k.geometryGroups[G].vertices+
+A>65535){H[S].counter+=1;G=H[S].hash+"_"+H[S].counter;k.geometryGroups[G]==undefined&&(k.geometryGroups[G]={faces:[],materials:C,vertices:0,numMorphTargets:ia})}k.geometryGroups[G].faces.push(t);k.geometryGroups[G].vertices+=A}}function E(k,y,z){k.push({buffer:y,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(k){if(k!=ea){switch(k){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,
+e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ea=k}}function M(k,y,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(k,e.TEXTURE_WRAP_S,da(y.wrapS));e.texParameteri(k,e.TEXTURE_WRAP_T,da(y.wrapT));e.texParameteri(k,
+e.TEXTURE_MAG_FILTER,da(y.magFilter));e.texParameteri(k,e.TEXTURE_MIN_FILTER,da(y.minFilter));e.generateMipmap(k)}else{e.texParameteri(k,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(k,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(k,e.TEXTURE_MAG_FILTER,R(y.magFilter));e.texParameteri(k,e.TEXTURE_MIN_FILTER,R(y.minFilter))}}function J(k){if(k&&!k.__webGLFramebuffer){k.__webGLFramebuffer=e.createFramebuffer();k.__webGLRenderbuffer=e.createRenderbuffer();k.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,
+k.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,k.width,k.height);e.bindTexture(e.TEXTURE_2D,k.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,da(k.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,da(k.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,da(k.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,da(k.minFilter));e.texImage2D(e.TEXTURE_2D,0,da(k.format),k.width,k.height,0,da(k.format),da(k.type),null);e.bindFramebuffer(e.FRAMEBUFFER,
+k.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,k.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,k.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,z;if(k){y=k.__webGLFramebuffer;z=k.width;k=k.height}else{y=null;z=na;k=ja}if(y!=V){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(fa,Ca,z,k);V=y}}function N(k,y){var z;if(k=="fragment")z=
+e.createShader(e.FRAGMENT_SHADER);else k=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,y);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));return null}return z}function R(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return e.LINEAR}}function da(k){switch(k){case THREE.RepeatWrapping:return e.REPEAT;
+case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
+case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var O=document.createElement("canvas"),
+e,Y=null,V=null,ma=this,ka=null,K=null,ea=null,Ha=null,fa=0,Ca=0,na=0,ja=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,la=new Float32Array(16),aa=new Float32Array(16),ta=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},U=!0,qa=new THREE.Color(0),Ba=0;if(a){if(a.antialias!==undefined)U=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);
+if(a.clearAlpha!==undefined)Ba=a.clearAlpha}this.maxMorphTargets=8;this.domElement=O;this.autoClear=!0;this.sortObjects=!0;(function(k,y,z){try{if(!(e=O.getContext("experimental-webgl",{antialias:k})))throw"Error creating WebGL context.";}catch(q){console.error(q)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,z);_cullEnabled=
+!0})(U,qa,Ba);this.context=e;this.setSize=function(k,y){O.width=k;O.height=y;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(k,y,z,q){fa=k;Ca=y;na=z;ja=q;e.viewport(fa,Ca,na,ja)};this.setScissor=function(k,y,z,q){e.scissor(k,y,z,q)};this.enableScissorTest=function(k){k?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){e.depthMask(k)};this.setClearColorHex=function(k,y){var z=new THREE.Color(k);e.clearColor(z.r,z.g,z.b,y)};this.setClearColor=
+function(k,y){e.clearColor(k.r,k.g,k.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(k,y,z,q){var t,D,A;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);
+else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);var C,S,G,H;A=G=H=0;for(C=y.length;A<C;A++){S=y[A];S instanceof THREE.DirectionalLight&&G++;S instanceof THREE.PointLight&&H++}if(H+G<=4)y=G;else{y=Math.ceil(4*G/(H+G));H=4-y}A={directional:y,point:H};C=50;if(q!==undefined&&q instanceof THREE.SkinnedMesh)C=q.bones.length;H=k.fragmentShader;y=k.vertexShader;C={fog:z,map:k.map,envMap:k.envMap,lightMap:k.lightMap,
+vertexColors:k.vertexColors,sizeAttenuation:k.sizeAttenuation,skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:C};z=e.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":
+"",C.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,"#define MAX_BONES "+C.maxBones,C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"",C.morphTargets?"#define USE_MORPHTARGETS":
+"",C.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+e.attachShader(z,N("fragment",A+H));e.attachShader(z,N("vertex",C+y));e.linkProgram(z);e.getProgramParameter(z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");z.uniforms={};z.attributes={};k.program=z;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in k.uniforms)z.push(t);
+t=k.program;H=0;for(y=z.length;H<y;H++){A=z[H];t.uniforms[A]=e.getUniformLocation(t,A)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<this.maxMorphTargets;t++)z.push("morphTarget"+t);for(D in k.attributes)z.push(D);D=k.program;t=z;z=0;for(H=t.length;z<H;z++){y=t[z];D.attributes[y]=e.getAttribLocation(D,y)}D=k.program.attributes;e.enableVertexAttribArray(D.position);D.color>=0&&e.enableVertexAttribArray(D.color);D.normal>=0&&e.enableVertexAttribArray(D.normal);
+D.tangent>=0&&e.enableVertexAttribArray(D.tangent);if(k.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){e.enableVertexAttribArray(D.skinVertexA);e.enableVertexAttribArray(D.skinVertexB);e.enableVertexAttribArray(D.skinIndex);e.enableVertexAttribArray(D.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(D.morphTarget0>=0){e.enableVertexAttribArray(D.morphTarget0);k.numSupportedMorphTargets++}if(D.morphTarget1>=0){e.enableVertexAttribArray(D.morphTarget1);
+k.numSupportedMorphTargets++}if(D.morphTarget2>=0){e.enableVertexAttribArray(D.morphTarget2);k.numSupportedMorphTargets++}if(D.morphTarget3>=0){e.enableVertexAttribArray(D.morphTarget3);k.numSupportedMorphTargets++}if(D.morphTarget4>=0){e.enableVertexAttribArray(D.morphTarget4);k.numSupportedMorphTargets++}if(D.morphTarget5>=0){e.enableVertexAttribArray(D.morphTarget5);k.numSupportedMorphTargets++}if(D.morphTarget6>=0){e.enableVertexAttribArray(D.morphTarget6);k.numSupportedMorphTargets++}if(D.morphTarget7>=
+0){e.enableVertexAttribArray(D.morphTarget7);k.numSupportedMorphTargets++}q.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(t=0;t<this.maxMorphTargets;t++)q.__webGLMorphTargetInfluences[t]=0}};this.render=function(k,y,z,q){var t,D,A,C,S,G,H,ia,oa=k.lights,W=k.fog;y.matrixAutoUpdate&&y.updateMatrix();k.update(undefined,!1,y);y.matrixWorldInverse.flattenToArray(aa);y.projectionMatrix.flattenToArray(la);Ga.multiply(y.projectionMatrix,y.matrixWorldInverse);j(Ga);this.initWebGLObjects(k);
+J(z);(this.autoClear||q)&&this.clear();S=k.__webglObjects.length;for(q=0;q<S;q++){t=k.__webglObjects[q];H=t.object;if(H.visible)if(!(H instanceof THREE.Mesh)||n(H)){H.matrixWorld.flattenToArray(H._objectMatrixArray);x(H,y);u(t);t.render=!0;if(this.sortObjects){ta.copy(H.position);Ga.multiplyVector3(ta);t.z=ta.z}}else t.render=!1;else t.render=!1}this.sortObjects&&k.__webglObjects.sort(o);G=k.__webglObjectsImmediate.length;for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){H.matrixAutoUpdate&&
+H.matrixWorld.flattenToArray(H._objectMatrixArray);x(H,y);v(t)}}w(THREE.NormalBlending);for(q=0;q<S;q++){t=k.__webglObjects[q];if(t.render){H=t.object;ia=t.buffer;A=t.opaque;h(H);for(t=0;t<A.count;t++){C=A.list[t];m(C.depthTest);f(y,oa,W,C,ia,H)}}}for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){A=t.opaque;h(H);for(t=0;t<A.count;t++){C=A.list[t];m(C.depthTest);D=d(y,oa,W,C,H);H.render(function(ha){g(ha,D)})}}}for(q=0;q<S;q++){t=k.__webglObjects[q];if(t.render){H=t.object;ia=
+t.buffer;A=t.transparent;h(H);for(t=0;t<A.count;t++){C=A.list[t];w(C.blending);m(C.depthTest);f(y,oa,W,C,ia,H)}}}for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){A=t.transparent;h(H);for(t=0;t<A.count;t++){C=A.list[t];w(C.blending);m(C.depthTest);D=d(y,oa,W,C,H);H.render(function(ha){g(ha,D)})}}}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(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[]}for(;k.__objectsAdded.length;){var y=k.__objectsAdded[0],z=k,q=void 0,t=void 0,D=void 0;if(y._modelViewMatrix==undefined){y._modelViewMatrix=new THREE.Matrix4;y._normalMatrixArray=new Float32Array(9);y._modelViewMatrixArray=new Float32Array(16);y._objectMatrixArray=new Float32Array(16);y.matrixWorld.flattenToArray(y._objectMatrixArray)}if(y instanceof THREE.Mesh){t=y.geometry;t.geometryGroups==
+undefined&&B(t);for(q in t.geometryGroups){D=t.geometryGroups[q];if(!D.__webGLVertexBuffer){var A=D;A.__webGLVertexBuffer=e.createBuffer();A.__webGLNormalBuffer=e.createBuffer();A.__webGLTangentBuffer=e.createBuffer();A.__webGLColorBuffer=e.createBuffer();A.__webGLUVBuffer=e.createBuffer();A.__webGLUV2Buffer=e.createBuffer();A.__webGLSkinVertexABuffer=e.createBuffer();A.__webGLSkinVertexBBuffer=e.createBuffer();A.__webGLSkinIndicesBuffer=e.createBuffer();A.__webGLSkinWeightsBuffer=e.createBuffer();
+A.__webGLFaceBuffer=e.createBuffer();A.__webGLLineBuffer=e.createBuffer();if(A.numMorphTargets){var C=void 0,S=void 0;A.__webGLMorphTargetsBuffers=[];C=0;for(S=A.numMorphTargets;C<S;C++)A.__webGLMorphTargetsBuffers.push(e.createBuffer())}A=D;var G=y,H=void 0,ia=void 0,oa=S=C=0;H=void 0;var W=void 0;ia=void 0;ia=void 0;var ha=G.geometry;W=ha.faces;var pa=A.faces;H=0;for(ia=pa.length;H<ia;H++){fi=pa[H];face=W[fi];if(face instanceof THREE.Face3){C+=3;S+=1;oa+=3}else if(face instanceof THREE.Face4){C+=
+4;S+=2;oa+=4}}H=A;ia=G;W=void 0;pa=void 0;var za=void 0,Ea=void 0;za=void 0;var ra=[];W=0;for(pa=ia.materials.length;W<pa;W++){za=ia.materials[W];if(za instanceof THREE.MeshFaceMaterial){za=0;for(l=H.materials.length;za<l;za++)(Ea=H.materials[za])&&ra.push(Ea)}else(Ea=za)&&ra.push(Ea)}ia=ra;a:{H=void 0;W=void 0;pa=ia.length;for(H=0;H<pa;H++){W=ia[H];if(W.map||W.lightMap){H=!0;break a}}H=!1}a:{W=void 0;pa=void 0;ra=ia.length;for(W=0;W<ra;W++){pa=ia[W];if(pa.vertexColors){W=pa.vertexColors;break a}}W=
+!1}a:{pa=void 0;ra=void 0;za=ia.length;for(pa=0;pa<za;pa++){ra=ia[pa];if(!(ra instanceof THREE.MeshBasicMaterial||ra instanceof THREE.MeshDepthMaterial)){ia=ra&&ra.shading!=undefined&&ra.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ia=!1}A.__vertexArray=new Float32Array(C*3);if(ia)A.__normalArray=new Float32Array(C*3);if(ha.hasTangents)A.__tangentArray=new Float32Array(C*4);if(W)A.__colorArray=new Float32Array(C*3);if(H){if(ha.faceUvs.length>0||ha.faceVertexUvs.length>
+0)A.__uvArray=new Float32Array(C*2);if(ha.faceUvs.length>1||ha.faceVertexUvs.length>1)A.__uv2Array=new Float32Array(C*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){A.__skinVertexAArray=new Float32Array(C*4);A.__skinVertexBArray=new Float32Array(C*4);A.__skinIndexArray=new Float32Array(C*4);A.__skinWeightArray=new Float32Array(C*4)}A.__faceArray=new Uint16Array(S*3);A.__lineArray=new Uint16Array(oa*2);if(A.numMorphTargets){G=void 0;ha=void 0;A.__morphTargetsArrays=[];G=0;for(ha=
+A.numMorphTargets;G<ha;G++)A.__morphTargetsArrays.push(new Float32Array(C*3))}A.__needsSmoothNormals=ia==THREE.SmoothShading;A.__uvType=H;A.__vertexColorType=W;A.__normalType=ia;A.__webGLFaceCount=S*3;A.__webGLLineCount=oa*2;t.__dirtyVertices=!0;t.__dirtyMorphTargets=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}E(z.__webglObjects,D,y)}}else if(y instanceof THREE.Ribbon){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();
+q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__webGLVertexCount=D;t.__dirtyVertices=!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else if(y instanceof THREE.Line){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__webGLLineCount=D;t.__dirtyVertices=
+!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else if(y instanceof THREE.ParticleSystem){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__sortArray=[];q.__webGLParticleCount=D;t.__dirtyVertices=!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else THREE.MarchingCubes!==undefined&&y instanceof THREE.MarchingCubes&&z.__webglObjectsImmediate.push({object:y,
+opaque:{list:[],count:0},transparent:{list:[],count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){y=k.__objectsRemoved[0];z=k;t=void 0;q=void 0;for(t=z.__webglObjects.length-1;t>=0;t--){q=z.__webglObjects[t].object;y==q&&z.__webglObjects.splice(t,1)}k.__objectsRemoved.splice(0,1)}y=0;for(z=k.__webglObjects.length;y<z;y++){q=k.__webglObjects[y].object;D=void 0;t=void 0;A=void 0;if(q instanceof THREE.Mesh){t=q.geometry;for(D in t.geometryGroups){A=t.geometryGroups[D];if(t.__dirtyVertices||
+t.__dirtyMorphTargets||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){C=e.DYNAMIC_DRAW;S=void 0;oa=void 0;var Na=void 0,L=void 0,Ma=void 0,La=void 0,Fa=void 0,Pa=void 0,Ra=void 0;Na=void 0;var T=void 0,Z=void 0,P=void 0,Aa=void 0;Fa=void 0;Pa=void 0;T=void 0;L=void 0;T=void 0;Z=void 0;P=void 0;Fa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;L=void 0;
+La=void 0;Ma=void 0;Ra=void 0;var Ia=void 0,Va=void 0,Ka=void 0,F=Ea=za=ra=pa=W=ia=H=ha=G=0,I=0,$=A.__vertexArray,ga=A.__uvArray,Q=A.__uv2Array,X=A.__normalArray,ca=A.__tangentArray,va=A.__colorArray,sa=A.__skinVertexAArray,ua=A.__skinVertexBArray,Da=A.__skinIndexArray,ya=A.__skinWeightArray,Ta=A.__morphTargetsArrays,Qa=A.__faceArray,Ja=A.__lineArray,Ua=A.__needsSmoothNormals,bb=A.__vertexColorType,Oa=q.geometry,cb=Oa.__dirtyVertices,db=Oa.__dirtyElements,ab=Oa.__dirtyUvs,eb=Oa.__dirtyNormals,fb=
+Oa.__dirtyTangents,gb=Oa.__dirtyColors,hb=Oa.__dirtyMorphTargets,Sa=Oa.vertices,ib=A.faces,jb=Oa.faces,kb=Oa.faceVertexUvs[0],lb=Oa.faceVertexUvs[1],mb=Oa.colors,Ya=Oa.skinVerticesA,Za=Oa.skinVerticesB,$a=Oa.skinIndices,Xa=Oa.skinWeights,Wa=Oa.morphTargets;S=0;for(oa=ib.length;S<oa;S++){Na=ib[S];L=jb[Na];Ra=kb[Na];Na=lb[Na];Ma=L.vertexNormals;La=L.normal;Fa=L.vertexColors;Pa=L.color;if(L instanceof THREE.Face3){if(cb){T=Sa[L.a].position;Z=Sa[L.b].position;P=Sa[L.c].position;$[ha]=T.x;$[ha+1]=T.y;
+$[ha+2]=T.z;$[ha+3]=Z.x;$[ha+4]=Z.y;$[ha+5]=Z.z;$[ha+6]=P.x;$[ha+7]=P.y;$[ha+8]=P.z;ha+=9}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){T=Wa[Ia].vertices[L.a].position;Z=Wa[Ia].vertices[L.b].position;P=Wa[Ia].vertices[L.c].position;Ka=Ta[Ia];Ka[I+0]=T.x;Ka[I+1]=T.y;Ka[I+2]=T.z;Ka[I+3]=Z.x;Ka[I+4]=Z.y;Ka[I+5]=Z.z;Ka[I+6]=P.x;Ka[I+7]=P.y;Ka[I+8]=P.z}I+=9}if(Xa.length){T=Xa[L.a];Z=Xa[L.b];P=Xa[L.c];ya[F]=T.x;ya[F+1]=T.y;ya[F+2]=T.z;ya[F+3]=T.w;ya[F+4]=Z.x;ya[F+5]=Z.y;ya[F+6]=Z.z;ya[F+7]=Z.w;ya[F+8]=P.x;ya[F+
+9]=P.y;ya[F+10]=P.z;ya[F+11]=P.w;T=$a[L.a];Z=$a[L.b];P=$a[L.c];Da[F]=T.x;Da[F+1]=T.y;Da[F+2]=T.z;Da[F+3]=T.w;Da[F+4]=Z.x;Da[F+5]=Z.y;Da[F+6]=Z.z;Da[F+7]=Z.w;Da[F+8]=P.x;Da[F+9]=P.y;Da[F+10]=P.z;Da[F+11]=P.w;T=Ya[L.a];Z=Ya[L.b];P=Ya[L.c];sa[F]=T.x;sa[F+1]=T.y;sa[F+2]=T.z;sa[F+3]=1;sa[F+4]=Z.x;sa[F+5]=Z.y;sa[F+6]=Z.z;sa[F+7]=1;sa[F+8]=P.x;sa[F+9]=P.y;sa[F+10]=P.z;sa[F+11]=1;T=Za[L.a];Z=Za[L.b];P=Za[L.c];ua[F]=T.x;ua[F+1]=T.y;ua[F+2]=T.z;ua[F+3]=1;ua[F+4]=Z.x;ua[F+5]=Z.y;ua[F+6]=Z.z;ua[F+7]=1;ua[F+8]=
+P.x;ua[F+9]=P.y;ua[F+10]=P.z;ua[F+11]=1;F+=12}if(gb&&bb){if(Fa.length==3&&bb==THREE.VertexColors){T=Fa[0];Z=Fa[1];P=Fa[2]}else P=Z=T=Pa;va[Ea]=T.r;va[Ea+1]=T.g;va[Ea+2]=T.b;va[Ea+3]=Z.r;va[Ea+4]=Z.g;va[Ea+5]=Z.b;va[Ea+6]=P.r;va[Ea+7]=P.g;va[Ea+8]=P.b;Ea+=9}if(fb&&Oa.hasTangents){Fa=Sa[L.a].tangent;Pa=Sa[L.b].tangent;T=Sa[L.c].tangent;ca[ra]=Fa.x;ca[ra+1]=Fa.y;ca[ra+2]=Fa.z;ca[ra+3]=Fa.w;ca[ra+4]=Pa.x;ca[ra+5]=Pa.y;ca[ra+6]=Pa.z;ca[ra+7]=Pa.w;ca[ra+8]=T.x;ca[ra+9]=T.y;ca[ra+10]=T.z;ca[ra+11]=T.w;ra+=
+12}if(eb)if(Ma.length==3&&Ua)for(L=0;L<3;L++){La=Ma[L];X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}else for(L=0;L<3;L++){X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}if(ab&&Ra)for(L=0;L<3;L++){Ma=Ra[L];ga[H]=Ma.u;ga[H+1]=Ma.v;H+=2}if(ab&&Na)for(L=0;L<3;L++){Ra=Na[L];Q[ia]=Ra.u;Q[ia+1]=Ra.v;ia+=2}if(db){Qa[W]=G;Qa[W+1]=G+1;Qa[W+2]=G+2;W+=3;Ja[za]=G;Ja[za+1]=G+1;Ja[za+2]=G;Ja[za+3]=G+2;Ja[za+4]=G+1;Ja[za+5]=G+2;za+=6;G+=3}}else if(L instanceof THREE.Face4){if(cb){T=Sa[L.a].position;Z=Sa[L.b].position;
+P=Sa[L.c].position;Aa=Sa[L.d].position;$[ha]=T.x;$[ha+1]=T.y;$[ha+2]=T.z;$[ha+3]=Z.x;$[ha+4]=Z.y;$[ha+5]=Z.z;$[ha+6]=P.x;$[ha+7]=P.y;$[ha+8]=P.z;$[ha+9]=Aa.x;$[ha+10]=Aa.y;$[ha+11]=Aa.z;ha+=12}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){T=Wa[Ia].vertices[L.a].position;Z=Wa[Ia].vertices[L.b].position;P=Wa[Ia].vertices[L.c].position;Aa=Wa[Ia].vertices[L.d].position;Ka=Ta[Ia];Ka[I+0]=T.x;Ka[I+1]=T.y;Ka[I+2]=T.z;Ka[I+3]=Z.x;Ka[I+4]=Z.y;Ka[I+5]=Z.z;Ka[I+6]=P.x;Ka[I+7]=P.y;Ka[I+8]=P.z;Ka[I+9]=Aa.x;Ka[I+10]=
+Aa.y;Ka[I+11]=Aa.z}I+=12}if(Xa.length){T=Xa[L.a];Z=Xa[L.b];P=Xa[L.c];Aa=Xa[L.d];ya[F]=T.x;ya[F+1]=T.y;ya[F+2]=T.z;ya[F+3]=T.w;ya[F+4]=Z.x;ya[F+5]=Z.y;ya[F+6]=Z.z;ya[F+7]=Z.w;ya[F+8]=P.x;ya[F+9]=P.y;ya[F+10]=P.z;ya[F+11]=P.w;ya[F+12]=Aa.x;ya[F+13]=Aa.y;ya[F+14]=Aa.z;ya[F+15]=Aa.w;T=$a[L.a];Z=$a[L.b];P=$a[L.c];Aa=$a[L.d];Da[F]=T.x;Da[F+1]=T.y;Da[F+2]=T.z;Da[F+3]=T.w;Da[F+4]=Z.x;Da[F+5]=Z.y;Da[F+6]=Z.z;Da[F+7]=Z.w;Da[F+8]=P.x;Da[F+9]=P.y;Da[F+10]=P.z;Da[F+11]=P.w;Da[F+12]=Aa.x;Da[F+13]=Aa.y;Da[F+14]=
+Aa.z;Da[F+15]=Aa.w;T=Ya[L.a];Z=Ya[L.b];P=Ya[L.c];Aa=Ya[L.d];sa[F]=T.x;sa[F+1]=T.y;sa[F+2]=T.z;sa[F+3]=1;sa[F+4]=Z.x;sa[F+5]=Z.y;sa[F+6]=Z.z;sa[F+7]=1;sa[F+8]=P.x;sa[F+9]=P.y;sa[F+10]=P.z;sa[F+11]=1;sa[F+12]=Aa.x;sa[F+13]=Aa.y;sa[F+14]=Aa.z;sa[F+15]=1;T=Za[L.a];Z=Za[L.b];P=Za[L.c];Aa=Za[L.d];ua[F]=T.x;ua[F+1]=T.y;ua[F+2]=T.z;ua[F+3]=1;ua[F+4]=Z.x;ua[F+5]=Z.y;ua[F+6]=Z.z;ua[F+7]=1;ua[F+8]=P.x;ua[F+9]=P.y;ua[F+10]=P.z;ua[F+11]=1;ua[F+12]=Aa.x;ua[F+13]=Aa.y;ua[F+14]=Aa.z;ua[F+15]=1;F+=16}if(gb&&bb){if(Fa.length==
+4&&bb==THREE.VertexColors){T=Fa[0];Z=Fa[1];P=Fa[2];Fa=Fa[3]}else Fa=P=Z=T=Pa;va[Ea]=T.r;va[Ea+1]=T.g;va[Ea+2]=T.b;va[Ea+3]=Z.r;va[Ea+4]=Z.g;va[Ea+5]=Z.b;va[Ea+6]=P.r;va[Ea+7]=P.g;va[Ea+8]=P.b;va[Ea+9]=Fa.r;va[Ea+10]=Fa.g;va[Ea+11]=Fa.b;Ea+=12}if(fb&&Oa.hasTangents){Fa=Sa[L.a].tangent;Pa=Sa[L.b].tangent;T=Sa[L.c].tangent;L=Sa[L.d].tangent;ca[ra]=Fa.x;ca[ra+1]=Fa.y;ca[ra+2]=Fa.z;ca[ra+3]=Fa.w;ca[ra+4]=Pa.x;ca[ra+5]=Pa.y;ca[ra+6]=Pa.z;ca[ra+7]=Pa.w;ca[ra+8]=T.x;ca[ra+9]=T.y;ca[ra+10]=T.z;ca[ra+11]=T.w;
+ca[ra+12]=L.x;ca[ra+13]=L.y;ca[ra+14]=L.z;ca[ra+15]=L.w;ra+=16}if(eb)if(Ma.length==4&&Ua)for(L=0;L<4;L++){La=Ma[L];X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}else for(L=0;L<4;L++){X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}if(ab&&Ra)for(L=0;L<4;L++){Ma=Ra[L];ga[H]=Ma.u;ga[H+1]=Ma.v;H+=2}if(ab&&Na)for(L=0;L<4;L++){Ra=Na[L];Q[ia]=Ra.u;Q[ia+1]=Ra.v;ia+=2}if(db){Qa[W]=G;Qa[W+1]=G+1;Qa[W+2]=G+2;Qa[W+3]=G;Qa[W+4]=G+2;Qa[W+5]=G+3;W+=6;Ja[za]=G;Ja[za+1]=G+1;Ja[za+2]=G;Ja[za+3]=G+3;Ja[za+4]=G+1;Ja[za+5]=G+
+2;Ja[za+6]=G+2;Ja[za+7]=G+3;za+=8;G+=4}}}if(cb){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,$,C)}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[Ia]);e.bufferData(e.ARRAY_BUFFER,Ta[Ia],C)}}if(gb&&mb.length){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,va,C)}if(eb){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,X,C)}if(fb&&Oa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
+A.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ca,C)}if(ab&&H>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,ga,C)}if(ab&&ia>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Q,C)}if(db){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Qa,C);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ja,C)}if(F>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);
+e.bufferData(e.ARRAY_BUFFER,sa,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Da,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}}}t.__dirtyVertices=!1;t.__dirtyMorphTargets=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(q instanceof THREE.Ribbon){t=q.geometry;if(t.__dirtyVertices||
+t.__dirtyColors){q=t;D=e.DYNAMIC_DRAW;G=void 0;G=void 0;ha=void 0;A=void 0;H=q.vertices;C=q.colors;ia=H.length;S=C.length;W=q.__vertexArray;oa=q.__colorArray;pa=q.__dirtyColors;if(q.__dirtyVertices){for(G=0;G<ia;G++){ha=H[G].position;A=G*3;W[A]=ha.x;W[A+1]=ha.y;W[A+2]=ha.z}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,W,D)}if(pa){for(G=0;G<S;G++){color=C[G];A=G*3;oa[A]=color.r;oa[A+1]=color.g;oa[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+oa,D)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(q instanceof THREE.Line){t=q.geometry;if(t.__dirtyVertices||t.__dirtyColors){q=t;D=e.DYNAMIC_DRAW;G=void 0;G=void 0;ha=void 0;A=void 0;H=q.vertices;C=q.colors;ia=H.length;S=C.length;W=q.__vertexArray;oa=q.__colorArray;pa=q.__dirtyColors;if(q.__dirtyVertices){for(G=0;G<ia;G++){ha=H[G].position;A=G*3;W[A]=ha.x;W[A+1]=ha.y;W[A+2]=ha.z}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,W,D)}if(pa){for(G=0;G<S;G++){color=
+C[G];A=G*3;oa[A]=color.r;oa[A+1]=color.g;oa[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,oa,D)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(q instanceof THREE.ParticleSystem){t=q.geometry;(t.__dirtyVertices||t.__dirtyColors||q.sortParticles)&&c(t,e.DYNAMIC_DRAW,q);t.__dirtyVertices=!1;t.__dirtyColors=!1}}};this.setFaceCulling=function(k,y){if(k){!y||y=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(k=="back")e.cullFace(e.BACK);else k=="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.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,f=b.length;for(d=0;d<f;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,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.Vertex;this.v2=new THREE.Vertex;this.materials=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.Vertex;this.v2=new THREE.Vertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,m=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,w=h.length;t<w;t++){var u=new THREE.Vertex(h[t].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}t=0;for(w=k.length;t<w;t++){h=k[t];var o,v=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+
-d,h.b+d,h.c+d,h.d+d));o.centroid.copy(h.centroid);o.normal.copy(h.normal);b=0;for(g=v.length;b<g;b++){u=v[b];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();j.push(o)}t=0;for(w=e.length;t<w;t++){d=e[t];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
-c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(t in N.objects)if(!I.objects[t]){B=N.objects[t];if(y=I.geometries[B.geometry]){Y=[];for(i=0;i<B.materials.length;i++)Y[i]=I.materials[B.materials[i]];F=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(y,Y);object.position.set(F[0],
-F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;I.scene.addObject(object);I.objects[t]=object}}}function h(ca){return function(za){I.geometries[ca]=za;g();X-=1;j()}}function j(){d({total_models:da,total_textures:ga,loaded_models:da-X,loaded_textures:ga-R},I);X==0&&R==0&&b(I)}var k,m,t,w,u,o,v,B,F,x,G,y,L,J,Y,N,f,X,R,da,ga,I;N=e.data;f=new THREE.Loader;R=X=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
-lights:{},fogs:{}};e=function(){R-=1;j()};for(u in N.cameras){x=N.cameras[u];if(x.type=="perspective")L=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho"){L=new THREE.Camera;L.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far)}F=x.position;x=x.target;L.position.set(F[0],F[1],F[2]);L.target.position.set(x[0],x[1],x[2]);I.cameras[u]=L}for(w in N.lights){u=N.lights[w];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],
-F[1],F[2]);light.position.normalize()}else if(u.type=="point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}x=u.color;i=u.intensity||1;light.color.setRGB(x[0]*i,x[1]*i,x[2]*i);I.scene.addLight(light);I.lights[w]=light}for(o in N.fogs){w=N.fogs[o];if(w.type=="linear")J=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(J=new THREE.FogExp2(0,w.density));x=w.color;J.color.setRGB(x[0],x[1],x[2]);I.fogs[o]=J}if(I.cameras&&N.defaults.camera)I.currentCamera=I.cameras[N.defaults.camera];
-if(I.fogs&&N.defaults.fog)I.scene.fog=I.fogs[N.defaults.fog];x=N.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(x[0],x[1],x[2]);I.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries){o=N.geometries[k];if(o.type=="bin_mesh"||o.type=="ascii_mesh")X+=1}da=X;for(k in N.geometries){o=N.geometries[k];if(o.type=="cube"){y=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);I.geometries[k]=y}else if(o.type=="plane"){y=new Plane(o.width,
-o.height,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=y}else if(o.type=="sphere"){y=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=y}else if(o.type=="cylinder"){y=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);I.geometries[k]=y}else if(o.type=="torus"){y=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);I.geometries[k]=y}else if(o.type=="icosahedron"){y=new Icosahedron(o.subdivisions);I.geometries[k]=y}else if(o.type=="bin_mesh")f.loadBinary({model:o.url,
-callback:h(k)});else o.type=="ascii_mesh"&&f.loadAscii({model:o.url,callback:h(k)})}for(v in N.textures){k=N.textures[v];R+=k.url instanceof Array?k.url.length:1}ga=R;for(v in N.textures){k=N.textures[v];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)o=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{o=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)o.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)o.magFilter=
-THREE[k.magFilter]}I.textures[v]=o}for(m in N.materials){v=N.materials[m];for(G in v.parameters)if(G=="envMap"||G=="map"||G=="lightMap")v.parameters[G]=I.textures[v.parameters[G]];else if(G=="shading")v.parameters[G]=v.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")v.parameters[G]=THREE[v.parameters[G]]?THREE[v.parameters[G]]:THREE.NormalBlending;else G=="combine"&&(v.parameters[G]=v.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);v=new THREE[v.type](v.parameters);
-I.materials[m]=v}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,m=a.faces,j=f.faces,n=a.uvs;f=f.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,v=h.length;p<v;p++){var u=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}p=0;for(v=j.length;p<v;p++){h=j[p];var o,x=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+
+d,h.b+d,h.c+d,h.d+d));o.centroid.copy(h.centroid);o.normal.copy(h.normal);b=0;for(g=x.length;b<g;b++){u=x[b];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();m.push(o)}p=0;for(v=f.length;p<v;p++){d=f[p];m=[];b=0;for(g=d.length;b<g;b++)m.push(new THREE.UV(d[b].u,d[b].v));n.push(m)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,
+c);c=f.loadCount=0;for(d=a.length;c<d;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(p in O.objects)if(!K.objects[p]){B=O.objects[p];if(J=K.geometries[B.geometry]){da=[];for(i=0;i<B.materials.length;i++)da[i]=K.materials[B.materials[i]];E=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(J,da);object.position.set(E[0],
+E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;K.scene.addObject(object);K.objects[p]=object}}}function h(ea){return function(Ha){K.geometries[ea]=Ha;g();Y-=1;m()}}function m(){d({total_models:ma,total_textures:ka,loaded_models:ma-Y,loaded_textures:ka-V},K);Y==0&&V==0&&b(K)}var j,n,p,v,u,o,x,B,E,w,M,J,N,R,da,O,e,Y,V,ma,ka,K;O=f.data;e=new THREE.Loader;V=Y=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};f=function(){V-=1;m()};for(u in O.cameras){w=O.cameras[u];if(w.type=="perspective")N=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}E=w.position;w=w.target;N.position.set(E[0],E[1],E[2]);N.target.position.set(w[0],w[1],w[2]);K.cameras[u]=N}for(v in O.lights){u=O.lights[v];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
+E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}w=u.color;i=u.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);K.scene.addLight(light);K.lights[v]=light}for(o in O.fogs){v=O.fogs[o];if(v.type=="linear")R=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(R=new THREE.FogExp2(0,v.density));w=v.color;R.color.setRGB(w[0],w[1],w[2]);K.fogs[o]=R}if(K.cameras&&O.defaults.camera)K.currentCamera=K.cameras[O.defaults.camera];
+if(K.fogs&&O.defaults.fog)K.scene.fog=K.fogs[O.defaults.fog];w=O.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(w[0],w[1],w[2]);K.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){o=O.geometries[j];if(o.type=="bin_mesh"||o.type=="ascii_mesh")Y+=1}ma=Y;for(j in O.geometries){o=O.geometries[j];if(o.type=="cube"){J=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);K.geometries[j]=J}else if(o.type=="plane"){J=new Plane(o.width,
+o.height,o.segmentsWidth,o.segmentsHeight);K.geometries[j]=J}else if(o.type=="sphere"){J=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);K.geometries[j]=J}else if(o.type=="cylinder"){J=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);K.geometries[j]=J}else if(o.type=="torus"){J=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);K.geometries[j]=J}else if(o.type=="icosahedron"){J=new Icosahedron(o.subdivisions);K.geometries[j]=J}else if(o.type=="bin_mesh")e.loadBinary({model:o.url,
+callback:h(j)});else o.type=="ascii_mesh"&&e.loadAscii({model:o.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];V+=j.url instanceof Array?j.url.length:1}ka=V;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)o=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{o=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)o.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)o.magFilter=
+THREE[j.magFilter]}K.textures[x]=o}for(n in O.materials){x=O.materials[n];for(M in x.parameters)if(M=="envMap"||M=="map"||M=="lightMap")x.parameters[M]=K.textures[x.parameters[M]];else if(M=="shading")x.parameters[M]=x.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")x.parameters[M]=THREE[x.parameters[M]]?THREE[x.parameters[M]]:THREE.NormalBlending;else M=="combine"&&(x.parameters[M]=x.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);
+K.materials[n]=x}g();c(K)}},addMesh:function(a,c,b,d,f,g,h,m,j,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=m;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
 return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
 return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
-a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
-SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},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",
+a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
+SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;for(d=0;d<f;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},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}",
 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}"},
 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},
 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},
@@ -314,8 +318,8 @@ 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}"},
 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}"},
 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}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
+THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 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=
@@ -323,76 +327,54 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(m,t,w,u){var o={name:w,fps:0.6,length:u,hierarchy:[]},v,B=t.getControlPointsArray(),F=t.getLength(),x=B.length,G=0;v=x-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[v]={time:u,pos:B[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v<x-1;v++){G=u*F.chunks[v]/F.total;t.keys[v]={time:G,pos:B[v]}}o.hierarchy[0]=t;THREE.AnimationHandler.add(o);return new THREE.Animation(m,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var w,
-u,o=new THREE.Geometry;for(w=0;w<m.points.length*t;w++){u=w/(m.points.length*t);u=m.getPoint(u);o.vertices[w]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(m,t){var w=b(t,10),u=b(t,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);u=new Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){w=new THREE.Mesh(u,o);w.position.copy(t.points[i]);w.updateMatrix();m.addChild(w)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
+THREE.PathCamera=function(a){function c(n,p,v,u){var o={name:v,fps:0.6,length:u,hierarchy:[]},x,B=p.getControlPointsArray(),E=p.getLength(),w=B.length,M=0;x=w-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[x]={time:u,pos:B[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<w-1;x++){M=u*E.chunks[x]/E.total;p.keys[x]={time:M,pos:B[x]}}o.hierarchy[0]=p;THREE.AnimationHandler.add(o);return new THREE.Animation(n,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var v,
+u,o=new THREE.Geometry;for(v=0;v<n.points.length*p;v++){u=v/(n.points.length*p);u=n.getPoint(u);o.vertices[v]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(n,p){var v=b(p,10),u=b(p,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(v,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);u=new Sphere(1,
+16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){v=new THREE.Mesh(u,o);v.position.copy(p.points[i]);v.updateMatrix();n.addChild(v)}}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;
 !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=
 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 e=Math.PI*2,g=Math.PI/180;this.update=function(m,t,w){var u,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,t,w)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(a,c,b,d,e,g,h,j,k){function m(F,x,G,y,L,J,Y,N){var f,X,R=d||1,da=e||1,ga=L/2,I=J/2,ca=t.vertices.length;if(F=="x"&&x=="y"||F=="y"&&x=="x")f="z";else if(F=="x"&&x=="z"||F=="z"&&x=="x"){f="y";da=g||1}else if(F=="z"&&x=="y"||F=="y"&&x=="z"){f="x";R=g||1}var za=R+1,ea=da+1;L/=R;var xa=J/da;for(X=0;X<ea;X++)for(J=0;J<za;J++){var ja=new THREE.Vector3;ja[F]=(J*L-ga)*G;ja[x]=(X*xa-I)*y;ja[f]=Y;t.vertices.push(new THREE.Vertex(ja))}for(X=0;X<da;X++)for(J=0;J<R;J++){t.faces.push(new THREE.Face4(J+
-za*X+ca,J+za*(X+1)+ca,J+1+za*(X+1)+ca,J+1+za*X+ca,null,N));t.uvs.push([new THREE.UV(J/R,X/da),new THREE.UV(J/R,(X+1)/da),new THREE.UV((J+1)/R,(X+1)/da),new THREE.UV((J+1)/R,X/da)])}}THREE.Geometry.call(this);var t=this,w=a/2,u=c/2,o=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var B in k)this.sides[B]!=undefined&&(this.sides[B]=
-k[B]);this.sides.px&&m("z","y",1*j,-1,b,c,-w,this.materials[0]);this.sides.nx&&m("z","y",-1*j,-1,b,c,w,this.materials[1]);this.sides.py&&m("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&m("x","z",1*j,-1,a,b,-u,this.materials[3]);this.sides.pz&&m("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&m("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var F=[],x=[],G=0,y=t.vertices.length;G<y;G++){for(var L=t.vertices[G],J=!1,Y=0,N=F.length;Y<N;Y++){var f=F[Y];if(L.position.x==f.position.x&&
-L.position.y==f.position.y&&L.position.z==f.position.z){x[G]=Y;J=!0;break}}if(!J){x[G]=F.length;F.push(new THREE.Vertex(L.position.clone()))}}G=0;for(y=t.faces.length;G<y;G++){L=t.faces[G];L.a=x[L.a];L.b=x[L.b];L.c=x[L.c];L.d=x[L.d]}t.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d,e,g){function h(t,w,u){j.vertices.push(new THREE.Vertex(new THREE.Vector3(t,w,u)))}THREE.Geometry.call(this);var j=this,k=Math.PI,m=d/2;for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*c,Math.cos(2*k*d/a)*c,-m);for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*b,Math.cos(2*k*d/a)*b,m);for(d=0;d<a;d++)j.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-m-(g||0));for(d=a;d<a+a/2;d++)j.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,m+(e||0));
-for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(w,u,o){var v=Math.sqrt(w*w+u*u+o*o);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(w/v,u/v,o/v)))-1}function b(w,u,o,v){v.faces.push(new THREE.Face3(w,u,o))}function d(w,u){var o=e.vertices[w].position,v=e.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
-1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),m=d(g.faces[j].b,g.faces[j].c),t=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,t,h);b(g.faces[j].b,m,k,h);b(g.faces[j].c,
-t,m,h);b(k,m,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.001;m+=c){for(j=0;j<d.length;j++)if(m<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;m==0&&(h=e);for(j=
-0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(m/b,j/a.length),new THREE.UV(m/b,(j+1)/a.length),new THREE.UV((m-c)/b,(j+1)/a.length),new THREE.UV((m-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var m=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,p,v){var u,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;u=this.phi%f;this.phi=u>=0?u:u+f;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,v)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),m=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(m,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+var Cube=function(a,c,b,d,f,g,h,m,j){function n(E,w,M,J,N,R,da,O){var e,Y,V=d||1,ma=f||1,ka=N/2,K=R/2,ea=p.vertices.length;if(E=="x"&&w=="y"||E=="y"&&w=="x")e="z";else if(E=="x"&&w=="z"||E=="z"&&w=="x"){e="y";ma=g||1}else if(E=="z"&&w=="y"||E=="y"&&w=="z"){e="x";V=g||1}var Ha=V+1,fa=ma+1;N/=V;var Ca=R/ma;for(Y=0;Y<fa;Y++)for(R=0;R<Ha;R++){var na=new THREE.Vector3;na[E]=(R*N-ka)*M;na[w]=(Y*Ca-K)*J;na[e]=da;p.vertices.push(new THREE.Vertex(na))}for(Y=0;Y<ma;Y++)for(R=0;R<V;R++){p.faces.push(new THREE.Face4(R+
+Ha*Y+ea,R+Ha*(Y+1)+ea,R+1+Ha*(Y+1)+ea,R+1+Ha*Y+ea,null,null,O));p.faceVertexUvs.push([new THREE.UV(R/V,Y/ma),new THREE.UV(R/V,(Y+1)/ma),new THREE.UV((R+1)/V,(Y+1)/ma),new THREE.UV((R+1)/V,Y/ma)])}}THREE.Geometry.call(this);var p=this,v=a/2,u=c/2,o=b/2;m=m?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=
+undefined&&(this.sides[B]=j[B]);this.sides.px&&n("z","y",1*m,-1,b,c,-v,this.materials[0]);this.sides.nx&&n("z","y",-1*m,-1,b,c,v,this.materials[1]);this.sides.py&&n("x","z",1*m,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*m,-1,a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*m,-1,a,c,o,this.materials[4]);this.sides.nz&&n("x","y",-1*m,-1,a,c,-o,this.materials[5]);(function(){for(var E=[],w=[],M=0,J=p.vertices.length;M<J;M++){for(var N=p.vertices[M],R=!1,da=0,O=E.length;da<O;da++){var e=
+E[da];if(N.position.x==e.position.x&&N.position.y==e.position.y&&N.position.z==e.position.z){w[M]=da;R=!0;break}}if(!R){w[M]=E.length;E.push(new THREE.Vertex(N.position.clone()))}}M=0;for(J=p.faces.length;M<J;M++){N=p.faces[M];N.a=w[N.a];N.b=w[N.b];N.c=w[N.c];N.d=w[N.d]}p.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,d,f,g){function h(p,v,u){m.vertices.push(new THREE.Vertex(new THREE.Vector3(p,v,u)))}THREE.Geometry.call(this);var m=this,j=Math.PI,n=d/2;for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-n);for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,n);for(d=0;d<a;d++)m.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-n-(g||0));for(d=a;d<a+a/2;d++)m.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
+for(d=a+a/2;d<2*a;d++)m.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(a){function c(v,u,o){var x=Math.sqrt(v*v+u*u+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(v/x,u/x,o/x)))-1}function b(v,u,o,x){x.faces.push(new THREE.Face3(v,u,o))}function d(v,u){var o=f.vertices[v].position,x=f.vertices[u].position;return c((o.x+x.x)/2,(o.y+x.y)/2,(o.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var m in g.faces){var j=d(g.faces[m].a,g.faces[m].b),n=d(g.faces[m].b,g.faces[m].c),p=d(g.faces[m].c,g.faces[m].a);b(g.faces[m].a,j,p,h);b(g.faces[m].b,n,j,h);b(g.faces[m].c,
+p,n,h);b(j,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],f=[],g=[],h=[],m=0;m<a.length;m++){this.vertices.push(new THREE.Vertex(a[m]));d[m]=a[m].clone();f[m]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<d.length;m++)if(n<this.angle){d[m]=j.multiplyVector3(d[m].clone());this.vertices.push(new THREE.Vertex(d[m]));g[m]=this.vertices.length-1}else g=h;n==0&&(h=f);for(m=
+0;m<f.length-1;m++){this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m]));this.uvs.push([new THREE.UV(n/b,m/a.length),new THREE.UV(n/b,(m+1)/a.length),new THREE.UV((n-c)/b,(m+1)/a.length),new THREE.UV((n-c)/b,m/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var m=b+1,j=d+1;a/=b;var n=c/d;for(f=0;f<j;f++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<d;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+m*f,c+m*(f+1),c+1+m*(f+1),c+1+m*f));this.faceVertexUvs.push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),m=[],t=0;for(d=0;d<g;d++){var w=2*d/g,u=k*Math.sin(w*e);w=k*Math.cos(w*e);(b==0||b==h)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,j,u)))-1);m.push(t)}c.push(m)}var o,v,B;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];j=c[b][m?g-1:d];k=c[b-1][m?g-1:d];m=c[b-1][m?
-0:d+1];u=b/(e-1);o=(b-1)/(e-1);v=(d+1)/g;w=d/g;t=new THREE.UV(1-v,u);u=new THREE.UV(1-w,u);w=new THREE.UV(1-w,o);var F=new THREE.UV(1-v,o);if(b<c.length-1){o=this.vertices[h].position.clone();v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();o.normalize();v.normalize();B.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([t,u,w])}if(b>1){o=this.vertices[h].position.clone();
-v=this.vertices[k].position.clone();B=this.vertices[m].position.clone();o.normalize();v.normalize();B.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([t,w,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
-var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,d,e,g,h){function j(w,u,o,v,B,F){u=o/v*w;o=Math.cos(u);return new THREE.Vector3(B*(2+o)*0.5*Math.cos(w),B*(2+o)*Math.sin(w)*0.5,F*B*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
-a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,this.p,this.radius,this.heightScale);k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;d.x=k.x+e.x;d.y=k.y+e.y;d.z=k.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();k=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*d.x+h*g.x;e.y+=k*d.y+h*g.y;e.z+=k*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
-0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.uvs.push([h,k,m]);this.faces.push(new THREE.Face3(g,d,b));this.uvs.push([t,m,k])}this.computeCentroids();
-this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var m=a*Math.cos(d*f),j=a*Math.sin(d*f),n=[],p=0;for(d=0;d<g;d++){var v=2*d/g,u=j*Math.sin(v*f);v=j*Math.cos(v*f);(b==0||b==h)&&d>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,u)))-1);n.push(p)}c.push(n)}var o,x,B;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];m=c[b][n?g-1:d];j=c[b-1][n?g-1:d];n=c[b-1][n?
+0:d+1];u=b/(f-1);o=(b-1)/(f-1);x=(d+1)/g;v=d/g;p=new THREE.UV(1-x,u);u=new THREE.UV(1-v,u);v=new THREE.UV(1-v,o);var E=new THREE.UV(1-x,o);if(b<c.length-1){o=this.vertices[h].position.clone();x=this.vertices[m].position.clone();B=this.vertices[j].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,m,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,u,v])}if(b>1){o=this.vertices[h].position.clone();
+x=this.vertices[j].position.clone();B=this.vertices[n].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,j,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,v,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
+1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([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]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,c,b,d,f,g,h){function m(v,u,o,x,B,E){u=o/x*v;o=Math.cos(u);return new THREE.Vector3(B*(2+o)*0.5*Math.cos(v),B*(2+o)*Math.sin(v)*0.5,E*B*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var j=
+a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=m(j,h,this.q,this.p,this.radius,this.heightScale);j=m(j+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=j.x-f.x;b.y=j.y-f.y;b.z=j.z-f.z;d.x=j.x+f.x;d.y=j.y+f.y;d.z=j.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();j=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=j*d.x+h*g.x;f.y+=j*d.y+h*g.y;f.z+=j*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,d));this.uvs.push([h,j,n]);this.faces.push(new THREE.Face3(g,d,b));this.uvs.push([p,n,j])}this.computeCentroids();
+this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(){this.statusDomElement=(this.showStatus=showStatus)?this.addStatusElement():null};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
-c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.Loader.prototype.createModel(e.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:
-THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
-h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,c,b,d){var e=function(g){function h(p,n){var q=t(p,n),C=t(p,n+1),A=t(p,n+2),D=t(p,n+3),P=(D<<1&255|A>>7)-127;q|=(A&127)<<16|C<<8;if(q==0&&P==-127)return 0;return(1-2*(D>>7))*(1+q*Math.pow(2,-23))*Math.pow(2,P)}function j(p,n){var q=t(p,n),C=t(p,n+1),A=t(p,n+2);return(t(p,n+3)<<24)+(A<<16)+(C<<8)+q}function k(p,n){var q=t(p,n);return(t(p,n+1)<<8)+q}function m(p,n){var q=t(p,n);return q>127?q-256:q}function t(p,n){return p.charCodeAt(n)&255}function w(p){var n,q,C;n=j(a,p);
-q=j(a,p+Y);C=j(a,p+N);p=k(a,p+f);THREE.Loader.prototype.f3(x,n,q,C,p)}function u(p){var n,q,C,A,D,P;n=j(a,p);q=j(a,p+Y);C=j(a,p+N);A=k(a,p+f);D=j(a,p+X);P=j(a,p+R);p=j(a,p+da);THREE.Loader.prototype.f3n(x,L,n,q,C,A,D,P,p)}function o(p){var n,q,C,A;n=j(a,p);q=j(a,p+ga);C=j(a,p+I);A=j(a,p+ca);p=k(a,p+za);THREE.Loader.prototype.f4(x,n,q,C,A,p)}function v(p){var n,q,C,A,D,P,U,E;n=j(a,p);q=j(a,p+ga);C=j(a,p+I);A=j(a,p+ca);D=k(a,p+za);P=j(a,p+ea);U=j(a,p+xa);E=j(a,p+ja);p=j(a,p+ha);THREE.Loader.prototype.f4n(x,
-L,n,q,C,A,D,P,U,E,p)}function B(p){var n,q;n=j(a,p);q=j(a,p+va);p=j(a,p+Aa);THREE.Loader.prototype.uv3(x.uvs,J[n*2],J[n*2+1],J[q*2],J[q*2+1],J[p*2],J[p*2+1])}function F(p){var n,q,C;n=j(a,p);q=j(a,p+ia);C=j(a,p+aa);p=j(a,p+qa);THREE.Loader.prototype.uv4(x.uvs,J[n*2],J[n*2+1],J[q*2],J[q*2+1],J[C*2],J[C*2+1],J[p*2],J[p*2+1])}var x=this,G=0,y,L=[],J=[],Y,N,f,X,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,aa,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,g);y={signature:a.substr(G,
-8),header_bytes:t(a,G+8),vertex_coordinate_bytes:t(a,G+9),normal_coordinate_bytes:t(a,G+10),uv_coordinate_bytes:t(a,G+11),vertex_index_bytes:t(a,G+12),normal_index_bytes:t(a,G+13),uv_index_bytes:t(a,G+14),material_index_bytes:t(a,G+15),nvertices:j(a,G+16),nnormals:j(a,G+16+4),nuvs:j(a,G+16+8),ntri_flat:j(a,G+16+12),ntri_smooth:j(a,G+16+16),ntri_flat_uv:j(a,G+16+20),ntri_smooth_uv:j(a,G+16+24),nquad_flat:j(a,G+16+28),nquad_smooth:j(a,G+16+32),nquad_flat_uv:j(a,G+16+36),nquad_smooth_uv:j(a,G+16+40)};
-G+=y.header_bytes;Y=y.vertex_index_bytes;N=y.vertex_index_bytes*2;f=y.vertex_index_bytes*3;X=y.vertex_index_bytes*3+y.material_index_bytes;R=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;da=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;ga=y.vertex_index_bytes;I=y.vertex_index_bytes*2;ca=y.vertex_index_bytes*3;za=y.vertex_index_bytes*4;ea=y.vertex_index_bytes*4+y.material_index_bytes;xa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;ja=
-y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;ha=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;va=y.uv_index_bytes;Aa=y.uv_index_bytes*2;ia=y.uv_index_bytes;aa=y.uv_index_bytes*2;qa=y.uv_index_bytes*3;g=y.vertex_index_bytes*3+y.material_index_bytes;z=y.vertex_index_bytes*4+y.material_index_bytes;ra=y.ntri_flat*g;Q=y.ntri_smooth*(g+y.normal_index_bytes*3);ma=y.ntri_flat_uv*(g+y.uv_index_bytes*3);ta=y.ntri_smooth_uv*(g+y.normal_index_bytes*3+y.uv_index_bytes*
-3);l=y.nquad_flat*z;g=y.nquad_smooth*(z+y.normal_index_bytes*4);z=y.nquad_flat_uv*(z+y.uv_index_bytes*4);G+=function(p){for(var n,q,C,A=y.vertex_coordinate_bytes*3,D=p+y.nvertices*A;p<D;p+=A){n=h(a,p);q=h(a,p+y.vertex_coordinate_bytes);C=h(a,p+y.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(x,n,q,C)}return y.nvertices*A}(G);G+=function(p){for(var n,q,C,A=y.normal_coordinate_bytes*3,D=p+y.nnormals*A;p<D;p+=A){n=m(a,p);q=m(a,p+y.normal_coordinate_bytes);C=m(a,p+y.normal_coordinate_bytes*2);L.push(n/
-127,q/127,C/127)}return y.nnormals*A}(G);G+=function(p){for(var n,q,C=y.uv_coordinate_bytes*2,A=p+y.nuvs*C;p<A;p+=C){n=h(a,p);q=h(a,p+y.uv_coordinate_bytes);J.push(n,q)}return y.nuvs*C}(G);ra=G+ra;Q=ra+Q;ma=Q+ma;ta=ma+ta;l=ta+l;g=l+g;z=g+z;(function(p){var n,q=y.vertex_index_bytes*3+y.material_index_bytes,C=q+y.uv_index_bytes*3,A=p+y.ntri_flat_uv*C;for(n=p;n<A;n+=C){w(n);B(n+q)}return A-p})(Q);(function(p){var n,q=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,C=q+y.uv_index_bytes*
-3,A=p+y.ntri_smooth_uv*C;for(n=p;n<A;n+=C){u(n);B(n+q)}return A-p})(ma);(function(p){var n,q=y.vertex_index_bytes*4+y.material_index_bytes,C=q+y.uv_index_bytes*4,A=p+y.nquad_flat_uv*C;for(n=p;n<A;n+=C){o(n);F(n+q)}return A-p})(g);(function(p){var n,q=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,C=q+y.uv_index_bytes*4,A=p+y.nquad_smooth_uv*C;for(n=p;n<A;n+=C){v(n);F(n+q)}return A-p})(z);(function(p){var n,q=y.vertex_index_bytes*3+y.material_index_bytes,C=p+y.ntri_flat*q;for(n=
-p;n<C;n+=q)w(n);return C-p})(G);(function(p){var n,q=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,C=p+y.ntri_smooth*q;for(n=p;n<C;n+=q)u(n);return C-p})(ra);(function(p){var n,q=y.vertex_index_bytes*4+y.material_index_bytes,C=p+y.nquad_flat*q;for(n=p;n<C;n+=q)o(n);return C-p})(ta);(function(p){var n,q=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,C=p+y.nquad_smooth*q;for(n=p;n<C;n+=q)v(n);return C-p})(l);this.computeCentroids();this.computeFaceNormals()};
-e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,m,t,w;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];m=a.vertices[h+1];t=a.vertices[h+2];THREE.Loader.prototype.v(g,k,m,t)}if(a.morphTargets!==undefined){h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=
-[];w=g.morphTargets[h].vertices;t=a.morphTargets[h].vertices;k=0;for(m=t.length;k<m;k+=3)w.push(new THREE.Vertex(new THREE.Vector3(t[k],t[k+1],t[k+2])))}}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];m=a.colors[h+1];t=a.colors[h+2];THREE.Loader.prototype.vc(g,k,m,t)}}})();(function(){function h(v,B){THREE.Loader.prototype.f3(g,v[B],v[B+1],v[B+2],v[B+3])}function j(v,B){THREE.Loader.prototype.f3n(g,a.normals,v[B],v[B+1],v[B+2],v[B+3],v[B+4],v[B+5],v[B+6])}function k(v,B){THREE.Loader.prototype.f4(g,
-v[B],v[B+1],v[B+2],v[B+3],v[B+4])}function m(v,B){THREE.Loader.prototype.f4n(g,a.normals,v[B],v[B+1],v[B+2],v[B+3],v[B+4],v[B+5],v[B+6],v[B+7],v[B+8])}function t(v,B){var F,x,G,y,L,J,Y,N,f;F=v[B];x=v[B+1];G=v[B+2];y=a.uvs[F*2];Y=a.uvs[F*2+1];L=a.uvs[x*2];N=a.uvs[x*2+1];J=a.uvs[G*2];f=a.uvs[G*2+1];THREE.Loader.prototype.uv3(g.uvs,y,Y,L,N,J,f);if(a.uvs2&&a.uvs2.length){y=a.uvs2[F*2];Y=a.uvs2[F*2+1];L=a.uvs2[x*2];N=a.uvs2[x*2+1];J=a.uvs2[G*2];f=a.uvs2[G*2+1];THREE.Loader.prototype.uv3(g.uvs2,y,1-Y,L,
-1-N,J,1-f)}}function w(v,B){var F,x,G,y,L,J,Y,N,f,X,R,da;F=v[B];x=v[B+1];G=v[B+2];y=v[B+3];L=a.uvs[F*2];f=a.uvs[F*2+1];J=a.uvs[x*2];X=a.uvs[x*2+1];Y=a.uvs[G*2];R=a.uvs[G*2+1];N=a.uvs[y*2];da=a.uvs[y*2+1];THREE.Loader.prototype.uv4(g.uvs,L,f,J,X,Y,R,N,da);if(a.uvs2){L=a.uvs2[F*2];f=a.uvs2[F*2+1];J=a.uvs2[x*2];X=a.uvs2[x*2+1];Y=a.uvs2[G*2];R=a.uvs2[G*2+1];N=a.uvs2[y*2];da=a.uvs2[y*2+1];THREE.Loader.prototype.uv4(g.uvs2,L,1-f,J,1-X,Y,1-R,N,1-da)}}var u,o;u=0;for(o=a.trianglesUvs.length;u<o;u+=7){h(a.trianglesUvs,
-u);t(a.trianglesUvs,u+4)}u=0;for(o=a.trianglesNormalsUvs.length;u<o;u+=10){j(a.trianglesNormalsUvs,u);t(a.trianglesNormalsUvs,u+7)}u=0;for(o=a.quadsUvs.length;u<o;u+=9){k(a.quadsUvs,u);w(a.quadsUvs,u+5)}u=0;for(o=a.quadsNormalsUvs.length;u<o;u+=13){m(a.quadsNormalsUvs,u);w(a.quadsNormalsUvs,u+9)}u=0;for(o=a.triangles.length;u<o;u+=4)h(a.triangles,u);u=0;for(o=a.trianglesNormals.length;u<o;u+=7)j(a.trianglesNormals,u);u=0;for(o=a.quads.length;u<o;u+=5)k(a.quads,u);u=0;for(o=a.quadsNormals.length;u<
-o;u+=9)m(a.quadsNormals,u)})();(function(){var h,j,k,m;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,m,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,k,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;
-d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,
-c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var m=c[j*3],t=c[j*3+1];j=c[j*3+2];var w=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,t,j),new THREE.Vector3(w,u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,m,t){h=a.materials[h];var w=c[k*3],u=c[k*3+1];k=c[k*3+2];var o=c[m*3],v=c[m*3+1];m=c[m*3+2];var B=c[t*3],F=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,
-d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(w,u,k),new THREE.Vector3(o,v,m),new THREE.Vector3(B,F,t)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));m.push(new THREE.UV(j,k));a.push(m)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=
-[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));j.image.width=t;j.image.height=w;j.image.getContext("2d").drawImage(this,0,0,t,w)}else j.image=this;j.needsUpdate=!0};m.src=k}var e,g,h;e="MeshLambertMaterial";
-g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");
-g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(m){m=Math.log(m)/Math.LN2;return Math.floor(m)==m}function d(m,j){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
+m.image.width=p;m.image.height=v;m.image.getContext("2d").drawImage(this,0,0,p,v)}else m.image=this;m.needsUpdate=!0};n.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
+255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,m,t,w){h=(h-t)/(w-t);t=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=m;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,m,t,w){h=(h-t)/(w-t);t=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
-2]=m;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,m,t,w){h=(h-t)/(w-t);t=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=m+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,m=g+this.yd,t=g+this.zd,w=k+this.yd,u=k+this.zd,o=g+this.yd+this.zd,v=k+this.yd+this.zd,B=0,F=this.field[g],x=this.field[k],G=this.field[m],y=this.field[w],L=this.field[t],J=this.field[u],Y=this.field[o],N=this.field[v];F<h&&(B|=1);x<h&&(B|=2);G<h&&(B|=8);y<h&&(B|=4);L<h&&(B|=16);J<h&&(B|=32);Y<h&&(B|=128);N<h&&(B|=64);var f=THREE.edgeTable[B];if(f==0)return 0;
-var X=this.delta,R=b+X,da=d+X;X=e+X;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,F,x)}if(f&2){this.compNorm(k);this.compNorm(w);this.VIntY(k*3,this.vlist,this.nlist,3,h,R,d,e,x,y)}if(f&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,da,e,G,y)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,F,G)}if(f&16){this.compNorm(t);this.compNorm(u);this.VIntX(t*3,this.vlist,this.nlist,12,h,b,d,
-X,L,J)}if(f&32){this.compNorm(u);this.compNorm(v);this.VIntY(u*3,this.vlist,this.nlist,15,h,R,d,X,J,N)}if(f&64){this.compNorm(o);this.compNorm(v);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,da,X,Y,N)}if(f&128){this.compNorm(t);this.compNorm(o);this.VIntY(t*3,this.vlist,this.nlist,21,h,b,d,X,L,Y)}if(f&256){this.compNorm(g);this.compNorm(t);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,F,L)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,R,d,e,x,J)}if(f&1024){this.compNorm(w);
-this.compNorm(v);this.VIntZ(w*3,this.vlist,this.nlist,30,h,R,da,e,y,N)}if(f&2048){this.compNorm(m);this.compNorm(o);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,da,e,G,Y)}B<<=4;for(h=g=0;THREE.triTable[B+h]!=-1;){b=B+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
-3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,m=d*this.size,t=b*this.size,w=Math.floor(k-j);w<1&&(w=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(t-j);o<1&&(o=1);j=Math.floor(t+j);
-j>this.size-1&&(j=this.size-1);for(var v,B,F,x,G,y;w<k;w++){t=this.size2*w;B=w/this.size-e;G=B*B;for(B=u;B<m;B++){F=t+this.size*B;v=B/this.size-d;y=v*v;for(v=o;v<j;v++){x=v/this.size-b;x=g/(1.0E-6+x*x+y+G)-h;x>0&&(this.field[F+v]+=x)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,t=this.yd,w=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(e=0;e<o;e++){g=e/m;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<m;g++){k=e+g*t;for(h=0;h<m;h++)u[w*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
-h,j,k,m,t=this.size,w=this.yd,u=this.zd,o=this.field,v=t*Math.sqrt(b/d);v>t&&(v=t);for(g=0;g<v;g++){e=g/t;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*w;for(e=0;e<t;e++){m=k+e;for(h=0;h<t;h++)o[u*h+m]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){m=k+g*yd;for(e=0;e<size;e++)field[m+e]+=j}}}};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 d,e,g,h,j,k,m,t,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){t=w+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(j,k,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,m,t,w,u;for(g=
-0;g<e.count;g++){m=g*3;w=m+1;u=m+2;h=e.positionArray[m];j=e.positionArray[w];k=e.positionArray[u];t=new THREE.Vector3(h,j,k);h=e.normalArray[m];j=e.normalArray[w];k=e.normalArray[u];m=new THREE.Vector3(h,j,k);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;w=m+1;u=m+2;t=d.vertices[m].normal;h=d.vertices[w].normal;j=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[t,h,j]);d.faces.push(m)}b+=nfaces;e.count=0});return d};this.init(a)};
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,f){return b+(d-b)*f};this.VIntX=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m+h*this.delta;d[g+1]=j;d[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m;d[g+1]=j+h*this.delta;d[g+
+2]=n;d=b+this.yd*3;f[g]=this.lerp(p[b],p[d],h);f[g+1]=this.lerp(p[b+1],p[d+1],h);f[g+2]=this.lerp(p[b+2],p[d+2],h)};this.VIntZ=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m;d[g+1]=j;d[g+2]=n+h*this.delta;d=b+this.zd*3;f[g]=this.lerp(p[b],p[d],h);f[g+1]=this.lerp(p[b+1],p[d+1],h);f[g+2]=this.lerp(p[b+2],p[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,f,g,h,m){var j=g+1,n=g+this.yd,p=g+this.zd,v=j+this.yd,u=j+this.zd,o=g+this.yd+this.zd,x=j+this.yd+this.zd,B=0,E=this.field[g],w=this.field[j],M=this.field[n],J=this.field[v],N=this.field[p],R=this.field[u],da=this.field[o],O=this.field[x];E<h&&(B|=1);w<h&&(B|=2);M<h&&(B|=8);J<h&&(B|=4);N<h&&(B|=16);R<h&&(B|=32);da<h&&(B|=128);O<h&&(B|=64);var e=THREE.edgeTable[B];if(e==0)return 0;
+var Y=this.delta,V=b+Y,ma=d+Y;Y=f+Y;if(e&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,f,E,w)}if(e&2){this.compNorm(j);this.compNorm(v);this.VIntY(j*3,this.vlist,this.nlist,3,h,V,d,f,w,J)}if(e&4){this.compNorm(n);this.compNorm(v);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,ma,f,M,J)}if(e&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,f,E,M)}if(e&16){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,d,
+Y,N,R)}if(e&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,V,d,Y,R,O)}if(e&64){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,ma,Y,da,O)}if(e&128){this.compNorm(p);this.compNorm(o);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,d,Y,N,da)}if(e&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,f,E,N)}if(e&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,V,d,f,w,R)}if(e&1024){this.compNorm(v);
+this.compNorm(x);this.VIntZ(v*3,this.vlist,this.nlist,30,h,V,ma,f,J,O)}if(e&2048){this.compNorm(n);this.compNorm(o);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,ma,f,M,da)}B<<=4;for(h=g=0;THREE.triTable[B+h]!=-1;){b=B+h;d=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[f],m);h+=3;g++}return g};this.posnormtriv=function(b,d,f,g,h,m){var j=this.count*3;this.positionArray[j]=b[f];this.positionArray[j+1]=b[f+1];this.positionArray[j+2]=b[f+2];this.positionArray[j+
+3]=b[g];this.positionArray[j+4]=b[g+1];this.positionArray[j+5]=b[g+2];this.positionArray[j+6]=b[h];this.positionArray[j+7]=b[h+1];this.positionArray[j+8]=b[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,f,g,h){var m=this.size*Math.sqrt(g/h),j=f*this.size,n=d*this.size,p=b*this.size,v=Math.floor(j-m);v<1&&(v=1);j=Math.floor(j+m);j>this.size-1&&(j=this.size-1);var u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var o=Math.floor(p-m);o<1&&(o=1);m=Math.floor(p+m);
+m>this.size-1&&(m=this.size-1);for(var x,B,E,w,M,J;v<j;v++){p=this.size2*v;B=v/this.size-f;M=B*B;for(B=u;B<n;B++){E=p+this.size*B;x=B/this.size-d;J=x*x;for(x=o;x<m;x++){w=x/this.size-b;w=g/(1.0E-6+w*w+J+M)-h;w>0&&(this.field[E+x]+=w)}}}};this.addPlaneX=function(b,d){var f,g,h,m,j,n=this.size,p=this.yd,v=this.zd,u=this.field,o=n*Math.sqrt(b/d);o>n&&(o=n);for(f=0;f<o;f++){g=f/n;g*=g;m=b/(1.0E-4+g)-d;if(m>0)for(g=0;g<n;g++){j=f+g*p;for(h=0;h<n;h++)u[v*h+j]+=m}}};this.addPlaneY=function(b,d){var f,g,
+h,m,j,n,p=this.size,v=this.yd,u=this.zd,o=this.field,x=p*Math.sqrt(b/d);x>p&&(x=p);for(g=0;g<x;g++){f=g/p;f*=f;m=b/(1.0E-4+f)-d;if(m>0){j=g*v;for(f=0;f<p;f++){n=j+f;for(h=0;h<p;h++)o[u*h+n]+=m}}}};this.addPlaneZ=function(b,d){var f,g,h,m,j,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;m=b/(1.0E-4+f)-d;if(m>0){j=zd*h;for(g=0;g<size;g++){n=j+g*yd;for(f=0;f<size;f++)field[n+f]+=m}}}};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 d,f,g,h,m,j,n,p,v,u=this.size-2;for(h=1;h<u;h++){v=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){p=v+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){m=(f-this.halfsize)/this.halfsize;d=p+f;this.polygonize(m,j,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(f){var g,h,m,j,n,p,v,u;for(g=
+0;g<f.count;g++){n=g*3;v=n+1;u=n+2;h=f.positionArray[n];m=f.positionArray[v];j=f.positionArray[u];p=new THREE.Vector3(h,m,j);h=f.normalArray[n];m=f.normalArray[v];j=f.normalArray[u];n=new THREE.Vector3(h,m,j);n.normalize();n=new THREE.Vertex(p,n);d.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;v=n+1;u=n+2;p=d.vertices[n].normal;h=d.vertices[v].normal;m=d.vertices[u].normal;n=new THREE.Face3(n,v,u,[p,h,m]);d.faces.push(n)}b+=nfaces;f.count=0});return d};this.init(a)};
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 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,
 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,
 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,

+ 7 - 5
build/custom/ThreeCanvas.js

@@ -48,17 +48,18 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
-THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
 c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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,
 c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(x,z,W,w,O,Y,H){f=x.vertices[z].position;g=x.vertices[W].position;i=x.vertices[w].position;h=e[O];j=e[Y];o=e[H];n=g.x-f.x;p=i.x-f.x;m=g.y-f.y;v=i.y-f.y;
 b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(x,z,W,w,O,Y,H){f=x.vertices[z].position;g=x.vertices[W].position;i=x.vertices[w].position;h=e[O];j=e[Y];o=e[H];n=g.x-f.x;p=i.x-f.x;m=g.y-f.y;v=i.y-f.y;
 t=g.z-f.z;s=i.z-f.z;k=j.u-h.u;G=o.u-h.u;F=j.v-h.v;K=o.v-h.v;I=1/(k*K-G*F);A.set((K*n-F*p)*I,(K*m-F*v)*I,(K*t-F*s)*I);L.set((k*p-G*n)*I,(k*v-G*m)*I,(k*s-G*t)*I);S[z].addSelf(A);S[W].addSelf(A);S[w].addSelf(A);C[z].addSelf(L);C[W].addSelf(L);C[w].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,p,m,v,t,s,k,G,F,K,I,S=[],C=[],A=new THREE.Vector3,L=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
 t=g.z-f.z;s=i.z-f.z;k=j.u-h.u;G=o.u-h.u;F=j.v-h.v;K=o.v-h.v;I=1/(k*K-G*F);A.set((K*n-F*p)*I,(K*m-F*v)*I,(K*t-F*s)*I);L.set((k*p-G*n)*I,(k*v-G*m)*I,(k*s-G*t)*I);S[z].addSelf(A);S[W].addSelf(A);S[w].addSelf(A);C[z].addSelf(L);C[W].addSelf(L);C[w].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,p,m,v,t,s,k,G,F,K,I,S=[],C=[],A=new THREE.Vector3,L=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
-for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
+for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=S[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();M.cross(this.vertices[b].normal,d);d=M.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=S[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();M.cross(this.vertices[b].normal,d);d=M.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
@@ -84,7 +85,8 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;

+ 3 - 3
build/custom/ThreeDOM.js

@@ -48,10 +48,10 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,c,e,d){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=d instanceof Array?d:[d]};THREE.Face4=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};
-THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
 0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
 0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
 {};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
 {};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*

+ 69 - 91
build/custom/ThreeExtras.js

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

+ 6 - 5
build/custom/ThreeSVG.js

@@ -48,17 +48,18 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
-THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
 c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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,
 c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(t,C,S,y,K,D,w){f=t.vertices[C].position;g=t.vertices[S].position;i=t.vertices[y].position;h=e[K];j=e[D];o=e[w];n=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;
 b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(t,C,S,y,K,D,w){f=t.vertices[C].position;g=t.vertices[S].position;i=t.vertices[y].position;h=e[K];j=e[D];o=e[w];n=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;
 s=g.z-f.z;v=i.z-f.z;l=j.u-h.u;J=o.u-h.u;r=j.v-h.v;A=o.v-h.v;F=1/(l*A-J*r);z.set((A*n-r*m)*F,(A*k-r*q)*F,(A*s-r*v)*F);L.set((l*m-J*n)*F,(l*q-J*k)*F,(l*v-J*s)*F);R[C].addSelf(z);R[S].addSelf(z);R[y].addSelf(z);B[C].addSelf(L);B[S].addSelf(L);B[y].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,m,k,q,s,v,l,J,r,A,F,R=[],B=[],z=new THREE.Vector3,L=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){R[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
 s=g.z-f.z;v=i.z-f.z;l=j.u-h.u;J=o.u-h.u;r=j.v-h.v;A=o.v-h.v;F=1/(l*A-J*r);z.set((A*n-r*m)*F,(A*k-r*q)*F,(A*s-r*v)*F);L.set((l*m-J*n)*F,(l*q-J*k)*F,(l*v-J*s)*F);R[C].addSelf(z);R[S].addSelf(z);R[y].addSelf(z);B[C].addSelf(L);B[S].addSelf(L);B[y].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,m,k,q,s,v,l,J,r,A,F,R=[],B=[],z=new THREE.Vector3,L=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){R[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
-for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
+for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=R[b];G.copy(d);G.subSelf(H.multiplyScalar(H.dot(d))).normalize();N.cross(this.vertices[b].normal,d);d=N.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(G.x,G.y,G.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=R[b];G.copy(d);G.subSelf(H.multiplyScalar(H.dot(d))).normalize();N.cross(this.vertices[b].normal,d);d=N.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(G.x,G.y,G.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
@@ -84,7 +85,7 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;

+ 129 - 126
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,f,h,j,o,m;if(d==0)e=f=h=0;else{j=Math.floor(a*6);o=a*6-j;a=d*(1-b);m=d*(1-b*o);b=d*(1-b*(1-o));switch(j){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=b;break;case 3:e=a;f=m;h=d;break;case 4:e=b;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d;f=b;h=a}}this.r=e;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,f,h,i,p,n;if(d==0)e=f=h=0;else{i=Math.floor(a*6);p=a*6-i;a=d*(1-b);n=d*(1-b*p);b=d*(1-b*(1-p));switch(i){case 1:e=n;f=d;h=a;break;case 2:e=a;f=d;h=b;break;case 3:e=a;f=n;h=d;break;case 4:e=b;f=a;h=d;break;case 5:e=d;f=a;h=n;break;case 6:case 0:e=d;f=b;h=a}}this.r=e;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,79 +12,81 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,j){return h.distance-j.distance});return f},intersectObject:function(a){function b(H,w,ga,U){U=U.clone().subSelf(w);ga=ga.clone().subSelf(w);var ha=H.clone().subSelf(w);H=U.dot(U);w=U.dot(ga);U=U.dot(ha);var fa=ga.dot(ga);ga=ga.dot(ha);ha=1/(H*fa-w*w);fa=(fa*U-w*ga)*ha;H=(H*ga-w*U)*ha;return fa>0&&H>0&&fa+H<1}var d,
-e,f,h,j,o,m,u,y,z,A,x=a.geometry,K=x.vertices,J=[];d=0;for(e=x.faces.length;d<e;d++){f=x.faces[d];z=this.origin.clone();A=this.direction.clone();m=a.matrixWorld;h=m.multiplyVector3(K[f.a].position.clone());j=m.multiplyVector3(K[f.b].position.clone());o=m.multiplyVector3(K[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(K[f.d].position.clone()):null;u=a.matrixRotationWorld.multiplyVector3(f.normal.clone());y=A.dot(u);if(y<0){u=u.dot((new THREE.Vector3).sub(h,z))/y;z=z.addSelf(A.multiplyScalar(u));
-if(f instanceof THREE.Face3){if(b(z,h,j,o)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(b(z,h,j,m)||b(z,j,o,m))){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};J.push(f)}}}return J}};
-THREE.Rectangle=function(){function a(){h=e-b;j=f-d}var b,d,e,f,h,j,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,u,y,z){o=!1;b=m;d=u;e=y;f=z;a()};this.addPoint=function(m,u){if(o){o=!1;b=m;d=u;e=m;f=u}else{b=b<m?b:m;d=d<u?d:u;e=e>m?e:m;f=f>u?f:u}a()};
-this.add3Points=function(m,u,y,z,A,x){if(o){o=!1;b=m<y?m<A?m:A:y<A?y:A;d=u<z?u<x?u:x:z<x?z:x;e=m>y?m>A?m:A:y>A?y:A;f=u>z?u>x?u:x:z>x?z:x}else{b=m<y?m<A?m<b?m:b:A<b?A:b:y<A?y<b?y:b:A<b?A:b;d=u<z?u<x?u<d?u:d:x<d?x:d:z<x?z<d?z:d:x<d?x:d;e=m>y?m>A?m>e?m:e:A>e?A:e:y>A?y>e?y:e:A>e?A:e;f=u>z?u>x?u>f?u:f:x>f?x:f:z>x?z>f?z:f:x>f?x:f}a()};this.addRectangle=function(m){if(o){o=!1;b=m.getLeft();d=m.getTop();e=m.getRight();f=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();e=e>m.getRight()?
-e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;e+=m;f+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){o=!0;f=e=d=b=0;a()};this.isEmpty=function(){return o}};
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function b(J,y,ja,V){V=V.clone().subSelf(y);ja=ja.clone().subSelf(y);var ka=J.clone().subSelf(y);J=V.dot(V);y=V.dot(ja);V=V.dot(ka);var ia=ja.dot(ja);ja=ja.dot(ka);ka=1/(J*ia-y*y);ia=(ia*V-y*ja)*ka;J=(J*ja-y*V)*ka;return ia>0&&J>0&&ia+J<1}var d,
+e,f,h,i,p,n,w,A,B,C,z=a.geometry,M=z.vertices,K=[];d=0;for(e=z.faces.length;d<e;d++){f=z.faces[d];B=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(M[f.a].position.clone());i=n.multiplyVector3(M[f.b].position.clone());p=n.multiplyVector3(M[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(M[f.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(f.normal.clone());A=C.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(h,B))/A;B=B.addSelf(C.multiplyScalar(w));
+if(f instanceof THREE.Face3){if(b(B,h,i,p)){f={distance:this.origin.distanceTo(B),point:B,face:f,object:a};K.push(f)}}else if(f instanceof THREE.Face4&&(b(B,h,i,n)||b(B,i,p,n))){f={distance:this.origin.distanceTo(B),point:B,face:f,object:a};K.push(f)}}}return K}};
+THREE.Rectangle=function(){function a(){h=e-b;i=f-d}var b,d,e,f,h,i,p=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,w,A,B){p=!1;b=n;d=w;e=A;f=B;a()};this.addPoint=function(n,w){if(p){p=!1;b=n;d=w;e=n;f=w}else{b=b<n?b:n;d=d<w?d:w;e=e>n?e:n;f=f>w?f:w}a()};
+this.add3Points=function(n,w,A,B,C,z){if(p){p=!1;b=n<A?n<C?n:C:A<C?A:C;d=w<B?w<z?w:z:B<z?B:z;e=n>A?n>C?n:C:A>C?A:C;f=w>B?w>z?w:z:B>z?B:z}else{b=n<A?n<C?n<b?n:b:C<b?C:b:A<C?A<b?A:b:C<b?C:b;d=w<B?w<z?w<d?w:d:z<d?z:d:B<z?B<d?B:d:z<d?z:d;e=n>A?n>C?n>e?n:e:C>e?C:e:A>C?A>e?A:e:C>e?C:e;f=w>B?w>z?w>f?w:f:z>f?z:f:B>z?B>f?B:f:z>f?z:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();d=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
+e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();f=f<n.getBottom()?f:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(f,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){p=!0;f=e=d=b=0;a()};this.isEmpty=function(){return p}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,e,f,h,j,o,m,u,y,z,A,x,K,J){this.set(a||1,b||0,d||0,e||0,f||0,h||1,j||0,o||0,m||0,u||0,y||1,z||0,A||0,x||0,K||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,e,f,h,j,o,m,u,y,z,A,x,K,J){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=o;this.n31=m;this.n32=u;this.n33=y;this.n34=z;this.n41=A;this.n42=x;this.n43=K;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,d,e,f,h,i,p,n,w,A,B,C,z,M,K){this.set(a||1,b||0,d||0,e||0,f||0,h||1,i||0,p||0,n||0,w||0,A||1,B||0,C||0,z||0,M||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,e,f,h,i,p,n,w,A,B,C,z,M,K){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=p;this.n31=n;this.n32=w;this.n33=A;this.n34=B;this.n41=C;this.n42=z;this.n43=M;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();if(e.length()===0){h.x+=1.0E-4;e.cross(d,h).normalize()}f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*
 f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();if(e.length()===0){h.x+=1.0E-4;e.cross(d,h).normalize()}f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*
 e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
 e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,o=a.n22,m=a.n23,u=a.n24,y=a.n31,z=a.n32,A=a.n33,x=a.n34,K=a.n41,J=a.n42,H=a.n43,w=a.n44,ga=b.n11,U=b.n12,ha=b.n13,fa=b.n14,ia=b.n21,M=b.n22,
-c=b.n23,ja=b.n24,W=b.n31,la=b.n32,Z=b.n33,R=b.n34;this.n11=d*ga+e*ia+f*W;this.n12=d*U+e*M+f*la;this.n13=d*ha+e*c+f*Z;this.n14=d*fa+e*ja+f*R+h;this.n21=j*ga+o*ia+m*W;this.n22=j*U+o*M+m*la;this.n23=j*ha+o*c+m*Z;this.n24=j*fa+o*ja+m*R+u;this.n31=y*ga+z*ia+A*W;this.n32=y*U+z*M+A*la;this.n33=y*ha+z*c+A*Z;this.n34=y*fa+z*ja+A*R+x;this.n41=K*ga+J*ia+H*W;this.n42=K*U+J*M+H*la;this.n43=K*ha+J*c+H*Z;this.n44=K*fa+J*ja+H*R+w;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,n=a.n23,w=a.n24,A=a.n31,B=a.n32,C=a.n33,z=a.n34,M=a.n41,K=a.n42,J=a.n43,y=a.n44,ja=b.n11,V=b.n12,ka=b.n13,ia=b.n14,la=b.n21,Q=b.n22,
+c=b.n23,ma=b.n24,Z=b.n31,oa=b.n32,$=b.n33,U=b.n34;this.n11=d*ja+e*la+f*Z;this.n12=d*V+e*Q+f*oa;this.n13=d*ka+e*c+f*$;this.n14=d*ia+e*ma+f*U+h;this.n21=i*ja+p*la+n*Z;this.n22=i*V+p*Q+n*oa;this.n23=i*ka+p*c+n*$;this.n24=i*ia+p*ma+n*U+w;this.n31=A*ja+B*la+C*Z;this.n32=A*V+B*Q+C*oa;this.n33=A*ka+B*c+C*$;this.n34=A*ia+B*ma+C*U+z;this.n41=M*ja+K*la+J*Z;this.n42=M*V+K*Q+J*oa;this.n43=M*ka+K*c+J*$;this.n44=M*ia+K*ma+J*U+y;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=
 this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
 this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,o=this.n24,m=this.n31,u=this.n32,y=this.n33,z=this.n34,A=this.n41,x=this.n42,K=this.n43,J=this.n44;return e*j*u*A-d*o*u*A-e*h*y*A+b*o*y*A+d*h*z*A-b*j*z*A-e*j*m*x+d*o*m*x+e*f*y*x-a*o*y*x-d*f*z*x+a*j*z*x+e*h*m*K-b*o*m*K-e*f*u*K+a*o*u*K+b*f*z*K-a*h*z*K-d*h*m*J+b*j*m*J+d*f*u*J-a*j*u*J-b*f*y*J+a*h*y*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,p=this.n24,n=this.n31,w=this.n32,A=this.n33,B=this.n34,C=this.n41,z=this.n42,M=this.n43,K=this.n44;return e*i*w*C-d*p*w*C-e*h*A*C+b*p*A*C+d*h*B*C-b*i*B*C-e*i*n*z+d*p*n*z+e*f*A*z-a*p*A*z-d*f*B*z+a*i*B*z+e*h*n*M-b*p*n*M-e*f*w*M+a*p*w*M+b*f*B*M-a*h*B*M-d*h*n*K+b*i*n*K+d*f*w*K-a*i*w*K-b*f*A*K+a*h*A*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,
 0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),f=
 0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),f=
-1-d,h=a.x,j=a.y,o=a.z,m=f*h,u=f*j;this.set(m*h+d,m*j-e*o,m*o+e*j,0,m*j+e*o,u*j+d,u*o-e*h,0,m*o-e*j,u*o+e*h,f*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var j=a*d,o=b*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=o*h+a*e;this.n22=-o*e+a*h;this.n23=-b*f;this.n31=-j*h+b*e;this.n32=j*e+b*h;this.n33=
-a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,f=a.w,h=b+b,j=d+d,o=e+e;a=b*h;var m=b*j;b*=o;var u=d*j;d*=o;e*=o;h*=f;j*=f;f*=o;this.n11=1-(u+e);this.n12=m-f;this.n13=b+j;this.n21=m+f;this.n22=1-(a+e);this.n23=d-h;this.n31=b-j;this.n32=d+h;this.n33=1-(a+u);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
+1-d,h=a.x,i=a.y,p=a.z,n=f*h,w=f*i;this.set(n*h+d,n*i-e*p,n*p+e*i,0,n*i+e*p,w*i+d,w*p-e*h,0,n*p-e*i,w*p+e*h,f*p*p+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var i=a*d,p=b*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=p*h+a*e;this.n22=-p*e+a*h;this.n23=-b*f;this.n31=-i*h+b*e;this.n32=i*e+b*h;this.n33=
+a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,f=a.w,h=b+b,i=d+d,p=e+e;a=b*h;var n=b*i;b*=p;var w=d*i;d*=p;e*=p;h*=f;i*=f;f*=p;this.n11=1-(w+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=d-h;this.n31=b-i;this.n32=d+h;this.n33=1-(a+w);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,o=a.n22,m=a.n23,u=a.n24,y=a.n31,z=a.n32,A=a.n33,x=a.n34,K=a.n41,J=a.n42,H=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=m*x*J-u*A*J+u*z*H-o*x*H-m*z*w+o*A*w;b.n12=h*A*J-f*x*J-h*z*H+e*x*H+f*z*w-e*A*w;b.n13=f*u*J-h*m*J+h*o*H-e*u*H-f*o*w+e*m*w;b.n14=h*m*z-f*u*z-h*o*A+e*u*A+f*o*x-e*m*x;b.n21=u*A*K-m*x*K-u*y*H+j*x*H+m*y*w-j*A*w;b.n22=f*x*K-h*A*K+h*y*H-d*x*H-f*y*w+d*A*w;b.n23=h*m*K-f*u*K-h*j*H+d*u*H+f*j*w-d*m*w;
-b.n24=f*u*y-h*m*y+h*j*A-d*u*A-f*j*x+d*m*x;b.n31=o*x*K-u*z*K+u*y*J-j*x*J-o*y*w+j*z*w;b.n32=h*z*K-e*x*K-h*y*J+d*x*J+e*y*w-d*z*w;b.n33=f*u*K-h*o*K+h*j*J-d*u*J-e*j*w+d*o*w;b.n34=h*o*y-e*u*y-h*j*z+d*u*z+e*j*x-d*o*x;b.n41=m*z*K-o*A*K-m*y*J+j*A*J+o*y*H-j*z*H;b.n42=e*A*K-f*z*K+f*y*J-d*A*J-e*y*H+d*z*H;b.n43=f*o*K-e*m*K-f*j*J+d*m*J+e*j*H-d*o*H;b.n44=e*m*y-f*o*y+f*j*z-d*m*z-e*j*A+d*o*A;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,u=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*u;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*f;d[2]=a*h;d[3]=a*j;d[4]=a*o;d[5]=a*m;d[6]=a*u;d[7]=a*y;d[8]=a*z;return b};
-THREE.Matrix4.makeFrustum=function(a,b,d,e,f,h){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+f)/(h-f);j.n34=-2*h*f/(h-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,b,d,e,f,h){var j,o,m,u;j=new THREE.Matrix4;o=b-a;m=d-e;u=h-f;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((b+a)/o);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((h+f)/u);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,n=a.n23,w=a.n24,A=a.n31,B=a.n32,C=a.n33,z=a.n34,M=a.n41,K=a.n42,J=a.n43,y=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*z*K-w*C*K+w*B*J-p*z*J-n*B*y+p*C*y;b.n12=h*C*K-f*z*K-h*B*J+e*z*J+f*B*y-e*C*y;b.n13=f*w*K-h*n*K+h*p*J-e*w*J-f*p*y+e*n*y;b.n14=h*n*B-f*w*B-h*p*C+e*w*C+f*p*z-e*n*z;b.n21=w*C*M-n*z*M-w*A*J+i*z*J+n*A*y-i*C*y;b.n22=f*z*M-h*C*M+h*A*J-d*z*J-f*A*y+d*C*y;b.n23=h*n*M-f*w*M-h*i*J+d*w*J+f*i*y-d*n*y;
+b.n24=f*w*A-h*n*A+h*i*C-d*w*C-f*i*z+d*n*z;b.n31=p*z*M-w*B*M+w*A*K-i*z*K-p*A*y+i*B*y;b.n32=h*B*M-e*z*M-h*A*K+d*z*K+e*A*y-d*B*y;b.n33=f*w*M-h*p*M+h*i*K-d*w*K-e*i*y+d*p*y;b.n34=h*p*A-e*w*A-h*i*B+d*w*B+e*i*z-d*p*z;b.n41=n*B*M-p*C*M-n*A*K+i*C*K+p*A*J-i*B*J;b.n42=e*C*M-f*B*M+f*A*K-d*C*K-e*A*J+d*B*J;b.n43=f*p*M-e*n*M-f*i*K+d*n*K+e*i*J-d*p*J;b.n44=e*n*A-f*p*A+f*i*B-d*n*B-e*i*C+d*p*C;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,B=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*i+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*p;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*B;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-d);i.n23=(e+d)/(e-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,f,h){var i,p,n,w;i=new THREE.Matrix4;p=b-a;n=d-e;w=h-f;i.n11=2/p;i.n12=0;i.n13=0;i.n14=-((b+a)/p);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((d+e)/n);i.n31=0;i.n32=0;i.n33=-2/w;i.n34=-((h+f)/w);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
 b,d)}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
 b,d)}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var j=a*b,o=e*f;this.w=j*h-o*d;this.x=j*d+o*h;this.y=e*b*h+a*f*d;this.z=a*f*h-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,f=this.w,h=a.x,j=a.y,o=a.z;a=a.w;this.x=b*a+f*h+d*o-e*j;this.y=d*a+f*j+e*h-b*o;this.z=e*a+f*o+b*j-d*h;this.w=f*a-b*h-d*j-e*o;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,f=a.z,h=this.x,j=this.y,o=this.z,m=this.w,u=m*d+j*f-o*e,y=m*e+o*d-h*f,z=m*f+h*e-j*d;d=-h*d-j*e-o*f;b.x=u*m+d*-h+y*-o-z*-j;b.y=y*m+d*-j+z*-h-u*-o;b.z=z*m+d*-o+u*-j-y*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=a.w*f+b.w*e;d.x=a.x*f+b.x*e;d.y=a.y*f+b.y*e;d.z=a.z*f+b.z*e;return d};
+THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*b,p=e*f;this.w=i*h-p*d;this.x=i*d+p*h;this.y=e*b*h+a*f*d;this.z=a*f*h-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,f=this.w,h=a.x,i=a.y,p=a.z;a=a.w;this.x=b*a+f*h+d*p-e*i;this.y=d*a+f*i+e*h-b*p;this.z=e*a+f*p+b*i-d*h;this.w=f*a-b*h-d*i-e*p;return this},
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,f=a.z,h=this.x,i=this.y,p=this.z,n=this.w,w=n*d+i*f-p*e,A=n*e+p*d-h*f,B=n*f+h*e-i*d;d=-h*d-i*e-p*f;b.x=w*n+d*-h+A*-p-B*-i;b.y=A*n+d*-i+B*-h-w*-p;b.z=B*n+d*-p+w*-i-A*-h;return b}};
+THREE.Quaternion.slerp=function(a,b,d,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;d.w=a.w*f+b.w*e;d.x=a.x*f+b.x*e;d.y=a.y*f+b.y*e;d.z=a.z*f+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,d,e,f){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,d,e,f,h){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};
-THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Face3=function(a,b,d,e,f,h){this.a=a;this.b=b;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,d,e,f,h,i){this.a=a;this.b=b;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[];this.faceVertexUvs=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,f,h,j,o=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){o.set(0,0,0);b=0;for(d=h.vertexNormals.length;b<d;b++)o.addSelf(h.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];o.sub(j.position,
-d.position);m.sub(b.position,d.position);o.crossSelf(m)}o.isZero()||o.normalize();h.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,f,h,i,p=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(d=h.vertexNormals.length;b<d;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];p.sub(i.position,
+d.position);n.sub(b.position,d.position);p.crossSelf(n)}p.isZero()||p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(R,N,Ba,L,ka,wa,P){h=R.vertices[N].position;j=R.vertices[Ba].position;o=R.vertices[L].position;m=f[ka];u=f[wa];y=f[P];z=j.x-h.x;A=o.x-h.x;x=j.y-h.y;K=o.y-
-h.y;J=j.z-h.z;H=o.z-h.z;w=u.u-m.u;ga=y.u-m.u;U=u.v-m.v;ha=y.v-m.v;fa=1/(w*ha-ga*U);c.set((ha*z-U*A)*fa,(ha*x-U*K)*fa,(ha*J-U*H)*fa);ja.set((w*A-ga*z)*fa,(w*K-ga*x)*fa,(w*H-ga*J)*fa);ia[N].addSelf(c);ia[Ba].addSelf(c);ia[L].addSelf(c);M[N].addSelf(ja);M[Ba].addSelf(ja);M[L].addSelf(ja)}var b,d,e,f,h,j,o,m,u,y,z,A,x,K,J,H,w,ga,U,ha,fa,ia=[],M=[],c=new THREE.Vector3,ja=new THREE.Vector3,W=new THREE.Vector3,la=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;
-M[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];f=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){Z.copy(this.vertices[b].normal);e=ia[b];W.copy(e);W.subSelf(Z.multiplyScalar(Z.dot(e))).normalize();la.cross(this.vertices[b].normal,e);e=la.dot(M[b]);e=e<0?-1:1;this.vertices[b].tangent.set(W.x,W.y,W.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(U,R,Da,N,na,ya,S){h=U.vertices[R].position;i=U.vertices[Da].position;p=U.vertices[N].position;n=f[na];w=f[ya];A=f[S];B=i.x-h.x;C=p.x-h.x;z=i.y-h.y;M=p.y-
+h.y;K=i.z-h.z;J=p.z-h.z;y=w.u-n.u;ja=A.u-n.u;V=w.v-n.v;ka=A.v-n.v;ia=1/(y*ka-ja*V);c.set((ka*B-V*C)*ia,(ka*z-V*M)*ia,(ka*K-V*J)*ia);ma.set((y*C-ja*B)*ia,(y*M-ja*z)*ia,(y*J-ja*K)*ia);la[R].addSelf(c);la[Da].addSelf(c);la[N].addSelf(c);Q[R].addSelf(ma);Q[Da].addSelf(ma);Q[N].addSelf(ma)}var b,d,e,f,h,i,p,n,w,A,B,C,z,M,K,J,y,ja,V,ka,ia,la=[],Q=[],c=new THREE.Vector3,ma=new THREE.Vector3,Z=new THREE.Vector3,oa=new THREE.Vector3,$=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){la[b]=new THREE.Vector3;
+Q[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){$.copy(this.vertices[b].normal);e=la[b];Z.copy(e);Z.subSelf($.multiplyScalar($.dot(e))).normalize();oa.cross(this.vertices[b].normal,e);e=oa.dot(Q[b]);e=e<0?-1:1;this.vertices[b].tangent.set(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var a=[],b={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var j=0;j<f.hierarchy[h].keys.length;j++){if(f.hierarchy[h].keys[j].time<
-0)f.hierarchy[h].keys[j].time=0;if(f.hierarchy[h].keys[j].rot!==undefined&&!(f.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var o=f.hierarchy[h].keys[j].rot;f.hierarchy[h].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){o={};for(j=0;j<f.hierarchy[h].keys.length;j++)for(var m=0;m<f.hierarchy[h].keys[j].morphTargets.length;m++){var u=f.hierarchy[h].keys[j].morphTargets[m];o[u]=-1}f.hierarchy[h].usedMorphTargets=o;for(j=0;j<f.hierarchy[h].keys.length;j++){var y=
-{};for(u in o){for(m=0;m<f.hierarchy[h].keys[j].morphTargets.length;m++)if(f.hierarchy[h].keys[j].morphTargets[m]===u){y[u]=f.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===f.hierarchy[h].keys[j].morphTargets.length&&(y[u]=0)}f.hierarchy[h].keys[j].morphTargetsInfluences=y}}for(j=1;j<f.hierarchy[h].keys.length;j++)if(f.hierarchy[h].keys[j].time===f.hierarchy[h].keys[j-1].time){f.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[h].keys.length;j++)f.hierarchy[h].keys[j].index=j}j=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)h.push(f.bones[j]);else e(f,h);return h};var e=function(f,h){h.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],h)};d.LINEAR=
+THREE.AnimationHandler=function(){var a=[],b={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
+0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var p=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var n=0;n<f.hierarchy[h].keys[i].morphTargets.length;n++){var w=f.hierarchy[h].keys[i].morphTargets[n];p[w]=-1}f.hierarchy[h].usedMorphTargets=p;for(i=0;i<f.hierarchy[h].keys.length;i++){var A=
+{};for(w in p){for(n=0;n<f.hierarchy[h].keys[i].morphTargets.length;n++)if(f.hierarchy[h].keys[i].morphTargets[n]===w){A[w]=f.hierarchy[h].keys[i].morphTargetsInfluences[n];break}n===f.hierarchy[h].keys[i].morphTargets.length&&(A[w]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=A}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else e(f,h);return h};var e=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)e(f.children[i],h)};d.LINEAR=
 0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,b,d,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,b,d,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],d,e,f,h,j,o,m,u,y=this.data.JIT.hierarchy,z,A;this.currentTime+=a*this.timeScale;A=this.currentTime;z=this.currentTime%=this.data.length;u=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var x=0,K=this.hierarchy.length;x<K;x++){a=this.hierarchy[x];m=a.animationCache;if(this.JITCompile&&y[x][u]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=y[x][u];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=y[x][u];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=b[J];j=m.prevKey[d];o=m.nextKey[d];if(o.time<=A){if(z<A)if(this.loop){j=this.data.hierarchy[x].keys[0];for(o=this.getNextKeyWith(d,x,1);o.time<z;){j=o;o=this.getNextKeyWith(d,x,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(d,x,o.index+1)}while(o.time<
-z)}m.prevKey[d]=j;m.nextKey[d]=o}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(z-j.time)/(o.time-j.time);f=j[d];h=o[d];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+x);e=e<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",x,j.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",x,o.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(d===
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}}}}if(this.JITCompile&&y[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(x=0;x<this.hierarchy.length;x++)y[x][u]=this.hierarchy[x]instanceof THREE.Bone?this.hierarchy[x].skinMatrix.clone():this.hierarchy[x].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var d=[],e=[],f,h,j,o,m,u;f=(a.length-1)*b;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];o=a[d[1]];m=a[d[2]];u=a[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(h[0],o[0],m[0],u[0],f,d,j);e[1]=this.interpolate(h[1],o[1],m[1],u[1],f,d,j);e[2]=this.interpolate(h[2],o[2],m[2],u[2],f,d,j);return e};
-THREE.Animation.prototype.interpolate=function(a,b,d,e,f,h,j){a=(d-a)*0.5;e=(e-b)*0.5;return(2*(b-d)+a+e)*j+(-3*(b-d)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<e.length-1?d:e.length-1;else d%=e.length;for(;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],d,e,f,h,i,p,n,w,A=this.data.JIT.hierarchy,B,C;this.currentTime+=a*this.timeScale;C=this.currentTime;B=this.currentTime%=this.data.length;w=parseInt(Math.min(B*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,M=this.hierarchy.length;z<M;z++){a=this.hierarchy[z];n=a.animationCache;if(this.JITCompile&&A[z][w]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=A[z][w];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=A[z][w];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){d=b[K];i=n.prevKey[d];p=n.nextKey[d];if(p.time<=C){if(B<C)if(this.loop){i=this.data.hierarchy[z].keys[0];for(p=this.getNextKeyWith(d,z,1);p.time<B;){i=p;p=this.getNextKeyWith(d,z,p.index+1)}}else{this.stop();return}else{do{i=p;p=this.getNextKeyWith(d,z,p.index+1)}while(p.time<
+B)}n.prevKey[d]=i;n.nextKey[d]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(B-i.time)/(p.time-i.time);f=i[d];h=p[d];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+z);e=e<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(d===
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}}}}if(this.JITCompile&&A[0][w]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)A[z][w]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var d=[],e=[],f,h,i,p,n,w;f=(a.length-1)*b;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];p=a[d[1]];n=a[d[2]];w=a[d[3]];d=f*f;i=f*d;e[0]=this.interpolate(h[0],p[0],n[0],w[0],f,d,i);e[1]=this.interpolate(h[1],p[1],n[1],w[1],f,d,i);e[2]=this.interpolate(h[2],p[2],n[2],w[2],f,d,i);return e};
+THREE.Animation.prototype.interpolate=function(a,b,d,e,f,h,i){a=(d-a)*0.5;e=(e-b)*0.5;return(2*(b-d)+a+e)*i+(-3*(b-d)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<e.length-1?d:e.length-1;else d%=e.length;for(;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Camera=function(a,b,d,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,d,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
-THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.MaterialColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
+THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
@@ -120,7 +122,7 @@ this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
 b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
 b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f,h,j,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;j=f.rotq;o=f.scl;e=this.addBone();e.name=f.name;e.position.set(h[0],h[1],h[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f,h,i,p;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;p=f.scl;e=this.addBone();e.name=f.name;e.position.set(h[0],h[1],h[2]);e.quaternion.set(i[0],i[1],i[2],i[3]);e.useQuaternion=!0;p!==undefined?e.scale.set(p[0],p[1],p[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
 e=this.bones[d];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 e=this.bones[d];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<d;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
 THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<d;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
@@ -138,19 +140,19 @@ THREE.LOD.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
-THREE.Projector=function(){function a(M,c){return c.z-M.z}function b(M,c){var ja=0,W=1,la=M.z+M.w,Z=c.z+c.w,R=-M.z+M.w,N=-c.z+c.w;if(la>=0&&Z>=0&&R>=0&&N>=0)return!0;else if(la<0&&Z<0||R<0&&N<0)return!1;else{if(la<0)ja=Math.max(ja,la/(la-Z));else Z<0&&(W=Math.min(W,la/(la-Z)));if(R<0)ja=Math.max(ja,R/(R-N));else N<0&&(W=Math.min(W,R/(R-N)));if(W<ja)return!1;else{M.lerpSelf(c,ja);c.lerpSelf(M,1-W);return!0}}}var d,e,f=[],h,j,o,m=[],u,y,z=[],A,x,K=[],J=new THREE.Vector4,H=new THREE.Vector4,w=new THREE.Matrix4,
-ga=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Vector4,fa=new THREE.Vector4,ia;this.projectObjects=function(M,c,ja){c=[];var W,la,Z;e=0;la=M.objects;M=0;for(W=la.length;M<W;M++){Z=la[M];var R;if(!(R=!Z.visible))if(R=Z instanceof THREE.Mesh){a:{R=void 0;for(var N=Z.matrixWorld,Ba=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),L=0;L<6;L++){R=U[L].x*N.n14+U[L].y*N.n24+
-U[L].z*N.n34+U[L].w;if(R<=Ba){R=!1;break a}}R=!0}R=!R}if(!R){d=f[e]=f[e]||new THREE.RenderableObject;J.copy(Z.position);w.multiplyVector3(J);d.object=Z;d.z=J.z;c.push(d);e++}}ja&&c.sort(a);return c};this.projectScene=function(M,c,ja){var W=[],la=c.near,Z=c.far,R,N,Ba,L,ka,wa,P,xa,Ha,Na,Ma,Fa,va,V,sa,za;o=y=x=0;c.matrixAutoUpdate&&c.updateMatrix();M.update(undefined,!1,c);w.multiply(c.projectionMatrix,c.matrixWorldInverse);U[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);U[1].set(w.n41+w.n11,
-w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);U[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);U[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);U[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);U[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(R=0;R<6;R++){wa=U[R];wa.divideScalar(Math.sqrt(wa.x*wa.x+wa.y*wa.y+wa.z*wa.z))}wa=this.projectObjects(M,c,!0);M=0;for(R=wa.length;M<R;M++){P=wa[M].object;if(P.visible){xa=P.matrixWorld;Ma=P.matrixRotationWorld;Ha=P.materials;Na=
-P.overdraw;if(P instanceof THREE.Mesh){Fa=P.geometry;va=Fa.vertices;N=0;for(Ba=va.length;N<Ba;N++){V=va[N];V.positionWorld.copy(V.position);xa.multiplyVector3(V.positionWorld);L=V.positionScreen;L.copy(V.positionWorld);w.multiplyVector4(L);L.x/=L.w;L.y/=L.w;V.__visible=L.z>la&&L.z<Z}Fa=Fa.faces;N=0;for(Ba=Fa.length;N<Ba;N++){V=Fa[N];if(V instanceof THREE.Face3){L=va[V.a];ka=va[V.b];sa=va[V.c];if(L.__visible&&ka.__visible&&sa.__visible&&(P.doubleSided||P.flipSided!=(sa.positionScreen.x-L.positionScreen.x)*
-(ka.positionScreen.y-L.positionScreen.y)-(sa.positionScreen.y-L.positionScreen.y)*(ka.positionScreen.x-L.positionScreen.x)<0)){h=m[o]=m[o]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(ka.positionWorld);h.v3.positionWorld.copy(sa.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(ka.positionScreen);h.v3.positionScreen.copy(sa.positionScreen);h.normalWorld.copy(V.normal);Ma.multiplyVector3(h.normalWorld);h.centroidWorld.copy(V.centroid);
-xa.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);w.multiplyVector3(h.centroidScreen);sa=V.vertexNormals;ia=h.vertexNormalsWorld;L=0;for(ka=sa.length;L<ka;L++){za=ia[L]=ia[L]||new THREE.Vector3;za.copy(sa[L]);Ma.multiplyVector3(za)}h.z=h.centroidScreen.z;h.meshMaterials=Ha;h.faceMaterials=V.materials;h.overdraw=Na;if(P.geometry.uvs[N]){h.uvs[0]=P.geometry.uvs[N][0];h.uvs[1]=P.geometry.uvs[N][1];h.uvs[2]=P.geometry.uvs[N][2]}W.push(h);o++}}else if(V instanceof THREE.Face4){L=
-va[V.a];ka=va[V.b];sa=va[V.c];za=va[V.d];if(L.__visible&&ka.__visible&&sa.__visible&&za.__visible&&(P.doubleSided||P.flipSided!=((za.positionScreen.x-L.positionScreen.x)*(ka.positionScreen.y-L.positionScreen.y)-(za.positionScreen.y-L.positionScreen.y)*(ka.positionScreen.x-L.positionScreen.x)<0||(ka.positionScreen.x-sa.positionScreen.x)*(za.positionScreen.y-sa.positionScreen.y)-(ka.positionScreen.y-sa.positionScreen.y)*(za.positionScreen.x-sa.positionScreen.x)<0))){h=m[o]=m[o]||new THREE.RenderableFace3;
-h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(ka.positionWorld);h.v3.positionWorld.copy(za.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(ka.positionScreen);h.v3.positionScreen.copy(za.positionScreen);h.normalWorld.copy(V.normal);Ma.multiplyVector3(h.normalWorld);h.centroidWorld.copy(V.centroid);xa.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);w.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
-Ha;h.faceMaterials=V.materials;h.overdraw=Na;if(P.geometry.uvs[N]){h.uvs[0]=P.geometry.uvs[N][0];h.uvs[1]=P.geometry.uvs[N][1];h.uvs[2]=P.geometry.uvs[N][3]}W.push(h);o++;j=m[o]=m[o]||new THREE.RenderableFace3;j.v1.positionWorld.copy(ka.positionWorld);j.v2.positionWorld.copy(sa.positionWorld);j.v3.positionWorld.copy(za.positionWorld);j.v1.positionScreen.copy(ka.positionScreen);j.v2.positionScreen.copy(sa.positionScreen);j.v3.positionScreen.copy(za.positionScreen);j.normalWorld.copy(h.normalWorld);
-j.centroidWorld.copy(h.centroidWorld);j.centroidScreen.copy(h.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=Ha;j.faceMaterials=V.materials;j.overdraw=Na;if(P.geometry.uvs[N]){j.uvs[0]=P.geometry.uvs[N][1];j.uvs[1]=P.geometry.uvs[N][2];j.uvs[2]=P.geometry.uvs[N][3]}W.push(j);o++}}}}else if(P instanceof THREE.Line){ga.multiply(w,xa);va=P.geometry.vertices;V=va[0];V.positionScreen.copy(V.position);ga.multiplyVector4(V.positionScreen);N=1;for(Ba=va.length;N<Ba;N++){L=va[N];L.positionScreen.copy(L.position);
-ga.multiplyVector4(L.positionScreen);ka=va[N-1];ha.copy(L.positionScreen);fa.copy(ka.positionScreen);if(b(ha,fa)){ha.multiplyScalar(1/ha.w);fa.multiplyScalar(1/fa.w);u=z[y]=z[y]||new THREE.RenderableLine;u.v1.positionScreen.copy(ha);u.v2.positionScreen.copy(fa);u.z=Math.max(ha.z,fa.z);u.materials=P.materials;W.push(u);y++}}}else if(P instanceof THREE.Particle){H.set(P.position.x,P.position.y,P.position.z,1);w.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){A=K[x]=K[x]||new THREE.RenderableParticle;A.x=
-H.x/H.w;A.y=H.y/H.w;A.z=H.z;A.rotation=P.rotation.z;A.scale.x=P.scale.x*Math.abs(A.x-(H.x+c.projectionMatrix.n11)/(H.w+c.projectionMatrix.n14));A.scale.y=P.scale.y*Math.abs(A.y-(H.y+c.projectionMatrix.n22)/(H.w+c.projectionMatrix.n24));A.materials=P.materials;W.push(A);x++}}}}ja&&W.sort(a);return W};this.unprojectVector=function(M,c){var ja=c.matrixWorld.clone();ja.multiplySelf(THREE.Matrix4.makeInvert(c.projectionMatrix));ja.multiplyVector3(M);return M}};
+THREE.Projector=function(){function a(Q,c){return c.z-Q.z}function b(Q,c){var ma=0,Z=1,oa=Q.z+Q.w,$=c.z+c.w,U=-Q.z+Q.w,R=-c.z+c.w;if(oa>=0&&$>=0&&U>=0&&R>=0)return!0;else if(oa<0&&$<0||U<0&&R<0)return!1;else{if(oa<0)ma=Math.max(ma,oa/(oa-$));else $<0&&(Z=Math.min(Z,oa/(oa-$)));if(U<0)ma=Math.max(ma,U/(U-R));else R<0&&(Z=Math.min(Z,U/(U-R)));if(Z<ma)return!1;else{Q.lerpSelf(c,ma);c.lerpSelf(Q,1-Z);return!0}}}var d,e,f=[],h,i,p,n=[],w,A,B=[],C,z,M=[],K=new THREE.Vector4,J=new THREE.Vector4,y=new THREE.Matrix4,
+ja=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,ia=new THREE.Vector4,la;this.projectObjects=function(Q,c,ma){c=[];var Z,oa,$;e=0;oa=Q.objects;Q=0;for(Z=oa.length;Q<Z;Q++){$=oa[Q];var U;if(!(U=!$.visible))if(U=$ instanceof THREE.Mesh){a:{U=void 0;for(var R=$.matrixWorld,Da=-$.geometry.boundingSphere.radius*Math.max($.scale.x,Math.max($.scale.y,$.scale.z)),N=0;N<6;N++){U=V[N].x*R.n14+V[N].y*R.n24+
+V[N].z*R.n34+V[N].w;if(U<=Da){U=!1;break a}}U=!0}U=!U}if(!U){d=f[e]=f[e]||new THREE.RenderableObject;K.copy($.position);y.multiplyVector3(K);d.object=$;d.z=K.z;c.push(d);e++}}ma&&c.sort(a);return c};this.projectScene=function(Q,c,ma){var Z=[],oa=c.near,$=c.far,U,R,Da,N,na,ya,S,za,Ka,Pa,Oa,Ha,xa,Y,ua,Ba;p=A=z=0;c.matrixAutoUpdate&&c.updateMatrix();Q.update(undefined,!1,c);y.multiply(c.projectionMatrix,c.matrixWorldInverse);V[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);V[1].set(y.n41+y.n11,
+y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);V[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);V[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);V[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);V[5].set(y.n41+y.n31,y.n42+y.n32,y.n43+y.n33,y.n44+y.n34);for(U=0;U<6;U++){ya=V[U];ya.divideScalar(Math.sqrt(ya.x*ya.x+ya.y*ya.y+ya.z*ya.z))}ya=this.projectObjects(Q,c,!0);Q=0;for(U=ya.length;Q<U;Q++){S=ya[Q].object;if(S.visible){za=S.matrixWorld;Oa=S.matrixRotationWorld;Ka=S.materials;Pa=
+S.overdraw;if(S instanceof THREE.Mesh){Ha=S.geometry;xa=Ha.vertices;R=0;for(Da=xa.length;R<Da;R++){Y=xa[R];Y.positionWorld.copy(Y.position);za.multiplyVector3(Y.positionWorld);N=Y.positionScreen;N.copy(Y.positionWorld);y.multiplyVector4(N);N.x/=N.w;N.y/=N.w;Y.__visible=N.z>oa&&N.z<$}Ha=Ha.faces;R=0;for(Da=Ha.length;R<Da;R++){Y=Ha[R];if(Y instanceof THREE.Face3){N=xa[Y.a];na=xa[Y.b];ua=xa[Y.c];if(N.__visible&&na.__visible&&ua.__visible&&(S.doubleSided||S.flipSided!=(ua.positionScreen.x-N.positionScreen.x)*
+(na.positionScreen.y-N.positionScreen.y)-(ua.positionScreen.y-N.positionScreen.y)*(na.positionScreen.x-N.positionScreen.x)<0)){h=n[p]=n[p]||new THREE.RenderableFace3;h.v1.positionWorld.copy(N.positionWorld);h.v2.positionWorld.copy(na.positionWorld);h.v3.positionWorld.copy(ua.positionWorld);h.v1.positionScreen.copy(N.positionScreen);h.v2.positionScreen.copy(na.positionScreen);h.v3.positionScreen.copy(ua.positionScreen);h.normalWorld.copy(Y.normal);Oa.multiplyVector3(h.normalWorld);h.centroidWorld.copy(Y.centroid);
+za.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);y.multiplyVector3(h.centroidScreen);ua=Y.vertexNormals;la=h.vertexNormalsWorld;N=0;for(na=ua.length;N<na;N++){Ba=la[N]=la[N]||new THREE.Vector3;Ba.copy(ua[N]);Oa.multiplyVector3(Ba)}h.z=h.centroidScreen.z;h.meshMaterials=Ka;h.faceMaterials=Y.materials;h.overdraw=Pa;if(S.geometry.uvs[R]){h.uvs[0]=S.geometry.uvs[R][0];h.uvs[1]=S.geometry.uvs[R][1];h.uvs[2]=S.geometry.uvs[R][2]}Z.push(h);p++}}else if(Y instanceof THREE.Face4){N=
+xa[Y.a];na=xa[Y.b];ua=xa[Y.c];Ba=xa[Y.d];if(N.__visible&&na.__visible&&ua.__visible&&Ba.__visible&&(S.doubleSided||S.flipSided!=((Ba.positionScreen.x-N.positionScreen.x)*(na.positionScreen.y-N.positionScreen.y)-(Ba.positionScreen.y-N.positionScreen.y)*(na.positionScreen.x-N.positionScreen.x)<0||(na.positionScreen.x-ua.positionScreen.x)*(Ba.positionScreen.y-ua.positionScreen.y)-(na.positionScreen.y-ua.positionScreen.y)*(Ba.positionScreen.x-ua.positionScreen.x)<0))){h=n[p]=n[p]||new THREE.RenderableFace3;
+h.v1.positionWorld.copy(N.positionWorld);h.v2.positionWorld.copy(na.positionWorld);h.v3.positionWorld.copy(Ba.positionWorld);h.v1.positionScreen.copy(N.positionScreen);h.v2.positionScreen.copy(na.positionScreen);h.v3.positionScreen.copy(Ba.positionScreen);h.normalWorld.copy(Y.normal);Oa.multiplyVector3(h.normalWorld);h.centroidWorld.copy(Y.centroid);za.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);y.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
+Ka;h.faceMaterials=Y.materials;h.overdraw=Pa;if(S.geometry.uvs[R]){h.uvs[0]=S.geometry.uvs[R][0];h.uvs[1]=S.geometry.uvs[R][1];h.uvs[2]=S.geometry.uvs[R][3]}Z.push(h);p++;i=n[p]=n[p]||new THREE.RenderableFace3;i.v1.positionWorld.copy(na.positionWorld);i.v2.positionWorld.copy(ua.positionWorld);i.v3.positionWorld.copy(Ba.positionWorld);i.v1.positionScreen.copy(na.positionScreen);i.v2.positionScreen.copy(ua.positionScreen);i.v3.positionScreen.copy(Ba.positionScreen);i.normalWorld.copy(h.normalWorld);
+i.centroidWorld.copy(h.centroidWorld);i.centroidScreen.copy(h.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=Ka;i.faceMaterials=Y.materials;i.overdraw=Pa;if(S.geometry.uvs[R]){i.uvs[0]=S.geometry.uvs[R][1];i.uvs[1]=S.geometry.uvs[R][2];i.uvs[2]=S.geometry.uvs[R][3]}Z.push(i);p++}}}}else if(S instanceof THREE.Line){ja.multiply(y,za);xa=S.geometry.vertices;Y=xa[0];Y.positionScreen.copy(Y.position);ja.multiplyVector4(Y.positionScreen);R=1;for(Da=xa.length;R<Da;R++){N=xa[R];N.positionScreen.copy(N.position);
+ja.multiplyVector4(N.positionScreen);na=xa[R-1];ka.copy(N.positionScreen);ia.copy(na.positionScreen);if(b(ka,ia)){ka.multiplyScalar(1/ka.w);ia.multiplyScalar(1/ia.w);w=B[A]=B[A]||new THREE.RenderableLine;w.v1.positionScreen.copy(ka);w.v2.positionScreen.copy(ia);w.z=Math.max(ka.z,ia.z);w.materials=S.materials;Z.push(w);A++}}}else if(S instanceof THREE.Particle){J.set(S.position.x,S.position.y,S.position.z,1);y.multiplyVector4(J);J.z/=J.w;if(J.z>0&&J.z<1){C=M[z]=M[z]||new THREE.RenderableParticle;C.x=
+J.x/J.w;C.y=J.y/J.w;C.z=J.z;C.rotation=S.rotation.z;C.scale.x=S.scale.x*Math.abs(C.x-(J.x+c.projectionMatrix.n11)/(J.w+c.projectionMatrix.n14));C.scale.y=S.scale.y*Math.abs(C.y-(J.y+c.projectionMatrix.n22)/(J.w+c.projectionMatrix.n24));C.materials=S.materials;Z.push(C);z++}}}}ma&&Z.sort(a);return Z};this.unprojectVector=function(Q,c){var ma=c.matrixWorld.clone();ma.multiplySelf(THREE.Matrix4.makeInvert(c.projectionMatrix));ma.multiplyVector3(Q);return Q}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,f=d.length;for(e=0;e<f;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,f=d.length;for(e=0;e<f;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 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",
 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_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",
@@ -176,77 +178,78 @@ 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,
 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.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.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(g,l,n){var i,k,s,p=g.vertices,r=p.length,E=g.colors,F=E.length,q=g.__vertexArray,G=g.__colorArray,S=g.__sortArray,Q=g.__dirtyVertices,O=g.__dirtyColors;if(n.sortParticles){Ha.multiplySelf(n.matrixWorld);for(i=0;i<r;i++){k=p[i].position;Fa.copy(k);Ha.multiplyVector3(Fa);S[i]=[Fa.z,i]}S.sort(function(I,X){return X[0]-I[0]});for(i=0;i<r;i++){k=p[S[i][1]].position;s=i*3;q[s]=k.x;q[s+1]=k.y;q[s+2]=k.z}for(i=0;i<F;i++){s=i*3;color=E[S[i][1]];G[s]=color.r;G[s+1]=
-color.g;G[s+2]=color.b}}else{if(Q)for(i=0;i<r;i++){k=p[i].position;s=i*3;q[s]=k.x;q[s+1]=k.y;q[s+2]=k.z}if(O)for(i=0;i<F;i++){color=E[i];s=i*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(Q||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,q,l)}if(O||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,G,l)}}function d(g,l){g.fragmentShader=l.fragmentShader;g.vertexShader=l.vertexShader;g.uniforms=Uniforms.clone(l.uniforms)}
-function e(g,l,n,i,k){i.program||la.initMaterial(i,l,n,k);var s=i.program,p=s.uniforms,r=i.uniforms;if(s!=ja){c.useProgram(s);ja=s}c.uniformMatrix4fv(p.projectionMatrix,!1,Na);if(n&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=n.far}else if(n instanceof
-THREE.FogExp2)r.fogDensity.value=n.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var E,F,q=0,G=0,S=0,Q,O,I,X=va,Y=X.directional.colors,Da=X.directional.positions,v=X.point.colors,Aa=X.point.positions,ra=0,ya=0;n=F=F=0;for(E=l.length;n<E;n++){F=l[n];Q=F.color;O=F.position;I=F.intensity;if(F instanceof THREE.AmbientLight){q+=Q.r;G+=Q.g;S+=Q.b}else if(F instanceof THREE.DirectionalLight){F=ra*3;Y[F]=Q.r*I;Y[F+1]=Q.g*I;Y[F+2]=Q.b*I;Da[F]=O.x;Da[F+1]=
-O.y;Da[F+2]=O.z;ra+=1}else if(F instanceof THREE.PointLight){F=ya*3;v[F]=Q.r*I;v[F+1]=Q.g*I;v[F+2]=Q.b*I;Aa[F]=O.x;Aa[F+1]=O.y;Aa[F+2]=O.z;ya+=1}}for(n=ra*3;n<Y.length;n++)Y[n]=0;for(n=ya*3;n<v.length;n++)v[n]=0;X.point.length=ya;X.directional.length=ra;X.ambient[0]=q;X.ambient[1]=G;X.ambient[2]=S;l=va;r.enableLighting.value=l.directional.length+l.point.length;r.ambientLightColor.value=l.ambient;r.directionalLightColor.value=l.directional.colors;r.directionalLightDirection.value=l.directional.positions;
-r.pointLightColor.value=l.point.colors;r.pointLightPosition.value=l.point.positions}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
-i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=M.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
-i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var B in r)if(q=s.uniforms[B]){n=r[B];E=n.type;l=n.value;if(E=="i")c.uniform1i(q,l);else if(E=="f")c.uniform1f(q,l);else if(E=="fv1")c.uniform1fv(q,l);else if(E=="fv")c.uniform3fv(q,l);else if(E==
-"v2")c.uniform2f(q,l.x,l.y);else if(E=="v3")c.uniform3f(q,l.x,l.y,l.z);else if(E=="c")c.uniform3f(q,l.r,l.g,l.b);else if(E=="t"){c.uniform1i(q,l);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);for(E=0;E<6;++E)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image[E])}else{n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
-n.image.__webGLTextureCube);for(E=0;E<6;++E)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[E]);n.__wasSetOnce=!0}ga(c.TEXTURE_CUBE_MAP,n,n.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image)}else{n.__webGLTexture=
-c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);n.__wasSetOnce=!0}ga(c.TEXTURE_2D,n,n.image);c.bindTexture(c.TEXTURE_2D,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(p.modelViewMatrix,!1,k._modelViewMatrixArray);c.uniformMatrix3fv(p.normalMatrix,!1,k._normalMatrixArray);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
-i.envMap)&&c.uniform3f(p.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&c.uniformMatrix4fv(p.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&c.uniformMatrix4fv(p.viewMatrix,!1,Ma);if(i.skinning){c.uniformMatrix4fv(p.cameraInverseMatrix,!1,Ma);c.uniformMatrix4fv(p.boneGlobalMatrices,!1,k.boneMatrices)}return s}
-function f(g,l,n,i,k,s){if(i.opacity!=0){g=e(g,l,n,i,s).attributes;if(i.morphTargets){l=i.program.attributes;s.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[s.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(l.position,3,c.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var p=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<p.length;){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[p[n]]);
-c.vertexAttribPointer(l["morphTarget"+n],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[p[n]];n++}}else{p=[];var E=-1,F=0;r=s.morphTargetInfluences;var q,G=r.length;n=0;for(s.morphTargetBase!==-1&&(p[s.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(q=0;q<G;q++)if(!p[q]&&r[q]>E){F=q;E=r[F]}c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[F]);c.vertexAttribPointer(l["morphTarget"+n],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=E;p[F]=1;E=-1;n++}}c.uniform1fv(i.program.uniforms.morphTargetInfluences,
+THREE.WebGLRenderer=function(a){function b(g,m,o){var j,k,s,q=g.vertices,r=q.length,E=g.colors,u=E.length,v=g.__vertexArray,L=g.__colorArray,W=g.__sortArray,H=g.__dirtyVertices,I=g.__dirtyColors;if(o.sortParticles){Ka.multiplySelf(o.matrixWorld);for(j=0;j<r;j++){k=q[j].position;Ha.copy(k);Ka.multiplyVector3(Ha);W[j]=[Ha.z,j]}W.sort(function(O,T){return T[0]-O[0]});for(j=0;j<r;j++){k=q[W[j][1]].position;s=j*3;v[s]=k.x;v[s+1]=k.y;v[s+2]=k.z}for(j=0;j<u;j++){s=j*3;color=E[W[j][1]];L[s]=color.r;L[s+1]=
+color.g;L[s+2]=color.b}}else{if(H)for(j=0;j<r;j++){k=q[j].position;s=j*3;v[s]=k.x;v[s+1]=k.y;v[s+2]=k.z}if(I)for(j=0;j<u;j++){color=E[j];s=j*3;L[s]=color.r;L[s+1]=color.g;L[s+2]=color.b}}if(H||o.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,m)}if(I||o.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,L,m)}}function d(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
+function e(g,m,o,j,k){j.program||oa.initMaterial(j,m,o,k);var s=j.program,q=s.uniforms,r=j.uniforms;if(s!=ma){c.useProgram(s);ma=s}c.uniformMatrix4fv(q.projectionMatrix,!1,Pa);if(o&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
+THREE.FogExp2)r.fogDensity.value=o.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var E,u,v=0,L=0,W=0,H,I,O,T=xa,X=T.directional.colors,P=T.directional.positions,Ca=T.point.colors,x=T.point.positions,Aa=0,ta=0;o=u=u=0;for(E=m.length;o<E;o++){u=m[o];H=u.color;I=u.position;O=u.intensity;if(u instanceof THREE.AmbientLight){v+=H.r;L+=H.g;W+=H.b}else if(u instanceof THREE.DirectionalLight){u=Aa*3;X[u]=H.r*O;X[u+1]=H.g*O;X[u+2]=H.b*O;P[u]=I.x;P[u+1]=I.y;
+P[u+2]=I.z;Aa+=1}else if(u instanceof THREE.PointLight){u=ta*3;Ca[u]=H.r*O;Ca[u+1]=H.g*O;Ca[u+2]=H.b*O;x[u]=I.x;x[u+1]=I.y;x[u+2]=I.z;ta+=1}}for(o=Aa*3;o<X.length;o++)X[o]=0;for(o=ta*3;o<Ca.length;o++)Ca[o]=0;T.point.length=ta;T.directional.length=Aa;T.ambient[0]=v;T.ambient[1]=L;T.ambient[2]=W;m=xa;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
+r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=
+j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Q.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,
+j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var aa in r)if(v=s.uniforms[aa]){o=r[aa];E=o.type;m=o.value;if(E=="i")c.uniform1i(v,m);else if(E=="f")c.uniform1f(v,m);else if(E=="fv1")c.uniform1fv(v,m);else if(E=="fv")c.uniform3fv(v,m);else if(E==
+"v2")c.uniform2f(v,m.x,m.y);else if(E=="v3")c.uniform3f(v,m.x,m.y,m.z);else if(E=="c")c.uniform3f(v,m.r,m.g,m.b);else if(E=="t"){c.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(E=0;E<6;++E)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,c.RGBA,c.UNSIGNED_BYTE,o.image[E])}else{o.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
+o.image.__webGLTextureCube);for(E=0;E<6;++E)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ja(c.TEXTURE_CUBE_MAP,o,o.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
+c.createTexture();c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(c.TEXTURE_2D,o,o.image);c.bindTexture(c.TEXTURE_2D,null);o.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_2D,o.__webGLTexture)}}}c.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);c.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||
+j.envMap)&&c.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&c.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(q.viewMatrix,!1,Oa);if(j.skinning){c.uniformMatrix4fv(q.cameraInverseMatrix,!1,Oa);c.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return s}
+function f(g,m,o,j,k,s){if(j.opacity!=0){g=e(g,m,o,j,s).attributes;if(j.morphTargets){m=j.program.attributes;s.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[s.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(m.position,3,c.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){o=0;for(var q=s.morphTargetForcedOrder,r=s.morphTargetInfluences;o<j.numSupportedMorphTargets&&o<q.length;){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
+c.vertexAttribPointer(m["morphTarget"+o],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,u=0;r=s.morphTargetInfluences;var v,L=r.length;o=0;for(s.morphTargetBase!==-1&&(q[s.morphTargetBase]=!0);o<j.numSupportedMorphTargets;){for(v=0;v<L;v++)if(!q[v]&&r[v]>E){u=v;E=r[u]}c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[u]);c.vertexAttribPointer(m["morphTarget"+o],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[o]=E;q[u]=1;E=-1;o++}}c.uniform1fv(j.program.uniforms.morphTargetInfluences,
 s.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(g.position,3,c.FLOAT,!1,0,0)}if(g.color>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLColorBuffer);c.vertexAttribPointer(g.color,3,c.FLOAT,!1,0,0)}if(g.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLNormalBuffer);c.vertexAttribPointer(g.normal,3,c.FLOAT,!1,0,0)}if(g.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLTangentBuffer);c.vertexAttribPointer(g.tangent,4,c.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,
 s.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(g.position,3,c.FLOAT,!1,0,0)}if(g.color>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLColorBuffer);c.vertexAttribPointer(g.color,3,c.FLOAT,!1,0,0)}if(g.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLNormalBuffer);c.vertexAttribPointer(g.normal,3,c.FLOAT,!1,0,0)}if(g.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLTangentBuffer);c.vertexAttribPointer(g.tangent,4,c.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,
-k.__webGLUVBuffer);c.vertexAttribPointer(g.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv)}else c.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLUV2Buffer);c.vertexAttribPointer(g.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv2)}else c.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);c.vertexAttribPointer(g.skinVertexA,
-4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);c.vertexAttribPointer(g.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);c.vertexAttribPointer(g.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);c.vertexAttribPointer(g.skinWeight,4,c.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(i.wireframe){c.lineWidth(i.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);c.drawElements(c.LINES,
-k.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,k.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(i.linewidth);c.drawArrays(s,0,k.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,k.__webGLParticleCount);else s instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,l){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
-c.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=c.createBuffer();if(g.hasPos){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,g.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.position);c.vertexAttribPointer(l.attributes.position,3,c.FLOAT,!1,0,0)}if(g.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,g.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.normal);c.vertexAttribPointer(l.attributes.normal,
-3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,g.count);g.count=0}function j(g){if(Z!=g.doubleSided){g.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);Z=g.doubleSided}if(R!=g.flipSided){g.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);R=g.flipSided}}function o(g){if(Ba!=g){g?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Ba=g}}function m(g){xa[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);xa[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);xa[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);xa[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);xa[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);xa[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var l;for(g=0;g<6;g++){l=xa[g];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z))}}function u(g){for(var l=g.matrixWorld,n=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),i=0;i<6;i++){g=xa[i].x*l.n14+xa[i].y*l.n24+xa[i].z*l.n34+xa[i].w;if(g<=n)return!1}return!0}function y(g,
-l){g.list[g.count]=l;g.count+=1}function z(g){var l,n,i=g.object,k=g.opaque,s=g.transparent;s.count=0;g=k.count=0;for(l=i.materials.length;g<l;g++){n=i.materials[g];n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?y(s,n):y(k,n)}}function A(g){var l,n,i,k,s=g.object,p=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(i=s.materials.length;g<i;g++){l=s.materials[g];if(l instanceof THREE.MeshFaceMaterial){l=0;for(n=p.materials.length;l<n;l++)(k=p.materials[l])&&(k.opacity&&k.opacity<
-1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k))}else{k=l;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k)}}}function x(g,l){return l.z-g.z}function K(g,l){g._modelViewMatrix.multiplyToArray(l.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function J(g){function l(S){var Q=[];n=0;for(i=S.length;n<i;n++)S[n]==undefined?Q.push("undefined"):Q.push(S[n].id);return Q.join("_")}var n,
-i,k,s,p,r,E,F,q={},G=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(s=g.faces.length;k<s;k++){p=g.faces[k];r=p.materials;E=l(r);q[E]==undefined&&(q[E]={hash:E,counter:0});F=q[E].hash+"_"+q[E].counter;g.geometryGroups[F]==undefined&&(g.geometryGroups[F]={faces:[],materials:r,vertices:0,numMorphTargets:G});p=p instanceof THREE.Face3?3:4;if(g.geometryGroups[F].vertices+p>65535){q[E].counter+=1;F=q[E].hash+"_"+q[E].counter;g.geometryGroups[F]==undefined&&(g.geometryGroups[F]=
-{faces:[],materials:r,vertices:0,numMorphTargets:G})}g.geometryGroups[F].faces.push(k);g.geometryGroups[F].vertices+=p}}function H(g,l,n){g.push({buffer:l,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(g){if(g!=N){switch(g){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}N=g}}function ga(g,l,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(g,c.TEXTURE_WRAP_S,ia(l.wrapS));c.texParameteri(g,c.TEXTURE_WRAP_T,ia(l.wrapT));c.texParameteri(g,c.TEXTURE_MAG_FILTER,ia(l.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,ia(l.minFilter));c.generateMipmap(g)}else{c.texParameteri(g,
-c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_MAG_FILTER,fa(l.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,fa(l.minFilter))}}function U(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=c.createFramebuffer();g.__webGLRenderbuffer=c.createRenderbuffer();g.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,g.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,g.width,g.height);c.bindTexture(c.TEXTURE_2D,
-g.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ia(g.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ia(g.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ia(g.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ia(g.minFilter));c.texImage2D(c.TEXTURE_2D,0,ia(g.format),g.width,g.height,0,ia(g.format),ia(g.type),null);c.bindFramebuffer(c.FRAMEBUFFER,g.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,g.__webGLTexture,
-0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,g.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var l,n;if(g){l=g.__webGLFramebuffer;n=g.width;g=g.height}else{l=null;n=wa;g=P}if(l!=W){c.bindFramebuffer(c.FRAMEBUFFER,l);c.viewport(L,ka,n,g);W=l}}function ha(g,l){var n;if(g=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else g=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,
-l);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));return null}return n}function fa(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function ia(g){switch(g){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;
+k.__webGLUVBuffer);c.vertexAttribPointer(g.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv)}else c.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLUV2Buffer);c.vertexAttribPointer(g.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv2)}else c.disableVertexAttribArray(g.uv2);if(j.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);c.vertexAttribPointer(g.skinVertexA,
+4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);c.vertexAttribPointer(g.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);c.vertexAttribPointer(g.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);c.vertexAttribPointer(g.skinWeight,4,c.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);c.drawElements(c.LINES,
+k.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,k.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(s,0,k.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,k.__webGLParticleCount);else s instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
+c.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=c.createBuffer();if(g.hasPos){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,g.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.position);c.vertexAttribPointer(m.attributes.position,3,c.FLOAT,!1,0,0)}if(g.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,g.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.normal);c.vertexAttribPointer(m.attributes.normal,
+3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,g.count);g.count=0}function i(g){if($!=g.doubleSided){g.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);$=g.doubleSided}if(U!=g.flipSided){g.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);U=g.flipSided}}function p(g){if(Da!=g){g?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Da=g}}function n(g){za[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);za[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);za[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);za[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);za[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);za[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=za[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function w(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),j=0;j<6;j++){g=za[j].x*m.n14+za[j].y*m.n24+za[j].z*m.n34+za[j].w;if(g<=o)return!1}return!0}function A(g,
+m){g.list[g.count]=m;g.count+=1}function B(g){var m,o,j=g.object,k=g.opaque,s=g.transparent;s.count=0;g=k.count=0;for(m=j.materials.length;g<m;g++){o=j.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?A(s,o):A(k,o)}}function C(g){var m,o,j,k,s=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(j=s.materials.length;g<j;g++){m=s.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
+1||k.blending!=THREE.NormalBlending?A(E,k):A(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(E,k):A(r,k)}}}function z(g,m){return m.z-g.z}function M(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(W){var H=[];o=0;for(j=W.length;o<j;o++)W[o]==undefined?H.push("undefined"):H.push(W[o].id);return H.join("_")}var o,
+j,k,s,q,r,E,u,v={},L=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(s=g.faces.length;k<s;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});u=v[E].hash+"_"+v[E].counter;g.geometryGroups[u]==undefined&&(g.geometryGroups[u]={faces:[],materials:r,vertices:0,numMorphTargets:L});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[u].vertices+q>65535){v[E].counter+=1;u=v[E].hash+"_"+v[E].counter;g.geometryGroups[u]==undefined&&(g.geometryGroups[u]=
+{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[u].faces.push(k);g.geometryGroups[u].vertices+=q}}function J(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(g){if(g!=R){switch(g){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){c.texParameteri(g,c.TEXTURE_WRAP_S,la(m.wrapS));c.texParameteri(g,c.TEXTURE_WRAP_T,la(m.wrapT));c.texParameteri(g,c.TEXTURE_MAG_FILTER,la(m.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,la(m.minFilter));c.generateMipmap(g)}else{c.texParameteri(g,
+c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_MAG_FILTER,ia(m.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,ia(m.minFilter))}}function V(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=c.createFramebuffer();g.__webGLRenderbuffer=c.createRenderbuffer();g.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,g.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,g.width,g.height);c.bindTexture(c.TEXTURE_2D,
+g.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,la(g.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,la(g.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,la(g.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,la(g.minFilter));c.texImage2D(c.TEXTURE_2D,0,la(g.format),g.width,g.height,0,la(g.format),la(g.type),null);c.bindFramebuffer(c.FRAMEBUFFER,g.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,g.__webGLTexture,
+0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,g.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ya;g=S}if(m!=Z){c.bindFramebuffer(c.FRAMEBUFFER,m);c.viewport(N,na,o,g);Z=m}}function ka(g,m){var o;if(g=="fragment")o=c.createShader(c.FRAGMENT_SHADER);else g=="vertex"&&(o=c.createShader(c.VERTEX_SHADER));c.shaderSource(o,
+m);c.compileShader(o);if(!c.getShaderParameter(o,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(o));return null}return o}function ia(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function la(g){switch(g){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;
 case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;
 case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;
-case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),c,ja=null,W=null,la=this,Z=null,R=null,N=null,Ba=null,L=0,ka=0,wa=0,P=
-0,xa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ha=new THREE.Matrix4,Na=new Float32Array(16),Ma=new Float32Array(16),Fa=new THREE.Vector4,va={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},V=!0,sa=new THREE.Color(0),za=0;if(a){if(a.antialias!==undefined)V=a.antialias;a.clearColor!==undefined&&sa.setHex(a.clearColor);if(a.clearAlpha!==undefined)za=a.clearAlpha}this.maxMorphTargets=
-8;this.domElement=M;this.autoClear=!0;this.sortObjects=!0;(function(g,l,n){try{if(!(c=M.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(l.r,l.g,l.b,n);_cullEnabled=!0})(V,sa,za);this.context=c;this.setSize=function(g,l){M.width=
-g;M.height=l;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(g,l,n,i){L=g;ka=l;wa=n;P=i;c.viewport(L,ka,wa,P)};this.setScissor=function(g,l,n,i){c.scissor(g,l,n,i)};this.enableScissorTest=function(g){g?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){c.depthMask(g)};this.setClearColorHex=function(g,l){var n=new THREE.Color(g);c.clearColor(n.r,n.g,n.b,l)};this.setClearColor=function(g,l){c.clearColor(g.r,g.g,g.b,l)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
-c.DEPTH_BUFFER_BIT)};this.initMaterial=function(g,l,n,i){var k,s,p;if(g instanceof THREE.MeshDepthMaterial)d(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)d(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)d(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)d(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)d(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)d(g,THREE.ShaderLib.basic);else g instanceof
-THREE.ParticleBasicMaterial&&d(g,THREE.ShaderLib.particle_basic);var r,E,F,q;p=F=q=0;for(r=l.length;p<r;p++){E=l[p];E instanceof THREE.DirectionalLight&&F++;E instanceof THREE.PointLight&&q++}if(q+F<=4)l=F;else{l=Math.ceil(4*F/(q+F));q=4-l}p={directional:l,point:q};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.bones.length;q=g.fragmentShader;l=g.vertexShader;r={fog:n,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,
-morphTargets:g.morphTargets,maxDirLights:p.directional,maxPointLights:p.point,maxBones:r};n=c.createProgram();p=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var Q=document.createElement("canvas"),c,ma=null,Z=null,oa=this,$=null,U=null,R=null,Da=null,N=0,na=0,ya=0,S=
+0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ka=new THREE.Matrix4,Pa=new Float32Array(16),Oa=new Float32Array(16),Ha=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Y=!0,ua=new THREE.Color(0),Ba=0;if(a){if(a.antialias!==undefined)Y=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ba=a.clearAlpha}this.maxMorphTargets=
+8;this.domElement=Q;this.autoClear=!0;this.sortObjects=!0;(function(g,m,o){try{if(!(c=Q.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(j){console.error(j)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(Y,ua,Ba);this.context=c;this.setSize=function(g,m){Q.width=
+g;Q.height=m;this.setViewport(0,0,Q.width,Q.height)};this.setViewport=function(g,m,o,j){N=g;na=m;ya=o;S=j;c.viewport(N,na,ya,S)};this.setScissor=function(g,m,o,j){c.scissor(g,m,o,j)};this.enableScissorTest=function(g){g?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){c.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);c.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){c.clearColor(g.r,g.g,g.b,m)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
+c.DEPTH_BUFFER_BIT)};this.initMaterial=function(g,m,o,j){var k,s,q;if(g instanceof THREE.MeshDepthMaterial)d(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)d(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)d(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)d(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)d(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)d(g,THREE.ShaderLib.basic);else g instanceof
+THREE.ParticleBasicMaterial&&d(g,THREE.ShaderLib.particle_basic);var r,E,u,v;q=u=v=0;for(r=m.length;q<r;q++){E=m[q];E instanceof THREE.DirectionalLight&&u++;E instanceof THREE.PointLight&&v++}if(v+u<=4)m=u;else{m=Math.ceil(4*u/(v+u));v=4-m}q={directional:m,point:v};r=50;if(j!==undefined&&j instanceof THREE.SkinnedMesh)r=j.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,
+morphTargets:g.morphTargets,maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=c.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 r=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
 r=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-c.attachShader(n,ha("fragment",p+q));c.attachShader(n,ha("vertex",r+l));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};g.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)n.push(k);
-k=g.program;q=0;for(l=n.length;q<l;q++){p=n[q];k.uniforms[p]=c.getUniformLocation(k,p)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)n.push("morphTarget"+k);for(s in g.attributes)n.push(s);s=g.program;k=n;n=0;for(q=k.length;n<q;n++){l=k[n];s.attributes[l]=c.getAttribLocation(s,l)}s=g.program.attributes;c.enableVertexAttribArray(s.position);s.color>=0&&c.enableVertexAttribArray(s.color);s.normal>=0&&c.enableVertexAttribArray(s.normal);
+c.attachShader(o,ka("fragment",q+v));c.attachShader(o,ka("vertex",r+m));c.linkProgram(o);c.getProgramParameter(o,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(o,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
+k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=c.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(s in g.attributes)o.push(s);s=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];s.attributes[m]=c.getAttribLocation(s,m)}s=g.program.attributes;c.enableVertexAttribArray(s.position);s.color>=0&&c.enableVertexAttribArray(s.color);s.normal>=0&&c.enableVertexAttribArray(s.normal);
 s.tangent>=0&&c.enableVertexAttribArray(s.tangent);if(g.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){c.enableVertexAttribArray(s.skinVertexA);c.enableVertexAttribArray(s.skinVertexB);c.enableVertexAttribArray(s.skinIndex);c.enableVertexAttribArray(s.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(s.morphTarget0>=0){c.enableVertexAttribArray(s.morphTarget0);g.numSupportedMorphTargets++}if(s.morphTarget1>=0){c.enableVertexAttribArray(s.morphTarget1);
 s.tangent>=0&&c.enableVertexAttribArray(s.tangent);if(g.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){c.enableVertexAttribArray(s.skinVertexA);c.enableVertexAttribArray(s.skinVertexB);c.enableVertexAttribArray(s.skinIndex);c.enableVertexAttribArray(s.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(s.morphTarget0>=0){c.enableVertexAttribArray(s.morphTarget0);g.numSupportedMorphTargets++}if(s.morphTarget1>=0){c.enableVertexAttribArray(s.morphTarget1);
 g.numSupportedMorphTargets++}if(s.morphTarget2>=0){c.enableVertexAttribArray(s.morphTarget2);g.numSupportedMorphTargets++}if(s.morphTarget3>=0){c.enableVertexAttribArray(s.morphTarget3);g.numSupportedMorphTargets++}if(s.morphTarget4>=0){c.enableVertexAttribArray(s.morphTarget4);g.numSupportedMorphTargets++}if(s.morphTarget5>=0){c.enableVertexAttribArray(s.morphTarget5);g.numSupportedMorphTargets++}if(s.morphTarget6>=0){c.enableVertexAttribArray(s.morphTarget6);g.numSupportedMorphTargets++}if(s.morphTarget7>=
 g.numSupportedMorphTargets++}if(s.morphTarget2>=0){c.enableVertexAttribArray(s.morphTarget2);g.numSupportedMorphTargets++}if(s.morphTarget3>=0){c.enableVertexAttribArray(s.morphTarget3);g.numSupportedMorphTargets++}if(s.morphTarget4>=0){c.enableVertexAttribArray(s.morphTarget4);g.numSupportedMorphTargets++}if(s.morphTarget5>=0){c.enableVertexAttribArray(s.morphTarget5);g.numSupportedMorphTargets++}if(s.morphTarget6>=0){c.enableVertexAttribArray(s.morphTarget6);g.numSupportedMorphTargets++}if(s.morphTarget7>=
-0){c.enableVertexAttribArray(s.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,l,n,i){var k,s,p,r,E,F,q,G,S=g.lights,Q=g.fog;l.matrixAutoUpdate&&l.updateMatrix();g.update(undefined,!1,l);l.matrixWorldInverse.flattenToArray(Ma);l.projectionMatrix.flattenToArray(Na);Ha.multiply(l.projectionMatrix,l.matrixWorldInverse);m(Ha);this.initWebGLObjects(g);
-U(n);(this.autoClear||i)&&this.clear();E=g.__webglObjects.length;for(i=0;i<E;i++){k=g.__webglObjects[i];q=k.object;if(q.visible)if(!(q instanceof THREE.Mesh)||u(q)){q.matrixWorld.flattenToArray(q._objectMatrixArray);K(q,l);A(k);k.render=!0;if(this.sortObjects){Fa.copy(q.position);Ha.multiplyVector3(Fa);k.z=Fa.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(x);F=g.__webglObjectsImmediate.length;for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){q.matrixAutoUpdate&&
-q.matrixWorld.flattenToArray(q._objectMatrixArray);K(q,l);z(k)}}w(THREE.NormalBlending);for(i=0;i<E;i++){k=g.__webglObjects[i];if(k.render){q=k.object;G=k.buffer;p=k.opaque;j(q);for(k=0;k<p.count;k++){r=p.list[k];o(r.depthTest);f(l,S,Q,r,G,q)}}}for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){p=k.opaque;j(q);for(k=0;k<p.count;k++){r=p.list[k];o(r.depthTest);s=e(l,S,Q,r,q);q.render(function(O){h(O,s)})}}}for(i=0;i<E;i++){k=g.__webglObjects[i];if(k.render){q=k.object;G=k.buffer;
-p=k.transparent;j(q);for(k=0;k<p.count;k++){r=p.list[k];w(r.blending);o(r.depthTest);f(l,S,Q,r,G,q)}}}for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){p=k.transparent;j(q);for(k=0;k<p.count;k++){r=p.list[k];w(r.blending);o(r.depthTest);s=e(l,S,Q,r,q);q.render(function(O){h(O,s)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var l=g.__objectsAdded[0],n=g,i=void 0,k=void 0,s=void 0;if(l._modelViewMatrix==undefined){l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);l._objectMatrixArray=new Float32Array(16);l.matrixWorld.flattenToArray(l._objectMatrixArray)}if(l instanceof THREE.Mesh){k=l.geometry;k.geometryGroups==undefined&&J(k);for(i in k.geometryGroups){s=
-k.geometryGroups[i];if(!s.__webGLVertexBuffer){var p=s;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=
-c.createBuffer();if(p.numMorphTargets){var r=void 0,E=void 0;p.__webGLMorphTargetsBuffers=[];r=0;for(E=p.numMorphTargets;r<E;r++)p.__webGLMorphTargetsBuffers.push(c.createBuffer())}p=s;var F=l,q=void 0,G=void 0,S=E=r=0,Q=F.geometry.faces,O=p.faces;q=0;for(G=O.length;q<G;q++){fi=O[q];face=Q[fi];if(face instanceof THREE.Face3){r+=3;E+=1;S+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;S+=4}}p.__vertexArray=new Float32Array(r*3);p.__normalArray=new Float32Array(r*3);p.__tangentArray=new Float32Array(r*
-4);p.__colorArray=new Float32Array(r*3);p.__uvArray=new Float32Array(r*2);p.__uv2Array=new Float32Array(r*2);p.__skinVertexAArray=new Float32Array(r*4);p.__skinVertexBArray=new Float32Array(r*4);p.__skinIndexArray=new Float32Array(r*4);p.__skinWeightArray=new Float32Array(r*4);p.__faceArray=new Uint16Array(E*3);p.__lineArray=new Uint16Array(S*2);G=q=p;Q=void 0;O=void 0;var I=void 0,X=void 0;I=void 0;var Y=!1;Q=0;for(O=F.materials.length;Q<O;Q++){I=F.materials[Q];if(I instanceof THREE.MeshFaceMaterial){I=
-0;for(X=G.materials.length;I<X;I++)if(G.materials[I]&&G.materials[I].shading!=undefined&&G.materials[I].shading==THREE.SmoothShading){Y=!0;break}}else if(I&&I.shading!=undefined&&I.shading==THREE.SmoothShading){Y=!0;break}if(Y)break}q.__needsSmoothNormals=Y;p.__webGLFaceCount=E*3;p.__webGLLineCount=S*2;if(p.numMorphTargets){E=void 0;S=void 0;p.__morphTargetsArrays=[];E=0;for(S=p.numMorphTargets;E<S;E++)p.__morphTargetsArrays.push(new Float32Array(r*3))}k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;
-k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}H(n.__webglObjects,s,l)}}else if(l instanceof THREE.Ribbon){k=l.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*3);i.__colorArray=new Float32Array(s*3);i.__webGLVertexCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else if(l instanceof THREE.Line){k=l.geometry;
-if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*3);i.__colorArray=new Float32Array(s*3);i.__webGLLineCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else if(l instanceof THREE.ParticleSystem){k=l.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*
-3);i.__colorArray=new Float32Array(s*3);i.__sortArray=[];i.__webGLParticleCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){l=g.__objectsRemoved[0];n=g;k=void 0;i=void 0;for(k=n.__webglObjects.length-1;k>=0;k--){i=n.__webglObjects[k].object;l==i&&
-n.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}l=0;for(n=g.__webglObjects.length;l<n;l++){i=g.__webglObjects[l].object;s=void 0;k=void 0;p=void 0;if(i instanceof THREE.Mesh){k=i.geometry;for(s in k.geometryGroups){p=k.geometryGroups[s];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=c.DYNAMIC_DRAW;E=void 0;S=void 0;var Da=void 0,v=void 0,Aa=void 0,ra=void 0,ya=void 0;Da=void 0;var B=void 0,C=void 0,
-D=void 0,T=void 0;B=void 0;C=void 0;D=void 0;v=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;v=void 0;ra=void 0;Aa=void 0;ya=void 0;var ta=void 0,Ra=void 0,ma=void 0,na=X=I=Y=O=Q=F=G=q=0,t=0,oa=0,pa=p.__vertexArray,Ta=p.__uvArray,Ua=p.__uv2Array,Ga=p.__normalArray,$=p.__tangentArray,qa=p.__colorArray,aa=p.__skinVertexAArray,ca=p.__skinVertexBArray,da=p.__skinIndexArray,
-ea=p.__skinWeightArray,Va=p.__morphTargetsArrays,Ia=p.__faceArray,Ca=p.__lineArray,bb=p.__needsSmoothNormals,ua=i.geometry,Wa=ua.__dirtyVertices,Xa=ua.__dirtyElements,Sa=ua.__dirtyUvs,Ya=ua.__dirtyNormals,Za=ua.__dirtyTangents,$a=ua.__dirtyColors,ab=ua.__dirtyMorphTargets,Ea=ua.vertices,cb=p.faces,db=ua.faces,eb=ua.uvs,fb=ua.uvs2,Ja=ua.colors,Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,La=ua.skinWeights,Ka=ua.morphTargets;E=0;for(S=cb.length;E<S;E++){Da=cb[E];v=db[Da];ya=eb[Da];Da=fb[Da];
-Aa=v.vertexNormals;ra=v.normal;if(v instanceof THREE.Face3){if(Wa){B=Ea[v.a].position;C=Ea[v.b].position;D=Ea[v.c].position;pa[G]=B.x;pa[G+1]=B.y;pa[G+2]=B.z;pa[G+3]=C.x;pa[G+4]=C.y;pa[G+5]=C.z;pa[G+6]=D.x;pa[G+7]=D.y;pa[G+8]=D.z;G+=9}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){B=Ka[ta].vertices[v.a].position;C=Ka[ta].vertices[v.b].position;D=Ka[ta].vertices[v.c].position;ma=Va[ta];ma[oa+0]=B.x;ma[oa+1]=B.y;ma[oa+2]=B.z;ma[oa+3]=C.x;ma[oa+4]=C.y;ma[oa+5]=C.z;ma[oa+6]=D.x;ma[oa+7]=D.y;ma[oa+8]=D.z}oa+=
-9}if(La.length){B=La[v.a];C=La[v.b];D=La[v.c];ea[t]=B.x;ea[t+1]=B.y;ea[t+2]=B.z;ea[t+3]=B.w;ea[t+4]=C.x;ea[t+5]=C.y;ea[t+6]=C.z;ea[t+7]=C.w;ea[t+8]=D.x;ea[t+9]=D.y;ea[t+10]=D.z;ea[t+11]=D.w;B=Qa[v.a];C=Qa[v.b];D=Qa[v.c];da[t]=B.x;da[t+1]=B.y;da[t+2]=B.z;da[t+3]=B.w;da[t+4]=C.x;da[t+5]=C.y;da[t+6]=C.z;da[t+7]=C.w;da[t+8]=D.x;da[t+9]=D.y;da[t+10]=D.z;da[t+11]=D.w;B=Oa[v.a];C=Oa[v.b];D=Oa[v.c];aa[t]=B.x;aa[t+1]=B.y;aa[t+2]=B.z;aa[t+3]=1;aa[t+4]=C.x;aa[t+5]=C.y;aa[t+6]=C.z;aa[t+7]=1;aa[t+8]=D.x;aa[t+
-9]=D.y;aa[t+10]=D.z;aa[t+11]=1;B=Pa[v.a];C=Pa[v.b];D=Pa[v.c];ca[t]=B.x;ca[t+1]=B.y;ca[t+2]=B.z;ca[t+3]=1;ca[t+4]=C.x;ca[t+5]=C.y;ca[t+6]=C.z;ca[t+7]=1;ca[t+8]=D.x;ca[t+9]=D.y;ca[t+10]=D.z;ca[t+11]=1;t+=12}if($a&&Ja.length){B=Ja[v.a];C=Ja[v.b];D=Ja[v.c];qa[na]=B.r;qa[na+1]=B.g;qa[na+2]=B.b;qa[na+3]=C.r;qa[na+4]=C.g;qa[na+5]=C.b;qa[na+6]=D.r;qa[na+7]=D.g;qa[na+8]=D.b;na+=9}if(Za&&ua.hasTangents){B=Ea[v.a].tangent;C=Ea[v.b].tangent;D=Ea[v.c].tangent;$[I]=B.x;$[I+1]=B.y;$[I+2]=B.z;$[I+3]=B.w;$[I+4]=C.x;
-$[I+5]=C.y;$[I+6]=C.z;$[I+7]=C.w;$[I+8]=D.x;$[I+9]=D.y;$[I+10]=D.z;$[I+11]=D.w;I+=12}if(Ya)if(Aa.length==3&&bb)for(v=0;v<3;v++){ra=Aa[v];Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}else for(v=0;v<3;v++){Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}if(Sa&&ya)for(v=0;v<3;v++){Aa=ya[v];Ta[F]=Aa.u;Ta[F+1]=Aa.v;F+=2}if(Sa&&Da)for(v=0;v<3;v++){ya=Da[v];Ua[Q]=ya.u;Ua[Q+1]=ya.v;Q+=2}if(Xa){Ia[O]=q;Ia[O+1]=q+1;Ia[O+2]=q+2;O+=3;Ca[X]=q;Ca[X+1]=q+1;Ca[X+2]=q;Ca[X+3]=q+2;Ca[X+4]=q+1;Ca[X+5]=q+2;X+=6;q+=3}}else if(v instanceof
-THREE.Face4){if(Wa){B=Ea[v.a].position;C=Ea[v.b].position;D=Ea[v.c].position;T=Ea[v.d].position;pa[G]=B.x;pa[G+1]=B.y;pa[G+2]=B.z;pa[G+3]=C.x;pa[G+4]=C.y;pa[G+5]=C.z;pa[G+6]=D.x;pa[G+7]=D.y;pa[G+8]=D.z;pa[G+9]=T.x;pa[G+10]=T.y;pa[G+11]=T.z;G+=12}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){B=Ka[ta].vertices[v.a].position;C=Ka[ta].vertices[v.b].position;D=Ka[ta].vertices[v.c].position;T=Ka[ta].vertices[v.d].position;ma=Va[ta];ma[oa+0]=B.x;ma[oa+1]=B.y;ma[oa+2]=B.z;ma[oa+3]=C.x;ma[oa+4]=C.y;ma[oa+5]=C.z;
-ma[oa+6]=D.x;ma[oa+7]=D.y;ma[oa+8]=D.z;ma[oa+9]=T.x;ma[oa+10]=T.y;ma[oa+11]=T.z}oa+=12}if(La.length){B=La[v.a];C=La[v.b];D=La[v.c];T=La[v.d];ea[t]=B.x;ea[t+1]=B.y;ea[t+2]=B.z;ea[t+3]=B.w;ea[t+4]=C.x;ea[t+5]=C.y;ea[t+6]=C.z;ea[t+7]=C.w;ea[t+8]=D.x;ea[t+9]=D.y;ea[t+10]=D.z;ea[t+11]=D.w;ea[t+12]=T.x;ea[t+13]=T.y;ea[t+14]=T.z;ea[t+15]=T.w;B=Qa[v.a];C=Qa[v.b];D=Qa[v.c];T=Qa[v.d];da[t]=B.x;da[t+1]=B.y;da[t+2]=B.z;da[t+3]=B.w;da[t+4]=C.x;da[t+5]=C.y;da[t+6]=C.z;da[t+7]=C.w;da[t+8]=D.x;da[t+9]=D.y;da[t+10]=
-D.z;da[t+11]=D.w;da[t+12]=T.x;da[t+13]=T.y;da[t+14]=T.z;da[t+15]=T.w;B=Oa[v.a];C=Oa[v.b];D=Oa[v.c];T=Oa[v.d];aa[t]=B.x;aa[t+1]=B.y;aa[t+2]=B.z;aa[t+3]=1;aa[t+4]=C.x;aa[t+5]=C.y;aa[t+6]=C.z;aa[t+7]=1;aa[t+8]=D.x;aa[t+9]=D.y;aa[t+10]=D.z;aa[t+11]=1;aa[t+12]=T.x;aa[t+13]=T.y;aa[t+14]=T.z;aa[t+15]=1;B=Pa[v.a];C=Pa[v.b];D=Pa[v.c];T=Pa[v.d];ca[t]=B.x;ca[t+1]=B.y;ca[t+2]=B.z;ca[t+3]=1;ca[t+4]=C.x;ca[t+5]=C.y;ca[t+6]=C.z;ca[t+7]=1;ca[t+8]=D.x;ca[t+9]=D.y;ca[t+10]=D.z;ca[t+11]=1;ca[t+12]=T.x;ca[t+13]=T.y;
-ca[t+14]=T.z;ca[t+15]=1;t+=16}if($a&&Ja.length){B=Ja[v.a];C=Ja[v.b];D=Ja[v.c];T=Ja[v.d];qa[na]=B.r;qa[na+1]=B.g;qa[na+2]=B.b;qa[na+3]=C.r;qa[na+4]=C.g;qa[na+5]=C.b;qa[na+6]=D.r;qa[na+7]=D.g;qa[na+8]=D.b;qa[na+9]=T.r;qa[na+10]=T.g;qa[na+11]=T.b;na+=12}if(Za&&ua.hasTangents){B=Ea[v.a].tangent;C=Ea[v.b].tangent;D=Ea[v.c].tangent;v=Ea[v.d].tangent;$[I]=B.x;$[I+1]=B.y;$[I+2]=B.z;$[I+3]=B.w;$[I+4]=C.x;$[I+5]=C.y;$[I+6]=C.z;$[I+7]=C.w;$[I+8]=D.x;$[I+9]=D.y;$[I+10]=D.z;$[I+11]=D.w;$[I+12]=v.x;$[I+13]=v.y;
-$[I+14]=v.z;$[I+15]=v.w;I+=16}if(Ya)if(Aa.length==4&&bb)for(v=0;v<4;v++){ra=Aa[v];Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}else for(v=0;v<4;v++){Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}if(Sa&&ya)for(v=0;v<4;v++){Aa=ya[v];Ta[F]=Aa.u;Ta[F+1]=Aa.v;F+=2}if(Sa&&Da)for(v=0;v<4;v++){ya=Da[v];Ua[Q]=ya.u;Ua[Q+1]=ya.v;Q+=2}if(Xa){Ia[O]=q;Ia[O+1]=q+1;Ia[O+2]=q+2;Ia[O+3]=q;Ia[O+4]=q+2;Ia[O+5]=q+3;O+=6;Ca[X]=q;Ca[X+1]=q+1;Ca[X+2]=q;Ca[X+3]=q+3;Ca[X+4]=q+1;Ca[X+5]=q+2;Ca[X+6]=q+2;Ca[X+7]=q+3;X+=8;q+=4}}}if(Wa){c.bindBuffer(c.ARRAY_BUFFER,
-p.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,pa,r)}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLMorphTargetsBuffers[ta]);c.bufferData(c.ARRAY_BUFFER,Va[ta],r)}}if($a&&Ja.length){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,qa,r)}if(Ya){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ga,r)}if(Za&&ua.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,$,r)}if(Sa&&
-F>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ta,r)}if(Sa&&Q>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ua,r)}if(Xa){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ia,r);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ca,r)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,aa,r);c.bindBuffer(c.ARRAY_BUFFER,
-p.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ca,r);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,da,r);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ea,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;s=c.DYNAMIC_DRAW;q=void 0;
-q=void 0;G=void 0;p=void 0;F=i.vertices;r=i.colors;Q=F.length;E=r.length;O=i.__vertexArray;S=i.__colorArray;Y=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<Q;q++){G=F[q].position;p=q*3;O[p]=G.x;O[p+1]=G.y;O[p+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,O,s)}if(Y){for(q=0;q<E;q++){color=r[q];p=q*3;S[p]=color.r;S[p+1]=color.g;S[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,S,s)}}k.__dirtyVertices=!1;k.__dirtyColors=
-!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;s=c.DYNAMIC_DRAW;q=void 0;q=void 0;G=void 0;p=void 0;F=i.vertices;r=i.colors;Q=F.length;E=r.length;O=i.__vertexArray;S=i.__colorArray;Y=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<Q;q++){G=F[q].position;p=q*3;O[p]=G.x;O[p+1]=G.y;O[p+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,O,s)}if(Y){for(q=0;q<E;q++){color=r[q];p=q*3;S[p]=color.r;S[p+1]=color.g;S[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
-i.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,S,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,c.DYNAMIC_DRAW,i);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,l){if(g){!l||l=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(g=="back")c.cullFace(c.BACK);else g=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};
-this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+0){c.enableVertexAttribArray(s.morphTarget7);g.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)j.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,j){var k,s,q,r,E,u,v,L,W=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Oa);m.projectionMatrix.flattenToArray(Pa);Ka.multiply(m.projectionMatrix,m.matrixWorldInverse);n(Ka);this.initWebGLObjects(g);
+V(o);(this.autoClear||j)&&this.clear();E=g.__webglObjects.length;for(j=0;j<E;j++){k=g.__webglObjects[j];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,m);C(k);k.render=!0;if(this.sortObjects){Ha.copy(v.position);Ka.multiplyVector3(Ha);k.z=Ha.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(z);u=g.__webglObjectsImmediate.length;for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);M(v,m);B(k)}}y(THREE.NormalBlending);for(j=0;j<E;j++){k=g.__webglObjects[j];if(k.render){v=k.object;L=k.buffer;q=k.opaque;i(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,W,H,r,L,v)}}}for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){q=k.opaque;i(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);s=e(m,W,H,r,v);v.render(function(I){h(I,s)})}}}for(j=0;j<E;j++){k=g.__webglObjects[j];if(k.render){v=k.object;L=k.buffer;
+q=k.transparent;i(v);for(k=0;k<q.count;k++){r=q.list[k];y(r.blending);p(r.depthTest);f(m,W,H,r,L,v)}}}for(j=0;j<u;j++){k=g.__webglObjectsImmediate[j];v=k.object;if(v.visible){q=k.transparent;i(v);for(k=0;k<q.count;k++){r=q.list[k];y(r.blending);p(r.depthTest);s=e(m,W,H,r,v);v.render(function(I){h(I,s)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,j=void 0,k=void 0,s=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(j in k.geometryGroups){s=
+k.geometryGroups[j];if(!s.__webGLVertexBuffer){var q=s;q.__webGLVertexBuffer=c.createBuffer();q.__webGLNormalBuffer=c.createBuffer();q.__webGLTangentBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q.__webGLUVBuffer=c.createBuffer();q.__webGLUV2Buffer=c.createBuffer();q.__webGLSkinVertexABuffer=c.createBuffer();q.__webGLSkinVertexBBuffer=c.createBuffer();q.__webGLSkinIndicesBuffer=c.createBuffer();q.__webGLSkinWeightsBuffer=c.createBuffer();q.__webGLFaceBuffer=c.createBuffer();q.__webGLLineBuffer=
+c.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(c.createBuffer())}q=s;var u=m,v=void 0,L=void 0,W=E=r=0;v=void 0;var H=void 0;L=void 0;L=void 0;var I=u.geometry;H=I.faces;var O=q.faces;v=0;for(L=O.length;v<L;v++){fi=O[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;W+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;W+=4}}v=q;L=u;H=void 0;O=void 0;var T=void 0,X=void 0;T=void 0;
+var P=[];H=0;for(O=L.materials.length;H<O;H++){T=L.materials[H];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=v.materials.length;T<l;T++)(X=v.materials[T])&&P.push(X)}else(X=T)&&P.push(X)}L=P;a:{v=void 0;H=void 0;O=L.length;for(v=0;v<O;v++){H=L[v];if(H.map||H.lightMap){v=!0;break a}}v=!1}a:{H=void 0;O=void 0;P=L.length;for(H=0;H<P;H++){O=L[H];if(O.vertexColors){H=O.vertexColors;break a}}H=!1}a:{O=void 0;P=void 0;T=L.length;for(O=0;O<T;O++){P=L[O];if(!(P instanceof THREE.MeshBasicMaterial||P instanceof
+THREE.MeshDepthMaterial)){L=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(L)q.__normalArray=new Float32Array(r*3);if(I.hasTangents)q.__tangentArray=new Float32Array(r*4);if(H)q.__colorArray=new Float32Array(r*3);if(v){if(I.faceUvs.length>0||I.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(I.faceUvs.length>1||I.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(r*2)}if(u.geometry.skinWeights.length&&
+u.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(W*2);if(q.numMorphTargets){u=void 0;I=void 0;q.__morphTargetsArrays=[];u=0;for(I=q.numMorphTargets;u<I;u++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=L==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=
+H;q.__normalType=L;q.__webGLFaceCount=E*3;q.__webGLLineCount=W*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}J(o.__webglObjects,s,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=
+s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=m.geometry;if(!k.__webGLVertexBuffer){j=k;j.__webGLVertexBuffer=
+c.createBuffer();j.__webGLColorBuffer=c.createBuffer();j=k;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}J(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];
+o=g;k=void 0;j=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){j=o.__webglObjects[k].object;m==j&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){j=g.__webglObjects[m].object;s=void 0;k=void 0;q=void 0;if(j instanceof THREE.Mesh){k=j.geometry;for(s in k.geometryGroups){q=k.geometryGroups[s];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=c.DYNAMIC_DRAW;E=void 0;
+W=void 0;var Ca=void 0,x=void 0,Aa=void 0,ta=void 0,aa=void 0,Fa=void 0,Ja=void 0;Ca=void 0;var D=void 0,F=void 0,G=void 0,ca=void 0;aa=void 0;Fa=void 0;D=void 0;x=void 0;D=void 0;F=void 0;G=void 0;aa=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;D=void 0;F=void 0;G=void 0;ca=void 0;x=void 0;ta=void 0;Aa=void 0;Ja=void 0;var va=void 0,Ta=void 0,pa=void 0,t=X=T=P=O=H=L=v=I=u=0,qa=0,ra=q.__vertexArray,Va=q.__uvArray,Wa=q.__uv2Array,
+Ia=q.__normalArray,da=q.__tangentArray,sa=q.__colorArray,ea=q.__skinVertexAArray,fa=q.__skinVertexBArray,ga=q.__skinIndexArray,ha=q.__skinWeightArray,Ya=q.__morphTargetsArrays,La=q.__faceArray,Ea=q.__lineArray,eb=q.__needsSmoothNormals,Xa=q.__vertexColorType,wa=j.geometry,Za=wa.__dirtyVertices,$a=wa.__dirtyElements,Ua=wa.__dirtyUvs,ab=wa.__dirtyNormals,bb=wa.__dirtyTangents,cb=wa.__dirtyColors,db=wa.__dirtyMorphTargets,Ga=wa.vertices,fb=q.faces,gb=wa.faces,hb=wa.faceVertexUvs[0],ib=wa.faceVertexUvs[1],
+jb=wa.colors,Qa=wa.skinVerticesA,Ra=wa.skinVerticesB,Sa=wa.skinIndices,Na=wa.skinWeights,Ma=wa.morphTargets;E=0;for(W=fb.length;E<W;E++){Ca=fb[E];x=gb[Ca];Ja=hb[Ca];Ca=ib[Ca];Aa=x.vertexNormals;ta=x.normal;aa=x.vertexColors;Fa=x.color;if(x instanceof THREE.Face3){if(Za){D=Ga[x.a].position;F=Ga[x.b].position;G=Ga[x.c].position;ra[I]=D.x;ra[I+1]=D.y;ra[I+2]=D.z;ra[I+3]=F.x;ra[I+4]=F.y;ra[I+5]=F.z;ra[I+6]=G.x;ra[I+7]=G.y;ra[I+8]=G.z;I+=9}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){D=Ma[va].vertices[x.a].position;
+F=Ma[va].vertices[x.b].position;G=Ma[va].vertices[x.c].position;pa=Ya[va];pa[qa+0]=D.x;pa[qa+1]=D.y;pa[qa+2]=D.z;pa[qa+3]=F.x;pa[qa+4]=F.y;pa[qa+5]=F.z;pa[qa+6]=G.x;pa[qa+7]=G.y;pa[qa+8]=G.z}qa+=9}if(Na.length){D=Na[x.a];F=Na[x.b];G=Na[x.c];ha[t]=D.x;ha[t+1]=D.y;ha[t+2]=D.z;ha[t+3]=D.w;ha[t+4]=F.x;ha[t+5]=F.y;ha[t+6]=F.z;ha[t+7]=F.w;ha[t+8]=G.x;ha[t+9]=G.y;ha[t+10]=G.z;ha[t+11]=G.w;D=Sa[x.a];F=Sa[x.b];G=Sa[x.c];ga[t]=D.x;ga[t+1]=D.y;ga[t+2]=D.z;ga[t+3]=D.w;ga[t+4]=F.x;ga[t+5]=F.y;ga[t+6]=F.z;ga[t+
+7]=F.w;ga[t+8]=G.x;ga[t+9]=G.y;ga[t+10]=G.z;ga[t+11]=G.w;D=Qa[x.a];F=Qa[x.b];G=Qa[x.c];ea[t]=D.x;ea[t+1]=D.y;ea[t+2]=D.z;ea[t+3]=1;ea[t+4]=F.x;ea[t+5]=F.y;ea[t+6]=F.z;ea[t+7]=1;ea[t+8]=G.x;ea[t+9]=G.y;ea[t+10]=G.z;ea[t+11]=1;D=Ra[x.a];F=Ra[x.b];G=Ra[x.c];fa[t]=D.x;fa[t+1]=D.y;fa[t+2]=D.z;fa[t+3]=1;fa[t+4]=F.x;fa[t+5]=F.y;fa[t+6]=F.z;fa[t+7]=1;fa[t+8]=G.x;fa[t+9]=G.y;fa[t+10]=G.z;fa[t+11]=1;t+=12}if(cb&&Xa){if(aa.length==3&&Xa==THREE.VertexColors){D=aa[0];F=aa[1];G=aa[2]}else G=F=D=Fa;sa[X]=D.r;sa[X+
+1]=D.g;sa[X+2]=D.b;sa[X+3]=F.r;sa[X+4]=F.g;sa[X+5]=F.b;sa[X+6]=G.r;sa[X+7]=G.g;sa[X+8]=G.b;X+=9}if(bb&&wa.hasTangents){aa=Ga[x.a].tangent;Fa=Ga[x.b].tangent;D=Ga[x.c].tangent;da[P]=aa.x;da[P+1]=aa.y;da[P+2]=aa.z;da[P+3]=aa.w;da[P+4]=Fa.x;da[P+5]=Fa.y;da[P+6]=Fa.z;da[P+7]=Fa.w;da[P+8]=D.x;da[P+9]=D.y;da[P+10]=D.z;da[P+11]=D.w;P+=12}if(ab)if(Aa.length==3&&eb)for(x=0;x<3;x++){ta=Aa[x];Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}else for(x=0;x<3;x++){Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}if(Ua&&Ja)for(x=
+0;x<3;x++){Aa=Ja[x];Va[v]=Aa.u;Va[v+1]=Aa.v;v+=2}if(Ua&&Ca)for(x=0;x<3;x++){Ja=Ca[x];Wa[L]=Ja.u;Wa[L+1]=Ja.v;L+=2}if($a){La[H]=u;La[H+1]=u+1;La[H+2]=u+2;H+=3;Ea[T]=u;Ea[T+1]=u+1;Ea[T+2]=u;Ea[T+3]=u+2;Ea[T+4]=u+1;Ea[T+5]=u+2;T+=6;u+=3}}else if(x instanceof THREE.Face4){if(Za){D=Ga[x.a].position;F=Ga[x.b].position;G=Ga[x.c].position;ca=Ga[x.d].position;ra[I]=D.x;ra[I+1]=D.y;ra[I+2]=D.z;ra[I+3]=F.x;ra[I+4]=F.y;ra[I+5]=F.z;ra[I+6]=G.x;ra[I+7]=G.y;ra[I+8]=G.z;ra[I+9]=ca.x;ra[I+10]=ca.y;ra[I+11]=ca.z;I+=
+12}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){D=Ma[va].vertices[x.a].position;F=Ma[va].vertices[x.b].position;G=Ma[va].vertices[x.c].position;ca=Ma[va].vertices[x.d].position;pa=Ya[va];pa[qa+0]=D.x;pa[qa+1]=D.y;pa[qa+2]=D.z;pa[qa+3]=F.x;pa[qa+4]=F.y;pa[qa+5]=F.z;pa[qa+6]=G.x;pa[qa+7]=G.y;pa[qa+8]=G.z;pa[qa+9]=ca.x;pa[qa+10]=ca.y;pa[qa+11]=ca.z}qa+=12}if(Na.length){D=Na[x.a];F=Na[x.b];G=Na[x.c];ca=Na[x.d];ha[t]=D.x;ha[t+1]=D.y;ha[t+2]=D.z;ha[t+3]=D.w;ha[t+4]=F.x;ha[t+5]=F.y;ha[t+6]=F.z;ha[t+7]=F.w;ha[t+
+8]=G.x;ha[t+9]=G.y;ha[t+10]=G.z;ha[t+11]=G.w;ha[t+12]=ca.x;ha[t+13]=ca.y;ha[t+14]=ca.z;ha[t+15]=ca.w;D=Sa[x.a];F=Sa[x.b];G=Sa[x.c];ca=Sa[x.d];ga[t]=D.x;ga[t+1]=D.y;ga[t+2]=D.z;ga[t+3]=D.w;ga[t+4]=F.x;ga[t+5]=F.y;ga[t+6]=F.z;ga[t+7]=F.w;ga[t+8]=G.x;ga[t+9]=G.y;ga[t+10]=G.z;ga[t+11]=G.w;ga[t+12]=ca.x;ga[t+13]=ca.y;ga[t+14]=ca.z;ga[t+15]=ca.w;D=Qa[x.a];F=Qa[x.b];G=Qa[x.c];ca=Qa[x.d];ea[t]=D.x;ea[t+1]=D.y;ea[t+2]=D.z;ea[t+3]=1;ea[t+4]=F.x;ea[t+5]=F.y;ea[t+6]=F.z;ea[t+7]=1;ea[t+8]=G.x;ea[t+9]=G.y;ea[t+
+10]=G.z;ea[t+11]=1;ea[t+12]=ca.x;ea[t+13]=ca.y;ea[t+14]=ca.z;ea[t+15]=1;D=Ra[x.a];F=Ra[x.b];G=Ra[x.c];ca=Ra[x.d];fa[t]=D.x;fa[t+1]=D.y;fa[t+2]=D.z;fa[t+3]=1;fa[t+4]=F.x;fa[t+5]=F.y;fa[t+6]=F.z;fa[t+7]=1;fa[t+8]=G.x;fa[t+9]=G.y;fa[t+10]=G.z;fa[t+11]=1;fa[t+12]=ca.x;fa[t+13]=ca.y;fa[t+14]=ca.z;fa[t+15]=1;t+=16}if(cb&&Xa){if(aa.length==4&&Xa==THREE.VertexColors){D=aa[0];F=aa[1];G=aa[2];aa=aa[3]}else aa=G=F=D=Fa;sa[X]=D.r;sa[X+1]=D.g;sa[X+2]=D.b;sa[X+3]=F.r;sa[X+4]=F.g;sa[X+5]=F.b;sa[X+6]=G.r;sa[X+7]=
+G.g;sa[X+8]=G.b;sa[X+9]=aa.r;sa[X+10]=aa.g;sa[X+11]=aa.b;X+=12}if(bb&&wa.hasTangents){aa=Ga[x.a].tangent;Fa=Ga[x.b].tangent;D=Ga[x.c].tangent;x=Ga[x.d].tangent;da[P]=aa.x;da[P+1]=aa.y;da[P+2]=aa.z;da[P+3]=aa.w;da[P+4]=Fa.x;da[P+5]=Fa.y;da[P+6]=Fa.z;da[P+7]=Fa.w;da[P+8]=D.x;da[P+9]=D.y;da[P+10]=D.z;da[P+11]=D.w;da[P+12]=x.x;da[P+13]=x.y;da[P+14]=x.z;da[P+15]=x.w;P+=16}if(ab)if(Aa.length==4&&eb)for(x=0;x<4;x++){ta=Aa[x];Ia[O]=ta.x;Ia[O+1]=ta.y;Ia[O+2]=ta.z;O+=3}else for(x=0;x<4;x++){Ia[O]=ta.x;Ia[O+
+1]=ta.y;Ia[O+2]=ta.z;O+=3}if(Ua&&Ja)for(x=0;x<4;x++){Aa=Ja[x];Va[v]=Aa.u;Va[v+1]=Aa.v;v+=2}if(Ua&&Ca)for(x=0;x<4;x++){Ja=Ca[x];Wa[L]=Ja.u;Wa[L+1]=Ja.v;L+=2}if($a){La[H]=u;La[H+1]=u+1;La[H+2]=u+2;La[H+3]=u;La[H+4]=u+2;La[H+5]=u+3;H+=6;Ea[T]=u;Ea[T+1]=u+1;Ea[T+2]=u;Ea[T+3]=u+3;Ea[T+4]=u+1;Ea[T+5]=u+2;Ea[T+6]=u+2;Ea[T+7]=u+3;T+=8;u+=4}}}if(Za){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,ra,r)}if(db){va=0;for(Ta=Ma.length;va<Ta;va++){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[va]);
+c.bufferData(c.ARRAY_BUFFER,Ya[va],r)}}if(cb&&jb.length){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,r)}if(ab){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ia,r)}if(bb&&wa.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,da,r)}if(Ua&&v>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Va,r)}if(Ua&&L>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,
+Wa,r)}if($a){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,La,r);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ea,r)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ea,r);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,fa,r);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ga,r);c.bindBuffer(c.ARRAY_BUFFER,
+q.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ha,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){k=j.geometry;if(k.__dirtyVertices||k.__dirtyColors){j=k;s=c.DYNAMIC_DRAW;u=void 0;u=void 0;I=void 0;q=void 0;v=j.vertices;r=j.colors;L=v.length;E=r.length;H=j.__vertexArray;W=j.__colorArray;O=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<L;u++){I=v[u].position;
+q=u*3;H[q]=I.x;H[q+1]=I.y;H[q+2]=I.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,H,s)}if(O){for(u=0;u<E;u++){color=r[u];q=u*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,W,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(j instanceof THREE.Line){k=j.geometry;if(k.__dirtyVertices||k.__dirtyColors){j=k;s=c.DYNAMIC_DRAW;u=void 0;u=void 0;I=void 0;q=void 0;v=j.vertices;r=j.colors;L=v.length;
+E=r.length;H=j.__vertexArray;W=j.__colorArray;O=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<L;u++){I=v[u].position;q=u*3;H[q]=I.x;H[q+1]=I.y;H[q+2]=I.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,H,s)}if(O){for(u=0;u<E;u++){color=r[u];q=u*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,W,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){k=j.geometry;
+(k.__dirtyVertices||k.__dirtyColors||j.sortParticles)&&b(k,c.DYNAMIC_DRAW,j);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(g=="back")c.cullFace(c.BACK);else g=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

+ 3 - 1
examples/obj/female02/Female02_bin.js

@@ -4,10 +4,12 @@
 //  materials: 6
 //  materials: 6
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

File diff suppressed because it is too large
+ 5 - 1
examples/obj/female02/Female02_slim.js


+ 3 - 1
examples/obj/lucy/Lucy100k_bin.js

@@ -4,10 +4,12 @@
 //  materials: 0
 //  materials: 0
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

File diff suppressed because it is too large
+ 5 - 3
examples/obj/lucy/Lucy100k_slim.js


+ 3 - 1
examples/obj/male02/Male02_bin.js

@@ -4,10 +4,12 @@
 //  materials: 5
 //  materials: 5
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

File diff suppressed because it is too large
+ 5 - 1
examples/obj/male02/Male02_slim.js


+ 3 - 1
examples/obj/ninja/NinjaLo_bin.js

@@ -4,10 +4,12 @@
 //  materials: 0
 //  materials: 0
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

+ 3 - 1
examples/obj/torus/Torus_bin.js

@@ -4,10 +4,12 @@
 //  materials: 1
 //  materials: 1
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

File diff suppressed because it is too large
+ 5 - 1
examples/obj/torus/Torus_slim.js


+ 3 - 1
examples/obj/walt/WaltHead_bin.js

@@ -4,10 +4,12 @@
 //  materials: 1
 //  materials: 1
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [	{
     'materials': [	{
 	"DbgColor" : 0xeeeeee,
 	"DbgColor" : 0xeeeeee,
 	"DbgIndex" : 0,
 	"DbgIndex" : 0,

File diff suppressed because it is too large
+ 5 - 1
examples/obj/walt/WaltHead_slim.js


+ 6 - 6
examples/webgl_objconvert_test.html

@@ -112,8 +112,8 @@
 				xm.map.needsUpdate = true;
 				xm.map.needsUpdate = true;
 				
 				
 				geometry = new Plane( 100, 100, 15, 10 );
 				geometry = new Plane( 100, 100, 15, 10 );
-				for(var i=0; i<geometry.uvs.length; i++) {
-					var uvs = geometry.uvs[i];
+				for(var i=0; i<geometry.faceVertexUvs.length; i++) {
+					var uvs = geometry.faceVertexUvs[i];
 					for ( j = 0, jl = uvs.length; j < jl; j++ ) {
 					for ( j = 0, jl = uvs.length; j < jl; j++ ) {
 						uvs[j].u *= 10;
 						uvs[j].u *= 10;
 						uvs[j].v *= 10;
 						uvs[j].v *= 10;
@@ -192,11 +192,11 @@
 					callbackMale   = function( geometry ) { createScene( geometry,  90, 50, FLOOR, 105 ) },
 					callbackMale   = function( geometry ) { createScene( geometry,  90, 50, FLOOR, 105 ) },
 					callbackFemale = function( geometry ) { createScene( geometry, -80, 50, FLOOR, 0 ) };
 					callbackFemale = function( geometry ) { createScene( geometry, -80, 50, FLOOR, 0 ) };
 
 
-				//loader.loadAscii( { model: "obj/male02/Male02_slim.js", callback: callbackMale } );
-				//loader.loadAscii( { model: "obj/female02/Female02_slim.js", callback: callbackFemale } );
+				loader.loadAscii( { model: "obj/male02/Male02_slim.js", callback: callbackMale } );
+				loader.loadAscii( { model: "obj/female02/Female02_slim.js", callback: callbackFemale } );
 
 
-				loader.loadBinary( { model: "obj/male02/Male02_bin.js", callback: callbackMale } );
-				loader.loadBinary( { model: "obj/female02/Female02_bin.js", callback: callbackFemale } );
+				//loader.loadBinary( { model: "obj/male02/Male02_bin.js", callback: callbackMale } );
+				//loader.loadBinary( { model: "obj/female02/Female02_bin.js", callback: callbackFemale } );
 
 
 			}
 			}
 
 

+ 2 - 2
src/extras/geometries/Cube.js

@@ -116,8 +116,8 @@ var Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, segme
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var d = ( ix + 1 ) + gridX1 * iy;
 				var d = ( ix + 1 ) + gridX1 * iy;
 
 
-				scope.faces.push( new THREE.Face4( a + offset, b + offset, c + offset, d + offset, null, material ) );
-				scope.uvs.push( [
+				scope.faces.push( new THREE.Face4( a + offset, b + offset, c + offset, d + offset, null, null, material ) );
+				scope.faceVertexUvs.push( [
 							new THREE.UV( ix / gridX, iy / gridY ),
 							new THREE.UV( ix / gridX, iy / gridY ),
 							new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 							new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 							new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),
 							new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),

+ 1 - 1
src/extras/geometries/Plane.js

@@ -41,7 +41,7 @@ var Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
 			var d = ( ix + 1 ) + gridX1 * iy;
 			var d = ( ix + 1 ) + gridX1 * iy;
 
 
 			this.faces.push( new THREE.Face4( a, b, c, d ) );
 			this.faces.push( new THREE.Face4( a, b, c, d ) );
-			this.uvs.push( [
+			this.faceVertexUvs.push( [
 						new THREE.UV( ix / gridX, iy / gridY ),
 						new THREE.UV( ix / gridX, iy / gridY ),
 						new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 						new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
 						new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),
 						new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -3503,7 +3503,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			
 			
 			m = materials[ i ];
 			m = materials[ i ];
 			
 			
-			if ( m instanceof THREE.MeshBasicMaterial || m instanceof MeshDepthMaterial ) continue;
+			if ( m instanceof THREE.MeshBasicMaterial || m instanceof THREE.MeshDepthMaterial ) continue;
 			
 			
 			if ( materialNeedsSmoothNormals( m ) ) {
 			if ( materialNeedsSmoothNormals( m ) ) {
 				
 				

+ 88 - 96
utils/exporters/convert_obj_three.py

@@ -1,10 +1,10 @@
-"""Convert Wavefront OBJ / MTL files into Three.js (slim models version, to be used with web worker based ascii / binary loader)
+"""Convert Wavefront OBJ / MTL files into Three.js (JSON model version, to be used with web worker based ascii / binary loader)
 
 
 -------------------------
 -------------------------
 How to use this converter
 How to use this converter
 -------------------------
 -------------------------
 
 
-python convert_obj_threejs_slim.py -i infile.obj -o outfile.js [-m morphfiles*.obj] [-a center|top|bottom] [-s smooth|flat] [-t ascii|binary] [-d invert|normal]
+python convert_obj_three.py -i infile.obj -o outfile.js [-m morphfiles*.obj] [-a center|top|bottom] [-s smooth|flat] [-t ascii|binary] [-d invert|normal]
 
 
 Notes: 
 Notes: 
 
 
@@ -32,7 +32,7 @@ How to use generated JS file in your HTML document
         var loader = new THREE.Loader();
         var loader = new THREE.Loader();
         
         
         // load ascii model
         // load ascii model
-        loader.loadAscii( "Model_slim.js", function( geometry ) { createScene( geometry) }, path_to_textures );
+        loader.loadAscii( "Model_ascii.js", function( geometry ) { createScene( geometry) }, path_to_textures );
 
 
         // load binary model
         // load binary model
         loader.loadBinary( "Model_bin.js", function( geometry ) { createScene( geometry) }, path_to_textures );
         loader.loadBinary( "Model_bin.js", function( geometry ) { createScene( geometry) }, path_to_textures );
@@ -147,32 +147,28 @@ TEMPLATE_FILE_ASCII = u"""\
 // Converted from: %(fname)s
 // Converted from: %(fname)s
 //  vertices: %(nvertex)d
 //  vertices: %(nvertex)d
 //  faces: %(nface)d 
 //  faces: %(nface)d 
+//  normals: %(nnormal)d 
+//  uvs: %(nuv)d 
 //  materials: %(nmaterial)d
 //  materials: %(nmaterial)d
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 2,
+    
     'materials': [%(materials)s],
     'materials': [%(materials)s],
 
 
-    'normals': [%(normals)s],
-
     'vertices': [%(vertices)s],
     'vertices': [%(vertices)s],
 
 
     'morphTargets': [%(morphTargets)s],
     'morphTargets': [%(morphTargets)s],
-    
-    'uvs': [%(uvs)s],
 
 
-    'triangles': [%(triangles)s],
-    'trianglesUvs': [%(trianglesUvs)s],
-    'trianglesNormals': [%(trianglesNormals)s],
-    'trianglesNormalsUvs': [%(trianglesNormalsUvs)s],
+    'normals': [%(normals)s],
+
+    'uvs': [%(uvs)s],
 
 
-    'quads': [%(quads)s],
-    'quadsUvs': [%(quadsUvs)s],
-    'quadsNormals': [%(quadsNormals)s],
-    'quadsNormalsUvs': [%(quadsNormalsUvs)s],
+    'faces': [%(faces)s],
 
 
     'end': (new Date).getTime()
     'end': (new Date).getTime()
     }
     }
@@ -187,10 +183,12 @@ TEMPLATE_FILE_BIN = u"""\
 //  materials: %(nmaterial)d
 //  materials: %(nmaterial)d
 //
 //
 //  Generated with OBJ -> Three.js converter
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 
 
 var model = {
 var model = {
+    'version' : 1,
+
     'materials': [%(materials)s],
     'materials': [%(materials)s],
 
 
     'buffers': '%(buffers)s',
     'buffers': '%(buffers)s',
@@ -203,21 +201,6 @@ postMessage( model );
 
 
 TEMPLATE_VERTEX = "%f,%f,%f"
 TEMPLATE_VERTEX = "%f,%f,%f"
 
 
-TEMPLATE_UV_TRI = "%f,%f,%f,%f,%f,%f"
-TEMPLATE_UV_QUAD = "%f,%f,%f,%f,%f,%f,%f,%f"
-
-TEMPLATE_TRI = "%d,%d,%d,%d"
-TEMPLATE_QUAD = "%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_UV = "%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_N = "%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_N = "%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
-TEMPLATE_TRI_N_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
-TEMPLATE_QUAD_N_UV = "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
-
 TEMPLATE_N = "%f,%f,%f"
 TEMPLATE_N = "%f,%f,%f"
 TEMPLATE_UV = "%f,%f"
 TEMPLATE_UV = "%f,%f"
 
 
@@ -571,64 +554,78 @@ def parse_obj(fname):
 # #####################################################
 # #####################################################
 # Generator
 # Generator
 # #####################################################
 # #####################################################
+def setBit(value, position, on):
+    if on:
+        mask = 1 << position
+        return (value | mask)
+    else:
+        mask = ~(1 << position)
+        return (value & mask)
+    
 def generate_vertex(v):
 def generate_vertex(v):
     return TEMPLATE_VERTEX % (v[0], v[1], v[2])
     return TEMPLATE_VERTEX % (v[0], v[1], v[2])
     
     
-def generate_triangle(f):
-    v = f['vertex']
-    return TEMPLATE_TRI % (v[0]-1, v[1]-1, v[2]-1, 
-                           f['material'])
-
-def generate_triangle_uv(f):
-    v = f['vertex']
-    uv = f['uv']
-    return TEMPLATE_TRI_UV % (v[0]-1, v[1]-1, v[2]-1, 
-                              f['material'], 
-                              uv[0]-1, uv[1]-1, uv[2]-1)
-
-def generate_triangle_n(f):
-    v = f['vertex']
-    n = f['normal']
-    return TEMPLATE_TRI_N % (v[0]-1, v[1]-1, v[2]-1, 
-                             f['material'], 
-                             n[0]-1, n[1]-1, n[2]-1)
-
-def generate_triangle_n_uv(f):
-    v = f['vertex']
-    n = f['normal']
-    uv = f['uv']
-    return TEMPLATE_TRI_N_UV % (v[0]-1, v[1]-1, v[2]-1, 
-                                f['material'], 
-                                n[0]-1, n[1]-1, n[2]-1, 
-                                uv[0]-1, uv[1]-1, uv[2]-1)
-
-def generate_quad(f):
-    vi = f['vertex']
-    return TEMPLATE_QUAD % (vi[0]-1, vi[1]-1, vi[2]-1, vi[3]-1, 
-                            f['material'])
+def generate_face(f):
+    isTriangle = ( len(f['vertex']) == 3 )
+    
+    if isTriangle:
+        nVertices = 3
+    else:
+        nVertices = 4
+        
+    hasMaterial = True # for the moment OBJs without materials get default material
+    
+    hasFaceUvs = False # not supported in OBJ
+    hasFaceVertexUvs = ( len(f['uv']) == nVertices )
 
 
-def generate_quad_uv(f):
-    v = f['vertex']
-    uv = f['uv']
-    return TEMPLATE_QUAD_UV % (v[0]-1, v[1]-1, v[2]-1, v[3]-1, 
-                               f['material'], 
-                               uv[0]-1, uv[1]-1, uv[2]-1, uv[3]-1)
-
-def generate_quad_n(f):
-    v = f['vertex']
-    n = f['normal']
-    return TEMPLATE_QUAD_N % (v[0]-1, v[1]-1, v[2]-1, v[3]-1, 
-                              f['material'],
-                              n[0]-1, n[1]-1, n[2]-1, n[3]-1)
-
-def generate_quad_n_uv(f):
-    v = f['vertex']
-    n = f['normal']
-    uv = f['uv']
-    return TEMPLATE_QUAD_N_UV % (v[0]-1, v[1]-1, v[2]-1, v[3]-1, 
-                                 f['material'],
-                                 n[0]-1, n[1]-1, n[2]-1, n[3]-1,
-                                 uv[0]-1, uv[1]-1, uv[2]-1, uv[3]-1)
+    hasFaceNormals = False # don't export any face normals (as they are computed in engine)
+    hasFaceVertexNormals = ( len(f["normal"]) == nVertices and SHADING == "smooth" )
+    
+    hasFaceColors = False       # not supported in OBJ
+    hasFaceVertexColors = False # not supported in OBJ
+
+    faceType = 0
+    faceType = setBit(faceType, 0, not isTriangle)
+    faceType = setBit(faceType, 1, hasMaterial)
+    faceType = setBit(faceType, 2, hasFaceUvs)
+    faceType = setBit(faceType, 3, hasFaceVertexUvs)
+    faceType = setBit(faceType, 4, hasFaceNormals)
+    faceType = setBit(faceType, 5, hasFaceVertexNormals)
+    faceType = setBit(faceType, 6, hasFaceColors)
+    faceType = setBit(faceType, 7, hasFaceVertexColors)    
+    
+    faceData = []
+    
+    # order is important, must match order in JSONLoader
+    
+    # face type
+    # vertex indices
+    # material index
+    # face uvs index
+    # face vertex uvs indices
+    # face color index
+    # face vertex colors indices
+    
+    faceData.append(faceType)    
+    
+    # must clamp in case on polygons bigger than quads
+    for i in xrange(nVertices):
+        index = f['vertex'][i] - 1
+        faceData.append(index)
+    
+    faceData.append( f['material'] )
+
+    if hasFaceVertexUvs:
+        for i in xrange(nVertices):
+            index = f['uv'][i] - 1
+            faceData.append(index)
+
+    if hasFaceVertexNormals:
+        for i in xrange(nVertices):
+            index = f['normal'][i] - 1
+            faceData.append(index)
+
+    return ",".join( map(str, faceData) )
 
 
 def generate_normal(n):
 def generate_normal(n):
     return TEMPLATE_N % (n[0], n[1], n[2])
     return TEMPLATE_N % (n[0], n[1], n[2])
@@ -819,11 +816,11 @@ def convert_ascii(infile, morphfiles, outfile):
     
     
     n_vertices = len(vertices)
     n_vertices = len(vertices)
     
     
+    nnormal = 0
     normals_string = ""
     normals_string = ""
     if SHADING == "smooth":
     if SHADING == "smooth":
         normals_string = ",".join(generate_normal(n) for n in normals)
         normals_string = ",".join(generate_normal(n) for n in normals)
-        
-    sfaces = sort_faces(faces)
+        nnormal = len(normals)
     
     
     skipOriginalMorph = False
     skipOriginalMorph = False
     norminfile = os.path.normpath(infile)
     norminfile = os.path.normpath(infile)
@@ -860,6 +857,8 @@ def convert_ascii(infile, morphfiles, outfile):
     "fname"     : infile,
     "fname"     : infile,
     "nvertex"   : len(vertices),
     "nvertex"   : len(vertices),
     "nface"     : len(faces),
     "nface"     : len(faces),
+    "nuv"       : len(uvs),
+    "nnormal"   : nnormal,
     "nmaterial" : len(materials),
     "nmaterial" : len(materials),
 
 
     "materials" : generate_materials_string(materials, mtllib),
     "materials" : generate_materials_string(materials, mtllib),
@@ -870,14 +869,7 @@ def convert_ascii(infile, morphfiles, outfile):
     
     
     "morphTargets"  : morphTargets,
     "morphTargets"  : morphTargets,
     
     
-    "triangles"     : ",".join(generate_triangle(f) for f in sfaces['triangles_flat']),
-    "trianglesUvs"  : ",".join(generate_triangle_uv(f) for f in sfaces['triangles_flat_uv']),
-    "trianglesNormals"   : ",".join(generate_triangle_n(f) for f in sfaces['triangles_smooth']),
-    "trianglesNormalsUvs": ",".join(generate_triangle_n_uv(f) for f in sfaces['triangles_smooth_uv']),
-    "quads"         : ",".join(generate_quad(f) for f in sfaces['quads_flat']),
-    "quadsUvs"      : ",".join(generate_quad_uv(f) for f in sfaces['quads_flat_uv']),
-    "quadsNormals"       : ",".join(generate_quad_n(f) for f in sfaces['quads_smooth']),
-    "quadsNormalsUvs"    : ",".join(generate_quad_n_uv(f) for f in sfaces['quads_smooth_uv'])
+    "faces"     : ",".join(generate_face(f) for f in faces)
     }
     }
     
     
     out = open(outfile, "w")
     out = open(outfile, "w")

Some files were not shown because too many files changed in this diff