Selaa lähdekoodia

Merge branch 'master' of git://github.com/mrdoob/three.js

Mikael Emtinger 14 vuotta sitten
vanhempi
commit
f70aaed1d8

+ 256 - 256
build/Three.js

@@ -12,33 +12,33 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,c,d,f){this.set(b||0,c||0,d||0,f||1)};
 THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,c){this.set(this.x+(b.x-this.x)*c,this.y+(b.y-this.y)*c,this.z+(b.z-this.z)*c,this.w+(b.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(G,L,V,z){z=z.clone().subSelf(L);V=V.clone().subSelf(L);var N=G.clone().subSelf(L);G=z.dot(z);L=z.dot(V);z=z.dot(N);var P=V.dot(V);V=V.dot(N);N=1/(G*P-L*L);P=(P*z-L*V)*N;G=(G*V-L*z)*N;return P>0&&G>0&&P+G<1}var d,f,g,h,j,k,n,o,p,u,
-y,v=b.geometry,A=v.vertices,E=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];u=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(A[g.a].position.clone());j=n.multiplyVector3(A[g.b].position.clone());k=n.multiplyVector3(A[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(A[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());p=y.dot(o);if(b.doubleSided||(b.flipSided?p>0:p<0)){o=o.dot((new THREE.Vector3).sub(h,u))/
-p;u=u.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(c(u,h,j,k)){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};E.push(g)}}else if(g instanceof THREE.Face4&&(c(u,h,j,n)||c(u,j,k,n))){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};E.push(g)}}}return E}};
-THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,o,p,u){k=!1;c=n;d=o;f=p;g=u;b()};this.addPoint=function(n,o){if(k){k=!1;c=n;d=o;f=n;g=o}else{c=c<n?c:n;d=d<o?d:o;f=f>n?f:n;g=g>o?g:o}b()};
-this.add3Points=function(n,o,p,u,y,v){if(k){k=!1;c=n<p?n<y?n:y:p<y?p:y;d=o<u?o<v?o:v:u<v?u:v;f=n>p?n>y?n:y:p>y?p:y;g=o>u?o>v?o:v:u>v?u:v}else{c=n<p?n<y?n<c?n:c:y<c?y:c:p<y?p<c?p:c:y<c?y:c;d=o<u?o<v?o<d?o:d:v<d?v:d:u<v?u<d?u:d:v<d?v:d;f=n>p?n>y?n>f?n:f:y>f?y:f:p>y?p>f?p:f:y>f?y:f;g=o>u?o>v?o>g?o:g:v>g?v:g:u>v?u>g?u:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();f=f>n.getRight()?
+THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(G,N,W,z){z=z.clone().subSelf(N);W=W.clone().subSelf(N);var O=G.clone().subSelf(N);G=z.dot(z);N=z.dot(W);z=z.dot(O);var P=W.dot(W);W=W.dot(O);O=1/(G*P-N*N);P=(P*z-N*W)*O;G=(G*W-N*z)*O;return P>0&&G>0&&P+G<1}var d,f,g,h,j,k,n,p,o,x,
+y,v=b.geometry,B=v.vertices,F=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];x=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(B[g.a].position.clone());j=n.multiplyVector3(B[g.b].position.clone());k=n.multiplyVector3(B[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,x))/
+o;x=x.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(c(x,h,j,n)||c(x,j,k,n))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}}return F}};
+THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,x){k=!1;c=n;d=p;f=o;g=x;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=c<n?c:n;d=d<p?d:p;f=f>n?f:n;g=g>p?g:p}b()};
+this.add3Points=function(n,p,o,x,y,v){if(k){k=!1;c=n<o?n<y?n:y:o<y?o:y;d=p<x?p<v?p:v:x<v?x:v;f=n>o?n>y?n:y:o>y?o:y;g=p>x?p>v?p:v:x>v?x:v}else{c=n<o?n<y?n<c?n:c:y<c?y:c:o<y?o<c?o:c:y<c?y:c;d=p<x?p<v?p<d?p:d:v<d?v:d:x<v?x<d?x:d:v<d?v:d;f=n>o?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>x?p>v?p>g?p:g:v>g?v:g:x>v?x>g?x:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();f=f>n.getRight()?
 f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){c-=n;d-=n;f+=n;g+=n;b()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f<n.getRight()?f:n.getRight();g=g<n.getBottom()?g:n.getBottom();b()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,o,p,u,y,v,A,E){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,o||0,p||1,u||0,y||0,v||0,A||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,o,p,u,y,v,A,E){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=o;this.n33=p;this.n34=u;this.n41=y;this.n42=v;this.n43=A;this.n44=E;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1,
+THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,x,y,v,B,F){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,y||0,v||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,x,y,v,B,F){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=x;this.n41=y;this.n42=v;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,o=b.n24,p=b.n31,u=b.n32,y=b.n33,v=b.n34,A=b.n41,E=b.n42,G=b.n43,L=b.n44,V=c.n11,z=c.n12,N=c.n13,P=c.n14,S=c.n21,xa=c.n22,
-sa=c.n23,qa=c.n24,e=c.n31,fa=c.n32,da=c.n33,ya=c.n34;this.n11=d*V+f*S+g*e;this.n12=d*z+f*xa+g*fa;this.n13=d*N+f*sa+g*da;this.n14=d*P+f*qa+g*ya+h;this.n21=j*V+k*S+n*e;this.n22=j*z+k*xa+n*fa;this.n23=j*N+k*sa+n*da;this.n24=j*P+k*qa+n*ya+o;this.n31=p*V+u*S+y*e;this.n32=p*z+u*xa+y*fa;this.n33=p*N+u*sa+y*da;this.n34=p*P+u*qa+y*ya+v;this.n41=A*V+E*S+G*e;this.n42=A*z+E*xa+G*fa;this.n43=A*N+E*sa+G*da;this.n44=A*P+E*qa+G*ya+L;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,G=b.n43,N=b.n44,W=c.n11,z=c.n12,O=c.n13,P=c.n14,S=c.n21,xa=c.n22,
+sa=c.n23,qa=c.n24,e=c.n31,fa=c.n32,da=c.n33,ya=c.n34;this.n11=d*W+f*S+g*e;this.n12=d*z+f*xa+g*fa;this.n13=d*O+f*sa+g*da;this.n14=d*P+f*qa+g*ya+h;this.n21=j*W+k*S+n*e;this.n22=j*z+k*xa+n*fa;this.n23=j*O+k*sa+n*da;this.n24=j*P+k*qa+n*ya+p;this.n31=o*W+x*S+y*e;this.n32=o*z+x*xa+y*fa;this.n33=o*O+x*sa+y*da;this.n34=o*P+x*qa+y*ya+v;this.n41=B*W+F*S+G*e;this.n42=B*z+F*xa+G*fa;this.n43=B*O+F*sa+G*da;this.n44=B*P+F*qa+G*ya+N;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=
 this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,o=this.n32,p=this.n33,u=this.n34,y=this.n41,v=this.n42,A=this.n43,E=this.n44;return f*j*o*y-d*k*o*y-f*h*p*y+c*k*p*y+d*h*u*y-c*j*u*y-f*j*n*v+d*k*n*v+f*g*p*v-b*k*p*v-d*g*u*v+b*j*u*v+f*h*n*A-c*k*n*A-f*g*o*A+b*k*o*A+c*g*u*A-b*h*u*A-d*h*n*E+c*j*n*E+d*g*o*E-b*j*o*E-c*g*p*E+b*h*p*E},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,x=this.n34,y=this.n41,v=this.n42,B=this.n43,F=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*x*y-c*j*x*y-f*j*n*v+d*k*n*v+f*g*o*v-b*k*o*v-d*g*x*v+b*j*x*v+f*h*n*B-c*k*n*B-f*g*p*B+b*k*p*B+c*g*x*B-b*h*x*B-d*h*n*F+c*j*n*F+d*g*p*F-b*j*p*F-c*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,
 0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),g=
-1-d,h=b.x,j=b.y,k=b.z,n=g*h,o=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,o*j+d,o*k-f*h,0,n*k-f*j,o*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=
-b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var o=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
+1-d,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+d,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=
+b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,o=b.n24,p=b.n31,u=b.n32,y=b.n33,v=b.n34,A=b.n41,E=b.n42,G=b.n43,L=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*E-o*y*E+o*u*G-k*v*G-n*u*L+k*y*L;c.n12=h*y*E-g*v*E-h*u*G+f*v*G+g*u*L-f*y*L;c.n13=g*o*E-h*n*E+h*k*G-f*o*G-g*k*L+f*n*L;c.n14=h*n*u-g*o*u-h*k*y+f*o*y+g*k*v-f*n*v;c.n21=o*y*A-n*v*A-o*p*G+j*v*G+n*p*L-j*y*L;c.n22=g*v*A-h*y*A+h*p*G-d*v*G-g*p*L+d*y*L;c.n23=h*n*A-g*o*A-h*j*G+d*o*G+g*j*L-d*n*L;
-c.n24=g*o*p-h*n*p+h*j*y-d*o*y-g*j*v+d*n*v;c.n31=k*v*A-o*u*A+o*p*E-j*v*E-k*p*L+j*u*L;c.n32=h*u*A-f*v*A-h*p*E+d*v*E+f*p*L-d*u*L;c.n33=g*o*A-h*k*A+h*j*E-d*o*E-f*j*L+d*k*L;c.n34=h*k*p-f*o*p-h*j*u+d*o*u+f*j*v-d*k*v;c.n41=n*u*A-k*y*A-n*p*E+j*y*E+k*p*G-j*u*G;c.n42=f*y*A-g*u*A+g*p*E-d*y*E-f*p*G+d*u*G;c.n43=g*k*A-f*n*A-g*j*E+d*n*E+f*j*G-d*k*G;c.n44=f*n*p-g*k*p+g*j*u-d*n*u-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*o;d[7]=b*p;d[8]=b*u;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,G=b.n43,N=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*F-p*y*F+p*x*G-k*v*G-n*x*N+k*y*N;c.n12=h*y*F-g*v*F-h*x*G+f*v*G+g*x*N-f*y*N;c.n13=g*p*F-h*n*F+h*k*G-f*p*G-g*k*N+f*n*N;c.n14=h*n*x-g*p*x-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*B-n*v*B-p*o*G+j*v*G+n*o*N-j*y*N;c.n22=g*v*B-h*y*B+h*o*G-d*v*G-g*o*N+d*y*N;c.n23=h*n*B-g*p*B-h*j*G+d*p*G+g*j*N-d*n*N;
+c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*B-p*x*B+p*o*F-j*v*F-k*o*N+j*x*N;c.n32=h*x*B-f*v*B-h*o*F+d*v*F+f*o*N-d*x*N;c.n33=g*p*B-h*k*B+h*j*F-d*p*F-f*j*N+d*k*N;c.n34=h*k*o-f*p*o-h*j*x+d*p*x+f*j*v-d*k*v;c.n41=n*x*B-k*y*B-n*o*F+j*y*F+k*o*G-j*x*G;c.n42=f*y*B-g*x*B+g*o*F-d*y*F-f*o*G+d*x*G;c.n43=g*k*B-f*n*B-g*j*F+d*n*F+f*j*G-d*k*G;c.n44=f*n*o-g*k*o+g*j*x-d*n*x-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*x;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,o;j=new THREE.Matrix4;k=c-b;n=d-f;o=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
@@ -47,7 +47,7 @@ undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c
 c,d)}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==undefined?f:1)};
 THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,g=b.z*c;b=Math.cos(f);f=Math.sin(f);c=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var c=this.x,d=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this},
-multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,o=n*d+j*g-k*f,p=n*f+k*d-h*g,u=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=o*n+d*-h+p*-k-u*-j;c.y=p*n+d*-j+u*-h-o*-k;c.z=u*n+d*-k+o*-j-p*-h;return c}};
+multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,x=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-x*-j;c.y=o*n+d*-j+x*-h-p*-k;c.z=x*n+d*-k+p*-j-o*-h;return c}};
 THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=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.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
@@ -56,32 +56,32 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f
 d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,d.position);n.sub(c.position,d.position);k.crossSelf(n)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];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{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);
-d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(aa,pa,za,ia,Y,ma,Da){k=aa.vertices[pa].position;n=aa.vertices[za].position;o=aa.vertices[ia].position;p=j[Y];u=j[ma];y=j[Da];v=n.x-k.x;A=o.x-k.x;E=n.y-k.y;G=o.y-k.y;L=n.z-k.z;V=o.z-k.z;z=u.u-p.u;N=y.u-p.u;P=u.v-p.v;S=y.v-p.v;xa=1/(z*S-
-N*P);fa.set((S*v-P*A)*xa,(S*E-P*G)*xa,(S*L-P*V)*xa);da.set((z*A-N*v)*xa,(z*G-N*E)*xa,(z*V-N*L)*xa);qa[pa].addSelf(fa);qa[za].addSelf(fa);qa[ia].addSelf(fa);e[pa].addSelf(da);e[za].addSelf(da);e[ia].addSelf(da)}var c,d,f,g,h,j,k,n,o,p,u,y,v,A,E,G,L,V,z,N,P,S,xa,sa,qa=[],e=[],fa=new THREE.Vector3,da=new THREE.Vector3,ya=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){qa[c]=new THREE.Vector3;e[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
+d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(aa,pa,za,ia,Y,ma,Da){k=aa.vertices[pa].position;n=aa.vertices[za].position;p=aa.vertices[ia].position;o=j[Y];x=j[ma];y=j[Da];v=n.x-k.x;B=p.x-k.x;F=n.y-k.y;G=p.y-k.y;N=n.z-k.z;W=p.z-k.z;z=x.u-o.u;O=y.u-o.u;P=x.v-o.v;S=y.v-o.v;xa=1/(z*S-
+O*P);fa.set((S*v-P*B)*xa,(S*F-P*G)*xa,(S*N-P*W)*xa);da.set((z*B-O*v)*xa,(z*G-O*F)*xa,(z*W-O*N)*xa);qa[pa].addSelf(fa);qa[za].addSelf(fa);qa[ia].addSelf(fa);e[pa].addSelf(da);e[za].addSelf(da);e[ia].addSelf(da)}var c,d,f,g,h,j,k,n,p,o,x,y,v,B,F,G,N,W,z,O,P,S,xa,sa,qa=[],e=[],fa=new THREE.Vector3,da=new THREE.Vector3,ya=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){qa[c]=new THREE.Vector3;e[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
 this.faces[c];j=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var ra=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Ga.copy(h.vertexNormals[f]);g=h[ra[f]];sa=qa[g];ya.copy(sa);ya.subSelf(Ga.multiplyScalar(Ga.dot(sa))).normalize();Fa.cross(h.vertexNormals[f],sa);g=Fa.dot(e[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(ya.x,
 ya.y,ya.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere=
-{radius:b}},computeEdgeFaces:function(){function b(n,o){return Math.min(n,o)+"_"+Math.max(n,o)}function c(n,o,p){if(n[o]===undefined){n[o]={set:{},array:[]};n[o].set[p]=1;n[o].array.push(p)}else if(n[o].set[p]===undefined){n[o].set[p]=1;n[o].array.push(p)}}var d,f,g,h,j,k={};d=0;for(f=this.faces.length;d<f;d++){j=this.faces[d];if(j instanceof THREE.Face3){g=b(j.a,j.b);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.a,j.c);c(k,g,d)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);c(k,g,d);g=b(j.a,j.b);c(k,g,d);
+{radius:b}},computeEdgeFaces:function(){function b(n,p){return Math.min(n,p)+"_"+Math.max(n,p)}function c(n,p,o){if(n[p]===undefined){n[p]={set:{},array:[]};n[p].set[o]=1;n[p].array.push(o)}else if(n[p].set[o]===undefined){n[p].set[o]=1;n[p].array.push(o)}}var d,f,g,h,j,k={};d=0;for(f=this.faces.length;d<f;d++){j=this.faces[d];if(j instanceof THREE.Face3){g=b(j.a,j.b);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.a,j.c);c(k,g,d)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);c(k,g,d);g=b(j.a,j.b);c(k,g,d);
 g=b(j.a,j.d);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.c,j.d);c(k,g,d)}}d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(v,A,E,G,L,V,z){v=(E-v)*0.5;G=(G-A)*0.5;return(2*(A-E)+v+G)*z+(-3*(A-E)-2*v-G)*V+v*L+A}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,o,p,u,y;this.initFromArray=function(v){this.points=[];for(var A=0;A<v.length;A++)this.points[A]={x:v[A][0],y:v[A][1],z:v[A][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];p=this.points[d[1]];
-u=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(o.x,p.x,u.x,y.x,j,k,n);f.y=c(o.y,p.y,u.y,y.y,j,k,n);f.z=c(o.z,p.z,u.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,A,E=this.points.length,G=[];for(v=0;v<E;v++){A=this.points[v];G[v]=[A.x,A.y,A.z]}return G};this.getLength=function(v){var A,E,G=A=A=0,L=new THREE.Vector3,V=new THREE.Vector3,z=[],N=0;z[0]=0;v||(v=100);E=this.points.length*v;L.copy(this.points[0]);for(v=1;v<E;v++){A=v/E;position=this.getPoint(A);V.copy(position);
-N+=V.distanceTo(L);L.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=G){z[A]=N;G=A}}z[z.length]=N;return{chunks:z,total:N}};this.reparametrizeByArcLength=function(v){var A,E,G,L,V,z,N=[],P=new THREE.Vector3,S=this.getLength();N.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){E=S.chunks[A]-S.chunks[A-1];z=Math.ceil(v*E/S.total);L=(A-1)/(this.points.length-1);V=A/(this.points.length-1);for(E=1;E<z-1;E++){G=L+E*(1/z)*(V-L);position=this.getPoint(G);N.push(P.copy(position).clone())}N.push(P.copy(this.points[A]).clone())}this.points=
-N}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
+THREE.Spline=function(b){function c(v,B,F,G,N,W,z){v=(F-v)*0.5;G=(G-B)*0.5;return(2*(B-F)+v+G)*z+(-3*(B-F)-2*v-G)*W+v*N+B}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,x,y;this.initFromArray=function(v){this.points=[];for(var B=0;B<v.length;B++)this.points[B]={x:v[B][0],y:v[B][1],z:v[B][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
+x=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,x.x,y.x,j,k,n);f.y=c(p.y,o.y,x.y,y.y,j,k,n);f.z=c(p.z,o.z,x.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,B,F=this.points.length,G=[];for(v=0;v<F;v++){B=this.points[v];G[v]=[B.x,B.y,B.z]}return G};this.getLength=function(v){var B,F,G=B=B=0,N=new THREE.Vector3,W=new THREE.Vector3,z=[],O=0;z[0]=0;v||(v=100);F=this.points.length*v;N.copy(this.points[0]);for(v=1;v<F;v++){B=v/F;position=this.getPoint(B);W.copy(position);
+O+=W.distanceTo(N);N.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=G){z[B]=O;G=B}}z[z.length]=O;return{chunks:z,total:O}};this.reparametrizeByArcLength=function(v){var B,F,G,N,W,z,O=[],P=new THREE.Vector3,S=this.getLength();O.push(P.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){F=S.chunks[B]-S.chunks[B-1];z=Math.ceil(v*F/S.total);N=(B-1)/(this.points.length-1);W=B/(this.points.length-1);for(F=1;F<z-1;F++){G=N+F*(1/z)*(W-N);position=this.getPoint(G);O.push(P.copy(position).clone())}O.push(P.copy(this.points[B]).clone())}this.points=
+O}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
 THREE.AnimationHandler=function(){var b=[],c={},d={};d.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};d.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};d.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};d.add=function(g){c[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");c[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<
-0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var o=g.hierarchy[h].keys[j].morphTargets[n];k[o]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var p=
-{};for(o in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===o){p[o]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(p[o]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=p}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
+0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
+{};for(p in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
 g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};d.get=function(g){if(typeof g==="string")if(c[g])return c[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};d.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};d.LINEAR=
 0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(b,c,d,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);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=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=c!==undefined?c:0;var d,f=this.hierarchy.length,g;for(d=0;d<f;d++){g=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
 g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.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];g.pos=this.getNextKeyWith("pos",d,1);g.rot=this.getNextKeyWith("rot",d,1);g.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.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,f,g,h,j,k,n,o,p=this.data.JIT.hierarchy,u,y;this.currentTime+=b*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;o=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,A=this.hierarchy.length;v<A;v++){b=this.hierarchy[v];n=b.animationCache;if(this.JITCompile&&p[v][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=p[v][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=p[v][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var E=0;E<3;E++){d=c[E];j=n.prevKey[d];k=n.nextKey[d];if(k.time<=y){if(u<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(d,v,1);k.time<u;){j=k;k=this.getNextKeyWith(d,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(d,v,k.index+1)}while(k.time<
-u)}n.prevKey[d]=j;n.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(k.time-j.time);g=j[d];h=k[d];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,f,g,h,j,k,n,p,o=this.data.JIT.hierarchy,x,y;this.currentTime+=b*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;p=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,B=this.hierarchy.length;v<B;v++){b=this.hierarchy[v];n=b.animationCache;if(this.JITCompile&&o[v][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var F=0;F<3;F++){d=c[F];j=n.prevKey[d];k=n.nextKey[d];if(k.time<=y){if(x<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(d,v,1);k.time<x;){j=k;k=this.getNextKeyWith(d,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(d,v,k.index+1)}while(k.time<
+x)}n.prevKey[d]=j;n.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(x-j.time)/(k.time-j.time);g=j[d];h=k[d];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d===
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&p[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;v<this.hierarchy.length;v++)p[v][o]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],f=[],g,h,j,k,n,o;g=(b.length-1)*c;h=Math.floor(g);g-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];n=b[d[2]];o=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],n[0],o[0],g,d,j);f[1]=this.interpolate(h[1],k[1],n[1],o[1],g,d,j);f[2]=this.interpolate(h[2],k[2],n[2],o[2],g,d,j);return f};
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],f=[],g,h,j,k,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];n=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,d,j);return f};
 THREE.Animation.prototype.interpolate=function(b,c,d,f,g,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<f.length-1?d:f.length-1;else d%=f.length;for(;d<f.length;d++)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+f.length;d>=0;d--)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.Camera=function(b,c,d,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
@@ -139,65 +139,65 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
 !1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,o,p,u=["a","b","c","d"];for(n=0;n<h;n++){k=c.length;j=g[n];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
-0;k<o;k++){p=b[j[u[k]]];c.push(new THREE.Vertex(p.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,o,p,u,y,v,A,E,G=0,L=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=c[L[A]];k=b[h];for(E=0;E<g;E++){j=d[L[E]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){o=k;p=n;u=h;y=j;v=L[A]}if(G===2){v+=L[A];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[o,p,n,k],indices:[u,
-y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[o,k,n,p],indices:[u,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,x=["a","b","c","d"];for(n=0;n<h;n++){k=c.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
+0;k<p;k++){o=b[j[x[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,p,o,x,y,v,B,F,G=0,N=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=c[N[B]];k=b[h];for(F=0;F<g;F++){j=d[N[F]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){p=k;o=n;x=h;y=j;v=N[B]}if(G===2){v+=N[B];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,n,k],indices:[x,
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,n,o],indices:[x,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else if(b instanceof THREE.Sound){c=this.sounds.indexOf(b);c!==-1&&this.sounds.splice(c,1)}else if(!(b instanceof THREE.Camera)){c=this.objects.indexOf(b);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(b)}}for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==undefined?c:2.5E-4};
 THREE.Projector=function(){function b(){var fa=n[k]=n[k]||new THREE.RenderableVertex;k++;return fa}function c(fa,da){return da.z-fa.z}function d(fa,da){var ya=0,Fa=1,Ga=fa.z+fa.w,ra=da.z+da.w,aa=-fa.z+fa.w,pa=-da.z+da.w;if(Ga>=0&&ra>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ra<0||aa<0&&pa<0)return!1;else{if(Ga<0)ya=Math.max(ya,Ga/(Ga-ra));else ra<0&&(Fa=Math.min(Fa,Ga/(Ga-ra)));if(aa<0)ya=Math.max(ya,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(Fa<ya)return!1;else{fa.lerpSelf(da,ya);da.lerpSelf(fa,
-1-Fa);return!0}}}var f,g,h=[],j,k,n=[],o,p,u=[],y,v=[],A,E,G=[],L,V,z=[],N=new THREE.Vector4,P=new THREE.Vector4,S=new THREE.Matrix4,xa=new THREE.Matrix4,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,e=new THREE.Vector4;this.projectVector=function(fa,da){S.multiply(da.projectionMatrix,da.matrixWorldInverse);S.multiplyVector3(fa);return fa};this.unprojectVector=function(fa,da){S.multiply(da.matrixWorld,THREE.Matrix4.makeInvert(da.projectionMatrix));
+1-Fa);return!0}}}var f,g,h=[],j,k,n=[],p,o,x=[],y,v=[],B,F,G=[],N,W,z=[],O=new THREE.Vector4,P=new THREE.Vector4,S=new THREE.Matrix4,xa=new THREE.Matrix4,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,e=new THREE.Vector4;this.projectVector=function(fa,da){S.multiply(da.projectionMatrix,da.matrixWorldInverse);S.multiplyVector3(fa);return fa};this.unprojectVector=function(fa,da){S.multiply(da.matrixWorld,THREE.Matrix4.makeInvert(da.projectionMatrix));
 S.multiplyVector3(fa);return fa};this.projectObjects=function(fa,da,ya){da=[];var Fa,Ga,ra;g=0;Ga=fa.objects;fa=0;for(Fa=Ga.length;fa<Fa;fa++){ra=Ga[fa];var aa;if(!(aa=!ra.visible))if(aa=ra instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ra.matrixWorld,za=-ra.geometry.boundingSphere.radius*Math.max(ra.scale.x,Math.max(ra.scale.y,ra.scale.z)),ia=0;ia<6;ia++){aa=sa[ia].x*pa.n14+sa[ia].y*pa.n24+sa[ia].z*pa.n34+sa[ia].w;if(aa<=za){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=h[g]=h[g]||new THREE.RenderableObject;
-g++;f=aa;N.copy(ra.position);S.multiplyVector3(N);f.object=ra;f.z=N.z;da.push(f)}}ya&&da.sort(c);return da};this.projectScene=function(fa,da,ya){var Fa=[],Ga=da.near,ra=da.far,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta,R,$,na;V=E=y=p=0;da.matrixAutoUpdate&&da.updateMatrix();fa.update(undefined,!1,da);S.multiply(da.projectionMatrix,da.matrixWorldInverse);sa[0].set(S.n41-S.n11,S.n42-S.n12,S.n43-S.n13,S.n44-S.n14);sa[1].set(S.n41+S.n11,S.n42+S.n12,S.n43+S.n13,S.n44+S.n14);sa[2].set(S.n41+S.n21,S.n42+S.n22,
+g++;f=aa;O.copy(ra.position);S.multiplyVector3(O);f.object=ra;f.z=O.z;da.push(f)}}ya&&da.sort(c);return da};this.projectScene=function(fa,da,ya){var Fa=[],Ga=da.near,ra=da.far,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta,R,$,na;W=F=y=o=0;da.matrixAutoUpdate&&da.updateMatrix();fa.update(undefined,!1,da);S.multiply(da.projectionMatrix,da.matrixWorldInverse);sa[0].set(S.n41-S.n11,S.n42-S.n12,S.n43-S.n13,S.n44-S.n14);sa[1].set(S.n41+S.n11,S.n42+S.n12,S.n43+S.n13,S.n44+S.n14);sa[2].set(S.n41+S.n21,S.n42+S.n22,
 S.n43+S.n23,S.n44+S.n24);sa[3].set(S.n41-S.n21,S.n42-S.n22,S.n43-S.n23,S.n44-S.n24);sa[4].set(S.n41-S.n31,S.n42-S.n32,S.n43-S.n33,S.n44-S.n34);sa[5].set(S.n41+S.n31,S.n42+S.n32,S.n43+S.n33,S.n44+S.n34);for(aa=0;aa<6;aa++){la=sa[aa];la.divideScalar(Math.sqrt(la.x*la.x+la.y*la.y+la.z*la.z))}la=this.projectObjects(fa,da,!0);fa=0;for(aa=la.length;fa<aa;fa++){Ea=la[fa].object;if(Ea.visible){Sa=Ea.matrixWorld;$a=Ea.matrixRotationWorld;Ya=Ea.materials;Ta=Ea.overdraw;k=0;if(Ea instanceof THREE.Mesh){R=Ea.geometry;
 ia=R.vertices;$=R.faces;R=R.faceVertexUvs;pa=0;for(za=ia.length;pa<za;pa++){j=b();j.positionWorld.copy(ia[pa].position);Sa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);S.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ga&&j.positionScreen.z<ra}ia=0;for(pa=$.length;ia<pa;ia++){za=$[ia];if(za instanceof THREE.Face3){Y=n[za.a];ma=n[za.b];Da=n[za.c];if(Y.visible&&ma.visible&&Da.visible&&
-(Ea.doubleSided||Ea.flipSided!=(Da.positionScreen.x-Y.positionScreen.x)*(ma.positionScreen.y-Y.positionScreen.y)-(Da.positionScreen.y-Y.positionScreen.y)*(ma.positionScreen.x-Y.positionScreen.x)<0)){ja=u[p]=u[p]||new THREE.RenderableFace3;p++;o=ja;o.v1.copy(Y);o.v2.copy(ma);o.v3.copy(Da)}else continue}else if(za instanceof THREE.Face4){Y=n[za.a];ma=n[za.b];Da=n[za.c];ja=n[za.d];if(Y.visible&&ma.visible&&Da.visible&&ja.visible&&(Ea.doubleSided||Ea.flipSided!=((ja.positionScreen.x-Y.positionScreen.x)*
-(ma.positionScreen.y-Y.positionScreen.y)-(ja.positionScreen.y-Y.positionScreen.y)*(ma.positionScreen.x-Y.positionScreen.x)<0||(ma.positionScreen.x-Da.positionScreen.x)*(ja.positionScreen.y-Da.positionScreen.y)-(ma.positionScreen.y-Da.positionScreen.y)*(ja.positionScreen.x-Da.positionScreen.x)<0))){na=v[y]=v[y]||new THREE.RenderableFace4;y++;o=na;o.v1.copy(Y);o.v2.copy(ma);o.v3.copy(Da);o.v4.copy(ja)}else continue}o.normalWorld.copy(za.normal);$a.multiplyVector3(o.normalWorld);o.centroidWorld.copy(za.centroid);
-Sa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);S.multiplyVector3(o.centroidScreen);Da=za.vertexNormals;Y=0;for(ma=Da.length;Y<ma;Y++){ja=o.vertexNormalsWorld[Y];ja.copy(Da[Y]);$a.multiplyVector3(ja)}Y=0;for(ma=R.length;Y<ma;Y++)if(na=R[Y][ia]){Da=0;for(ja=na.length;Da<ja;Da++)o.uvs[Y][Da]=na[Da]}o.meshMaterials=Ya;o.faceMaterials=za.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Fa.push(o)}}else if(Ea instanceof THREE.Line){xa.multiply(S,Sa);ia=Ea.geometry.vertices;Y=b();
-Y.positionScreen.copy(ia[0].position);xa.multiplyVector4(Y.positionScreen);pa=1;for(za=ia.length;pa<za;pa++){Y=b();Y.positionScreen.copy(ia[pa].position);xa.multiplyVector4(Y.positionScreen);ma=n[k-2];qa.copy(Y.positionScreen);e.copy(ma.positionScreen);if(d(qa,e)){qa.multiplyScalar(1/qa.w);e.multiplyScalar(1/e.w);Sa=G[E]=G[E]||new THREE.RenderableLine;E++;A=Sa;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(e);A.z=Math.max(qa.z,e.z);A.materials=Ea.materials;Fa.push(A)}}}else if(Ea instanceof
-THREE.Particle){P.set(Ea.position.x,Ea.position.y,Ea.position.z,1);S.multiplyVector4(P);P.z/=P.w;if(P.z>0&&P.z<1){Sa=z[V]=z[V]||new THREE.RenderableParticle;V++;L=Sa;L.x=P.x/P.w;L.y=P.y/P.w;L.z=P.z;L.rotation=Ea.rotation.z;L.scale.x=Ea.scale.x*Math.abs(L.x-(P.x+da.projectionMatrix.n11)/(P.w+da.projectionMatrix.n14));L.scale.y=Ea.scale.y*Math.abs(L.y-(P.y+da.projectionMatrix.n22)/(P.w+da.projectionMatrix.n24));L.materials=Ea.materials;Fa.push(L)}}}}ya&&Fa.sort(c);return Fa}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,o,p,u,y,v,A,E;b=c.projectScene(j,k);n=0;for(o=b.length;n<o;n++){y=b[n];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;E=y.y*h+h;p=0;for(u=y.material.length;p<u;p++){v=y.material[p];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=A+"px";v.style.top=E+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(oa){if(v!=oa)p.globalAlpha=v=oa}function c(oa){if(A!=oa){switch(oa){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}A=oa}}function d(oa){if(E!=oa)p.strokeStyle=E=oa}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,o,p=h.getContext("2d"),u=new THREE.Color(0),y=0,v=1,A=0,
-E=null,G=null,L=null,V=null,z=null,N,P,S,xa,sa=new THREE.RenderableVertex,qa=new THREE.RenderableVertex,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma=new THREE.Color,Da=new THREE.Color,ja=new THREE.Color,la=new THREE.Color,Ea=new THREE.Color,Sa,$a,Ya,Ta,R,$,na,Ba,ha,ka,m=new THREE.Rectangle,C=new THREE.Rectangle,x=new THREE.Rectangle,w=!1,B=new THREE.Color,O=new THREE.Color,I=new THREE.Color,K=new THREE.Color,H=new THREE.Vector3,F,J,M,X,U,Ca,Ha=16;F=document.createElement("canvas");F.width=F.height=2;J=F.getContext("2d");
-J.fillStyle="rgba(0,0,0,1)";J.fillRect(0,0,2,2);M=J.getImageData(0,0,2,2);X=M.data;U=document.createElement("canvas");U.width=U.height=Ha;Ca=U.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(oa,wa){j=oa;k=wa;n=j/2;o=k/2;h.width=j;h.height=k;m.set(-n,-o,n,o);v=1;A=0;z=V=L=G=E=null};this.setClearColor=function(oa,wa){u=oa;y=wa};this.setClearColorHex=function(oa,wa){u.setHex(oa);y=wa};this.clear=
-function(){p.setTransform(1,0,0,-1,n,o);if(!C.isEmpty()){C.inflate(1);C.minSelf(m);if(u.hex==0&&y==0)p.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);b(1);p.fillStyle="rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+y+")";p.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(oa,wa){function cb(W){var ta,ea,ca,va=W.lights;O.setRGB(0,0,0);I.setRGB(0,0,0);K.setRGB(0,0,0);W=0;for(ta=va.length;W<ta;W++){ea=
-va[W];ca=ea.color;if(ea instanceof THREE.AmbientLight){O.r+=ca.r;O.g+=ca.g;O.b+=ca.b}else if(ea instanceof THREE.DirectionalLight){I.r+=ca.r;I.g+=ca.g;I.b+=ca.b}else if(ea instanceof THREE.PointLight){K.r+=ca.r;K.g+=ca.g;K.b+=ca.b}}}function Aa(W,ta,ea,ca){var va,ua,ga,Q,Na=W.lights;W=0;for(va=Na.length;W<va;W++){ua=Na[W];ga=ua.color;if(ua instanceof THREE.DirectionalLight){Q=ea.dot(ua.position);if(!(Q<=0)){Q*=ua.intensity;ca.r+=ga.r*Q;ca.g+=ga.g*Q;ca.b+=ga.b*Q}}else if(ua instanceof THREE.PointLight){Q=
-ea.dot(H.sub(ua.position,ta).normalize());if(!(Q<=0)){Q*=ua.distance==0?1:1-Math.min(ta.distanceTo(ua.position)/ua.distance,1);if(Q!=0){Q*=ua.intensity;ca.r+=ga.r*Q;ca.g+=ga.g*Q;ca.b+=ga.b*Q}}}}}function Ia(W,ta,ea){b(ea.opacity);c(ea.blending);var ca,va,ua,ga,Q,Na;if(ea instanceof THREE.ParticleBasicMaterial){if(ea.map){ga=ea.map.image;Q=ga.width>>1;Na=ga.height>>1;ea=ta.scale.x*n;ua=ta.scale.y*o;ca=ea*Q;va=ua*Na;x.set(W.x-ca,W.y-va,W.x+ca,W.y+va);if(m.instersects(x)){p.save();p.translate(W.x,W.y);
-p.rotate(-ta.rotation);p.scale(ea,-ua);p.translate(-Q,-Na);p.drawImage(ga,0,0);p.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){ca=ta.scale.x*n;va=ta.scale.y*o;x.set(W.x-ca,W.y-va,W.x+ca,W.y+va);if(m.instersects(x)){d(ea.color.__styleString);ua=ea.color.__styleString;if(G!=ua)p.fillStyle=G=ua;p.save();p.translate(W.x,W.y);p.rotate(-ta.rotation);p.scale(ca,va);ea.program(p);p.restore()}}}function Ja(W,ta,ea,ca){b(ca.opacity);c(ca.blending);p.beginPath();p.moveTo(W.positionScreen.x,
-W.positionScreen.y);p.lineTo(ta.positionScreen.x,ta.positionScreen.y);p.closePath();if(ca instanceof THREE.LineBasicMaterial){ma.__styleString=ca.color.__styleString;W=ca.linewidth;if(L!=W)p.lineWidth=L=W;W=ca.linecap;if(V!=W)p.lineCap=V=W;W=ca.linejoin;if(z!=W)p.lineJoin=z=W;d(ma.__styleString);p.stroke();x.inflate(ca.linewidth*2)}}function Qa(W,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);e=W.positionScreen.x;fa=W.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;
-Ga=ea.positionScreen.y;Z(e,fa,da,ya,Fa,Ga);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=wa.matrixWorldInverse;H.copy(ga.vertexNormalsWorld[0]);R=(H.x*W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;$=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[1]);na=(H.x*
-W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;Ba=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[2]);ha=(H.x*W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;ka=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;Ma(e,fa,da,ya,Fa,Ga,Q.envMap.image,R,$,na,Ba,ha,ka)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=
-ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){Da.r=ja.r=la.r=O.r;Da.g=ja.g=la.g=O.g;Da.b=ja.b=la.b=O.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v3.positionWorld,ga.vertexNormalsWorld[2],la);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=
-Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else{B.r=O.r;B.g=O.g;B.b=O.b;Aa(Na,ga.centroidWorld,ga.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;
-$a=wa.far;Da.r=Da.g=Da.b=1-gb(W.positionScreen.z,Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ea.positionScreen.z,Sa,$a);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
-fb(ma.__styleString)}}function D(W,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(W,ta,ca,0,1,3,ga,Q,Na);Qa(va,ea,ua,1,2,3,ga,Q,Na)}else{e=W.positionScreen.x;fa=W.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;Ga=ea.positionScreen.y;ra=ca.positionScreen.x;aa=ca.positionScreen.y;pa=va.positionScreen.x;za=va.positionScreen.y;ia=ua.positionScreen.x;Y=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,fa,da,ya,Fa,Ga,ra,aa);
-Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){Da.r=ja.r=la.r=Ea.r=O.r;Da.g=ja.g=la.g=Ea.g=O.g;Da.b=ja.b=la.b=Ea.b=O.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v4.positionWorld,ga.vertexNormalsWorld[3],la);Aa(Na,
-ga.v3.positionWorld,ga.vertexNormalsWorld[2],Ea);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}else{B.r=O.r;B.g=O.g;B.b=O.b;Aa(Na,ga.centroidWorld,ga.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else{t(e,fa,da,ya,Fa,Ga,ra,aa);
-Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;$a=wa.far;Da.r=Da.g=Da.b=1-gb(W.positionScreen.z,
-Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ca.positionScreen.z,Sa,$a);Ea.r=Ea.g=Ea.b=1-gb(ea.positionScreen.z,Sa,$a);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}}}function Z(W,ta,ea,ca,va,ua){p.beginPath();p.moveTo(W,ta);p.lineTo(ea,ca);p.lineTo(va,ua);p.lineTo(W,ta);p.closePath()}function t(W,ta,ea,ca,va,ua,ga,Q){p.beginPath();p.moveTo(W,ta);p.lineTo(ea,ca);p.lineTo(va,ua);p.lineTo(ga,
-Q);p.lineTo(W,ta);p.closePath()}function ab(W,ta,ea,ca){if(L!=ta)p.lineWidth=L=ta;if(V!=ea)p.lineCap=V=ea;if(z!=ca)p.lineJoin=z=ca;d(W);p.stroke();x.inflate(ta*2)}function fb(W){if(G!=W)p.fillStyle=G=W;p.fill()}function Ma(W,ta,ea,ca,va,ua,ga,Q,Na,db,Ua,bb,lb){var Pa,ib;Pa=ga.width-1;ib=ga.height-1;Q*=Pa;Na*=ib;db*=Pa;Ua*=ib;bb*=Pa;lb*=ib;ea-=W;ca-=ta;va-=W;ua-=ta;db-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=db*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*ea-Ua*va)*ib;Ua=(lb*ca-Ua*ua)*ib;ea=(db*va-bb*ea)*ib;ca=(db*ua-bb*ca)*
-ib;W=W-Pa*Q-ea*Na;ta=ta-Ua*Q-ca*Na;p.save();p.transform(Pa,Ua,ea,ca,W,ta);p.clip();p.drawImage(ga,0,0);p.restore()}}function Va(W,ta,ea,ca){var va=~~(W.r*255),ua=~~(W.g*255);W=~~(W.b*255);var ga=~~(ta.r*255),Q=~~(ta.g*255);ta=~~(ta.b*255);var Na=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);var Ua=~~(ca.r*255),bb=~~(ca.g*255);ca=~~(ca.b*255);X[0]=va<0?0:va>255?255:va;X[1]=ua<0?0:ua>255?255:ua;X[2]=W<0?0:W>255?255:W;X[4]=ga<0?0:ga>255?255:ga;X[5]=Q<0?0:Q>255?255:Q;X[6]=ta<0?0:ta>255?255:ta;X[8]=Na<
-0?0:Na>255?255:Na;X[9]=db<0?0:db>255?255:db;X[10]=ea<0?0:ea>255?255:ea;X[12]=Ua<0?0:Ua>255?255:Ua;X[13]=bb<0?0:bb>255?255:bb;X[14]=ca<0?0:ca>255?255:ca;J.putImageData(M,0,0);Ca.drawImage(F,0,0);return U}function gb(W,ta,ea){W=(W-ta)/(ea-ta);return W*W*(3-2*W)}function hb(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Wa(W,ta){var ea=ta.x-W.x,ca=ta.y-W.y,va=1/Math.sqrt(ea*ea+ca*ca);ea*=va;ca*=va;ta.x+=ea;ta.y+=ca;W.x-=ea;W.y-=ca}var eb,Oa,Ka,La,T,Ra,Xa,Za;this.autoClear?this.clear():p.setTransform(1,
-0,0,-1,n,o);f=g.projectScene(oa,wa,this.sortElements);(w=oa.lights.length>0)&&cb(oa);eb=0;for(Oa=f.length;eb<Oa;eb++){Ka=f[eb];x.empty();if(Ka instanceof THREE.RenderableParticle){N=Ka;N.x*=n;N.y*=o;La=0;for(T=Ka.materials.length;La<T;){Za=Ka.materials[La++];Za.opacity!=0&&Ia(N,Ka,Za,oa)}}else if(Ka instanceof THREE.RenderableLine){N=Ka.v1;P=Ka.v2;N.positionScreen.x*=n;N.positionScreen.y*=o;P.positionScreen.x*=n;P.positionScreen.y*=o;x.addPoint(N.positionScreen.x,N.positionScreen.y);x.addPoint(P.positionScreen.x,
-P.positionScreen.y);if(m.instersects(x)){La=0;for(T=Ka.materials.length;La<T;){Za=Ka.materials[La++];Za.opacity!=0&&Ja(N,P,Ka,Za,oa)}}}else if(Ka instanceof THREE.RenderableFace3){N=Ka.v1;P=Ka.v2;S=Ka.v3;N.positionScreen.x*=n;N.positionScreen.y*=o;P.positionScreen.x*=n;P.positionScreen.y*=o;S.positionScreen.x*=n;S.positionScreen.y*=o;if(Ka.overdraw){Wa(N.positionScreen,P.positionScreen);Wa(P.positionScreen,S.positionScreen);Wa(S.positionScreen,N.positionScreen)}x.add3Points(N.positionScreen.x,N.positionScreen.y,
-P.positionScreen.x,P.positionScreen.y,S.positionScreen.x,S.positionScreen.y);if(m.instersects(x)){La=0;for(T=Ka.meshMaterials.length;La<T;){Za=Ka.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ka.faceMaterials.length;Ra<Xa;)(Za=Ka.faceMaterials[Ra++])&&Za.opacity!=0&&Qa(N,P,S,0,1,2,Ka,Za,oa)}else Za.opacity!=0&&Qa(N,P,S,0,1,2,Ka,Za,oa)}}}else if(Ka instanceof THREE.RenderableFace4){N=Ka.v1;P=Ka.v2;S=Ka.v3;xa=Ka.v4;N.positionScreen.x*=n;N.positionScreen.y*=o;P.positionScreen.x*=
-n;P.positionScreen.y*=o;S.positionScreen.x*=n;S.positionScreen.y*=o;xa.positionScreen.x*=n;xa.positionScreen.y*=o;sa.positionScreen.copy(P.positionScreen);qa.positionScreen.copy(xa.positionScreen);if(Ka.overdraw){Wa(N.positionScreen,P.positionScreen);Wa(P.positionScreen,xa.positionScreen);Wa(xa.positionScreen,N.positionScreen);Wa(S.positionScreen,sa.positionScreen);Wa(S.positionScreen,qa.positionScreen)}x.addPoint(N.positionScreen.x,N.positionScreen.y);x.addPoint(P.positionScreen.x,P.positionScreen.y);
-x.addPoint(S.positionScreen.x,S.positionScreen.y);x.addPoint(xa.positionScreen.x,xa.positionScreen.y);if(m.instersects(x)){La=0;for(T=Ka.meshMaterials.length;La<T;){Za=Ka.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ka.faceMaterials.length;Ra<Xa;)(Za=Ka.faceMaterials[Ra++])&&Za.opacity!=0&&D(N,P,S,xa,sa,qa,Ka,Za,oa)}else Za.opacity!=0&&D(N,P,S,xa,sa,qa,Ka,Za,oa)}}}C.addRectangle(x)}p.setTransform(1,0,0,1,0,0)}};
+(Ea.doubleSided||Ea.flipSided!=(Da.positionScreen.x-Y.positionScreen.x)*(ma.positionScreen.y-Y.positionScreen.y)-(Da.positionScreen.y-Y.positionScreen.y)*(ma.positionScreen.x-Y.positionScreen.x)<0)){ja=x[o]=x[o]||new THREE.RenderableFace3;o++;p=ja;p.v1.copy(Y);p.v2.copy(ma);p.v3.copy(Da)}else continue}else if(za instanceof THREE.Face4){Y=n[za.a];ma=n[za.b];Da=n[za.c];ja=n[za.d];if(Y.visible&&ma.visible&&Da.visible&&ja.visible&&(Ea.doubleSided||Ea.flipSided!=((ja.positionScreen.x-Y.positionScreen.x)*
+(ma.positionScreen.y-Y.positionScreen.y)-(ja.positionScreen.y-Y.positionScreen.y)*(ma.positionScreen.x-Y.positionScreen.x)<0||(ma.positionScreen.x-Da.positionScreen.x)*(ja.positionScreen.y-Da.positionScreen.y)-(ma.positionScreen.y-Da.positionScreen.y)*(ja.positionScreen.x-Da.positionScreen.x)<0))){na=v[y]=v[y]||new THREE.RenderableFace4;y++;p=na;p.v1.copy(Y);p.v2.copy(ma);p.v3.copy(Da);p.v4.copy(ja)}else continue}p.normalWorld.copy(za.normal);$a.multiplyVector3(p.normalWorld);p.centroidWorld.copy(za.centroid);
+Sa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);S.multiplyVector3(p.centroidScreen);Da=za.vertexNormals;Y=0;for(ma=Da.length;Y<ma;Y++){ja=p.vertexNormalsWorld[Y];ja.copy(Da[Y]);$a.multiplyVector3(ja)}Y=0;for(ma=R.length;Y<ma;Y++)if(na=R[Y][ia]){Da=0;for(ja=na.length;Da<ja;Da++)p.uvs[Y][Da]=na[Da]}p.meshMaterials=Ya;p.faceMaterials=za.materials;p.overdraw=Ta;p.z=p.centroidScreen.z;Fa.push(p)}}else if(Ea instanceof THREE.Line){xa.multiply(S,Sa);ia=Ea.geometry.vertices;Y=b();
+Y.positionScreen.copy(ia[0].position);xa.multiplyVector4(Y.positionScreen);pa=1;for(za=ia.length;pa<za;pa++){Y=b();Y.positionScreen.copy(ia[pa].position);xa.multiplyVector4(Y.positionScreen);ma=n[k-2];qa.copy(Y.positionScreen);e.copy(ma.positionScreen);if(d(qa,e)){qa.multiplyScalar(1/qa.w);e.multiplyScalar(1/e.w);Sa=G[F]=G[F]||new THREE.RenderableLine;F++;B=Sa;B.v1.positionScreen.copy(qa);B.v2.positionScreen.copy(e);B.z=Math.max(qa.z,e.z);B.materials=Ea.materials;Fa.push(B)}}}else if(Ea instanceof
+THREE.Particle){P.set(Ea.position.x,Ea.position.y,Ea.position.z,1);S.multiplyVector4(P);P.z/=P.w;if(P.z>0&&P.z<1){Sa=z[W]=z[W]||new THREE.RenderableParticle;W++;N=Sa;N.x=P.x/P.w;N.y=P.y/P.w;N.z=P.z;N.rotation=Ea.rotation.z;N.scale.x=Ea.scale.x*Math.abs(N.x-(P.x+da.projectionMatrix.n11)/(P.w+da.projectionMatrix.n14));N.scale.y=Ea.scale.y*Math.abs(N.y-(P.y+da.projectionMatrix.n22)/(P.w+da.projectionMatrix.n24));N.materials=Ea.materials;Fa.push(N)}}}}ya&&Fa.sort(c);return Fa}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,x,y,v,B,F;b=c.projectScene(j,k);n=0;for(p=b.length;n<p;n++){y=b[n];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;F=y.y*h+h;o=0;for(x=y.material.length;o<x;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=B+"px";v.style.top=F+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(oa){if(v!=oa)o.globalAlpha=v=oa}function c(oa){if(B!=oa){switch(oa){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=oa}}function d(oa){if(F!=oa)o.strokeStyle=F=oa}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),x=new THREE.Color(0),y=0,v=1,B=0,
+F=null,G=null,N=null,W=null,z=null,O,P,S,xa,sa=new THREE.RenderableVertex,qa=new THREE.RenderableVertex,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma=new THREE.Color,Da=new THREE.Color,ja=new THREE.Color,la=new THREE.Color,Ea=new THREE.Color,Sa,$a,Ya,Ta,R,$,na,Ba,ha,ka,m=new THREE.Rectangle,C=new THREE.Rectangle,u=new THREE.Rectangle,w=!1,A=new THREE.Color,M=new THREE.Color,I=new THREE.Color,K=new THREE.Color,H=new THREE.Vector3,E,J,L,U,V,Ca,Ha=16;E=document.createElement("canvas");E.width=E.height=2;J=E.getContext("2d");
+J.fillStyle="rgba(0,0,0,1)";J.fillRect(0,0,2,2);L=J.getImageData(0,0,2,2);U=L.data;V=document.createElement("canvas");V.width=V.height=Ha;Ca=V.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(oa,wa){j=oa;k=wa;n=j/2;p=k/2;h.width=j;h.height=k;m.set(-n,-p,n,p);v=1;B=0;z=W=N=G=F=null};this.setClearColor=function(oa,wa){x=oa;y=wa};this.setClearColorHex=function(oa,wa){x.setHex(oa);y=wa};this.clear=
+function(){o.setTransform(1,0,0,-1,n,p);if(!C.isEmpty()){C.inflate(1);C.minSelf(m);if(x.hex==0&&y==0)o.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+y+")";o.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(oa,wa){function cb(X){var ta,ea,ca,va=X.lights;M.setRGB(0,0,0);I.setRGB(0,0,0);K.setRGB(0,0,0);X=0;for(ta=va.length;X<ta;X++){ea=
+va[X];ca=ea.color;if(ea instanceof THREE.AmbientLight){M.r+=ca.r;M.g+=ca.g;M.b+=ca.b}else if(ea instanceof THREE.DirectionalLight){I.r+=ca.r;I.g+=ca.g;I.b+=ca.b}else if(ea instanceof THREE.PointLight){K.r+=ca.r;K.g+=ca.g;K.b+=ca.b}}}function Aa(X,ta,ea,ca){var va,ua,ga,Q,Na=X.lights;X=0;for(va=Na.length;X<va;X++){ua=Na[X];ga=ua.color;if(ua instanceof THREE.DirectionalLight){Q=ea.dot(ua.position);if(!(Q<=0)){Q*=ua.intensity;ca.r+=ga.r*Q;ca.g+=ga.g*Q;ca.b+=ga.b*Q}}else if(ua instanceof THREE.PointLight){Q=
+ea.dot(H.sub(ua.position,ta).normalize());if(!(Q<=0)){Q*=ua.distance==0?1:1-Math.min(ta.distanceTo(ua.position)/ua.distance,1);if(Q!=0){Q*=ua.intensity;ca.r+=ga.r*Q;ca.g+=ga.g*Q;ca.b+=ga.b*Q}}}}}function Ia(X,ta,ea){b(ea.opacity);c(ea.blending);var ca,va,ua,ga,Q,Na;if(ea instanceof THREE.ParticleBasicMaterial){if(ea.map){ga=ea.map.image;Q=ga.width>>1;Na=ga.height>>1;ea=ta.scale.x*n;ua=ta.scale.y*p;ca=ea*Q;va=ua*Na;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){o.save();o.translate(X.x,X.y);
+o.rotate(-ta.rotation);o.scale(ea,-ua);o.translate(-Q,-Na);o.drawImage(ga,0,0);o.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){ca=ta.scale.x*n;va=ta.scale.y*p;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){d(ea.color.__styleString);ua=ea.color.__styleString;if(G!=ua)o.fillStyle=G=ua;o.save();o.translate(X.x,X.y);o.rotate(-ta.rotation);o.scale(ca,va);ea.program(o);o.restore()}}}function Ja(X,ta,ea,ca){b(ca.opacity);c(ca.blending);o.beginPath();o.moveTo(X.positionScreen.x,
+X.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(ca instanceof THREE.LineBasicMaterial){ma.__styleString=ca.color.__styleString;X=ca.linewidth;if(N!=X)o.lineWidth=N=X;X=ca.linecap;if(W!=X)o.lineCap=W=X;X=ca.linejoin;if(z!=X)o.lineJoin=z=X;d(ma.__styleString);o.stroke();u.inflate(ca.linewidth*2)}}function Qa(X,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);e=X.positionScreen.x;fa=X.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;
+Ga=ea.positionScreen.y;Z(e,fa,da,ya,Fa,Ga);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){X=wa.matrixWorldInverse;H.copy(ga.vertexNormalsWorld[0]);R=(H.x*X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;$=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[1]);na=(H.x*
+X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;Ba=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[2]);ha=(H.x*X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;ka=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;Ma(e,fa,da,ya,Fa,Ga,Q.envMap.image,R,$,na,Ba,ha,ka)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=
+ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){Da.r=ja.r=la.r=M.r;Da.g=ja.g=la.g=M.g;Da.b=ja.b=la.b=M.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v3.positionWorld,ga.vertexNormalsWorld[2],la);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=
+Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else{A.r=M.r;A.g=M.g;A.b=M.b;Aa(Na,ga.centroidWorld,ga.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;
+$a=wa.far;Da.r=Da.g=Da.b=1-gb(X.positionScreen.z,Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ea.positionScreen.z,Sa,$a);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
+fb(ma.__styleString)}}function D(X,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(X,ta,ca,0,1,3,ga,Q,Na);Qa(va,ea,ua,1,2,3,ga,Q,Na)}else{e=X.positionScreen.x;fa=X.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;Ga=ea.positionScreen.y;ra=ca.positionScreen.x;aa=ca.positionScreen.y;pa=va.positionScreen.x;za=va.positionScreen.y;ia=ua.positionScreen.x;Y=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,fa,da,ya,Fa,Ga,ra,aa);
+Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){Da.r=ja.r=la.r=Ea.r=M.r;Da.g=ja.g=la.g=Ea.g=M.g;Da.b=ja.b=la.b=Ea.b=M.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v4.positionWorld,ga.vertexNormalsWorld[3],la);Aa(Na,
+ga.v3.positionWorld,ga.vertexNormalsWorld[2],Ea);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}else{A.r=M.r;A.g=M.g;A.b=M.b;Aa(Na,ga.centroidWorld,ga.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else{t(e,fa,da,ya,Fa,Ga,ra,aa);
+Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;$a=wa.far;Da.r=Da.g=Da.b=1-gb(X.positionScreen.z,
+Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ca.positionScreen.z,Sa,$a);Ea.r=Ea.g=Ea.b=1-gb(ea.positionScreen.z,Sa,$a);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}}}function Z(X,ta,ea,ca,va,ua){o.beginPath();o.moveTo(X,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(X,ta);o.closePath()}function t(X,ta,ea,ca,va,ua,ga,Q){o.beginPath();o.moveTo(X,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(ga,
+Q);o.lineTo(X,ta);o.closePath()}function ab(X,ta,ea,ca){if(N!=ta)o.lineWidth=N=ta;if(W!=ea)o.lineCap=W=ea;if(z!=ca)o.lineJoin=z=ca;d(X);o.stroke();u.inflate(ta*2)}function fb(X){if(G!=X)o.fillStyle=G=X;o.fill()}function Ma(X,ta,ea,ca,va,ua,ga,Q,Na,db,Ua,bb,lb){var Pa,ib;Pa=ga.width-1;ib=ga.height-1;Q*=Pa;Na*=ib;db*=Pa;Ua*=ib;bb*=Pa;lb*=ib;ea-=X;ca-=ta;va-=X;ua-=ta;db-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=db*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*ea-Ua*va)*ib;Ua=(lb*ca-Ua*ua)*ib;ea=(db*va-bb*ea)*ib;ca=(db*ua-bb*ca)*
+ib;X=X-Pa*Q-ea*Na;ta=ta-Ua*Q-ca*Na;o.save();o.transform(Pa,Ua,ea,ca,X,ta);o.clip();o.drawImage(ga,0,0);o.restore()}}function Va(X,ta,ea,ca){var va=~~(X.r*255),ua=~~(X.g*255);X=~~(X.b*255);var ga=~~(ta.r*255),Q=~~(ta.g*255);ta=~~(ta.b*255);var Na=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);var Ua=~~(ca.r*255),bb=~~(ca.g*255);ca=~~(ca.b*255);U[0]=va<0?0:va>255?255:va;U[1]=ua<0?0:ua>255?255:ua;U[2]=X<0?0:X>255?255:X;U[4]=ga<0?0:ga>255?255:ga;U[5]=Q<0?0:Q>255?255:Q;U[6]=ta<0?0:ta>255?255:ta;U[8]=Na<
+0?0:Na>255?255:Na;U[9]=db<0?0:db>255?255:db;U[10]=ea<0?0:ea>255?255:ea;U[12]=Ua<0?0:Ua>255?255:Ua;U[13]=bb<0?0:bb>255?255:bb;U[14]=ca<0?0:ca>255?255:ca;J.putImageData(L,0,0);Ca.drawImage(E,0,0);return V}function gb(X,ta,ea){X=(X-ta)/(ea-ta);return X*X*(3-2*X)}function hb(X){X=(X+1)*0.5;return X<0?0:X>1?1:X}function Wa(X,ta){var ea=ta.x-X.x,ca=ta.y-X.y,va=1/Math.sqrt(ea*ea+ca*ca);ea*=va;ca*=va;ta.x+=ea;ta.y+=ca;X.x-=ea;X.y-=ca}var eb,Oa,Ka,La,T,Ra,Xa,Za;this.autoClear?this.clear():o.setTransform(1,
+0,0,-1,n,p);f=g.projectScene(oa,wa,this.sortElements);(w=oa.lights.length>0)&&cb(oa);eb=0;for(Oa=f.length;eb<Oa;eb++){Ka=f[eb];u.empty();if(Ka instanceof THREE.RenderableParticle){O=Ka;O.x*=n;O.y*=p;La=0;for(T=Ka.materials.length;La<T;){Za=Ka.materials[La++];Za.opacity!=0&&Ia(O,Ka,Za,oa)}}else if(Ka instanceof THREE.RenderableLine){O=Ka.v1;P=Ka.v2;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;u.addPoint(O.positionScreen.x,O.positionScreen.y);u.addPoint(P.positionScreen.x,
+P.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ka.materials.length;La<T;){Za=Ka.materials[La++];Za.opacity!=0&&Ja(O,P,Ka,Za,oa)}}}else if(Ka instanceof THREE.RenderableFace3){O=Ka.v1;P=Ka.v2;S=Ka.v3;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;if(Ka.overdraw){Wa(O.positionScreen,P.positionScreen);Wa(P.positionScreen,S.positionScreen);Wa(S.positionScreen,O.positionScreen)}u.add3Points(O.positionScreen.x,O.positionScreen.y,
+P.positionScreen.x,P.positionScreen.y,S.positionScreen.x,S.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ka.meshMaterials.length;La<T;){Za=Ka.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ka.faceMaterials.length;Ra<Xa;)(Za=Ka.faceMaterials[Ra++])&&Za.opacity!=0&&Qa(O,P,S,0,1,2,Ka,Za,oa)}else Za.opacity!=0&&Qa(O,P,S,0,1,2,Ka,Za,oa)}}}else if(Ka instanceof THREE.RenderableFace4){O=Ka.v1;P=Ka.v2;S=Ka.v3;xa=Ka.v4;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=
+n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;xa.positionScreen.x*=n;xa.positionScreen.y*=p;sa.positionScreen.copy(P.positionScreen);qa.positionScreen.copy(xa.positionScreen);if(Ka.overdraw){Wa(O.positionScreen,P.positionScreen);Wa(P.positionScreen,xa.positionScreen);Wa(xa.positionScreen,O.positionScreen);Wa(S.positionScreen,sa.positionScreen);Wa(S.positionScreen,qa.positionScreen)}u.addPoint(O.positionScreen.x,O.positionScreen.y);u.addPoint(P.positionScreen.x,P.positionScreen.y);
+u.addPoint(S.positionScreen.x,S.positionScreen.y);u.addPoint(xa.positionScreen.x,xa.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ka.meshMaterials.length;La<T;){Za=Ka.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ka.faceMaterials.length;Ra<Xa;)(Za=Ka.faceMaterials[Ra++])&&Za.opacity!=0&&D(O,P,S,xa,sa,qa,Ka,Za,oa)}else Za.opacity!=0&&D(O,P,S,xa,sa,qa,Ka,Za,oa)}}}C.addRectangle(u)}o.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(ra,aa,pa){var za,ia,Y,ma;za=0;for(ia=ra.lights.length;za<ia;za++){Y=ra.lights[za];if(Y instanceof THREE.DirectionalLight){ma=aa.normalWorld.dot(Y.position)*Y.intensity;if(ma>0){pa.r+=Y.color.r*ma;pa.g+=Y.color.g*ma;pa.b+=Y.color.b*ma}}else if(Y instanceof THREE.PointLight){qa.sub(Y.position,aa.centroidWorld);qa.normalize();ma=aa.normalWorld.dot(qa)*Y.intensity;if(ma>0){pa.r+=Y.color.r*ma;pa.g+=Y.color.g*ma;pa.b+=Y.color.b*ma}}}}function c(ra,aa,pa,za,ia,Y){da=
-f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(V){N.r=P.r;N.g=P.g;N.b=P.b;b(Y,za,N);z.r=ia.color.r*N.r;z.g=ia.color.g*N.g;z.b=ia.color.b*N.b;z.updateStyleString()}else z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){sa=
+f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(W){O.r=P.r;O.g=P.g;O.b=P.b;b(Y,za,O);z.r=ia.color.r*O.r;z.g=ia.color.g*O.g;z.b=ia.color.b*O.b;z.updateStyleString()}else z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){sa=
 1-ia.__2near/(ia.__farPlusNear-za.z*ia.__farMinusNear);z.setRGB(sa,sa,sa)}else ia instanceof THREE.MeshNormalMaterial&&z.setRGB(g(za.normalWorld.x),g(za.normalWorld.y),g(za.normalWorld.z));ia.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ia.opacity);
-k.appendChild(da)}function d(ra,aa,pa,za,ia,Y,ma){da=f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(V){N.r=P.r;N.g=P.g;N.b=P.b;b(ma,ia,N);z.r=Y.color.r*N.r;z.g=Y.color.g*N.g;z.b=Y.color.b*
-N.b;z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){sa=1-Y.__2near/(Y.__farPlusNear-ia.z*Y.__farMinusNear);z.setRGB(sa,sa,sa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ia.normalWorld.x),g(ia.normalWorld.y),g(ia.normalWorld.z));Y.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+
-Y.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(da)}function f(ra){if(e[ra]==null){e[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ga==0&&e[ra].setAttribute("shape-rendering","crispEdges")}return e[ra]}function g(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,o,p,u,y,v,A,E,G=new THREE.Rectangle,L=
-new THREE.Rectangle,V=!1,z=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0),S=new THREE.Color(0),xa=new THREE.Color(0),sa,qa=new THREE.Vector3,e=[],fa=[],da,ya,Fa,Ga=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ga=1;break;case "low":Ga=0}};this.setSize=function(ra,aa){n=ra;o=aa;p=n/2;u=o/2;k.setAttribute("viewBox",-p+" "+-u+" "+n+" "+o);k.setAttribute("width",n);k.setAttribute("height",
-o);G.set(-p,-u,p,u)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(ra,aa){var pa,za,ia,Y,ma,Da,ja,la;this.autoClear&&this.clear();h=j.projectScene(ra,aa,this.sortElements);Fa=ya=0;if(V=ra.lights.length>0){ja=ra.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);xa.setRGB(0,0,0);pa=0;for(za=ja.length;pa<za;pa++){ia=ja[pa];Y=ia.color;if(ia instanceof THREE.AmbientLight){P.r+=Y.r;P.g+=Y.g;P.b+=Y.b}else if(ia instanceof THREE.DirectionalLight){S.r+=Y.r;S.g+=
-Y.g;S.b+=Y.b}else if(ia instanceof THREE.PointLight){xa.r+=Y.r;xa.g+=Y.g;xa.b+=Y.b}}}pa=0;for(za=h.length;pa<za;pa++){ja=h[pa];L.empty();if(ja instanceof THREE.RenderableParticle){y=ja;y.x*=p;y.y*=-u;ia=0;for(Y=ja.materials.length;ia<Y;)ia++}else if(ja instanceof THREE.RenderableLine){y=ja.v1;v=ja.v2;y.positionScreen.x*=p;y.positionScreen.y*=-u;v.positionScreen.x*=p;v.positionScreen.y*=-u;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);if(G.instersects(L)){ia=
+k.appendChild(da)}function d(ra,aa,pa,za,ia,Y,ma){da=f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(W){O.r=P.r;O.g=P.g;O.b=P.b;b(ma,ia,O);z.r=Y.color.r*O.r;z.g=Y.color.g*O.g;z.b=Y.color.b*
+O.b;z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){sa=1-Y.__2near/(Y.__farPlusNear-ia.z*Y.__farMinusNear);z.setRGB(sa,sa,sa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ia.normalWorld.x),g(ia.normalWorld.y),g(ia.normalWorld.z));Y.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+
+Y.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(da)}function f(ra){if(e[ra]==null){e[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ga==0&&e[ra].setAttribute("shape-rendering","crispEdges")}return e[ra]}function g(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,x,y,v,B,F,G=new THREE.Rectangle,N=
+new THREE.Rectangle,W=!1,z=new THREE.Color(16777215),O=new THREE.Color(16777215),P=new THREE.Color(0),S=new THREE.Color(0),xa=new THREE.Color(0),sa,qa=new THREE.Vector3,e=[],fa=[],da,ya,Fa,Ga=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ga=1;break;case "low":Ga=0}};this.setSize=function(ra,aa){n=ra;p=aa;o=n/2;x=p/2;k.setAttribute("viewBox",-o+" "+-x+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",
+p);G.set(-o,-x,o,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(ra,aa){var pa,za,ia,Y,ma,Da,ja,la;this.autoClear&&this.clear();h=j.projectScene(ra,aa,this.sortElements);Fa=ya=0;if(W=ra.lights.length>0){ja=ra.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);xa.setRGB(0,0,0);pa=0;for(za=ja.length;pa<za;pa++){ia=ja[pa];Y=ia.color;if(ia instanceof THREE.AmbientLight){P.r+=Y.r;P.g+=Y.g;P.b+=Y.b}else if(ia instanceof THREE.DirectionalLight){S.r+=Y.r;S.g+=
+Y.g;S.b+=Y.b}else if(ia instanceof THREE.PointLight){xa.r+=Y.r;xa.g+=Y.g;xa.b+=Y.b}}}pa=0;for(za=h.length;pa<za;pa++){ja=h[pa];N.empty();if(ja instanceof THREE.RenderableParticle){y=ja;y.x*=o;y.y*=-x;ia=0;for(Y=ja.materials.length;ia<Y;)ia++}else if(ja instanceof THREE.RenderableLine){y=ja.v1;v=ja.v2;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);if(G.instersects(N)){ia=
 0;for(Y=ja.materials.length;ia<Y;)if((la=ja.materials[ia++])&&la.opacity!=0){ma=y;Da=v;var Ea=Fa++;if(fa[Ea]==null){fa[Ea]=document.createElementNS("http://www.w3.org/2000/svg","line");Ga==0&&fa[Ea].setAttribute("shape-rendering","crispEdges")}da=fa[Ea];da.setAttribute("x1",ma.positionScreen.x);da.setAttribute("y1",ma.positionScreen.y);da.setAttribute("x2",Da.positionScreen.x);da.setAttribute("y2",Da.positionScreen.y);if(la instanceof THREE.LineBasicMaterial){z.__styleString=la.color.__styleString;
-da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(da)}}}}else if(ja instanceof THREE.RenderableFace3){y=ja.v1;v=ja.v2;A=ja.v3;y.positionScreen.x*=p;y.positionScreen.y*=-u;v.positionScreen.x*=p;v.positionScreen.y*=-u;A.positionScreen.x*=p;A.positionScreen.y*=-u;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);
-L.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(L)){ia=0;for(Y=ja.meshMaterials.length;ia<Y;){la=ja.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ja.faceMaterials.length;ma<Da;)(la=ja.faceMaterials[ma++])&&la.opacity!=0&&c(y,v,A,ja,la,ra)}else la&&la.opacity!=0&&c(y,v,A,ja,la,ra)}}}else if(ja instanceof THREE.RenderableFace4){y=ja.v1;v=ja.v2;A=ja.v3;E=ja.v4;y.positionScreen.x*=p;y.positionScreen.y*=-u;v.positionScreen.x*=p;v.positionScreen.y*=-u;A.positionScreen.x*=
-p;A.positionScreen.y*=-u;E.positionScreen.x*=p;E.positionScreen.y*=-u;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);L.addPoint(A.positionScreen.x,A.positionScreen.y);L.addPoint(E.positionScreen.x,E.positionScreen.y);if(G.instersects(L)){ia=0;for(Y=ja.meshMaterials.length;ia<Y;){la=ja.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ja.faceMaterials.length;ma<Da;)(la=ja.faceMaterials[ma++])&&la.opacity!=0&&d(y,v,A,E,ja,la,
-ra)}else la&&la.opacity!=0&&d(y,v,A,E,ja,la,ra)}}}}}};
+da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(da)}}}}else if(ja instanceof THREE.RenderableFace3){y=ja.v1;v=ja.v2;B=ja.v3;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;B.positionScreen.x*=o;B.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);
+N.addPoint(B.positionScreen.x,B.positionScreen.y);if(G.instersects(N)){ia=0;for(Y=ja.meshMaterials.length;ia<Y;){la=ja.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ja.faceMaterials.length;ma<Da;)(la=ja.faceMaterials[ma++])&&la.opacity!=0&&c(y,v,B,ja,la,ra)}else la&&la.opacity!=0&&c(y,v,B,ja,la,ra)}}}else if(ja instanceof THREE.RenderableFace4){y=ja.v1;v=ja.v2;B=ja.v3;F=ja.v4;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;B.positionScreen.x*=
+o;B.positionScreen.y*=-x;F.positionScreen.x*=o;F.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);N.addPoint(B.positionScreen.x,B.positionScreen.y);N.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(N)){ia=0;for(Y=ja.meshMaterials.length;ia<Y;){la=ja.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ja.faceMaterials.length;ma<Da;)(la=ja.faceMaterials[ma++])&&la.opacity!=0&&d(y,v,B,F,ja,la,
+ra)}else la&&la.opacity!=0&&d(y,v,B,F,ja,la,ra)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -223,110 +223,110 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(m,C,x){var w,B,O,I=m.vertices,K=I.length,H=m.colors,F=H.length,J=m.__vertexArray,M=m.__colorArray,X=m.__sortArray,U=m.__dirtyVertices,Ca=m.__dirtyColors;if(x.sortParticles){Ea.multiplySelf(x.matrixWorld);for(w=0;w<K;w++){B=I[w].position;Ya.copy(B);Ea.multiplyVector3(Ya);X[w]=[Ya.z,w]}X.sort(function(Ha,oa){return oa[0]-Ha[0]});for(w=0;w<K;w++){B=I[X[w][1]].position;O=w*3;J[O]=B.x;J[O+1]=B.y;J[O+2]=B.z}for(w=0;w<F;w++){O=w*3;color=H[X[w][1]];M[O]=color.r;
-M[O+1]=color.g;M[O+2]=color.b}}else{if(U)for(w=0;w<K;w++){B=I[w].position;O=w*3;J[O]=B.x;J[O+1]=B.y;J[O+2]=B.z}if(Ca)for(w=0;w<F;w++){color=H[w];O=w*3;M[O]=color.r;M[O+1]=color.g;M[O+2]=color.b}}if(U||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}if(Ca||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}function d(m,C,x,w,B){w.program||ra.initMaterial(w,C,x,B);var O=w.program,I=O.uniforms,K=w.uniforms;
-if(O!=ya){e.useProgram(O);ya=O}e.uniformMatrix4fv(I.projectionMatrix,!1,Sa);if(x&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){K.fogColor.value.setHex(x.color.hex);if(x instanceof THREE.Fog){K.fogNear.value=x.near;K.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)K.fogDensity.value=x.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof
-THREE.MeshLambertMaterial||w.lights){var H,F,J=0,M=0,X=0,U,Ca,Ha,oa,wa=Ta,cb=wa.directional.colors,Aa=wa.directional.positions,Ia=wa.point.colors,Ja=wa.point.positions,Qa=wa.point.distances,D=0,Z=0;x=F=oa=0;for(H=C.length;x<H;x++){F=C[x];U=F.color;Ca=F.position;Ha=F.intensity;oa=F.distance;if(F instanceof THREE.AmbientLight){J+=U.r;M+=U.g;X+=U.b}else if(F instanceof THREE.DirectionalLight){oa=D*3;cb[oa]=U.r*Ha;cb[oa+1]=U.g*Ha;cb[oa+2]=U.b*Ha;Aa[oa]=Ca.x;Aa[oa+1]=Ca.y;Aa[oa+2]=Ca.z;D+=1}else if(F instanceof
-THREE.PointLight){F=Z*3;Ia[F]=U.r*Ha;Ia[F+1]=U.g*Ha;Ia[F+2]=U.b*Ha;Ja[F]=Ca.x;Ja[F+1]=Ca.y;Ja[F+2]=Ca.z;Qa[Z]=oa;Z+=1}}for(x=D*3;x<cb.length;x++)cb[x]=0;for(x=Z*3;x<Ia.length;x++)Ia[x]=0;wa.point.length=Z;wa.directional.length=D;wa.ambient[0]=J;wa.ambient[1]=M;wa.ambient[2]=X;x=Ta;K.enableLighting.value=x.directional.length+x.point.length;K.ambientLightColor.value=x.ambient;K.directionalLightColor.value=x.directional.colors;K.directionalLightDirection.value=x.directional.positions;K.pointLightColor.value=
-x.point.colors;K.pointLightPosition.value=x.point.positions;K.pointLightDistance.value=x.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){K.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);K.opacity.value=w.opacity;K.map.texture=w.map;K.lightMap.texture=w.lightMap;K.envMap.texture=w.envMap;K.reflectivity.value=w.reflectivity;K.refractionRatio.value=w.refractionRatio;K.combine.value=w.combine;K.useRefract.value=
+THREE.WebGLRenderer=function(b){function c(m,C,u){var w,A,M,I=m.vertices,K=I.length,H=m.colors,E=H.length,J=m.__vertexArray,L=m.__colorArray,U=m.__sortArray,V=m.__dirtyVertices,Ca=m.__dirtyColors;if(u.sortParticles){Ea.multiplySelf(u.matrixWorld);for(w=0;w<K;w++){A=I[w].position;Ya.copy(A);Ea.multiplyVector3(Ya);U[w]=[Ya.z,w]}U.sort(function(Ha,oa){return oa[0]-Ha[0]});for(w=0;w<K;w++){A=I[U[w][1]].position;M=w*3;J[M]=A.x;J[M+1]=A.y;J[M+2]=A.z}for(w=0;w<E;w++){M=w*3;color=H[U[w][1]];L[M]=color.r;
+L[M+1]=color.g;L[M+2]=color.b}}else{if(V)for(w=0;w<K;w++){A=I[w].position;M=w*3;J[M]=A.x;J[M+1]=A.y;J[M+2]=A.z}if(Ca)for(w=0;w<E;w++){color=H[w];M=w*3;L[M]=color.r;L[M+1]=color.g;L[M+2]=color.b}}if(V||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}if(Ca||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}function d(m,C,u,w,A){w.program||ra.initMaterial(w,C,u,A);var M=w.program,I=M.uniforms,K=w.uniforms;
+if(M!=ya){e.useProgram(M);ya=M}e.uniformMatrix4fv(I.projectionMatrix,!1,Sa);if(u&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){K.fogColor.value.setHex(u.color.hex);if(u instanceof THREE.Fog){K.fogNear.value=u.near;K.fogFar.value=u.far}else if(u instanceof THREE.FogExp2)K.fogDensity.value=u.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof
+THREE.MeshLambertMaterial||w.lights){var H,E,J=0,L=0,U=0,V,Ca,Ha,oa,wa=Ta,cb=wa.directional.colors,Aa=wa.directional.positions,Ia=wa.point.colors,Ja=wa.point.positions,Qa=wa.point.distances,D=0,Z=0;u=E=oa=0;for(H=C.length;u<H;u++){E=C[u];V=E.color;Ca=E.position;Ha=E.intensity;oa=E.distance;if(E instanceof THREE.AmbientLight){J+=V.r;L+=V.g;U+=V.b}else if(E instanceof THREE.DirectionalLight){oa=D*3;cb[oa]=V.r*Ha;cb[oa+1]=V.g*Ha;cb[oa+2]=V.b*Ha;Aa[oa]=Ca.x;Aa[oa+1]=Ca.y;Aa[oa+2]=Ca.z;D+=1}else if(E instanceof
+THREE.PointLight){E=Z*3;Ia[E]=V.r*Ha;Ia[E+1]=V.g*Ha;Ia[E+2]=V.b*Ha;Ja[E]=Ca.x;Ja[E+1]=Ca.y;Ja[E+2]=Ca.z;Qa[Z]=oa;Z+=1}}for(u=D*3;u<cb.length;u++)cb[u]=0;for(u=Z*3;u<Ia.length;u++)Ia[u]=0;wa.point.length=Z;wa.directional.length=D;wa.ambient[0]=J;wa.ambient[1]=L;wa.ambient[2]=U;u=Ta;K.enableLighting.value=u.directional.length+u.point.length;K.ambientLightColor.value=u.ambient;K.directionalLightColor.value=u.directional.colors;K.directionalLightDirection.value=u.directional.positions;K.pointLightColor.value=
+u.point.colors;K.pointLightPosition.value=u.point.positions;K.pointLightDistance.value=u.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){K.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);K.opacity.value=w.opacity;K.map.texture=w.map;K.lightMap.texture=w.lightMap;K.envMap.texture=w.envMap;K.reflectivity.value=w.reflectivity;K.refractionRatio.value=w.refractionRatio;K.combine.value=w.combine;K.useRefract.value=
 w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof THREE.LineBasicMaterial){K.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);K.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){K.psColor.value.setRGB(w.color.r,w.color.g,w.color.b);K.opacity.value=w.opacity;K.size.value=w.size;K.scale.value=fa.height/2;K.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){K.ambient.value.setRGB(w.ambient.r,w.ambient.g,w.ambient.b);K.specular.value.setRGB(w.specular.r,
-w.specular.g,w.specular.b);K.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){K.mNear.value=m.near;K.mFar.value=m.far;K.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)K.opacity.value=w.opacity;for(var t in K)if(M=O.uniforms[t]){H=K[t];J=H.type;x=H.value;if(J=="i")e.uniform1i(M,x);else if(J=="f")e.uniform1f(M,x);else if(J=="fv1")e.uniform1fv(M,x);else if(J=="fv")e.uniform3fv(M,x);else if(J=="v2")e.uniform2f(M,x.x,x.y);else if(J=="v3")e.uniform3f(M,x.x,
-x.y,x.z);else if(J=="v4")e.uniform4f(M,x.x,x.y,x.z,x.w);else if(J=="c")e.uniform3f(M,x.r,x.g,x.b);else if(J=="t"){e.uniform1i(M,x);if(H=H.texture)if(H.image instanceof Array&&H.image.length==6){if(H.image.length==6){if(H.needsUpdate){if(H.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,H.image[J])}else{H.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
-H.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,H.image[J]);H.__webglInit=!0}N(e.TEXTURE_CUBE_MAP,H,H.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);H.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube)}}else P(H,x)}}e.uniformMatrix4fv(I.modelViewMatrix,!1,B._modelViewMatrixArray);e.uniformMatrix3fv(I.normalMatrix,!1,B._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||
-w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(I.cameraPosition,m.position.x,m.position.y,m.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(I.objectMatrix,!1,B._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(I.viewMatrix,!1,$a);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=K.directionalLightDirection.value;m[0]=
--C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(I.directionalLightDirection,m);e.uniformMatrix4fv(I.objectMatrix,!1,B._objectMatrixArray);e.uniformMatrix4fv(I.viewMatrix,!1,$a)}if(w.skinning){e.uniformMatrix4fv(I.cameraInverseMatrix,!1,$a);e.uniformMatrix4fv(I.boneGlobalMatrices,!1,B.boneMatrices)}return O}function f(m,C,x,w,B,O){if(w.opacity!=0){var I;m=d(m,C,x,w,O).attributes;if(w.morphTargets){C=w.program.attributes;O.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[O.morphTargetBase]):
-e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(O.morphTargetForcedOrder.length){x=0;for(var K=O.morphTargetForcedOrder,H=O.morphTargetInfluences;x<w.numSupportedMorphTargets&&x<K.length;){e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[K[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);O.__webglMorphTargetInfluences[x]=H[K[x]];x++}}else{K=[];var F=-1,J=0;H=O.morphTargetInfluences;var M,X=H.length;x=0;for(O.morphTargetBase!==
--1&&(K[O.morphTargetBase]=!0);x<w.numSupportedMorphTargets;){for(M=0;M<X;M++)if(!K[M]&&H[M]>F){J=M;F=H[J]}e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);O.__webglMorphTargetInfluences[x]=F;K[J]=1;F=-1;x++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,O.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(B.__webglCustomAttributes)for(I in B.__webglCustomAttributes)if(m[I]>=
-0){C=B.__webglCustomAttributes[I];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[I],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(B.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
-B.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(B.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,B.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(O instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);e.drawElements(e.LINES,
-B.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);e.drawElements(e.TRIANGLES,B.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(O instanceof THREE.Line){O=O.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(O,0,B.__webglLineCount)}else if(O instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,B.__webglParticleCount);else O instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,B.__webglVertexCount)}}function g(m,C){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=
-e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,
-3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function h(m){if(aa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);aa=m.doubleSided}if(pa!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);pa=m.flipSided}}function j(m){if(ia!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ia=m}}function k(m){la[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);la[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);la[2].set(m.n41+m.n21,m.n42+m.n22,
-m.n43+m.n23,m.n44+m.n24);la[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);la[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);la[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var C;for(m=0;m<6;m++){C=la[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function n(m){for(var C=m.matrixWorld,x=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=la[w].x*C.n14+la[w].y*C.n24+la[w].z*C.n34+la[w].w;if(m<=x)return!1}return!0}function o(m,
-C){m.list[m.count]=C;m.count+=1}function p(m){var C,x,w=m.object,B=m.opaque,O=m.transparent;O.count=0;m=B.count=0;for(C=w.materials.length;m<C;m++){x=w.materials[m];x.transparent?o(O,x):o(B,x)}}function u(m){var C,x,w,B,O=m.object,I=m.buffer,K=m.opaque,H=m.transparent;H.count=0;m=K.count=0;for(w=O.materials.length;m<w;m++){C=O.materials[m];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=I.materials.length;C<x;C++)(B=I.materials[C])&&(B.transparent?o(H,B):o(K,B))}else(B=C)&&(B.transparent?o(H,B):
-o(K,B))}}function y(m,C){return C.z-m.z}function v(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,x=m.lights.length,w,B=m.lights,O=[],I,K,H,F,J,M=m.__webglShadowVolumes.length;for(C=0;C<x;C++){w=m.lights[C];if(w instanceof THREE.DirectionalLight){O[0]=-w.position.x;
-O[1]=-w.position.y;O[2]=-w.position.z;for(J=0;J<M;J++){w=m.__webglShadowVolumes[J].object;I=m.__webglShadowVolumes[J].buffer;K=w.materials[0];K.program||ra.initMaterial(K,B,undefined,w);K=K.program;H=K.uniforms;F=K.attributes;if(ya!==K){e.useProgram(K);ya=K;e.uniformMatrix4fv(H.projectionMatrix,!1,Sa);e.uniformMatrix4fv(H.viewMatrix,!1,$a);e.uniform3fv(H.directionalLightDirection,O)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(H.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,
-I.__webglVertexBuffer);e.vertexAttribPointer(F.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,I.__webglNormalBuffer);e.vertexAttribPointer(F.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,I.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,I.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,I.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,
-e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);za="";ya=ha.program;e.useProgram(ha.program);e.uniformMatrix4fv(ha.projectionLocation,!1,Sa);e.uniform1f(ha.darknessLocation,ha.darkness);e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.vertexAttribPointer(ha.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ha.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);
-e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function A(m,C){var x,w,B,O=m.__webglLensFlares.length,I,K,H;I=new THREE.Vector3;var F=ja/Da;K=Da*0.5;H=ja*0.5;var J=16/ja,M=[J*F,J],X=[1,1,0];J=[1,1];var U,Ca=ka.readBackPixels,Ha,oa,wa=ka.uniforms;x=ka.attributes;e.useProgram(ka.program);ya=ka.program;za="";e.uniform1i(wa.map,0);e.activeTexture(e.TEXTURE0);e.uniform1f(wa.opacity,1);e.uniform1f(wa.rotation,0);e.uniform2fv(wa.scale,M);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.vertexAttribPointer(x.vertex,
-2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);for(B=0;B<O;B++){x=m.__webglLensFlares[B].object;I.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(I);w=I.z;C.projectionMatrix.multiplyVector3(I);X[0]=I.x;X[1]=I.y;X[2]=I.z;J[0]=X[0]*K+K;J[1]=X[1]*H+H;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,J[0]-8,J[1]-
-8,16,16);e.uniform3fv(wa.screenPosition,X);e.uniform1i(wa.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);try{e.readPixels(J[0]-8,J[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ka.readBackPixels)}catch(cb){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-w,C.far))/C.far),10)+2;w=sampleDistance*4;U=sampleDistance*64;oa=0;Ha=28-w+
-(448-U);ka.readBackPixels[Ha+0]===255&&ka.readBackPixels[Ha+1]===0&&ka.readBackPixels[Ha+2]===255&&(oa+=0.2);Ha=28+w+(448-U);Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=28+w+(448+U);Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=28-w+(448+U);Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=476;Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);x.positionScreen.x=X[0];x.positionScreen.y=X[1];x.positionScreen.z=X[2];x.customUpdateCallback?x.customUpdateCallback(oa,
-x):x.updateLensFlares(oa);e.uniform1i(wa.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(B=0;B<O;B++){x=m.__webglLensFlares[B].object;I=0;for(K=x.lensFlares.length;I<K;I++){H=x.lensFlares[I];if(H.opacity>0.0010&&H.scale>0.0010){X[0]=H.x;X[1]=H.y;X[2]=H.z;J=H.size*H.scale/ja;M[0]=J*F;M[1]=J;e.uniform3fv(wa.screenPosition,X);e.uniform1f(wa.rotation,H.rotation);e.uniform2fv(wa.scale,M);e.uniform1f(wa.opacity,H.opacity);z(H.blending);P(H.texture,0);e.drawElements(e.TRIANGLES,
-6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function E(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,x,w,B,O;if(m instanceof THREE.Mesh){x=m.geometry;for(C in x.geometryGroups){w=x.geometryGroups[C];O=!1;for(B in w.__webglCustomAttributes)if(w.__webglCustomAttributes[B].needsUpdate){O=!0;break}if(x.__dirtyVertices||
-x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||O){O=e.DYNAMIC_DRAW;var I=void 0,K=void 0,H=void 0,F=void 0;H=void 0;var J=void 0,M=void 0,X=void 0,U=void 0,Ca=void 0,Ha=void 0,oa=void 0,wa=void 0,cb=void 0,Aa=void 0,Ia=void 0,Ja=void 0,Qa=void 0;M=void 0;X=void 0;F=void 0;U=void 0;F=void 0;var D=void 0,Z=void 0;M=void 0;D=void 0;Z=void 0;var t=void 0,ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=
-void 0;Z=void 0;t=void 0;F=void 0;U=void 0;J=void 0;H=void 0;H=void 0;D=void 0;Z=void 0;t=void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa=0,Ka=0,La=0,T=0,Ra=0;Z=D=0;var Xa=w.__vertexArray,Za=w.__uvArray,W=w.__uv2Array,ta=w.__normalArray,ea=w.__tangentArray,ca=w.__colorArray,va=w.__skinVertexAArray,ua=w.__skinVertexBArray,ga=w.__skinIndexArray,Q=w.__skinWeightArray,Na=w.__morphTargetsArrays,db=w.__webglCustomAttributes;t=void 0;var Ua=w.__faceArray,bb=w.__lineArray,lb=w.__needsSmoothNormals;
-Ha=w.__vertexColorType;Ca=w.__uvType;oa=w.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals,ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=w.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(db)for(fb in db){db[fb].offset=0;db[fb].offsetSrc=0}I=0;for(K=xb.length;I<K;I++){H=
-xb[I];F=Ab[H];yb&&(wa=yb[H]);zb&&(cb=zb[H]);H=F.vertexNormals;J=F.normal;M=F.vertexColors;X=F.color;U=F.vertexTangents;if(F instanceof THREE.Face3){if(ib){Aa=nb[F.a].position;Ia=nb[F.b].position;Ja=nb[F.c].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ia.x;Xa[Va+4]=Ia.y;Xa[Va+5]=Ia.z;Xa[Va+6]=Ja.x;Xa[Va+7]=Ja.y;Xa[Va+8]=Ja.z;Va+=9}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[F.a];
-t.array[D+1]=t.value[F.b];t.array[D+2]=t.value[F.c]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[F.a];Ia=t.value[F.b];Ja=t.value[F.c]}else if(t.boundTo==="faces"){Aa=t.value[Z];Ia=t.value[Z];Ja=t.value[Z];t.offsetSrc++}else if(t.boundTo===
-"faceVertices"){Aa=t.value[Z+0];Ia=t.value[Z+1];Ja=t.value[Z+2];t.offsetSrc+=3}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ia.x;t.array[D+3]=Ia.y;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ia.r;t.array[D+4]=Ia.g;t.array[D+5]=Ia.b;t.array[D+6]=Ja.r;t.array[D+7]=Ja.g;t.array[D+8]=Ja.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ia.x;t.array[D+4]=
-Ia.y;t.array[D+5]=Ia.z;t.array[D+6]=Ja.x;t.array[D+7]=Ja.y;t.array[D+8]=Ja.z}t.offset+=9}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Ia.z;t.array[D+7]=Ia.w;t.array[D+8]=Ja.x;t.array[D+9]=Ja.y;t.array[D+10]=Ja.z;t.array[D+11]=Ja.w;t.offset+=12}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[F.a].position;Ia=jb[D].vertices[F.b].position;Ja=jb[D].vertices[F.c].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=
-Aa.z;t[Ra+3]=Ia.x;t[Ra+4]=Ia.y;t[Ra+5]=Ia.z;t[Ra+6]=Ja.x;t[Ra+7]=Ja.y;t[Ra+8]=Ja.z}Ra+=9}if(kb.length){D=kb[F.a];Z=kb[F.b];t=kb[F.c];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;D=qb[F.a];Z=qb[F.b];t=qb[F.c];ga[T]=D.x;ga[T+1]=D.y;ga[T+2]=D.z;ga[T+3]=D.w;ga[T+4]=Z.x;ga[T+5]=Z.y;ga[T+6]=Z.z;ga[T+7]=Z.w;ga[T+8]=t.x;ga[T+9]=t.y;ga[T+10]=t.z;ga[T+11]=t.w;D=ob[F.a];Z=ob[F.b];t=ob[F.c];va[T]=D.x;va[T+1]=D.y;va[T+2]=D.z;
-va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+10]=t.z;va[T+11]=1;D=pb[F.a];Z=pb[F.b];t=pb[F.c];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;T+=12}if(vb&&Ha){if(M.length==3&&Ha==THREE.VertexColors){F=M[0];D=M[1];Z=M[2]}else Z=D=F=X;ca[La]=F.r;ca[La+1]=F.g;ca[La+2]=F.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;La+=9}if(ub&&Pa.hasTangents){M=
-U[0];X=U[1];F=U[2];ea[Oa]=M.x;ea[Oa+1]=M.y;ea[Oa+2]=M.z;ea[Oa+3]=M.w;ea[Oa+4]=X.x;ea[Oa+5]=X.y;ea[Oa+6]=X.z;ea[Oa+7]=X.w;ea[Oa+8]=F.x;ea[Oa+9]=F.y;ea[Oa+10]=F.z;ea[Oa+11]=F.w;Oa+=12}if(tb&&oa)if(H.length==3&&lb)for(U=0;U<3;U++){J=H[U];ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}else for(U=0;U<3;U++){ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}if(rb&&wa!==undefined&&Ca)for(U=0;U<3;U++){H=wa[U];Za[gb]=H.u;Za[gb+1]=H.v;gb+=2}if(rb&&cb!==undefined&&Ca)for(U=0;U<3;U++){H=cb[U];W[hb]=H.u;W[hb+1]=H.v;hb+=
-2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+2;Wa+=3;bb[Ka]=Ma;bb[Ka+1]=Ma+1;bb[Ka+2]=Ma;bb[Ka+3]=Ma+2;bb[Ka+4]=Ma+1;bb[Ka+5]=Ma+2;Ka+=6;Ma+=3}}else if(F instanceof THREE.Face4){if(ib){Aa=nb[F.a].position;Ia=nb[F.b].position;Ja=nb[F.c].position;Qa=nb[F.d].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ia.x;Xa[Va+4]=Ia.y;Xa[Va+5]=Ia.z;Xa[Va+6]=Ja.x;Xa[Va+7]=Ja.y;Xa[Va+8]=Ja.z;Xa[Va+9]=Qa.x;Xa[Va+10]=Qa.y;Xa[Va+11]=Qa.z;Va+=12}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;
-if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[F.a];t.array[D+1]=t.value[F.b];t.array[D+2]=t.value[F.c];t.array[D+2]=t.value[F.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];t.array[D+2]=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.array[D+2]=t.value[Z+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||
-t.boundTo==="vertices"){Aa=t.value[F.a];Ia=t.value[F.b];Ja=t.value[F.c];Qa=t.value[F.d]}else if(t.boundTo==="faces"){Aa=t.value[Z];Ia=t.value[Z];Ja=t.value[Z];Qa=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[Z+0];Ia=t.value[Z+1];Ja=t.value[Z+2];Qa=t.value[Z+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ia.x;t.array[D+3]=Ia.y;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.array[D+6]=Qa.x;t.array[D+7]=Qa.y;t.offset+=8}else if(t.size===3){if(t.type===
-"c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ia.r;t.array[D+4]=Ia.g;t.array[D+5]=Ia.b;t.array[D+6]=Ja.r;t.array[D+7]=Ja.g;t.array[D+8]=Ja.b;t.array[D+9]=Qa.r;t.array[D+10]=Qa.g;t.array[D+11]=Qa.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ia.x;t.array[D+4]=Ia.y;t.array[D+5]=Ia.z;t.array[D+6]=Ja.x;t.array[D+7]=Ja.y;t.array[D+8]=Ja.z;t.array[D+9]=Qa.x;t.array[D+10]=Qa.y;t.array[D+11]=Qa.z}t.offset+=12}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+
-2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Ia.z;t.array[D+7]=Ia.w;t.array[D+8]=Ja.x;t.array[D+9]=Ja.y;t.array[D+10]=Ja.z;t.array[D+11]=Ja.w;t.array[D+12]=Qa.x;t.array[D+13]=Qa.y;t.array[D+14]=Qa.z;t.array[D+15]=Qa.w;t.offset+=16}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[F.a].position;Ia=jb[D].vertices[F.b].position;Ja=jb[D].vertices[F.c].position;Qa=jb[D].vertices[F.d].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ia.x;t[Ra+4]=Ia.y;
-t[Ra+5]=Ia.z;t[Ra+6]=Ja.x;t[Ra+7]=Ja.y;t[Ra+8]=Ja.z;t[Ra+9]=Qa.x;t[Ra+10]=Qa.y;t[Ra+11]=Qa.z}Ra+=12}if(kb.length){D=kb[F.a];Z=kb[F.b];t=kb[F.c];ab=kb[F.d];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;Q[T+12]=ab.x;Q[T+13]=ab.y;Q[T+14]=ab.z;Q[T+15]=ab.w;D=qb[F.a];Z=qb[F.b];t=qb[F.c];ab=qb[F.d];ga[T]=D.x;ga[T+1]=D.y;ga[T+2]=D.z;ga[T+3]=D.w;ga[T+4]=Z.x;ga[T+5]=Z.y;ga[T+6]=Z.z;ga[T+7]=Z.w;ga[T+8]=t.x;ga[T+9]=t.y;ga[T+
-10]=t.z;ga[T+11]=t.w;ga[T+12]=ab.x;ga[T+13]=ab.y;ga[T+14]=ab.z;ga[T+15]=ab.w;D=ob[F.a];Z=ob[F.b];t=ob[F.c];ab=ob[F.d];va[T]=D.x;va[T+1]=D.y;va[T+2]=D.z;va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+10]=t.z;va[T+11]=1;va[T+12]=ab.x;va[T+13]=ab.y;va[T+14]=ab.z;va[T+15]=1;D=pb[F.a];Z=pb[F.b];t=pb[F.c];F=pb[F.d];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;ua[T+12]=F.x;ua[T+
-13]=F.y;ua[T+14]=F.z;ua[T+15]=1;T+=16}if(vb&&Ha){if(M.length==4&&Ha==THREE.VertexColors){F=M[0];D=M[1];Z=M[2];M=M[3]}else M=Z=D=F=X;ca[La]=F.r;ca[La+1]=F.g;ca[La+2]=F.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;ca[La+9]=M.r;ca[La+10]=M.g;ca[La+11]=M.b;La+=12}if(ub&&Pa.hasTangents){M=U[0];X=U[1];F=U[2];U=U[3];ea[Oa]=M.x;ea[Oa+1]=M.y;ea[Oa+2]=M.z;ea[Oa+3]=M.w;ea[Oa+4]=X.x;ea[Oa+5]=X.y;ea[Oa+6]=X.z;ea[Oa+7]=X.w;ea[Oa+8]=F.x;ea[Oa+9]=F.y;ea[Oa+10]=F.z;ea[Oa+11]=F.w;
-ea[Oa+12]=U.x;ea[Oa+13]=U.y;ea[Oa+14]=U.z;ea[Oa+15]=U.w;Oa+=16}if(tb&&oa)if(H.length==4&&lb)for(U=0;U<4;U++){J=H[U];ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}else for(U=0;U<4;U++){ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}if(rb&&wa!==undefined&&Ca)for(U=0;U<4;U++){H=wa[U];Za[gb]=H.u;Za[gb+1]=H.v;gb+=2}if(rb&&cb!==undefined&&Ca)for(U=0;U<4;U++){H=cb[U];W[hb]=H.u;W[hb+1]=H.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+3;Ua[Wa+3]=Ma+1;Ua[Wa+4]=Ma+2;Ua[Wa+5]=Ma+3;Wa+=6;bb[Ka]=Ma;bb[Ka+1]=Ma+1;
-bb[Ka+2]=Ma;bb[Ka+3]=Ma+3;bb[Ka+4]=Ma+1;bb[Ka+5]=Ma+2;bb[Ka+6]=Ma+2;bb[Ka+7]=Ma+3;Ka+=8;Ma+=4}}}if(mb){I=0;for(K=mb.length;I<K;I++){Ua[Wa]=mb[I].a;Ua[Wa+1]=mb[I].b;Ua[Wa+2]=mb[I].c;Ua[Wa+3]=mb[I].a;Ua[Wa+4]=mb[I].c;Ua[Wa+5]=mb[I].d;Wa+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Xa,O)}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,O);t.needsUpdate=!1}}if(wb){D=0;for(Z=jb.length;D<
-Z;D++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,Na[D],O)}}if(vb&&La>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ca,O)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,O)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ea,O)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,O)}if(rb&&
-hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,W,O)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,O);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,O)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,O);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,O);e.bindBuffer(e.ARRAY_BUFFER,
-w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ga,O);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Q,O)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;C=e.DYNAMIC_DRAW;Ha=m.vertices;w=m.colors;oa=Ha.length;O=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors;
-if(m.__dirtyVertices){for(K=0;K<oa;K++){Ca=Ha[K].position;B=K*3;wa[B]=Ca.x;wa[B+1]=Ca.y;wa[B+2]=Ca.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa,C)}if(cb){for(K=0;K<O;K++){color=w[K];B=K*3;I[B]=color.r;I[B+1]=color.g;I[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;C=e.DYNAMIC_DRAW;Ha=
-m.vertices;w=m.colors;oa=Ha.length;O=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors;if(m.__dirtyVertices){for(K=0;K<oa;K++){Ca=Ha[K].position;B=K*3;wa[B]=Ca.x;wa[B+1]=Ca.y;wa[B+2]=Ca.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa,C)}if(cb){for(K=0;K<O;K++){color=w[K];B=K*3;I[B]=color.r;I[B+1]=color.g;I[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof
-THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&c(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function L(m){function C(X){var U=[];x=0;for(w=X.length;x<w;x++)X[x]==undefined?U.push("undefined"):U.push(X[x].id);return U.join("_")}var x,w,B,O,I,K,H,F,J={},M=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};B=0;for(O=m.faces.length;B<O;B++){I=m.faces[B];K=I.materials;H=C(K);J[H]==undefined&&(J[H]={hash:H,counter:0});F=J[H].hash+
-"_"+J[H].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:K,vertices:0,numMorphTargets:M});I=I instanceof THREE.Face3?3:4;if(m.geometryGroups[F].vertices+I>65535){J[H].counter+=1;F=J[H].hash+"_"+J[H].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:K,vertices:0,numMorphTargets:M})}m.geometryGroups[F].faces.push(B);m.geometryGroups[F].vertices+=I}}function V(m,C,x){m.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function z(m){if(m!=za){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}za=m}}function N(m,C,x){if((x.width&
-x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,qa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,qa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,qa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,qa(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,sa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,sa(C.minFilter))}}function P(m,
-C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}N(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===
-undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,qa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,qa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,qa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,qa(m.minFilter));e.texImage2D(e.TEXTURE_2D,
-0,qa(m.format),m.width,m.height,0,qa(m.format),qa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
-e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,x;if(m){C=m.__webglFramebuffer;x=m.width;m=m.height}else{C=null;x=Da;m=ja}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Y,ma,x,m);Fa=C}}function xa(m,C){var x;if(m=="fragment")x=
-e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function sa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function qa(m){switch(m){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 e,fa=document.createElement("canvas"),da=[],ya=null,Fa=null,Ga=!0,ra=this,aa=null,pa=null,za=null,ia=null,
-Y=0,ma=0,Da=0,ja=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,$=!0,na=new THREE.Color(0),Ba=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)$=b.antialias;b.clearColor!==undefined&&na.setHex(b.clearColor);
-if(b.clearAlpha!==undefined)Ba=b.clearAlpha}this.maxMorphTargets=8;this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(m,C,x,w){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(B){console.error(B)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
-e.clearColor(C.r,C.g,C.b,x)})($,na,Ba,R);this.context=e;if(R){var ha={};ha.vertices=new Float32Array(12);ha.faces=new Uint16Array(6);ha.darkness=0.5;ha.vertices[0]=-20;ha.vertices[1]=-20;ha.vertices[2]=-1;ha.vertices[3]=20;ha.vertices[4]=-20;ha.vertices[5]=-1;ha.vertices[6]=20;ha.vertices[7]=20;ha.vertices[8]=-1;ha.vertices[9]=-20;ha.vertices[10]=20;ha.vertices[11]=-1;ha.faces[0]=0;ha.faces[1]=1;ha.faces[2]=2;ha.faces[3]=0;ha.faces[4]=2;ha.faces[5]=3;ha.vertexBuffer=e.createBuffer();ha.elementBuffer=
-e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ha.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha.faces,e.STATIC_DRAW);ha.program=e.createProgram();e.attachShader(ha.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ha.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ha.program);ha.vertexLocation=e.getAttribLocation(ha.program,"position");
-ha.projectionLocation=e.getUniformLocation(ha.program,"projectionMatrix");ha.darknessLocation=e.getUniformLocation(ha.program,"darkness")}var ka={};ka.vertices=new Float32Array(16);ka.faces=new Uint16Array(6);ka.transparency=0.5;b=0;ka.vertices[b++]=-1;ka.vertices[b++]=-1;ka.vertices[b++]=0;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=
-1;ka.vertices[b++]=0;ka.vertices[b++]=1;b=0;ka.faces[b++]=0;ka.faces[b++]=1;ka.faces[b++]=2;ka.faces[b++]=0;ka.faces[b++]=2;ka.faces[b++]=3;ka.vertexBuffer=e.createBuffer();ka.elementBuffer=e.createBuffer();ka.tempTexture=e.createTexture();ka.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,
-ka.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ka.program=e.createProgram();e.attachShader(ka.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ka.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));
-e.linkProgram(ka.program);ka.attributes={};ka.uniforms={};ka.attributes.vertex=e.getAttribLocation(ka.program,"position");ka.attributes.uv=e.getAttribLocation(ka.program,"UV");ka.uniforms.map=e.getUniformLocation(ka.program,"map");ka.uniforms.opacity=e.getUniformLocation(ka.program,"opacity");ka.uniforms.scale=e.getUniformLocation(ka.program,"scale");ka.uniforms.rotation=e.getUniformLocation(ka.program,"rotation");ka.uniforms.screenPosition=e.getUniformLocation(ka.program,"screenPosition");ka.uniforms.renderPink=
-e.getUniformLocation(ka.program,"renderPink");this.setSize=function(m,C){fa.width=m;fa.height=C;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,C,x,w){Y=m;ma=C;Da=x;ja=w;e.viewport(Y,ma,Da,ja)};this.setScissor=function(m,C,x,w){e.scissor(m,C,x,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ga=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var x=new THREE.Color(m);e.clearColor(x.r,x.g,
-x.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ha.darkness=m};this.initMaterial=function(m,C,x,w){var B,O,I;if(m instanceof THREE.MeshDepthMaterial)I="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)I="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)I="normal";else if(m instanceof THREE.MeshBasicMaterial)I="basic";
-else if(m instanceof THREE.MeshLambertMaterial)I="lambert";else if(m instanceof THREE.MeshPhongMaterial)I="phong";else if(m instanceof THREE.LineBasicMaterial)I="basic";else m instanceof THREE.ParticleBasicMaterial&&(I="particle_basic");if(I){var K=THREE.ShaderLib[I];m.uniforms=Uniforms.clone(K.uniforms);m.vertexShader=K.vertexShader;m.fragmentShader=K.fragmentShader}var H,F,J;H=J=K=0;for(F=C.length;H<F;H++){O=C[H];O instanceof THREE.DirectionalLight&&J++;O instanceof THREE.PointLight&&K++}if(K+J<=
-4)C=J;else{C=Math.ceil(4*J/(K+J));K=4-C}O={directional:C,point:K};J=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)J=w.bones.length;var M;a:{H=m.fragmentShader;F=m.vertexShader;K=m.uniforms;C=m.attributes;x={map:!!m.map,envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:O.directional,maxPointLights:O.point,maxBones:J};var X;O=[];if(I)O.push(I);
-else{O.push(H);O.push(F)}for(X in x){O.push(X);O.push(x[X])}I=O.join();X=0;for(O=da.length;X<O;X++)if(da[X].code==I){M=da[X].program;break a}X=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?
-"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":
-"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e.attachShader(X,xa("fragment",prefix_fragment+H));e.attachShader(X,xa("vertex",prefix_vertex+F));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var U;H=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in K)H.push(U);
-U=H;K=0;for(H=U.length;K<H;K++){F=U[K];X.uniforms[F]=e.getUniformLocation(X,F)}H=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<x.maxMorphTargets;U++)H.push("morphTarget"+U);for(M in C)H.push(M);M=H;U=0;for(C=M.length;U<C;U++){x=M[U];X.attributes[x]=e.getAttribLocation(X,x)}da.push({program:X,code:I});M=X}m.program=M;M=m.program.attributes;e.enableVertexAttribArray(M.position);M.color>=0&&e.enableVertexAttribArray(M.color);M.normal>=
-0&&e.enableVertexAttribArray(M.normal);M.tangent>=0&&e.enableVertexAttribArray(M.tangent);if(m.skinning&&M.skinVertexA>=0&&M.skinVertexB>=0&&M.skinIndex>=0&&M.skinWeight>=0){e.enableVertexAttribArray(M.skinVertexA);e.enableVertexAttribArray(M.skinVertexB);e.enableVertexAttribArray(M.skinIndex);e.enableVertexAttribArray(M.skinWeight)}for(B in m.attributes)M[B]>=0&&e.enableVertexAttribArray(M[B]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(M.morphTarget0>=0){e.enableVertexAttribArray(M.morphTarget0);
-m.numSupportedMorphTargets++}if(M.morphTarget1>=0){e.enableVertexAttribArray(M.morphTarget1);m.numSupportedMorphTargets++}if(M.morphTarget2>=0){e.enableVertexAttribArray(M.morphTarget2);m.numSupportedMorphTargets++}if(M.morphTarget3>=0){e.enableVertexAttribArray(M.morphTarget3);m.numSupportedMorphTargets++}if(M.morphTarget4>=0){e.enableVertexAttribArray(M.morphTarget4);m.numSupportedMorphTargets++}if(M.morphTarget5>=0){e.enableVertexAttribArray(M.morphTarget5);m.numSupportedMorphTargets++}if(M.morphTarget6>=
-0){e.enableVertexAttribArray(M.morphTarget6);m.numSupportedMorphTargets++}if(M.morphTarget7>=0){e.enableVertexAttribArray(M.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(B=this.maxMorphTargets;m<B;m++)w.__webglMorphTargetInfluences[m]=0}};this.render=function(m,C,x,w){var B,O,I,K,H,F,J,M,X=m.lights,U=m.fog;C.matrixAutoUpdate&&C.updateMatrix();m.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray($a);C.projectionMatrix.flattenToArray(Sa);
-Ea.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ea);this.initWebGLObjects(m);S(x);(this.autoClear||w)&&this.clear();H=m.__webglObjects.length;for(w=0;w<H;w++){B=m.__webglObjects[w];J=B.object;if(J.visible)if(!(J instanceof THREE.Mesh)||n(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);E(J,C);u(B);B.render=!0;if(this.sortObjects){Ya.copy(J.position);Ea.multiplyVector3(Ya);B.z=Ya.z}}else B.render=!1;else B.render=!1}this.sortObjects&&m.__webglObjects.sort(y);F=m.__webglObjectsImmediate.length;
-for(w=0;w<F;w++){B=m.__webglObjectsImmediate[w];J=B.object;if(J.visible){J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray);E(J,C);p(B)}}z(THREE.NormalBlending);for(w=0;w<H;w++){B=m.__webglObjects[w];if(B.render){J=B.object;M=B.buffer;I=B.opaque;h(J);for(B=0;B<I.count;B++){K=I.list[B];j(K.depthTest);f(C,X,U,K,M,J)}}}for(w=0;w<F;w++){B=m.__webglObjectsImmediate[w];J=B.object;if(J.visible){I=B.opaque;h(J);for(B=0;B<I.count;B++){K=I.list[B];j(K.depthTest);O=d(C,X,U,K,J);J.render(function(Ca){g(Ca,
-O)})}}}for(w=0;w<H;w++){B=m.__webglObjects[w];if(B.render){J=B.object;M=B.buffer;I=B.transparent;h(J);for(B=0;B<I.count;B++){K=I.list[B];z(K.blending);j(K.depthTest);f(C,X,U,K,M,J)}}}for(w=0;w<F;w++){B=m.__webglObjectsImmediate[w];J=B.object;if(J.visible){I=B.transparent;h(J);for(B=0;B<I.count;B++){K=I.list[B];z(K.blending);j(K.depthTest);O=d(C,X,U,K,J);J.render(function(Ca){g(Ca,O)})}}}R&&m.__webglShadowVolumes.length&&m.lights.length&&v(m);m.__webglLensFlares.length&&A(m,C);if(x&&x.minFilter!==
-THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[]}for(;m.__objectsAdded.length;){var C=m.__objectsAdded[0],x=m,w=void 0,B=void 0,O=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);
-C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){B=C.geometry;B.geometryGroups==undefined&&L(B);for(w in B.geometryGroups){O=B.geometryGroups[w];if(!O.__webglVertexBuffer){var I=O;I.__webglVertexBuffer=e.createBuffer();I.__webglNormalBuffer=e.createBuffer();I.__webglTangentBuffer=e.createBuffer();I.__webglColorBuffer=e.createBuffer();I.__webglUVBuffer=e.createBuffer();I.__webglUV2Buffer=
-e.createBuffer();I.__webglSkinVertexABuffer=e.createBuffer();I.__webglSkinVertexBBuffer=e.createBuffer();I.__webglSkinIndicesBuffer=e.createBuffer();I.__webglSkinWeightsBuffer=e.createBuffer();I.__webglFaceBuffer=e.createBuffer();I.__webglLineBuffer=e.createBuffer();if(I.numMorphTargets){var K=void 0,H=void 0;I.__webglMorphTargetsBuffers=[];K=0;for(H=I.numMorphTargets;K<H;K++)I.__webglMorphTargetsBuffers.push(e.createBuffer())}I=O;K=C;var F=void 0,J=void 0,M=void 0;M=void 0;var X=void 0,U=void 0,
-Ca=void 0,Ha=Ca=H=0;J=void 0;M=void 0;var oa=void 0;F=void 0;J=void 0;X=K.geometry;oa=X.faces;U=I.faces;F=0;for(J=U.length;F<J;F++){M=U[F];M=oa[M];if(M instanceof THREE.Face3){H+=3;Ca+=1;Ha+=3}else if(M instanceof THREE.Face4){H+=4;Ca+=2;Ha+=4}}F=I;J=K;oa=void 0;U=void 0;var wa=void 0,cb=void 0;wa=void 0;M=[];oa=0;for(U=J.materials.length;oa<U;oa++){wa=J.materials[oa];if(wa instanceof THREE.MeshFaceMaterial){wa=0;for(l=F.materials.length;wa<l;wa++)(cb=F.materials[wa])&&M.push(cb)}else(cb=wa)&&M.push(cb)}F=
-M;a:{J=void 0;oa=void 0;U=F.length;for(J=0;J<U;J++){oa=F[J];if(oa.map||oa.lightMap||oa instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{oa=F;U=void 0;M=void 0;wa=oa.length;for(U=0;U<wa;U++){M=oa[U];if(!(M instanceof THREE.MeshBasicMaterial&&!M.envMap||M instanceof THREE.MeshDepthMaterial)){oa=M&&M.shading!=undefined&&M.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}oa=!1}a:{U=void 0;M=void 0;wa=F.length;for(U=0;U<wa;U++){M=F[U];if(M.vertexColors){M=M.vertexColors;
-break a}}M=!1}I.__vertexArray=new Float32Array(H*3);if(oa)I.__normalArray=new Float32Array(H*3);if(X.hasTangents)I.__tangentArray=new Float32Array(H*4);if(M)I.__colorArray=new Float32Array(H*3);if(J){if(X.faceUvs.length>0||X.faceVertexUvs.length>0)I.__uvArray=new Float32Array(H*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(H*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){I.__skinVertexAArray=new Float32Array(H*4);I.__skinVertexBArray=new Float32Array(H*
-4);I.__skinIndexArray=new Float32Array(H*4);I.__skinWeightArray=new Float32Array(H*4)}I.__faceArray=new Uint16Array(Ca*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));I.__lineArray=new Uint16Array(Ha*2);if(I.numMorphTargets){I.__morphTargetsArrays=[];X=0;for(U=I.numMorphTargets;X<U;X++)I.__morphTargetsArrays.push(new Float32Array(H*3))}I.__needsSmoothNormals=oa==THREE.SmoothShading;I.__uvType=J;I.__vertexColorType=M;I.__normalType=oa;I.__webglFaceCount=Ca*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*
-6:0);I.__webglLineCount=Ha*2;X=0;for(U=F.length;X<U;X++)if(F[X].attributes){I.__webglCustomAttributes={};for(a in F[X].attributes){J=F[X].attributes[a];Ca=1;if(J.type==="v2")Ca=2;else if(J.type==="v3")Ca=3;else if(J.type==="v4")Ca=4;else J.type==="c"&&(Ca=3);J.size=Ca;J.needsUpdate=!0;J.array=new Float32Array(H*Ca);J.buffer=e.createBuffer();I.__webglCustomAttributes[a]=J}}B.__dirtyVertices=!0;B.__dirtyMorphTargets=!0;B.__dirtyElements=!0;B.__dirtyUvs=!0;B.__dirtyNormals=!0;B.__dirtyTangents=!0;B.__dirtyColors=
-!0}C instanceof THREE.ShadowVolume?V(x.__webglShadowVolumes,O,C):V(x.__webglObjects,O,C)}}else if(C instanceof THREE.LensFlare)V(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){B=C.geometry;if(!B.__webglVertexBuffer){w=B;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=B;O=w.vertices.length;w.__vertexArray=new Float32Array(O*3);w.__colorArray=new Float32Array(O*3);w.__webglVertexCount=O;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(x.__webglObjects,B,
-C)}else if(C instanceof THREE.Line){B=C.geometry;if(!B.__webglVertexBuffer){w=B;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=B;O=w.vertices.length;w.__vertexArray=new Float32Array(O*3);w.__colorArray=new Float32Array(O*3);w.__webglLineCount=O;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(x.__webglObjects,B,C)}else if(C instanceof THREE.ParticleSystem){B=C.geometry;if(!B.__webglVertexBuffer){w=B;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();
-w=B;O=w.vertices.length;w.__vertexArray=new Float32Array(O*3);w.__colorArray=new Float32Array(O*3);w.__sortArray=[];w.__webglParticleCount=O;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(x.__webglObjects,B,C)}else THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes&&x.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){C=m.__objectsRemoved[0];x=m;B=void 0;w=void 0;for(B=x.__webglObjects.length-
-1;B>=0;B--){w=x.__webglObjects[B].object;C==w&&x.__webglObjects.splice(B,1)}m.__objectsRemoved.splice(0,1)}C=0;for(x=m.__webglObjects.length;C<x;C++)G(m.__webglObjects[C].object,m);C=0;for(x=m.__webglShadowVolumes.length;C<x;C++)G(m.__webglShadowVolumes[C].object,m);C=0;for(x=m.__webglLensFlares.length;C<x;C++)G(m.__webglLensFlares[C].object,m)};this.setFaceCulling=function(m,C){if(m){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):
-e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+w.specular.g,w.specular.b);K.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){K.mNear.value=m.near;K.mFar.value=m.far;K.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)K.opacity.value=w.opacity;for(var t in K)if(L=M.uniforms[t]){H=K[t];J=H.type;u=H.value;if(J=="i")e.uniform1i(L,u);else if(J=="f")e.uniform1f(L,u);else if(J=="fv1")e.uniform1fv(L,u);else if(J=="fv")e.uniform3fv(L,u);else if(J=="v2")e.uniform2f(L,u.x,u.y);else if(J=="v3")e.uniform3f(L,u.x,
+u.y,u.z);else if(J=="v4")e.uniform4f(L,u.x,u.y,u.z,u.w);else if(J=="c")e.uniform3f(L,u.r,u.g,u.b);else if(J=="t"){e.uniform1i(L,u);if(H=H.texture)if(H.image instanceof Array&&H.image.length==6){if(H.image.length==6){if(H.needsUpdate){if(H.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,H.image[J])}else{H.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
+H.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,H.image[J]);H.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,H,H.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);H.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube)}}else P(H,u)}}e.uniformMatrix4fv(I.modelViewMatrix,!1,A._modelViewMatrixArray);e.uniformMatrix3fv(I.normalMatrix,!1,A._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||
+w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(I.cameraPosition,m.position.x,m.position.y,m.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(I.objectMatrix,!1,A._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(I.viewMatrix,!1,$a);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=K.directionalLightDirection.value;m[0]=
+-C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(I.directionalLightDirection,m);e.uniformMatrix4fv(I.objectMatrix,!1,A._objectMatrixArray);e.uniformMatrix4fv(I.viewMatrix,!1,$a)}if(w.skinning){e.uniformMatrix4fv(I.cameraInverseMatrix,!1,$a);e.uniformMatrix4fv(I.boneGlobalMatrices,!1,A.boneMatrices)}return M}function f(m,C,u,w,A,M){if(w.opacity!=0){var I;m=d(m,C,u,w,M).attributes;if(w.morphTargets){C=w.program.attributes;M.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[M.morphTargetBase]):
+e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(M.morphTargetForcedOrder.length){u=0;for(var K=M.morphTargetForcedOrder,H=M.morphTargetInfluences;u<w.numSupportedMorphTargets&&u<K.length;){e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[K[u]]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[u]=H[K[u]];u++}}else{K=[];var E=-1,J=0;H=M.morphTargetInfluences;var L,U=H.length;u=0;for(M.morphTargetBase!==
+-1&&(K[M.morphTargetBase]=!0);u<w.numSupportedMorphTargets;){for(L=0;L<U;L++)if(!K[L]&&H[L]>E){J=L;E=H[J]}e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[u]=E;K[J]=1;E=-1;u++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,M.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(A.__webglCustomAttributes)for(I in A.__webglCustomAttributes)if(m[I]>=
+0){C=A.__webglCustomAttributes[I];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[I],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(A.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
+A.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(A.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,A.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(M instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);e.drawElements(e.LINES,
+A.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);e.drawElements(e.TRIANGLES,A.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(M instanceof THREE.Line){M=M.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(M,0,A.__webglLineCount)}else if(M instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,A.__webglParticleCount);else M instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,A.__webglVertexCount)}}function g(m,C,
+u){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);if(u==THREE.FlatShading){var w,A,M,I,K,H,E,J,L,U,V=m.count*3;for(U=
+0;U<V;U+=9){u=m.normalArray;w=u[U];A=u[U+1];M=u[U+2];I=u[U+3];H=u[U+4];J=u[U+5];K=u[U+6];E=u[U+7];L=u[U+8];w=(w+I+K)/3;A=(A+H+E)/3;M=(M+J+L)/3;u[U]=w;u[U+1]=A;u[U+2]=M;u[U+3]=w;u[U+4]=A;u[U+5]=M;u[U+6]=w;u[U+7]=A;u[U+8]=M}}e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function h(m){if(aa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE);aa=m.doubleSided}if(pa!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);pa=m.flipSided}}function j(m){if(ia!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ia=m}}function k(m){la[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);la[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);la[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);la[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);la[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-
+m.n34);la[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var C;for(m=0;m<6;m++){C=la[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function n(m){for(var C=m.matrixWorld,u=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=la[w].x*C.n14+la[w].y*C.n24+la[w].z*C.n34+la[w].w;if(m<=u)return!1}return!0}function p(m,C){m.list[m.count]=C;m.count+=1}function o(m){var C,u,w=m.object,A=m.opaque,M=m.transparent;M.count=0;m=A.count=0;for(C=w.materials.length;m<
+C;m++){u=w.materials[m];u.transparent?p(M,u):p(A,u)}}function x(m){var C,u,w,A,M=m.object,I=m.buffer,K=m.opaque,H=m.transparent;H.count=0;m=K.count=0;for(w=M.materials.length;m<w;m++){C=M.materials[m];if(C instanceof THREE.MeshFaceMaterial){C=0;for(u=I.materials.length;C<u;C++)(A=I.materials[C])&&(A.transparent?p(H,A):p(K,A))}else(A=C)&&(A.transparent?p(H,A):p(K,A))}}function y(m,C){return C.z-m.z}function v(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);
+e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,u=m.lights.length,w,A=m.lights,M=[],I,K,H,E,J,L=m.__webglShadowVolumes.length;for(C=0;C<u;C++){w=m.lights[C];if(w instanceof THREE.DirectionalLight){M[0]=-w.position.x;M[1]=-w.position.y;M[2]=-w.position.z;for(J=0;J<L;J++){w=m.__webglShadowVolumes[J].object;I=m.__webglShadowVolumes[J].buffer;K=w.materials[0];K.program||ra.initMaterial(K,
+A,undefined,w);K=K.program;H=K.uniforms;E=K.attributes;if(ya!==K){e.useProgram(K);ya=K;e.uniformMatrix4fv(H.projectionMatrix,!1,Sa);e.uniformMatrix4fv(H.viewMatrix,!1,$a);e.uniform3fv(H.directionalLightDirection,M)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(H.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,I.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,I.__webglNormalBuffer);e.vertexAttribPointer(E.normal,
+3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,I.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,I.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,I.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);za="";ya=ha.program;e.useProgram(ha.program);e.uniformMatrix4fv(ha.projectionLocation,!1,Sa);e.uniform1f(ha.darknessLocation,
+ha.darkness);e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.vertexAttribPointer(ha.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ha.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function B(m,C){var u,w,A,M=m.__webglLensFlares.length,I,K,H;I=new THREE.Vector3;var E=ja/Da;K=Da*0.5;H=
+ja*0.5;var J=16/ja,L=[J*E,J],U=[1,1,0];J=[1,1];var V,Ca=ka.readBackPixels,Ha,oa,wa=ka.uniforms;u=ka.attributes;e.useProgram(ka.program);ya=ka.program;za="";e.uniform1i(wa.map,0);e.activeTexture(e.TEXTURE0);e.uniform1f(wa.opacity,1);e.uniform1f(wa.rotation,0);e.uniform2fv(wa.scale,L);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.vertexAttribPointer(u.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+ka.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);for(A=0;A<M;A++){u=m.__webglLensFlares[A].object;I.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(I);w=I.z;C.projectionMatrix.multiplyVector3(I);U[0]=I.x;U[1]=I.y;U[2]=I.z;J[0]=U[0]*K+K;J[1]=U[1]*H+H;e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,J[0]-8,J[1]-8,16,16);e.uniform3fv(wa.screenPosition,U);e.uniform1i(wa.renderPink,1);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);
+try{e.readPixels(J[0]-8,J[1]-8,16,16,e.RGBA,e.UNSIGNED_BYTE,ka.readBackPixels)}catch(cb){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}e.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-w,C.far))/C.far),10)+2;w=sampleDistance*4;V=sampleDistance*64;oa=0;Ha=28-w+(448-V);ka.readBackPixels[Ha+0]===255&&ka.readBackPixels[Ha+1]===0&&ka.readBackPixels[Ha+2]===255&&(oa+=0.2);Ha=28+w+(448-V);Ca[Ha+0]===255&&Ca[Ha+
+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=28+w+(448+V);Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=28-w+(448+V);Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);Ha=476;Ca[Ha+0]===255&&Ca[Ha+1]===0&&Ca[Ha+2]===255&&(oa+=0.2);u.positionScreen.x=U[0];u.positionScreen.y=U[1];u.positionScreen.z=U[2];u.customUpdateCallback?u.customUpdateCallback(oa,u):u.updateLensFlares(oa);e.uniform1i(wa.renderPink,0);e.disable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}for(A=0;A<M;A++){u=
+m.__webglLensFlares[A].object;I=0;for(K=u.lensFlares.length;I<K;I++){H=u.lensFlares[I];if(H.opacity>0.0010&&H.scale>0.0010){U[0]=H.x;U[1]=H.y;U[2]=H.z;J=H.size*H.scale/ja;L[0]=J*E;L[1]=J;e.uniform3fv(wa.screenPosition,U);e.uniform1f(wa.rotation,H.rotation);e.uniform2fv(wa.scale,L);e.uniform1f(wa.opacity,H.opacity);z(H.blending);P(H.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function F(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,
+m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,u,w,A,M;if(m instanceof THREE.Mesh){u=m.geometry;for(C in u.geometryGroups){w=u.geometryGroups[C];M=!1;for(A in w.__webglCustomAttributes)if(w.__webglCustomAttributes[A].needsUpdate){M=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||M){M=e.DYNAMIC_DRAW;var I=void 0,
+K=void 0,H=void 0,E=void 0;H=void 0;var J=void 0,L=void 0,U=void 0,V=void 0,Ca=void 0,Ha=void 0,oa=void 0,wa=void 0,cb=void 0,Aa=void 0,Ia=void 0,Ja=void 0,Qa=void 0;L=void 0;U=void 0;E=void 0;V=void 0;E=void 0;var D=void 0,Z=void 0;L=void 0;D=void 0;Z=void 0;var t=void 0,ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;E=void 0;V=void 0;J=void 0;H=void 0;H=void 0;D=void 0;Z=void 0;t=void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa=
+0,Ka=0,La=0,T=0,Ra=0;Z=D=0;var Xa=w.__vertexArray,Za=w.__uvArray,X=w.__uv2Array,ta=w.__normalArray,ea=w.__tangentArray,ca=w.__colorArray,va=w.__skinVertexAArray,ua=w.__skinVertexBArray,ga=w.__skinIndexArray,Q=w.__skinWeightArray,Na=w.__morphTargetsArrays,db=w.__webglCustomAttributes;t=void 0;var Ua=w.__faceArray,bb=w.__lineArray,lb=w.__needsSmoothNormals;Ha=w.__vertexColorType;Ca=w.__uvType;oa=w.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals,
+ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=w.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(db)for(fb in db){db[fb].offset=0;db[fb].offsetSrc=0}I=0;for(K=xb.length;I<K;I++){H=xb[I];E=Ab[H];yb&&(wa=yb[H]);zb&&(cb=zb[H]);H=E.vertexNormals;J=E.normal;L=E.vertexColors;U=E.color;V=E.vertexTangents;if(E instanceof THREE.Face3){if(ib){Aa=
+nb[E.a].position;Ia=nb[E.b].position;Ja=nb[E.c].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ia.x;Xa[Va+4]=Ia.y;Xa[Va+5]=Ia.z;Xa[Va+6]=Ja.x;Xa[Va+7]=Ja.y;Xa[Va+8]=Ja.z;Va+=9}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=t.value[E.c]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];
+t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ia=t.value[E.b];Ja=t.value[E.c]}else if(t.boundTo==="faces"){Aa=t.value[Z];Ia=t.value[Z];Ja=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[Z+0];Ia=t.value[Z+1];Ja=t.value[Z+2];t.offsetSrc+=3}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+
+2]=Ia.x;t.array[D+3]=Ia.y;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ia.r;t.array[D+4]=Ia.g;t.array[D+5]=Ia.b;t.array[D+6]=Ja.r;t.array[D+7]=Ja.g;t.array[D+8]=Ja.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ia.x;t.array[D+4]=Ia.y;t.array[D+5]=Ia.z;t.array[D+6]=Ja.x;t.array[D+7]=Ja.y;t.array[D+8]=Ja.z}t.offset+=9}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+
+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Ia.z;t.array[D+7]=Ia.w;t.array[D+8]=Ja.x;t.array[D+9]=Ja.y;t.array[D+10]=Ja.z;t.array[D+11]=Ja.w;t.offset+=12}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[E.a].position;Ia=jb[D].vertices[E.b].position;Ja=jb[D].vertices[E.c].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ia.x;t[Ra+4]=Ia.y;t[Ra+5]=Ia.z;t[Ra+6]=Ja.x;t[Ra+7]=Ja.y;t[Ra+8]=Ja.z}Ra+=9}if(kb.length){D=kb[E.a];Z=kb[E.b];t=kb[E.c];Q[T]=D.x;
+Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;D=qb[E.a];Z=qb[E.b];t=qb[E.c];ga[T]=D.x;ga[T+1]=D.y;ga[T+2]=D.z;ga[T+3]=D.w;ga[T+4]=Z.x;ga[T+5]=Z.y;ga[T+6]=Z.z;ga[T+7]=Z.w;ga[T+8]=t.x;ga[T+9]=t.y;ga[T+10]=t.z;ga[T+11]=t.w;D=ob[E.a];Z=ob[E.b];t=ob[E.c];va[T]=D.x;va[T+1]=D.y;va[T+2]=D.z;va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+10]=t.z;va[T+11]=1;D=pb[E.a];Z=pb[E.b];t=pb[E.c];ua[T]=
+D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;T+=12}if(vb&&Ha){if(L.length==3&&Ha==THREE.VertexColors){E=L[0];D=L[1];Z=L[2]}else Z=D=E=U;ca[La]=E.r;ca[La+1]=E.g;ca[La+2]=E.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;La+=9}if(ub&&Pa.hasTangents){L=V[0];U=V[1];E=V[2];ea[Oa]=L.x;ea[Oa+1]=L.y;ea[Oa+2]=L.z;ea[Oa+3]=L.w;ea[Oa+4]=U.x;ea[Oa+5]=U.y;ea[Oa+6]=U.z;ea[Oa+7]=U.w;ea[Oa+8]=E.x;
+ea[Oa+9]=E.y;ea[Oa+10]=E.z;ea[Oa+11]=E.w;Oa+=12}if(tb&&oa)if(H.length==3&&lb)for(V=0;V<3;V++){J=H[V];ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}else for(V=0;V<3;V++){ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}if(rb&&wa!==undefined&&Ca)for(V=0;V<3;V++){H=wa[V];Za[gb]=H.u;Za[gb+1]=H.v;gb+=2}if(rb&&cb!==undefined&&Ca)for(V=0;V<3;V++){H=cb[V];X[hb]=H.u;X[hb+1]=H.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+2;Wa+=3;bb[Ka]=Ma;bb[Ka+1]=Ma+1;bb[Ka+2]=Ma;bb[Ka+3]=Ma+2;bb[Ka+4]=Ma+1;bb[Ka+5]=Ma+2;Ka+=
+6;Ma+=3}}else if(E instanceof THREE.Face4){if(ib){Aa=nb[E.a].position;Ia=nb[E.b].position;Ja=nb[E.c].position;Qa=nb[E.d].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ia.x;Xa[Va+4]=Ia.y;Xa[Va+5]=Ia.z;Xa[Va+6]=Ja.x;Xa[Va+7]=Ja.y;Xa[Va+8]=Ja.z;Xa[Va+9]=Qa.x;Xa[Va+10]=Qa.y;Xa[Va+11]=Qa.z;Va+=12}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+
+2]=t.value[E.c];t.array[D+2]=t.value[E.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];t.array[D+2]=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.array[D+2]=t.value[Z+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ia=t.value[E.b];Ja=t.value[E.c];Qa=t.value[E.d]}else if(t.boundTo==="faces"){Aa=t.value[Z];
+Ia=t.value[Z];Ja=t.value[Z];Qa=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[Z+0];Ia=t.value[Z+1];Ja=t.value[Z+2];Qa=t.value[Z+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ia.x;t.array[D+3]=Ia.y;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.array[D+6]=Qa.x;t.array[D+7]=Qa.y;t.offset+=8}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ia.r;t.array[D+4]=Ia.g;t.array[D+5]=Ia.b;t.array[D+6]=Ja.r;
+t.array[D+7]=Ja.g;t.array[D+8]=Ja.b;t.array[D+9]=Qa.r;t.array[D+10]=Qa.g;t.array[D+11]=Qa.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ia.x;t.array[D+4]=Ia.y;t.array[D+5]=Ia.z;t.array[D+6]=Ja.x;t.array[D+7]=Ja.y;t.array[D+8]=Ja.z;t.array[D+9]=Qa.x;t.array[D+10]=Qa.y;t.array[D+11]=Qa.z}t.offset+=12}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Ia.z;t.array[D+7]=Ia.w;t.array[D+8]=Ja.x;t.array[D+
+9]=Ja.y;t.array[D+10]=Ja.z;t.array[D+11]=Ja.w;t.array[D+12]=Qa.x;t.array[D+13]=Qa.y;t.array[D+14]=Qa.z;t.array[D+15]=Qa.w;t.offset+=16}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[E.a].position;Ia=jb[D].vertices[E.b].position;Ja=jb[D].vertices[E.c].position;Qa=jb[D].vertices[E.d].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ia.x;t[Ra+4]=Ia.y;t[Ra+5]=Ia.z;t[Ra+6]=Ja.x;t[Ra+7]=Ja.y;t[Ra+8]=Ja.z;t[Ra+9]=Qa.x;t[Ra+10]=Qa.y;t[Ra+11]=Qa.z}Ra+=12}if(kb.length){D=kb[E.a];Z=
+kb[E.b];t=kb[E.c];ab=kb[E.d];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;Q[T+12]=ab.x;Q[T+13]=ab.y;Q[T+14]=ab.z;Q[T+15]=ab.w;D=qb[E.a];Z=qb[E.b];t=qb[E.c];ab=qb[E.d];ga[T]=D.x;ga[T+1]=D.y;ga[T+2]=D.z;ga[T+3]=D.w;ga[T+4]=Z.x;ga[T+5]=Z.y;ga[T+6]=Z.z;ga[T+7]=Z.w;ga[T+8]=t.x;ga[T+9]=t.y;ga[T+10]=t.z;ga[T+11]=t.w;ga[T+12]=ab.x;ga[T+13]=ab.y;ga[T+14]=ab.z;ga[T+15]=ab.w;D=ob[E.a];Z=ob[E.b];t=ob[E.c];ab=ob[E.d];va[T]=
+D.x;va[T+1]=D.y;va[T+2]=D.z;va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+10]=t.z;va[T+11]=1;va[T+12]=ab.x;va[T+13]=ab.y;va[T+14]=ab.z;va[T+15]=1;D=pb[E.a];Z=pb[E.b];t=pb[E.c];E=pb[E.d];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;ua[T+12]=E.x;ua[T+13]=E.y;ua[T+14]=E.z;ua[T+15]=1;T+=16}if(vb&&Ha){if(L.length==4&&Ha==THREE.VertexColors){E=L[0];D=L[1];Z=L[2];L=L[3]}else L=
+Z=D=E=U;ca[La]=E.r;ca[La+1]=E.g;ca[La+2]=E.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;ca[La+9]=L.r;ca[La+10]=L.g;ca[La+11]=L.b;La+=12}if(ub&&Pa.hasTangents){L=V[0];U=V[1];E=V[2];V=V[3];ea[Oa]=L.x;ea[Oa+1]=L.y;ea[Oa+2]=L.z;ea[Oa+3]=L.w;ea[Oa+4]=U.x;ea[Oa+5]=U.y;ea[Oa+6]=U.z;ea[Oa+7]=U.w;ea[Oa+8]=E.x;ea[Oa+9]=E.y;ea[Oa+10]=E.z;ea[Oa+11]=E.w;ea[Oa+12]=V.x;ea[Oa+13]=V.y;ea[Oa+14]=V.z;ea[Oa+15]=V.w;Oa+=16}if(tb&&oa)if(H.length==4&&lb)for(V=0;V<4;V++){J=H[V];ta[eb]=
+J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}else for(V=0;V<4;V++){ta[eb]=J.x;ta[eb+1]=J.y;ta[eb+2]=J.z;eb+=3}if(rb&&wa!==undefined&&Ca)for(V=0;V<4;V++){H=wa[V];Za[gb]=H.u;Za[gb+1]=H.v;gb+=2}if(rb&&cb!==undefined&&Ca)for(V=0;V<4;V++){H=cb[V];X[hb]=H.u;X[hb+1]=H.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+3;Ua[Wa+3]=Ma+1;Ua[Wa+4]=Ma+2;Ua[Wa+5]=Ma+3;Wa+=6;bb[Ka]=Ma;bb[Ka+1]=Ma+1;bb[Ka+2]=Ma;bb[Ka+3]=Ma+3;bb[Ka+4]=Ma+1;bb[Ka+5]=Ma+2;bb[Ka+6]=Ma+2;bb[Ka+7]=Ma+3;Ka+=8;Ma+=4}}}if(mb){I=0;for(K=mb.length;I<
+K;I++){Ua[Wa]=mb[I].a;Ua[Wa+1]=mb[I].b;Ua[Wa+2]=mb[I].c;Ua[Wa+3]=mb[I].a;Ua[Wa+4]=mb[I].c;Ua[Wa+5]=mb[I].d;Wa+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Xa,M)}if(db)for(fb in db){t=db[fb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,M);t.needsUpdate=!1}}if(wb){D=0;for(Z=jb.length;D<Z;D++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,Na[D],M)}}if(vb&&La>0){e.bindBuffer(e.ARRAY_BUFFER,
+w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ca,M)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,M)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ea,M)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,M)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,X,M)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,M);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,M)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ga,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
+Q,M)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ha=m.vertices;w=m.colors;oa=Ha.length;M=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors;if(m.__dirtyVertices){for(K=0;K<oa;K++){Ca=Ha[K].position;A=K*3;wa[A]=Ca.x;wa[A+1]=Ca.y;wa[A+2]=Ca.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);
+e.bufferData(e.ARRAY_BUFFER,wa,C)}if(cb){for(K=0;K<M;K++){color=w[K];A=K*3;I[A]=color.r;I[A+1]=color.g;I[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Line){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ha=m.vertices;w=m.colors;oa=Ha.length;M=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors;if(m.__dirtyVertices){for(K=0;K<oa;K++){Ca=Ha[K].position;
+A=K*3;wa[A]=Ca.x;wa[A+1]=Ca.y;wa[A+2]=Ca.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa,C)}if(cb){for(K=0;K<M;K++){color=w[K];A=K*3;I[A]=color.r;I[A+1]=color.g;I[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){u=m.geometry;(u.__dirtyVertices||u.__dirtyColors||m.sortParticles)&&c(u,e.DYNAMIC_DRAW,m);u.__dirtyVertices=!1;u.__dirtyColors=
+!1}}function N(m){function C(U){var V=[];u=0;for(w=U.length;u<w;u++)U[u]==undefined?V.push("undefined"):V.push(U[u].id);return V.join("_")}var u,w,A,M,I,K,H,E,J={},L=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};A=0;for(M=m.faces.length;A<M;A++){I=m.faces[A];K=I.materials;H=C(K);J[H]==undefined&&(J[H]={hash:H,counter:0});E=J[H].hash+"_"+J[H].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:K,vertices:0,numMorphTargets:L});I=I instanceof THREE.Face3?
+3:4;if(m.geometryGroups[E].vertices+I>65535){J[H].counter+=1;E=J[H].hash+"_"+J[H].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:K,vertices:0,numMorphTargets:L})}m.geometryGroups[E].faces.push(A);m.geometryGroups[E].vertices+=I}}function W(m,C,u){m.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function z(m){if(m!=za){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}za=m}}function O(m,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,qa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,qa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,qa(C.magFilter));
+e.texParameteri(m,e.TEXTURE_MIN_FILTER,qa(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,sa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,sa(C.minFilter))}}function P(m,C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();
+e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();
+m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,qa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,qa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,qa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,qa(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,qa(m.format),m.width,m.height,0,qa(m.format),qa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
+m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
+m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(m){C=m.__webglFramebuffer;u=m.width;m=m.height}else{C=null;u=Da;m=ja}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Y,ma,u,m);Fa=C}}function xa(m,C){var u;if(m=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,
+C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function sa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function qa(m){switch(m){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 e,fa=document.createElement("canvas"),da=[],ya=null,Fa=null,Ga=!0,ra=this,aa=null,pa=null,za=null,ia=null,Y=0,ma=0,Da=0,ja=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,$=!0,na=new THREE.Color(0),Ba=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)$=b.antialias;b.clearColor!==undefined&&na.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ba=b.clearAlpha}this.maxMorphTargets=8;this.domElement=fa;
+this.autoClear=!0;this.sortObjects=!0;(function(m,C,u,w){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(A){console.error(A)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,u)})($,na,Ba,R);this.context=e;if(R){var ha={};
+ha.vertices=new Float32Array(12);ha.faces=new Uint16Array(6);ha.darkness=0.5;ha.vertices[0]=-20;ha.vertices[1]=-20;ha.vertices[2]=-1;ha.vertices[3]=20;ha.vertices[4]=-20;ha.vertices[5]=-1;ha.vertices[6]=20;ha.vertices[7]=20;ha.vertices[8]=-1;ha.vertices[9]=-20;ha.vertices[10]=20;ha.vertices[11]=-1;ha.faces[0]=0;ha.faces[1]=1;ha.faces[2]=2;ha.faces[3]=0;ha.faces[4]=2;ha.faces[5]=3;ha.vertexBuffer=e.createBuffer();ha.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,
+ha.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha.faces,e.STATIC_DRAW);ha.program=e.createProgram();e.attachShader(ha.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ha.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ha.program);ha.vertexLocation=e.getAttribLocation(ha.program,"position");ha.projectionLocation=e.getUniformLocation(ha.program,"projectionMatrix");ha.darknessLocation=
+e.getUniformLocation(ha.program,"darkness")}var ka={};ka.vertices=new Float32Array(16);ka.faces=new Uint16Array(6);ka.transparency=0.5;b=0;ka.vertices[b++]=-1;ka.vertices[b++]=-1;ka.vertices[b++]=0;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;b=0;ka.faces[b++]=0;ka.faces[b++]=1;ka.faces[b++]=2;ka.faces[b++]=
+0;ka.faces[b++]=2;ka.faces[b++]=3;ka.vertexBuffer=e.createBuffer();ka.elementBuffer=e.createBuffer();ka.tempTexture=e.createTexture();ka.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,
+e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ka.program=e.createProgram();e.attachShader(ka.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ka.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ka.program);ka.attributes={};ka.uniforms={};ka.attributes.vertex=e.getAttribLocation(ka.program,
+"position");ka.attributes.uv=e.getAttribLocation(ka.program,"UV");ka.uniforms.map=e.getUniformLocation(ka.program,"map");ka.uniforms.opacity=e.getUniformLocation(ka.program,"opacity");ka.uniforms.scale=e.getUniformLocation(ka.program,"scale");ka.uniforms.rotation=e.getUniformLocation(ka.program,"rotation");ka.uniforms.screenPosition=e.getUniformLocation(ka.program,"screenPosition");ka.uniforms.renderPink=e.getUniformLocation(ka.program,"renderPink");this.setSize=function(m,C){fa.width=m;fa.height=
+C;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,C,u,w){Y=m;ma=C;Da=u;ja=w;e.viewport(Y,ma,Da,ja)};this.setScissor=function(m,C,u,w){e.scissor(m,C,u,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ga=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var u=new THREE.Color(m);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
+e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ha.darkness=m};this.initMaterial=function(m,C,u,w){var A,M,I;if(m instanceof THREE.MeshDepthMaterial)I="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)I="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)I="normal";else if(m instanceof THREE.MeshBasicMaterial)I="basic";else if(m instanceof THREE.MeshLambertMaterial)I="lambert";else if(m instanceof THREE.MeshPhongMaterial)I="phong";else if(m instanceof
+THREE.LineBasicMaterial)I="basic";else m instanceof THREE.ParticleBasicMaterial&&(I="particle_basic");if(I){var K=THREE.ShaderLib[I];m.uniforms=Uniforms.clone(K.uniforms);m.vertexShader=K.vertexShader;m.fragmentShader=K.fragmentShader}var H,E,J;H=J=K=0;for(E=C.length;H<E;H++){M=C[H];M instanceof THREE.DirectionalLight&&J++;M instanceof THREE.PointLight&&K++}if(K+J<=4)C=J;else{C=Math.ceil(4*J/(K+J));K=4-C}M={directional:C,point:K};J=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)J=w.bones.length;
+var L;a:{H=m.fragmentShader;E=m.vertexShader;K=m.uniforms;C=m.attributes;u={map:!!m.map,envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:u,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:M.directional,maxPointLights:M.point,maxBones:J};var U;M=[];if(I)M.push(I);else{M.push(H);M.push(E)}for(U in u){M.push(U);M.push(u[U])}I=M.join();U=0;for(M=da.length;U<M;U++)if(da[U].code==I){L=da[U].program;
+break a}U=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+e.attachShader(U,xa("fragment",prefix_fragment+H));e.attachShader(U,xa("vertex",prefix_vertex+E));e.linkProgram(U);e.getProgramParameter(U,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(U,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");U.uniforms={};U.attributes={};var V;H=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(V in K)H.push(V);
+V=H;K=0;for(H=V.length;K<H;K++){E=V[K];U.uniforms[E]=e.getUniformLocation(U,E)}H=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(V=0;V<u.maxMorphTargets;V++)H.push("morphTarget"+V);for(L in C)H.push(L);L=H;V=0;for(C=L.length;V<C;V++){u=L[V];U.attributes[u]=e.getAttribLocation(U,u)}da.push({program:U,code:I});L=U}m.program=L;L=m.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
+0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(m.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(A in m.attributes)L[A]>=0&&e.enableVertexAttribArray(L[A]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
+m.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);m.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);m.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);m.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);m.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);m.numSupportedMorphTargets++}if(L.morphTarget6>=
+0){e.enableVertexAttribArray(L.morphTarget6);m.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(A=this.maxMorphTargets;m<A;m++)w.__webglMorphTargetInfluences[m]=0}};this.render=function(m,C,u,w){var A,M,I,K,H,E,J,L,U=m.lights,V=m.fog;C.matrixAutoUpdate&&C.updateMatrix();m.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray($a);C.projectionMatrix.flattenToArray(Sa);
+Ea.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ea);this.initWebGLObjects(m);S(u);(this.autoClear||w)&&this.clear();H=m.__webglObjects.length;for(w=0;w<H;w++){A=m.__webglObjects[w];J=A.object;if(J.visible)if(!(J instanceof THREE.Mesh)||n(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);F(J,C);x(A);A.render=!0;if(this.sortObjects){Ya.copy(J.position);Ea.multiplyVector3(Ya);A.z=Ya.z}}else A.render=!1;else A.render=!1}this.sortObjects&&m.__webglObjects.sort(y);E=m.__webglObjectsImmediate.length;
+for(w=0;w<E;w++){A=m.__webglObjectsImmediate[w];J=A.object;if(J.visible){J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray);F(J,C);o(A)}}z(THREE.NormalBlending);for(w=0;w<H;w++){A=m.__webglObjects[w];if(A.render){J=A.object;L=A.buffer;I=A.opaque;h(J);for(A=0;A<I.count;A++){K=I.list[A];j(K.depthTest);f(C,U,V,K,L,J)}}}for(w=0;w<E;w++){A=m.__webglObjectsImmediate[w];J=A.object;if(J.visible){I=A.opaque;h(J);for(A=0;A<I.count;A++){K=I.list[A];j(K.depthTest);M=d(C,U,V,K,J);J.render(function(Ca){g(Ca,
+M,K.shading)})}}}for(w=0;w<H;w++){A=m.__webglObjects[w];if(A.render){J=A.object;L=A.buffer;I=A.transparent;h(J);for(A=0;A<I.count;A++){K=I.list[A];z(K.blending);j(K.depthTest);f(C,U,V,K,L,J)}}}for(w=0;w<E;w++){A=m.__webglObjectsImmediate[w];J=A.object;if(J.visible){I=A.transparent;h(J);for(A=0;A<I.count;A++){K=I.list[A];z(K.blending);j(K.depthTest);M=d(C,U,V,K,J);J.render(function(Ca){g(Ca,M,K.shading)})}}}R&&m.__webglShadowVolumes.length&&m.lights.length&&v(m);m.__webglLensFlares.length&&B(m,C);
+if(u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,u.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[]}for(;m.__objectsAdded.length;){var C=m.__objectsAdded[0],u=m,w=void 0,A=void 0,M=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=
+new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){A=C.geometry;A.geometryGroups==undefined&&N(A);for(w in A.geometryGroups){M=A.geometryGroups[w];if(!M.__webglVertexBuffer){var I=M;I.__webglVertexBuffer=e.createBuffer();I.__webglNormalBuffer=e.createBuffer();I.__webglTangentBuffer=e.createBuffer();I.__webglColorBuffer=e.createBuffer();I.__webglUVBuffer=e.createBuffer();
+I.__webglUV2Buffer=e.createBuffer();I.__webglSkinVertexABuffer=e.createBuffer();I.__webglSkinVertexBBuffer=e.createBuffer();I.__webglSkinIndicesBuffer=e.createBuffer();I.__webglSkinWeightsBuffer=e.createBuffer();I.__webglFaceBuffer=e.createBuffer();I.__webglLineBuffer=e.createBuffer();if(I.numMorphTargets){var K=void 0,H=void 0;I.__webglMorphTargetsBuffers=[];K=0;for(H=I.numMorphTargets;K<H;K++)I.__webglMorphTargetsBuffers.push(e.createBuffer())}I=M;K=C;var E=void 0,J=void 0,L=void 0;L=void 0;var U=
+void 0,V=void 0,Ca=void 0,Ha=Ca=H=0;J=void 0;L=void 0;var oa=void 0;E=void 0;J=void 0;U=K.geometry;oa=U.faces;V=I.faces;E=0;for(J=V.length;E<J;E++){L=V[E];L=oa[L];if(L instanceof THREE.Face3){H+=3;Ca+=1;Ha+=3}else if(L instanceof THREE.Face4){H+=4;Ca+=2;Ha+=4}}E=I;J=K;oa=void 0;V=void 0;var wa=void 0,cb=void 0;wa=void 0;L=[];oa=0;for(V=J.materials.length;oa<V;oa++){wa=J.materials[oa];if(wa instanceof THREE.MeshFaceMaterial){wa=0;for(l=E.materials.length;wa<l;wa++)(cb=E.materials[wa])&&L.push(cb)}else(cb=
+wa)&&L.push(cb)}E=L;a:{J=void 0;oa=void 0;V=E.length;for(J=0;J<V;J++){oa=E[J];if(oa.map||oa.lightMap||oa instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{oa=E;V=void 0;L=void 0;wa=oa.length;for(V=0;V<wa;V++){L=oa[V];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){oa=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}oa=!1}a:{V=void 0;L=void 0;wa=E.length;for(V=0;V<wa;V++){L=E[V];if(L.vertexColors){L=
+L.vertexColors;break a}}L=!1}I.__vertexArray=new Float32Array(H*3);if(oa)I.__normalArray=new Float32Array(H*3);if(U.hasTangents)I.__tangentArray=new Float32Array(H*4);if(L)I.__colorArray=new Float32Array(H*3);if(J){if(U.faceUvs.length>0||U.faceVertexUvs.length>0)I.__uvArray=new Float32Array(H*2);if(U.faceUvs.length>1||U.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(H*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){I.__skinVertexAArray=new Float32Array(H*4);I.__skinVertexBArray=
+new Float32Array(H*4);I.__skinIndexArray=new Float32Array(H*4);I.__skinWeightArray=new Float32Array(H*4)}I.__faceArray=new Uint16Array(Ca*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));I.__lineArray=new Uint16Array(Ha*2);if(I.numMorphTargets){I.__morphTargetsArrays=[];U=0;for(V=I.numMorphTargets;U<V;U++)I.__morphTargetsArrays.push(new Float32Array(H*3))}I.__needsSmoothNormals=oa==THREE.SmoothShading;I.__uvType=J;I.__vertexColorType=L;I.__normalType=oa;I.__webglFaceCount=Ca*3+(K.geometry.edgeFaces?
+K.geometry.edgeFaces.length*6:0);I.__webglLineCount=Ha*2;U=0;for(V=E.length;U<V;U++)if(E[U].attributes){I.__webglCustomAttributes={};for(a in E[U].attributes){J=E[U].attributes[a];Ca=1;if(J.type==="v2")Ca=2;else if(J.type==="v3")Ca=3;else if(J.type==="v4")Ca=4;else J.type==="c"&&(Ca=3);J.size=Ca;J.needsUpdate=!0;J.array=new Float32Array(H*Ca);J.buffer=e.createBuffer();I.__webglCustomAttributes[a]=J}}A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=
+!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}C instanceof THREE.ShadowVolume?W(u.__webglShadowVolumes,M,C):W(u.__webglObjects,M,C)}}else if(C instanceof THREE.LensFlare)W(u.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){A=C.geometry;if(!A.__webglVertexBuffer){w=A;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=A;M=w.vertices.length;w.__vertexArray=new Float32Array(M*3);w.__colorArray=new Float32Array(M*3);w.__webglVertexCount=M;A.__dirtyVertices=!0;
+A.__dirtyColors=!0}W(u.__webglObjects,A,C)}else if(C instanceof THREE.Line){A=C.geometry;if(!A.__webglVertexBuffer){w=A;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=A;M=w.vertices.length;w.__vertexArray=new Float32Array(M*3);w.__colorArray=new Float32Array(M*3);w.__webglLineCount=M;A.__dirtyVertices=!0;A.__dirtyColors=!0}W(u.__webglObjects,A,C)}else if(C instanceof THREE.ParticleSystem){A=C.geometry;if(!A.__webglVertexBuffer){w=A;w.__webglVertexBuffer=e.createBuffer();
+w.__webglColorBuffer=e.createBuffer();w=A;M=w.vertices.length;w.__vertexArray=new Float32Array(M*3);w.__colorArray=new Float32Array(M*3);w.__sortArray=[];w.__webglParticleCount=M;A.__dirtyVertices=!0;A.__dirtyColors=!0}W(u.__webglObjects,A,C)}else THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes&&u.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){C=m.__objectsRemoved[0];u=
+m;A=void 0;w=void 0;for(A=u.__webglObjects.length-1;A>=0;A--){w=u.__webglObjects[A].object;C==w&&u.__webglObjects.splice(A,1)}m.__objectsRemoved.splice(0,1)}C=0;for(u=m.__webglObjects.length;C<u;C++)G(m.__webglObjects[C].object,m);C=0;for(u=m.__webglShadowVolumes.length;C<u;C++)G(m.__webglShadowVolumes[C].object,m);C=0;for(u=m.__webglLensFlares.length;C<u;C++)G(m.__webglLensFlares[C].object,m)};this.setFaceCulling=function(m,C){if(m){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);
+else m=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==
 undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!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(b,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;f<g;f++){b=d[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
@@ -335,22 +335,22 @@ THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};
 THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0};THREE.MeshCollider=function(b,c,d,f){this.vertices=b;this.faces=c;this.normals=d;this.box=f;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();var c=0;for(var d=this.hits.length=0;d<this.colliders.length;d++){var f=this.rayCast(b,this.colliders[d]);if(f<Number.MAX_VALUE){this.colliders[d].distance=f;f>c?this.hits.push(this.colliders[d]):this.hits.unshift(this.colliders[d]);c=f}}return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,d,f,g,h=0;c=0;for(d=this.colliders.length;c<d;c++){g=this.colliders[c];f=this.rayCast(b,g);if(f<Number.MAX_VALUE){g.distance=f;f>h?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[d]);if(f<Number.MAX_VALUE){c[d].distance=f;break}d++}if(d>c.length)return null;return c[d]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
 THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g=0;g<c.numFaces/3;g++){var h=g*3;f=Math.min(f,this.rayTriangle(d,c.vertices[c.faces[h+0]],c.vertices[c.faces[h+1]],c.vertices[c.faces[h+2]],c.normals[c.faces[g]],f))}return f};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,f,g,h){var j=(new THREE.Vector3).sub(d,c);g=(new THREE.Vector3).sub(f,d);g=(new THREE.Vector3).cross(j,g);var k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=b.origin.clone().addSelf(b.direction.clone().multiplyScalar(j));if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-c.y;h=d.y-c.y;g=f.y-c.y;k=k.z-c.z;d=d.z-
-c.z;f=f.z-c.z}else{b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}c=h*f-d*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;j.sub(d,c);k.sub(f,d);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-c.y;g=d.y-c.y;h=f.y-c.y;
+k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}c=g*f-d*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=g*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(c.matrixWorld);f.multiplyVector3(d.origin);f.rotateAxis(d.direction);d.direction.normalize();return d};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,n=0,o=!0;if(d.origin.x<c.min.x){f=c.min.x-d.origin.x;f/=d.direction.x;o=!1;j=-1}else if(d.origin.x>c.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;o=!1;j=1}if(d.origin.y<c.min.y){g=c.min.y-d.origin.y;g/=d.direction.y;o=!1;k=-1}else if(d.origin.y>c.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;o=!1;k=
-1}if(d.origin.z<c.min.z){h=c.min.z-d.origin.z;h/=d.direction.z;o=!1;n=-1}else if(d.origin.z>c.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;o=!1;n=1}if(o)return-1;o=0;if(g>f){o=1;f=g}if(h>f){o=2;f=h}switch(o){case 0:k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,n=0,p=!0;if(d.origin.x<c.min.x){f=c.min.x-d.origin.x;f/=d.direction.x;p=!1;j=-1}else if(d.origin.x>c.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;p=!1;j=1}if(d.origin.y<c.min.y){g=c.min.y-d.origin.y;g/=d.direction.y;p=!1;k=-1}else if(d.origin.y>c.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;p=!1;k=
+1}if(d.origin.z<c.min.z){h=c.min.z-d.origin.z;h/=d.direction.z;p=!1;n=-1}else if(d.origin.z>c.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;p=!1;n=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+
 d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,k,0);break;case 2:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(d<0)d=(f-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var f=d.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-f*f);if(d>=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionUtils={};
+THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var f=d.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-f*f);if(d>=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={};
 THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]);c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]);d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],n=0;n<d;n++)h.push(new THREE.Vector3(c[n].position.x,c[n].position.y,c[n].position.z));for(n=0;n<g;n++){j.push(f[n].a,f[n].b,f[n].c);k.push(new THREE.Vector3(f[n].normal.x,f[n].normal.y,f[n].normal.z))}c=new THREE.MeshCollider(h,j,k,THREE.CollisionUtils.MeshOBB(b));c.mesh=b;return c};
-var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,f=b.vertices.length,g=d?c.geometry:c,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,u=j.length;p<u;p++){var y=new THREE.Vertex(j[p].position.clone());d&&c.matrix.multiplyVector3(y.position);h.push(y)}p=0;for(u=n.length;p<u;p++){j=n[p];var v,A,E=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);d=0;for(h=E.length;d<h;d++){A=E[d];v.vertexNormals.push(A.clone())}v.color.copy(j.color);d=0;for(h=y.length;d<h;d++){A=y[d];v.vertexColors.push(A.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}p=0;for(u=g.length;p<u;p++){f=g[p];k=[];d=0;for(h=f.length;d<h;d++)k.push(new THREE.UV(f[d].u,f[d].v));o.push(k)}}},ImageUtils={loadTexture:function(b,c,d){var f=new Image,g=
-new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;d&&d(this)};f.src=b;return g},loadTextureCube:function(b,c,d){var f,g=[],h=new THREE.Texture(g,c);c=g.loadCount=0;for(f=b.length;c<f;++c){g[c]=new Image;g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;d&&d(this)};g[c].src=b[c]}return h}},SceneUtils={addMesh:function(b,c,d,f,g,h,j,k,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=j;c.rotation.y=k;
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,f=b.vertices.length,g=d?c.geometry:c,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,x=j.length;o<x;o++){var y=new THREE.Vertex(j[o].position.clone());d&&c.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(x=n.length;o<x;o++){j=n[o];var v,B,F=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);d=0;for(h=F.length;d<h;d++){B=F[d];v.vertexNormals.push(B.clone())}v.color.copy(j.color);d=0;for(h=y.length;d<h;d++){B=y[d];v.vertexColors.push(B.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}o=0;for(x=g.length;o<x;o++){f=g[o];k=[];d=0;for(h=f.length;d<h;d++)k.push(new THREE.UV(f[d].u,f[d].v));p.push(k)}}},ImageUtils={loadTexture:function(b,c,d){var f=new Image,g=
+new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;d&&d(this)};f.src=b;return g},loadTextureCube:function(b,c,d){var f,g=[],h=new THREE.Texture(g,c);c=g.loadCount=0;for(f=b.length;c<f;++c){g[c]=new Image;g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;d&&d(this)};g[c].src=b[c]}return h}},SceneUtils={addMesh:function(b,c,d,f,g,h,j,k,n,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=j;c.rotation.y=k;
 c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),d);b.addObject(c);return c},addPanoramaCube:function(b,c,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
 f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,f,!0),new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var f=c/2;c=new Plane(c,c);var g=Math.PI,h=Math.PI/2;SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(b,
 c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){SceneUtils.traverseHierarchy(b,function(d){d.visible=c})},traverseHierarchy:function(b,c){var d,f,g=b.children.length;
@@ -373,89 +373,89 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/
 3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(o,p,u,y){var v={name:u,fps:0.6,length:y,hierarchy:[]},A,E=p.getControlPointsArray(),G=p.getLength(),L=E.length,V=0;A=L-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:E[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<L-1;A++){V=y*G.chunks[A]/G.total;p.keys[A]={time:V,pos:E[A]}}v.hierarchy[0]=p;THREE.AnimationHandler.add(v);return new THREE.Animation(o,u,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(o,p){var u,
-y,v=new THREE.Geometry;for(u=0;u<o.points.length*p;u++){y=u/(o.points.length*p);y=o.getPoint(y);v.vertices[u]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(o,p){var u=d(p,10),y=d(p,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(u,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new Sphere(1,
-16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){u=new THREE.Mesh(y,v);u.position.copy(p.points[i]);u.updateMatrix();o.addChild(u)}}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=
+THREE.PathCamera=function(b){function c(p,o,x,y){var v={name:x,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),G=o.getLength(),N=F.length,W=0;B=N-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<N-1;B++){W=y*G.chunks[B]/G.total;o.keys[B]={time:W,pos:F[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var x,
+y,v=new THREE.Geometry;for(x=0;x<p.points.length*o;x++){y=x/(p.points.length*o);y=p.getPoint(y);v.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var x=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
+16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){x=new THREE.Mesh(y,v);x.position.copy(o.points[i]);x.updateMatrix();p.addChild(x)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
 if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(o,p,u){var y,v;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,p,u)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,x){var y,v;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,x)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,p){return function(){p.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(b,c,d,f,g,h,j,k,n){function o(G,L,V,z,N,P,S,xa){var sa,qa,e=f||1,fa=g||1,da=N/2,ya=P/2,Fa=p.vertices.length;if(G=="x"&&L=="y"||G=="y"&&L=="x")sa="z";else if(G=="x"&&L=="z"||G=="z"&&L=="x"){sa="y";fa=h||1}else if(G=="z"&&L=="y"||G=="y"&&L=="z"){sa="x";e=h||1}var Ga=e+1,ra=fa+1;N/=e;var aa=P/fa;for(qa=0;qa<ra;qa++)for(P=0;P<Ga;P++){var pa=new THREE.Vector3;pa[G]=(P*N-da)*V;pa[L]=(qa*aa-ya)*z;pa[sa]=S;p.vertices.push(new THREE.Vertex(pa))}for(qa=0;qa<fa;qa++)for(P=0;P<e;P++){p.faces.push(new THREE.Face4(P+
-Ga*qa+Fa,P+Ga*(qa+1)+Fa,P+1+Ga*(qa+1)+Fa,P+1+Ga*qa+Fa,null,null,xa));p.faceVertexUvs[0].push([new THREE.UV(P/e,qa/fa),new THREE.UV(P/e,(qa+1)/fa),new THREE.UV((P+1)/e,(qa+1)/fa),new THREE.UV((P+1)/e,qa/fa)])}}THREE.Geometry.call(this);var p=this,u=b/2,y=c/2,v=d/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var E in n)this.sides[E]!=
-undefined&&(this.sides[E]=n[E]);this.sides.px&&o("z","y",1*k,-1,d,c,-u,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,d,c,u,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var G=[],L=[],V=0,z=p.vertices.length;V<z;V++){for(var N=p.vertices[V],P=!1,S=0,xa=G.length;S<xa;S++){var sa=
-G[S];if(N.position.x==sa.position.x&&N.position.y==sa.position.y&&N.position.z==sa.position.z){L[V]=S;P=!0;break}}if(!P){L[V]=G.length;G.push(new THREE.Vertex(N.position.clone()))}}V=0;for(z=p.faces.length;V<z;V++){N=p.faces[V];N.a=L[N.a];N.b=L[N.b];N.c=L[N.c];N.d=L[N.d]}p.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(b,c,d,f,g,h){function j(p,u,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(p,u,y)))}THREE.Geometry.call(this);var k=this,n=Math.PI,o=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,-o);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,o);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(d>0){j(0,0,-o-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(c>0){j(0,0,o+(g||0));
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+var Cube=function(b,c,d,f,g,h,j,k,n){function p(G,N,W,z,O,P,S,xa){var sa,qa,e=f||1,fa=g||1,da=O/2,ya=P/2,Fa=o.vertices.length;if(G=="x"&&N=="y"||G=="y"&&N=="x")sa="z";else if(G=="x"&&N=="z"||G=="z"&&N=="x"){sa="y";fa=h||1}else if(G=="z"&&N=="y"||G=="y"&&N=="z"){sa="x";e=h||1}var Ga=e+1,ra=fa+1;O/=e;var aa=P/fa;for(qa=0;qa<ra;qa++)for(P=0;P<Ga;P++){var pa=new THREE.Vector3;pa[G]=(P*O-da)*W;pa[N]=(qa*aa-ya)*z;pa[sa]=S;o.vertices.push(new THREE.Vertex(pa))}for(qa=0;qa<fa;qa++)for(P=0;P<e;P++){o.faces.push(new THREE.Face4(P+
+Ga*qa+Fa,P+Ga*(qa+1)+Fa,P+1+Ga*(qa+1)+Fa,P+1+Ga*qa+Fa,null,null,xa));o.faceVertexUvs[0].push([new THREE.UV(P/e,qa/fa),new THREE.UV(P/e,(qa+1)/fa),new THREE.UV((P+1)/e,(qa+1)/fa),new THREE.UV((P+1)/e,qa/fa)])}}THREE.Geometry.call(this);var o=this,x=b/2,y=c/2,v=d/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var F in n)this.sides[F]!=
+undefined&&(this.sides[F]=n[F]);this.sides.px&&p("z","y",1*k,-1,d,c,-x,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,x,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var G=[],N=[],W=0,z=o.vertices.length;W<z;W++){for(var O=o.vertices[W],P=!1,S=0,xa=G.length;S<xa;S++){var sa=
+G[S];if(O.position.x==sa.position.x&&O.position.y==sa.position.y&&O.position.z==sa.position.z){N[W]=S;P=!0;break}}if(!P){N[W]=G.length;G.push(new THREE.Vertex(O.position.clone()))}}W=0;for(z=o.faces.length;W<z;W++){O=o.faces[W];O.a=N[O.a];O.b=N[O.b];O.c=N[O.c];O.d=N[O.d]}o.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(b,c,d,f,g,h){function j(o,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,x,y)))}THREE.Geometry.call(this);var k=this,n=Math.PI,p=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,-p);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,p);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(d>0){j(0,0,-p-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(c>0){j(0,0,p+(g||0));
 for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(b){function c(u,y,v){var A=Math.sqrt(u*u+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(u/A,y/A,v/A)))-1}function d(u,y,v,A){A.faces.push(new THREE.Face3(u,y,v))}function f(u,y){var v=g.vertices[u].position,A=g.vertices[y].position;return c((v.x+A.x)/2,(v.y+A.y)/2,(v.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
-1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,p,j);d(h.faces[k].b,o,n,j);d(h.faces[k].c,
-p,o,j);d(n,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(k=0;k<f.length;k++)if(o<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;o==0&&(j=g);for(k=
-0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(o/d,k/b.length),new THREE.UV(o/d,(k+1)/b.length),new THREE.UV((o-c)/d,(k+1)/b.length),new THREE.UV((o-c)/d,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var o=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
+var Icosahedron=function(b){function c(x,y,v){var B=Math.sqrt(x*x+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,y/B,v/B)))-1}function d(x,y,v,B){B.faces.push(new THREE.Face3(x,y,v))}function f(x,y){var v=g.vertices[x].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
+1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,o,j);d(h.faces[k].b,p,n,j);d(h.faces[k].c,
+o,p,j);d(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(c),p=0;p<=this.angle+0.0010;p+=c){for(k=0;k<f.length;k++)if(p<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;p==0&&(j=g);for(k=
+0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(p/d,k/b.length),new THREE.UV(p/d,(k+1)/b.length),new THREE.UV((p-c)/d,(k+1)/b.length),new THREE.UV((p-c)/d,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var p=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d<j+1;d++){f=d/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),o=[],p=0;for(f=0;f<h;f++){var u=2*f/h,y=n*Math.sin(u*g);u=n*Math.cos(u*g);(d==0||d==j)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);o.push(p)}c.push(o)}var v,A,E;g=c.length;for(d=0;d<g;d++){h=c[d].length;if(d>0)for(f=0;f<h;f++){o=f==h-1;j=c[d][o?0:f+1];k=c[d][o?h-1:f];n=c[d-1][o?h-1:f];o=c[d-1][o?
-0:f+1];y=d/(g-1);v=(d-1)/(g-1);A=(f+1)/h;u=f/h;p=new THREE.UV(1-A,y);y=new THREE.UV(1-u,y);u=new THREE.UV(1-u,v);var G=new THREE.UV(1-A,v);if(d<c.length-1){v=this.vertices[j].position.clone();A=this.vertices[k].position.clone();E=this.vertices[n].position.clone();v.normalize();A.normalize();E.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([p,y,u])}if(d>1){v=this.vertices[j].position.clone();
-A=this.vertices[n].position.clone();E=this.vertices[o].position.clone();v.normalize();A.normalize();E.normalize();this.faces.push(new THREE.Face3(j,n,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([p,u,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d<j+1;d++){f=d/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var x=2*f/h,y=n*Math.sin(x*g);x=n*Math.cos(x*g);(d==0||d==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);p.push(o)}c.push(p)}var v,B,F;g=c.length;for(d=0;d<g;d++){h=c[d].length;if(d>0)for(f=0;f<h;f++){p=f==h-1;j=c[d][p?0:f+1];k=c[d][p?h-1:f];n=c[d-1][p?h-1:f];p=c[d-1][p?
+0:f+1];y=d/(g-1);v=(d-1)/(g-1);B=(f+1)/h;x=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,v);var G=new THREE.UV(1-B,v);if(d<c.length-1){v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();F=this.vertices[n].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,y,x])}if(d>1){v=this.vertices[j].position.clone();
+B=this.vertices[n].position.clone();F=this.vertices[p].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,x,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(b,c,d,f){this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){f=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
 1;d<=this.segmentsT;++d){f=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(b,c,d,f,g,h,j){function k(u,y,v,A,E,G){y=v/A*u;v=Math.cos(y);return new THREE.Vector3(E*(2+v)*0.5*Math.cos(u),E*(2+v)*Math.sin(u)*0.5,G*E*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
+var TorusKnot=function(b,c,d,f,g,h,j){function k(x,y,v,B,F,G){y=v/B*x;v=Math.cos(y);return new THREE.Vector3(F*(2+v)*0.5*Math.cos(x),F*(2+v)*Math.sin(x)*0.5,G*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
 b/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;g=k(n,j,this.q,this.p,this.radius,this.heightScale);n=k(n+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=n.x-g.x;d.y=n.y-g.y;d.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(d,f);f.cross(h,d);h.normalize();f.normalize();n=this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
-0;c<this.segmentsT;++c){h=(b+1)%this.segmentsR;j=(c+1)%this.segmentsT;g=this.grid[b][c];d=this.grid[h][c];f=this.grid[b][j];h=this.grid[h][j];j=new THREE.UV(b/this.segmentsR,c/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,d,f));this.faceVertexUvs[0].push([j,n,o]);this.faces.push(new THREE.Face3(h,f,d));this.faceVertexUvs[0].push([p,
-o,n])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+0;c<this.segmentsT;++c){h=(b+1)%this.segmentsR;j=(c+1)%this.segmentsT;g=this.grid[b][c];d=this.grid[h][c];f=this.grid[b][j];h=this.grid[h][j];j=new THREE.UV(b/this.segmentsR,c/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT);var p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,d,f));this.faceVertexUvs[0].push([j,n,p]);this.faces.push(new THREE.Face3(h,f,d));this.faceVertexUvs[0].push([o,
+p,n])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(b,c){function d(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,n){var o=new Image;o.onload=function(){if(!d(this.width)||!d(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),u=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=p;k.image.height=u;k.image.getContext("2d").drawImage(this,0,0,p,u)}else k.image=this;k.needsUpdate=!0};o.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
+this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(b,c){function d(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,n){var p=new Image;p.onload=function(){if(!d(this.width)||!d(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,o,x)}else k.image=this;k.needsUpdate=!0};p.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
 "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(d);b=new Worker(d);b.onmessage=function(h){c.createModel(h.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,o,p,u,y,v,A,E,G,L,V,z=b.faces;v=b.vertices;var N=b.normals,P=b.colors;o=b.scale!==undefined?b.scale:1;var S=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&S++;for(g=0;g<S;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=v.length;k<n;){p=new THREE.Vertex;p.position.x=v[k++]/
-o;p.position.y=v[k++]/o;p.position.z=v[k++]/o;f.vertices.push(p)}k=0;for(n=z.length;k<n;){v=z[k++];o=v&1;j=v&2;g=v&4;h=v&8;u=v&16;p=v&32;A=v&64;v&=128;if(o){E=new THREE.Face4;E.a=z[k++];E.b=z[k++];E.c=z[k++];E.d=z[k++];o=4}else{E=new THREE.Face3;E.a=z[k++];E.b=z[k++];E.c=z[k++];o=3}if(j){j=z[k++];E.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<S;g++){G=b.uvs[g];y=z[k++];V=G[y*2];y=G[y*2+1];f.faceUvs[g][j]=new THREE.UV(V,y)}if(h)for(g=0;g<S;g++){G=b.uvs[g];L=[];for(h=0;h<o;h++){y=z[k++];
-V=G[y*2];y=G[y*2+1];L[h]=new THREE.UV(V,y)}f.faceVertexUvs[g][j]=L}if(u){u=z[k++]*3;h=new THREE.Vector3;h.x=N[u++];h.y=N[u++];h.z=N[u];E.normal=h}if(p)for(g=0;g<o;g++){u=z[k++]*3;h=new THREE.Vector3;h.x=N[u++];h.y=N[u++];h.z=N[u];E.vertexNormals.push(h)}if(A){p=z[k++];p=new THREE.Color(P[p]);E.color=p}if(v)for(g=0;g<o;g++){p=z[k++];p=new THREE.Color(P[p]);E.vertexColors.push(p)}f.faces.push(E)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
-k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,n,o;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];n=f.morphTargets[g].vertices;o=b.morphTargets[g].vertices;
-j=0;for(k=o.length;j<k;j+=3)n.push(new THREE.Vertex(new THREE.Vector3(o[j],o[j+1],o[j+2])))}}if(b.morphColors!==undefined){var p,u;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];o=f.morphColors[g].colors;p=b.morphColors[g].colors;k=0;for(n=p.length;k<n;k+=3){u=new THREE.Color(16755200);u.setRGB(p[j],p[j+1],p[j+2]);o.push(u)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,x,y,v,B,F,G,N,W,z=b.faces;v=b.vertices;var O=b.normals,P=b.colors;p=b.scale!==undefined?b.scale:1;var S=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&S++;for(g=0;g<S;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=v.length;k<n;){o=new THREE.Vertex;o.position.x=v[k++]/
+p;o.position.y=v[k++]/p;o.position.z=v[k++]/p;f.vertices.push(o)}k=0;for(n=z.length;k<n;){v=z[k++];p=v&1;j=v&2;g=v&4;h=v&8;x=v&16;o=v&32;B=v&64;v&=128;if(p){F=new THREE.Face4;F.a=z[k++];F.b=z[k++];F.c=z[k++];F.d=z[k++];p=4}else{F=new THREE.Face3;F.a=z[k++];F.b=z[k++];F.c=z[k++];p=3}if(j){j=z[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<S;g++){G=b.uvs[g];y=z[k++];W=G[y*2];y=G[y*2+1];f.faceUvs[g][j]=new THREE.UV(W,y)}if(h)for(g=0;g<S;g++){G=b.uvs[g];N=[];for(h=0;h<p;h++){y=z[k++];
+W=G[y*2];y=G[y*2+1];N[h]=new THREE.UV(W,y)}f.faceVertexUvs[g][j]=N}if(x){x=z[k++]*3;h=new THREE.Vector3;h.x=O[x++];h.y=O[x++];h.z=O[x];F.normal=h}if(o)for(g=0;g<p;g++){x=z[k++]*3;h=new THREE.Vector3;h.x=O[x++];h.y=O[x++];h.z=O[x];F.vertexNormals.push(h)}if(B){o=z[k++];o=new THREE.Color(P[o]);F.color=o}if(v)for(g=0;g<p;g++){o=z[k++];o=new THREE.Color(P[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
+k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,n,p;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];n=f.morphTargets[g].vertices;p=b.morphTargets[g].vertices;
+j=0;for(k=p.length;j<k;j+=3)n.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,x;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(n=o.length;k<n;k+=3){x=new THREE.Color(16755200);x.setRGB(o[j],o[j+1],o[j+2]);p.push(x)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
 j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c);b=(new Date).getTime();c=new Worker(c);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,d,g,f,h)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,d,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,g,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(R,$){var na=p(R,$),Ba=p(R,$+1),ha=p(R,$+2),ka=p(R,$+3),m=(ka<<1&255|ha>>7)-127;na|=(ha&127)<<16|Ba<<8;if(na==0&&m==-127)return 0;return(1-2*(ka>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,m)}function k(R,$){var na=p(R,$),Ba=p(R,$+1),ha=p(R,$+2);return(p(R,$+3)<<24)+(ha<<16)+(Ba<<8)+na}function n(R,$){var na=p(R,$);return(p(R,$+1)<<8)+na}function o(R,$){var na=p(R,$);return na>127?
-na-256:na}function p(R,$){return R.charCodeAt($)&255}function u(R){var $,na,Ba;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);R=n(b,R+sa);THREE.BinaryLoader.prototype.f3(L,$,na,Ba,R)}function y(R){var $,na,Ba,ha,ka,m;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);ha=n(b,R+sa);ka=k(b,R+qa);m=k(b,R+e);R=k(b,R+fa);THREE.BinaryLoader.prototype.f3n(L,N,$,na,Ba,ha,ka,m,R)}function v(R){var $,na,Ba,ha;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);R=n(b,R+Ga);THREE.BinaryLoader.prototype.f4(L,$,na,Ba,ha,R)}function A(R){var $,na,
-Ba,ha,ka,m,C,x;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);ka=n(b,R+Ga);m=k(b,R+ra);C=k(b,R+aa);x=k(b,R+pa);R=k(b,R+za);THREE.BinaryLoader.prototype.f4n(L,N,$,na,Ba,ha,ka,m,C,x,R)}function E(R){var $,na;$=k(b,R);na=k(b,R+ia);R=k(b,R+Y);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],P[R*2],P[R*2+1])}function G(R){var $,na,Ba;$=k(b,R);na=k(b,R+ma);Ba=k(b,R+Da);R=k(b,R+ja);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],
-P[Ba*2],P[Ba*2+1],P[R*2],P[R*2+1])}var L=this,V=0,z,N=[],P=[],S,xa,sa,qa,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);z={signature:b.substr(V,8),header_bytes:p(b,V+8),vertex_coordinate_bytes:p(b,V+9),normal_coordinate_bytes:p(b,V+10),uv_coordinate_bytes:p(b,V+11),vertex_index_bytes:p(b,V+12),normal_index_bytes:p(b,V+13),uv_index_bytes:p(b,V+14),material_index_bytes:p(b,V+15),nvertices:k(b,V+16),nnormals:k(b,V+16+
-4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=z.header_bytes;S=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;sa=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(R,$){var na=o(R,$),Ba=o(R,$+1),ha=o(R,$+2),ka=o(R,$+3),m=(ka<<1&255|ha>>7)-127;na|=(ha&127)<<16|Ba<<8;if(na==0&&m==-127)return 0;return(1-2*(ka>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,m)}function k(R,$){var na=o(R,$),Ba=o(R,$+1),ha=o(R,$+2);return(o(R,$+3)<<24)+(ha<<16)+(Ba<<8)+na}function n(R,$){var na=o(R,$);return(o(R,$+1)<<8)+na}function p(R,$){var na=o(R,$);return na>127?
+na-256:na}function o(R,$){return R.charCodeAt($)&255}function x(R){var $,na,Ba;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);R=n(b,R+sa);THREE.BinaryLoader.prototype.f3(N,$,na,Ba,R)}function y(R){var $,na,Ba,ha,ka,m;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);ha=n(b,R+sa);ka=k(b,R+qa);m=k(b,R+e);R=k(b,R+fa);THREE.BinaryLoader.prototype.f3n(N,O,$,na,Ba,ha,ka,m,R)}function v(R){var $,na,Ba,ha;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);R=n(b,R+Ga);THREE.BinaryLoader.prototype.f4(N,$,na,Ba,ha,R)}function B(R){var $,na,
+Ba,ha,ka,m,C,u;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);ka=n(b,R+Ga);m=k(b,R+ra);C=k(b,R+aa);u=k(b,R+pa);R=k(b,R+za);THREE.BinaryLoader.prototype.f4n(N,O,$,na,Ba,ha,ka,m,C,u,R)}function F(R){var $,na;$=k(b,R);na=k(b,R+ia);R=k(b,R+Y);THREE.BinaryLoader.prototype.uv3(N.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],P[R*2],P[R*2+1])}function G(R){var $,na,Ba;$=k(b,R);na=k(b,R+ma);Ba=k(b,R+Da);R=k(b,R+ja);THREE.BinaryLoader.prototype.uv4(N.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],
+P[Ba*2],P[Ba*2+1],P[R*2],P[R*2+1])}var N=this,W=0,z,O=[],P=[],S,xa,sa,qa,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(N,f,h);z={signature:b.substr(W,8),header_bytes:o(b,W+8),vertex_coordinate_bytes:o(b,W+9),normal_coordinate_bytes:o(b,W+10),uv_coordinate_bytes:o(b,W+11),vertex_index_bytes:o(b,W+12),normal_index_bytes:o(b,W+13),uv_index_bytes:o(b,W+14),material_index_bytes:o(b,W+15),nvertices:k(b,W+16),nnormals:k(b,W+16+
+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=z.header_bytes;S=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;sa=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*
 2;da=z.vertex_index_bytes;ya=z.vertex_index_bytes*2;Fa=z.vertex_index_bytes*3;Ga=z.vertex_index_bytes*4;ra=z.vertex_index_bytes*4+z.material_index_bytes;aa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;pa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;za=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;ia=z.uv_index_bytes;Y=z.uv_index_bytes*2;ma=z.uv_index_bytes;Da=z.uv_index_bytes*2;ja=z.uv_index_bytes*3;h=z.vertex_index_bytes*3+z.material_index_bytes;
-Ta=z.vertex_index_bytes*4+z.material_index_bytes;la=z.ntri_flat*h;Ea=z.ntri_smooth*(h+z.normal_index_bytes*3);Sa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);Ya=z.nquad_flat*Ta;h=z.nquad_smooth*(Ta+z.normal_index_bytes*4);Ta=z.nquad_flat_uv*(Ta+z.uv_index_bytes*4);V+=function(R){for(var $,na,Ba,ha=z.vertex_coordinate_bytes*3,ka=R+z.nvertices*ha;R<ka;R+=ha){$=j(b,R);na=j(b,R+z.vertex_coordinate_bytes);Ba=j(b,R+z.vertex_coordinate_bytes*2);
-THREE.BinaryLoader.prototype.v(L,$,na,Ba)}return z.nvertices*ha}(V);V+=function(R){for(var $,na,Ba,ha=z.normal_coordinate_bytes*3,ka=R+z.nnormals*ha;R<ka;R+=ha){$=o(b,R);na=o(b,R+z.normal_coordinate_bytes);Ba=o(b,R+z.normal_coordinate_bytes*2);N.push($/127,na/127,Ba/127)}return z.nnormals*ha}(V);V+=function(R){for(var $,na,Ba=z.uv_coordinate_bytes*2,ha=R+z.nuvs*Ba;R<ha;R+=Ba){$=j(b,R);na=j(b,R+z.uv_coordinate_bytes);P.push($,na)}return z.nuvs*Ba}(V);la=V+la;Ea=la+Ea;Sa=Ea+Sa;$a=Sa+$a;Ya=$a+Ya;h=Ya+
-h;Ta=h+Ta;(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes,Ba=na+z.uv_index_bytes*3,ha=R+z.ntri_flat_uv*Ba;for($=R;$<ha;$+=Ba){u($);E($+na)}return ha-R})(Ea);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ba=na+z.uv_index_bytes*3,ha=R+z.ntri_smooth_uv*Ba;for($=R;$<ha;$+=Ba){y($);E($+na)}return ha-R})(Sa);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes,Ba=na+z.uv_index_bytes*4,ha=R+z.nquad_flat_uv*Ba;for($=R;$<ha;$+=
-Ba){v($);G($+na)}return ha-R})(h);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ba=na+z.uv_index_bytes*4,ha=R+z.nquad_smooth_uv*Ba;for($=R;$<ha;$+=Ba){A($);G($+na)}return ha-R})(Ta);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes,Ba=R+z.ntri_flat*na;for($=R;$<Ba;$+=na)u($);return Ba-R})(V);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ba=R+z.ntri_smooth*na;for($=R;$<Ba;$+=na)y($);return Ba-
-R})(la);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes,Ba=R+z.nquad_flat*na;for($=R;$<Ba;$+=na)v($);return Ba-R})($a);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ba=R+z.nquad_smooth*na;for($=R;$<Ba;$+=na)A($);return Ba-R})(Ya);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,f)))},f3:function(b,
-c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var o=c[k*3],p=c[k*3+1];k=c[k*3+2];var u=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(u,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,o,p){j=b.materials[j];var u=c[n*3],y=c[n*3+1];n=
-c[n*3+2];var v=c[o*3],A=c[o*3+1];o=c[o*3+2];var E=c[p*3],G=c[p*3+1];p=c[p*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,y,n),new THREE.Vector3(v,A,o),new THREE.Vector3(E,G,p)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var o=[];o.push(new THREE.UV(c,d));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,
-n));b.push(o)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(za,ia){return ia=="relativeToHTML"?za:h+"/"+za}function n(){for(v in e.objects)if(!aa.objects[v]){V=e.objects[v];if(S=aa.geometries[V.geometry]){qa=[];for(pa=0;pa<V.materials.length;pa++)qa[pa]=aa.materials[V.materials[pa]];z=V.position;r=V.rotation;q=V.quaternion;s=V.scale;q=0;qa.length==0&&(qa[0]=new THREE.MeshFaceMaterial);object=
-new THREE.Mesh(S,qa);object.position.set(z[0],z[1],z[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=V.visible;aa.scene.addObject(object);aa.objects[v]=object}}}function o(za){return function(ia){aa.geometries[za]=ia;n();ya-=1;p()}}function p(){f({total_models:Ga,total_textures:ra,loaded_models:Ga-ya,loaded_textures:ra-Fa},aa);ya==0&&Fa==0&&d(aa)}var u,y,v,A,E,G,L,V,z,N,P,S,xa,sa,
-qa,e,fa,da,ya,Fa,Ga,ra,aa;e=j.data;fa=new THREE.BinaryLoader;da=new THREE.JSONLoader;Fa=ya=0;aa={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Fa-=1;p()};for(E in e.cameras){N=e.cameras[E];if(N.type=="perspective")xa=new THREE.Camera(N.fov,N.aspect,N.near,N.far);else if(N.type=="ortho"){xa=new THREE.Camera;xa.projectionMatrix=THREE.Matrix4.makeOrtho(N.left,N.right,N.top,N.bottom,N.near,N.far)}z=N.position;N=N.target;xa.position.set(z[0],
-z[1],z[2]);xa.target.position.set(N[0],N[1],N[2]);aa.cameras[E]=xa}for(A in e.lights){E=e.lights[A];xa=E.color!==undefined?E.color:16777215;N=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){z=E.direction;light=new THREE.DirectionalLight(xa,N);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(E.type=="point"){z=E.position;light=new THREE.PointLight(xa,N);light.position.set(z[0],z[1],z[2])}aa.scene.addLight(light);aa.lights[A]=light}for(G in e.fogs){A=e.fogs[G];if(A.type==
-"linear")sa=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(sa=new THREE.FogExp2(0,A.density));N=A.color;sa.color.setRGB(N[0],N[1],N[2]);aa.fogs[G]=sa}if(aa.cameras&&e.defaults.camera)aa.currentCamera=aa.cameras[e.defaults.camera];if(aa.fogs&&e.defaults.fog)aa.scene.fog=aa.fogs[e.defaults.fog];N=e.defaults.bgcolor;aa.bgColor=new THREE.Color;aa.bgColor.setRGB(N[0],N[1],N[2]);aa.bgColorAlpha=e.defaults.bgalpha;for(u in e.geometries){G=e.geometries[u];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ya+=
-1}Ga=ya;for(u in e.geometries){G=e.geometries[u];if(G.type=="cube"){S=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);aa.geometries[u]=S}else if(G.type=="plane"){S=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);aa.geometries[u]=S}else if(G.type=="sphere"){S=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);aa.geometries[u]=S}else if(G.type=="cylinder"){S=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);
-aa.geometries[u]=S}else if(G.type=="torus"){S=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);aa.geometries[u]=S}else if(G.type=="icosahedron"){S=new Icosahedron(G.subdivisions);aa.geometries[u]=S}else if(G.type=="bin_mesh")fa.load({model:k(G.url,e.urlBaseType),callback:o(u)});else G.type=="ascii_mesh"&&da.load({model:k(G.url,e.urlBaseType),callback:o(u)})}for(L in e.textures){u=e.textures[L];Fa+=u.url instanceof Array?u.url.length:1}ra=Fa;for(L in e.textures){u=e.textures[L];if(u.mapping!=undefined&&
-THREE[u.mapping]!=undefined)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){G=[];for(var pa=0;pa<u.url.length;pa++)G[pa]=k(u.url[pa],e.urlBaseType);G=ImageUtils.loadTextureCube(G,u.mapping,j)}else{G=ImageUtils.loadTexture(k(u.url,e.urlBaseType),u.mapping,j);if(THREE[u.minFilter]!=undefined)G.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=undefined)G.magFilter=THREE[u.magFilter]}aa.textures[L]=G}for(y in e.materials){L=e.materials[y];for(P in L.parameters)if(P=="envMap"||P=="map"||P==
-"lightMap")L.parameters[P]=aa.textures[L.parameters[P]];else if(P=="shading")L.parameters[P]=L.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")L.parameters[P]=THREE[L.parameters[P]]?THREE[L.parameters[P]]:THREE.NormalBlending;else P=="combine"&&(L.parameters[P]=L.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);L=new THREE[L.type](L.parameters);aa.materials[y]=L}n();c(aa)}}};
+Ta=z.vertex_index_bytes*4+z.material_index_bytes;la=z.ntri_flat*h;Ea=z.ntri_smooth*(h+z.normal_index_bytes*3);Sa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);Ya=z.nquad_flat*Ta;h=z.nquad_smooth*(Ta+z.normal_index_bytes*4);Ta=z.nquad_flat_uv*(Ta+z.uv_index_bytes*4);W+=function(R){for(var $,na,Ba,ha=z.vertex_coordinate_bytes*3,ka=R+z.nvertices*ha;R<ka;R+=ha){$=j(b,R);na=j(b,R+z.vertex_coordinate_bytes);Ba=j(b,R+z.vertex_coordinate_bytes*2);
+THREE.BinaryLoader.prototype.v(N,$,na,Ba)}return z.nvertices*ha}(W);W+=function(R){for(var $,na,Ba,ha=z.normal_coordinate_bytes*3,ka=R+z.nnormals*ha;R<ka;R+=ha){$=p(b,R);na=p(b,R+z.normal_coordinate_bytes);Ba=p(b,R+z.normal_coordinate_bytes*2);O.push($/127,na/127,Ba/127)}return z.nnormals*ha}(W);W+=function(R){for(var $,na,Ba=z.uv_coordinate_bytes*2,ha=R+z.nuvs*Ba;R<ha;R+=Ba){$=j(b,R);na=j(b,R+z.uv_coordinate_bytes);P.push($,na)}return z.nuvs*Ba}(W);la=W+la;Ea=la+Ea;Sa=Ea+Sa;$a=Sa+$a;Ya=$a+Ya;h=Ya+
+h;Ta=h+Ta;(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes,Ba=na+z.uv_index_bytes*3,ha=R+z.ntri_flat_uv*Ba;for($=R;$<ha;$+=Ba){x($);F($+na)}return ha-R})(Ea);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ba=na+z.uv_index_bytes*3,ha=R+z.ntri_smooth_uv*Ba;for($=R;$<ha;$+=Ba){y($);F($+na)}return ha-R})(Sa);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes,Ba=na+z.uv_index_bytes*4,ha=R+z.nquad_flat_uv*Ba;for($=R;$<ha;$+=
+Ba){v($);G($+na)}return ha-R})(h);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ba=na+z.uv_index_bytes*4,ha=R+z.nquad_smooth_uv*Ba;for($=R;$<ha;$+=Ba){B($);G($+na)}return ha-R})(Ta);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes,Ba=R+z.ntri_flat*na;for($=R;$<Ba;$+=na)x($);return Ba-R})(W);(function(R){var $,na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ba=R+z.ntri_smooth*na;for($=R;$<Ba;$+=na)y($);return Ba-
+R})(la);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes,Ba=R+z.nquad_flat*na;for($=R;$<Ba;$+=na)v($);return Ba-R})($a);(function(R){var $,na=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ba=R+z.nquad_smooth*na;for($=R;$<Ba;$+=na)B($);return Ba-R})(Ya);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,f)))},f3:function(b,
+c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var x=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(x,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,p,o){j=b.materials[j];var x=c[n*3],y=c[n*3+1];n=
+c[n*3+2];var v=c[p*3],B=c[p*3+1];p=c[p*3+2];var F=c[o*3],G=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,y,n),new THREE.Vector3(v,B,p),new THREE.Vector3(F,G,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,
+n));b.push(p)}};THREE.SceneLoader=function(){};
+THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(za,ia){return ia=="relativeToHTML"?za:h+"/"+za}function n(){for(v in e.objects)if(!aa.objects[v]){W=e.objects[v];if(S=aa.geometries[W.geometry]){qa=[];for(pa=0;pa<W.materials.length;pa++)qa[pa]=aa.materials[W.materials[pa]];z=W.position;r=W.rotation;q=W.quaternion;s=W.scale;q=0;qa.length==0&&(qa[0]=new THREE.MeshFaceMaterial);object=
+new THREE.Mesh(S,qa);object.position.set(z[0],z[1],z[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=W.visible;aa.scene.addObject(object);aa.objects[v]=object}}}function p(za){return function(ia){aa.geometries[za]=ia;n();ya-=1;o()}}function o(){f({total_models:Ga,total_textures:ra,loaded_models:Ga-ya,loaded_textures:ra-Fa},aa);ya==0&&Fa==0&&d(aa)}var x,y,v,B,F,G,N,W,z,O,P,S,xa,sa,
+qa,e,fa,da,ya,Fa,Ga,ra,aa;e=j.data;fa=new THREE.BinaryLoader;da=new THREE.JSONLoader;Fa=ya=0;aa={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Fa-=1;o()};for(F in e.cameras){O=e.cameras[F];if(O.type=="perspective")xa=new THREE.Camera(O.fov,O.aspect,O.near,O.far);else if(O.type=="ortho"){xa=new THREE.Camera;xa.projectionMatrix=THREE.Matrix4.makeOrtho(O.left,O.right,O.top,O.bottom,O.near,O.far)}z=O.position;O=O.target;xa.position.set(z[0],
+z[1],z[2]);xa.target.position.set(O[0],O[1],O[2]);aa.cameras[F]=xa}for(B in e.lights){F=e.lights[B];xa=F.color!==undefined?F.color:16777215;O=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){z=F.direction;light=new THREE.DirectionalLight(xa,O);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(F.type=="point"){z=F.position;light=new THREE.PointLight(xa,O);light.position.set(z[0],z[1],z[2])}aa.scene.addLight(light);aa.lights[B]=light}for(G in e.fogs){B=e.fogs[G];if(B.type==
+"linear")sa=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(sa=new THREE.FogExp2(0,B.density));O=B.color;sa.color.setRGB(O[0],O[1],O[2]);aa.fogs[G]=sa}if(aa.cameras&&e.defaults.camera)aa.currentCamera=aa.cameras[e.defaults.camera];if(aa.fogs&&e.defaults.fog)aa.scene.fog=aa.fogs[e.defaults.fog];O=e.defaults.bgcolor;aa.bgColor=new THREE.Color;aa.bgColor.setRGB(O[0],O[1],O[2]);aa.bgColorAlpha=e.defaults.bgalpha;for(x in e.geometries){G=e.geometries[x];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ya+=
+1}Ga=ya;for(x in e.geometries){G=e.geometries[x];if(G.type=="cube"){S=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);aa.geometries[x]=S}else if(G.type=="plane"){S=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);aa.geometries[x]=S}else if(G.type=="sphere"){S=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);aa.geometries[x]=S}else if(G.type=="cylinder"){S=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);
+aa.geometries[x]=S}else if(G.type=="torus"){S=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);aa.geometries[x]=S}else if(G.type=="icosahedron"){S=new Icosahedron(G.subdivisions);aa.geometries[x]=S}else if(G.type=="bin_mesh")fa.load({model:k(G.url,e.urlBaseType),callback:p(x)});else G.type=="ascii_mesh"&&da.load({model:k(G.url,e.urlBaseType),callback:p(x)})}for(N in e.textures){x=e.textures[N];Fa+=x.url instanceof Array?x.url.length:1}ra=Fa;for(N in e.textures){x=e.textures[N];if(x.mapping!=undefined&&
+THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){G=[];for(var pa=0;pa<x.url.length;pa++)G[pa]=k(x.url[pa],e.urlBaseType);G=ImageUtils.loadTextureCube(G,x.mapping,j)}else{G=ImageUtils.loadTexture(k(x.url,e.urlBaseType),x.mapping,j);if(THREE[x.minFilter]!=undefined)G.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)G.magFilter=THREE[x.magFilter]}aa.textures[N]=G}for(y in e.materials){N=e.materials[y];for(P in N.parameters)if(P=="envMap"||P=="map"||P==
+"lightMap")N.parameters[P]=aa.textures[N.parameters[P]];else if(P=="shading")N.parameters[P]=N.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")N.parameters[P]=THREE[N.parameters[P]]?THREE[N.parameters[P]]:THREE.NormalBlending;else P=="combine"&&(N.parameters[P]=N.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);N=new THREE[N.type](N.parameters);aa.materials[y]=N}n();c(aa)}}};
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;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(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,n,o,p,u){j=(j-p)/(u-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=o;g[h]=this.lerp(p[d],p[d+3],j);g[h+1]=this.lerp(p[d+1],p[d+4],j);g[h+2]=this.lerp(p[d+2],p[d+5],j)};this.VIntY=function(d,f,g,h,j,k,n,o,p,u){j=(j-p)/(u-p);p=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
-2]=o;f=d+this.yd*3;g[h]=this.lerp(p[d],p[f],j);g[h+1]=this.lerp(p[d+1],p[f+1],j);g[h+2]=this.lerp(p[d+2],p[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,n,o,p,u){j=(j-p)/(u-p);p=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=o+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(p[d],p[f],j);g[h+1]=this.lerp(p[d+1],p[f+1],j);g[h+2]=this.lerp(p[d+2],p[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
-this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,o=h+this.yd,p=h+this.zd,u=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,A=n+this.yd+this.zd,E=0,G=this.field[h],L=this.field[n],V=this.field[o],z=this.field[u],N=this.field[p],P=this.field[y],S=this.field[v],xa=this.field[A];G<j&&(E|=1);L<j&&(E|=2);V<j&&(E|=8);z<j&&(E|=4);N<j&&(E|=16);P<j&&(E|=32);S<j&&(E|=128);xa<j&&(E|=64);var sa=THREE.edgeTable[E];if(sa==0)return 0;
-var qa=this.delta,e=d+qa,fa=f+qa;qa=g+qa;if(sa&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,G,L)}if(sa&2){this.compNorm(n);this.compNorm(u);this.VIntY(n*3,this.vlist,this.nlist,3,j,e,f,g,L,z)}if(sa&4){this.compNorm(o);this.compNorm(u);this.VIntX(o*3,this.vlist,this.nlist,6,j,d,fa,g,V,z)}if(sa&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,G,V)}if(sa&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
-12,j,d,f,qa,N,P)}if(sa&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,e,f,qa,P,xa)}if(sa&64){this.compNorm(v);this.compNorm(A);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,fa,qa,S,xa)}if(sa&128){this.compNorm(p);this.compNorm(v);this.VIntY(p*3,this.vlist,this.nlist,21,j,d,f,qa,N,S)}if(sa&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,G,N)}if(sa&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,e,
-f,g,L,P)}if(sa&1024){this.compNorm(u);this.compNorm(A);this.VIntZ(u*3,this.vlist,this.nlist,30,j,e,fa,g,z,xa)}if(sa&2048){this.compNorm(o);this.compNorm(v);this.VIntZ(o*3,this.vlist,this.nlist,33,j,d,fa,g,V,S)}E<<=4;for(j=h=0;THREE.triTable[E+j]!=-1;){d=E+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[d],o[d+3],j);g[h+1]=this.lerp(o[d+1],o[d+4],j);g[h+2]=this.lerp(o[d+2],o[d+5],j)};this.VIntY=function(d,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
+2]=p;f=d+this.yd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,n,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
+this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,x=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,B=n+this.yd+this.zd,F=0,G=this.field[h],N=this.field[n],W=this.field[p],z=this.field[x],O=this.field[o],P=this.field[y],S=this.field[v],xa=this.field[B];G<j&&(F|=1);N<j&&(F|=2);W<j&&(F|=8);z<j&&(F|=4);O<j&&(F|=16);P<j&&(F|=32);S<j&&(F|=128);xa<j&&(F|=64);var sa=THREE.edgeTable[F];if(sa==0)return 0;
+var qa=this.delta,e=d+qa,fa=f+qa;qa=g+qa;if(sa&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,G,N)}if(sa&2){this.compNorm(n);this.compNorm(x);this.VIntY(n*3,this.vlist,this.nlist,3,j,e,f,g,N,z)}if(sa&4){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,fa,g,W,z)}if(sa&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,G,W)}if(sa&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
+12,j,d,f,qa,O,P)}if(sa&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,e,f,qa,P,xa)}if(sa&64){this.compNorm(v);this.compNorm(B);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,fa,qa,S,xa)}if(sa&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,qa,O,S)}if(sa&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,G,O)}if(sa&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,e,
+f,g,N,P)}if(sa&1024){this.compNorm(x);this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,j,e,fa,g,z,xa)}if(sa&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,fa,g,W,S)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){d=F+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
 1];this.positionArray[n+2]=d[g+2];this.positionArray[n+3]=d[h];this.positionArray[n+4]=d[h+1];this.positionArray[n+5]=d[h+2];this.positionArray[n+6]=d[j];this.positionArray[n+7]=d[j+1];this.positionArray[n+8]=d[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
-this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,o=f*this.size,p=d*this.size,u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&(o=
-this.size-1);var v=Math.floor(p-k);v<1&&(v=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,E,G,L,V,z;u<n;u++){p=this.size2*u;E=u/this.size-g;V=E*E;for(E=y;E<o;E++){G=p+this.size*E;A=E/this.size-f;z=A*A;for(A=v;A<k;A++){L=A/this.size-d;L=h/(1.0E-6+L*L+z+V)-j;L>0&&(this.field[G+A]+=L)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,o=this.size,p=this.yd,u=this.zd,y=this.field,v=o*Math.sqrt(d/f);v>o&&(v=o);for(g=0;g<v;g++){h=g/o;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){n=g+h*p;for(j=
-0;j<o;j++)y[u*j+n]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,n,o,p=this.size,u=this.yd,y=this.zd,v=this.field,A=p*Math.sqrt(d/f);A>p&&(A=p);for(h=0;h<A;h++){g=h/p;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=h*u;for(g=0;g<p;g++){o=n+g;for(j=0;j<p;j++)v[y*j+o]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,n,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){o=n+h*yd;
-for(g=0;g<size;g++)field[o+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,n,o,p,u,y=this.size-2;for(j=1;j<y;j++){u=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){p=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=p+g;this.polygonize(k,n,o,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry;
-this.render(function(g){var h,j,k,n,o,p,u,y;for(h=0;h<g.count;h++){o=h*3;u=o+1;y=o+2;j=g.positionArray[o];k=g.positionArray[u];n=g.positionArray[y];p=new THREE.Vector3(j,k,n);j=g.normalArray[o];k=g.normalArray[u];n=g.normalArray[y];o=new THREE.Vector3(j,k,n);o.normalize();o=new THREE.Vertex(p,o);f.vertices.push(o)}nfaces=g.count/3;for(h=0;h<nfaces;h++){o=(d+h)*3;u=o+1;y=o+2;p=f.vertices[o].normal;j=f.vertices[u].normal;k=f.vertices[y].normal;o=new THREE.Face3(o,u,y,[p,j,k]);f.faces.push(o)}d+=nfaces;
-g.count=0});return f};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=d*this.size,x=Math.floor(n-k);x<1&&(x=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
+this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,G,N,W,z;x<n;x++){o=this.size2*x;F=x/this.size-g;W=F*F;for(F=y;F<p;F++){G=o+this.size*F;B=F/this.size-f;z=B*B;for(B=v;B<k;B++){N=B/this.size-d;N=h/(1.0E-6+N*N+z+W)-j;N>0&&(this.field[G+B]+=N)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
+0;j<p;j++)y[x*j+n]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,n,p,o=this.size,x=this.yd,y=this.zd,v=this.field,B=o*Math.sqrt(d/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=h*x;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
+for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,n,p,o,x,y=this.size-2;for(j=1;j<y;j++){x=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=x+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry,
+g=[];this.render(function(h){var j,k,n,p,o,x,y,v;for(j=0;j<h.count;j++){y=j*3;o=y+1;v=y+2;k=h.positionArray[y];n=h.positionArray[o];p=h.positionArray[v];x=new THREE.Vector3(k,n,p);k=h.normalArray[y];n=h.normalArray[o];p=h.normalArray[v];y=new THREE.Vector3(k,n,p);y.normalize();o=new THREE.Vertex(x);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(d+j)*3;o=y+1;v=y+2;x=g[y];k=g[o];n=g[v];y=new THREE.Face3(y,o,v,[x,k,n]);f.faces.push(y)}d+=nfaces;h.count=0});return f};this.init(b)};
+THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7 - 7
build/custom/ThreeExtras.js


+ 158 - 158
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // ThreeWebGL.js r38 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,k,j,o,p;if(e==0)h=g=k=0;else{j=Math.floor(b*6);o=b*6-j;b=e*(1-d);p=e*(1-d*o);d=e*(1-d*(1-o));switch(j){case 1:h=p;g=e;k=b;break;case 2:h=b;g=e;k=d;break;case 3:h=b;g=p;k=e;break;case 4:h=d;g=b;k=e;break;case 5:h=e;g=b;
-k=p;break;case 6:case 0:h=e;g=d;k=b}}this.r=h;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&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*
+THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,m,j,o,p;if(e==0)h=g=m=0;else{j=Math.floor(b*6);o=b*6-j;b=e*(1-d);p=e*(1-d*o);d=e*(1-d*(1-o));switch(j){case 1:h=p;g=e;m=b;break;case 2:h=b;g=e;m=d;break;case 3:h=b;g=p;m=e;break;case 4:h=d;g=b;m=e;break;case 5:h=e;g=b;
+m=p;break;case 6:case 0:h=e;g=d;m=b}}this.r=h;this.g=g;this.b=m;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&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(b,d){this.set(b||0,d||0)};
 THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
@@ -12,73 +12,73 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,h){this.set(b||0,d||0,e||0,h||1)};
 THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(k,j){return k.distance-j.distance});return g},intersectObject:function(b){function d(Y,O,ca,ma){ma=ma.clone().subSelf(O);ca=ca.clone().subSelf(O);var wa=Y.clone().subSelf(O);Y=ma.dot(ma);O=ma.dot(ca);ma=ma.dot(wa);var $=ca.dot(ca);ca=ca.dot(wa);wa=1/(Y*$-O*O);$=($*ma-O*ca)*wa;Y=(Y*ca-O*ma)*wa;return $>0&&Y>0&&$+Y<
-1}var e,h,g,k,j,o,p,u,D,F,I,G=b.geometry,L=G.vertices,M=[];e=0;for(h=G.faces.length;e<h;e++){g=G.faces[e];F=this.origin.clone();I=this.direction.clone();p=b.matrixWorld;k=p.multiplyVector3(L[g.a].position.clone());j=p.multiplyVector3(L[g.b].position.clone());o=p.multiplyVector3(L[g.c].position.clone());p=g instanceof THREE.Face4?p.multiplyVector3(L[g.d].position.clone()):null;u=b.matrixRotationWorld.multiplyVector3(g.normal.clone());D=I.dot(u);if(b.doubleSided||(b.flipSided?D>0:D<0)){u=u.dot((new THREE.Vector3).sub(k,
-F))/D;F=F.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(d(F,k,j,o)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(F,k,j,p)||d(F,j,o,p))){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}}return M}};
-THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,u,D,F){o=!1;d=p;e=u;h=D;g=F;b()};this.addPoint=function(p,u){if(o){o=!1;d=p;e=u;h=p;g=u}else{d=d<p?d:p;e=e<u?e:u;h=h>p?h:p;g=g>u?g:u}b()};
-this.add3Points=function(p,u,D,F,I,G){if(o){o=!1;d=p<D?p<I?p:I:D<I?D:I;e=u<F?u<G?u:G:F<G?F:G;h=p>D?p>I?p:I:D>I?D:I;g=u>F?u>G?u:G:F>G?F:G}else{d=p<D?p<I?p<d?p:d:I<d?I:d:D<I?D<d?D:d:I<d?I:d;e=u<F?u<G?u<e?u:e:G<e?G:e:F<G?F<e?F:e:G<e?G:e;h=p>D?p>I?p>h?p:h:I>h?I:h:D>I?D>h?D:h:I>h?I:h;g=u>F?u>G?u>g?u:g:G>g?G:g:F>G?F>g?F:g:G>g?G:g}b()};this.addRectangle=function(p){if(o){o=!1;d=p.getLeft();e=p.getTop();h=p.getRight();g=p.getBottom()}else{d=d<p.getLeft()?d:p.getLeft();e=e<p.getTop()?e:p.getTop();h=h>p.getRight()?
+THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(m,j){return m.distance-j.distance});return g},intersectObject:function(b){function d(Y,O,ca,ma){ma=ma.clone().subSelf(O);ca=ca.clone().subSelf(O);var wa=Y.clone().subSelf(O);Y=ma.dot(ma);O=ma.dot(ca);ma=ma.dot(wa);var $=ca.dot(ca);ca=ca.dot(wa);wa=1/(Y*$-O*O);$=($*ma-O*ca)*wa;Y=(Y*ca-O*ma)*wa;return $>0&&Y>0&&$+Y<
+1}var e,h,g,m,j,o,p,u,E,G,I,H=b.geometry,L=H.vertices,M=[];e=0;for(h=H.faces.length;e<h;e++){g=H.faces[e];G=this.origin.clone();I=this.direction.clone();p=b.matrixWorld;m=p.multiplyVector3(L[g.a].position.clone());j=p.multiplyVector3(L[g.b].position.clone());o=p.multiplyVector3(L[g.c].position.clone());p=g instanceof THREE.Face4?p.multiplyVector3(L[g.d].position.clone()):null;u=b.matrixRotationWorld.multiplyVector3(g.normal.clone());E=I.dot(u);if(b.doubleSided||(b.flipSided?E>0:E<0)){u=u.dot((new THREE.Vector3).sub(m,
+G))/E;G=G.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(d(G,m,j,o)){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(G,m,j,p)||d(G,j,o,p))){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}}return M}};
+THREE.Rectangle=function(){function b(){m=h-d;j=g-e}var d,e,h,g,m,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,u,E,G){o=!1;d=p;e=u;h=E;g=G;b()};this.addPoint=function(p,u){if(o){o=!1;d=p;e=u;h=p;g=u}else{d=d<p?d:p;e=e<u?e:u;h=h>p?h:p;g=g>u?g:u}b()};
+this.add3Points=function(p,u,E,G,I,H){if(o){o=!1;d=p<E?p<I?p:I:E<I?E:I;e=u<G?u<H?u:H:G<H?G:H;h=p>E?p>I?p:I:E>I?E:I;g=u>G?u>H?u:H:G>H?G:H}else{d=p<E?p<I?p<d?p:d:I<d?I:d:E<I?E<d?E:d:I<d?I:d;e=u<G?u<H?u<e?u:e:H<e?H:e:G<H?G<e?G:e:H<e?H:e;h=p>E?p>I?p>h?p:h:I>h?I:h:E>I?E>h?E:h:I>h?I:h;g=u>G?u>H?u>g?u:g:H>g?H:g:G>H?G>g?G:g:H>g?H:g}b()};this.addRectangle=function(p){if(o){o=!1;d=p.getLeft();e=p.getTop();h=p.getRight();g=p.getBottom()}else{d=d<p.getLeft()?d:p.getLeft();e=e<p.getTop()?e:p.getTop();h=h>p.getRight()?
 h:p.getRight();g=g>p.getBottom()?g:p.getBottom()}b()};this.inflate=function(p){d-=p;e-=p;h+=p;g+=p;b()};this.minSelf=function(p){d=d>p.getLeft()?d:p.getLeft();e=e>p.getTop()?e:p.getTop();h=h<p.getRight()?h:p.getRight();g=g<p.getBottom()?g:p.getBottom();b()};this.instersects=function(p){return Math.min(h,p.getRight())-Math.max(d,p.getLeft())>=0&&Math.min(g,p.getBottom())-Math.max(e,p.getTop())>=0};this.empty=function(){o=!0;g=h=e=d=0;b()};this.isEmpty=function(){return o}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
-THREE.Matrix4=function(b,d,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,j||0,o||0,p||0,u||0,D||1,F||0,I||0,G||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=o;this.n31=p;this.n32=u;this.n33=D;this.n34=F;this.n41=I;this.n42=G;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
-g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
+THREE.Matrix4=function(b,d,e,h,g,m,j,o,p,u,E,G,I,H,L,M){this.set(b||1,d||0,e||0,h||0,g||0,m||1,j||0,o||0,p||0,u||0,E||1,G||0,I||0,H||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,h,g,m,j,o,p,u,E,G,I,H,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=m;this.n23=j;this.n24=o;this.n31=p;this.n32=u;this.n33=E;this.n34=G;this.n41=I;this.n42=H;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,d).normalize();if(m.length()===0)m.z=1;h.cross(e,m).normalize();if(h.length()===0){m.x+=1.0E-4;h.cross(e,m).normalize()}g.cross(m,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=m.x;this.n21=h.y;this.n22=g.y;this.n23=m.y;this.n31=h.z;this.n32=g.z;this.n33=m.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
 h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22,
-ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+k;this.n21=j*ca+o*J+p*c;this.n22=j*ma+o*xa+p*U;this.n23=j*wa+o*ta+p*V;this.n24=j*$+o*ea+p*na+u;this.n31=D*ca+F*J+I*c;this.n32=D*ma+F*xa+I*U;this.n33=D*wa+F*ta+I*V;this.n34=D*$+F*ea+I*na+G;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,m=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22,
+ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+m;this.n21=j*ca+o*J+p*c;this.n22=j*ma+o*xa+p*U;this.n23=j*wa+o*ta+p*V;this.n24=j*$+o*ea+p*na+u;this.n31=E*ca+G*J+I*c;this.n32=E*ma+G*xa+I*U;this.n33=E*wa+G*ta+I*V;this.n34=E*$+G*ea+I*na+H;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
 e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,k=this.n22,j=this.n23,o=this.n24,p=this.n31,u=this.n32,D=this.n33,F=this.n34,I=this.n41,G=this.n42,L=this.n43,M=this.n44;return h*j*u*I-e*o*u*I-h*k*D*I+d*o*D*I+e*k*F*I-d*j*F*I-h*j*p*G+e*o*p*G+h*g*D*G-b*o*D*G-e*g*F*G+b*j*F*G+h*k*p*L-d*o*p*L-h*g*u*L+b*o*u*L+d*g*F*L-b*k*F*L-e*k*p*M+d*j*p*M+e*g*u*M-b*j*u*M-d*g*D*M+b*k*D*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,m=this.n22,j=this.n23,o=this.n24,p=this.n31,u=this.n32,E=this.n33,G=this.n34,I=this.n41,H=this.n42,L=this.n43,M=this.n44;return h*j*u*I-e*o*u*I-h*m*E*I+d*o*E*I+e*m*G*I-d*j*G*I-h*j*p*H+e*o*p*H+h*g*E*H-b*o*E*H-e*g*G*H+b*j*G*H+h*m*p*L-d*o*p*L-h*g*u*L+b*o*u*L+d*g*G*L-b*m*G*L-e*m*p*M+d*j*p*M+e*g*u*M-b*j*u*M-d*g*E*M+b*m*E*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,
 0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),h=Math.sin(d),g=
-1-e,k=b.x,j=b.y,o=b.z,p=g*k,u=g*j;this.set(p*k+e,p*j-h*o,p*o+h*j,0,p*j+h*o,u*j+e,u*o-h*k,0,p*o-h*j,u*o+h*k,g*o*o+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=o*k+b*h;this.n22=-o*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33=
-b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,o=h+h;b=d*k;var p=d*j;d*=o;var u=e*j;e*=o;h*=o;k*=g;j*=g;g*=o;this.n11=1-(u+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;this.n33=1-(b+u);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
+1-e,m=b.x,j=b.y,o=b.z,p=g*m,u=g*j;this.set(p*m+e,p*j-h*o,p*o+h*j,0,p*j+h*o,u*j+e,u*o-h*m,0,p*o-h*j,u*o+h*m,g*o*o+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var m=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*m;this.n12=-g*h;this.n13=e;this.n21=o*m+b*h;this.n22=-o*h+b*m;this.n23=-d*g;this.n31=-j*m+d*h;this.n32=j*h+d*m;this.n33=
+b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,m=d+d,j=e+e,o=h+h;b=d*m;var p=d*j;d*=o;var u=e*j;e*=o;h*=o;m*=g;j*=g;g*=o;this.n11=1-(u+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-m;this.n31=d-j;this.n32=e+m;this.n33=1-(b+u);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*G*M-u*I*M+u*F*Y-o*G*Y-p*F*O+o*I*O;d.n12=k*I*M-g*G*M-k*F*Y+h*G*Y+g*F*O-h*I*O;d.n13=g*u*M-k*p*M+k*o*Y-h*u*Y-g*o*O+h*p*O;d.n14=k*p*F-g*u*F-k*o*I+h*u*I+g*o*G-h*p*G;d.n21=u*I*L-p*G*L-u*D*Y+j*G*Y+p*D*O-j*I*O;d.n22=g*G*L-k*I*L+k*D*Y-e*G*Y-g*D*O+e*I*O;d.n23=k*p*L-g*u*L-k*j*Y+e*u*Y+g*j*O-e*p*O;
-d.n24=g*u*D-k*p*D+k*j*I-e*u*I-g*j*G+e*p*G;d.n31=o*G*L-u*F*L+u*D*M-j*G*M-o*D*O+j*F*O;d.n32=k*F*L-h*G*L-k*D*M+e*G*M+h*D*O-e*F*O;d.n33=g*u*L-k*o*L+k*j*M-e*u*M-h*j*O+e*o*O;d.n34=k*o*D-h*u*D-k*j*F+e*u*F+h*j*G-e*o*G;d.n41=p*F*L-o*I*L-p*D*M+j*I*M+o*D*Y-j*F*Y;d.n42=h*I*L-g*F*L+g*D*M-e*I*M-h*D*Y+e*F*Y;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*Y-e*o*Y;d.n44=h*p*D-g*o*D+g*j*F-e*p*F-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,D=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*u;e[7]=b*D;e[8]=b*F;return d};
-THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
-THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,o,p,u;j=new THREE.Matrix4;o=d-b;p=e-h;u=k-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((k+g)/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(b,d){var e=b.n11,h=b.n12,g=b.n13,m=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*H*M-u*I*M+u*G*Y-o*H*Y-p*G*O+o*I*O;d.n12=m*I*M-g*H*M-m*G*Y+h*H*Y+g*G*O-h*I*O;d.n13=g*u*M-m*p*M+m*o*Y-h*u*Y-g*o*O+h*p*O;d.n14=m*p*G-g*u*G-m*o*I+h*u*I+g*o*H-h*p*H;d.n21=u*I*L-p*H*L-u*E*Y+j*H*Y+p*E*O-j*I*O;d.n22=g*H*L-m*I*L+m*E*Y-e*H*Y-g*E*O+e*I*O;d.n23=m*p*L-g*u*L-m*j*Y+e*u*Y+g*j*O-e*p*O;
+d.n24=g*u*E-m*p*E+m*j*I-e*u*I-g*j*H+e*p*H;d.n31=o*H*L-u*G*L+u*E*M-j*H*M-o*E*O+j*G*O;d.n32=m*G*L-h*H*L-m*E*M+e*H*M+h*E*O-e*G*O;d.n33=g*u*L-m*o*L+m*j*M-e*u*M-h*j*O+e*o*O;d.n34=m*o*E-h*u*E-m*j*G+e*u*G+h*j*H-e*o*H;d.n41=p*G*L-o*I*L-p*E*M+j*I*M+o*E*Y-j*G*Y;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*Y+e*G*Y;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*Y-e*o*Y;d.n44=h*p*E-g*o*E+g*j*G-e*p*G-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*m;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*u;e[7]=b*E;e[8]=b*G;return d};
+THREE.Matrix4.makeFrustum=function(b,d,e,h,g,m){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(m+g)/(m-g);j.n34=-2*m*g/(m-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
+THREE.Matrix4.makeOrtho=function(b,d,e,h,g,m){var j,o,p,u;j=new THREE.Matrix4;o=d-b;p=e-h;u=m-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((m+g)/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.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
 undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,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(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var h=this.children.length;b<h;b++)this.children[b].update(this.matrixWorld,
 d,e)}};THREE.Quaternion=function(b,d,e,h){this.set(b||0,d||0,e||0,h!==undefined?h:1)};
-THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var k=Math.cos(e);e=Math.sin(e);var j=b*d,o=h*g;this.w=j*k-o*e;this.x=j*e+o*k;this.y=h*d*k+b*g*e;this.z=b*g*k-h*d*e;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,e=this.y,h=this.z,g=this.w,k=b.x,j=b.y,o=b.z;b=b.w;this.x=d*b+g*k+e*o-h*j;this.y=e*b+g*j+h*k-d*o;this.z=h*b+g*o+d*j-e*k;this.w=g*b-d*k-e*j-h*o;return this},
-multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,k=this.x,j=this.y,o=this.z,p=this.w,u=p*e+j*g-o*h,D=p*h+o*e-k*g,F=p*g+k*h-j*e;e=-k*e-j*h-o*g;d.x=u*p+e*-k+D*-o-F*-j;d.y=D*p+e*-j+F*-k-u*-o;d.z=F*p+e*-o+u*-j-D*-k;return d}};
-THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var k=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*k)/j;h=Math.sin(h*k)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,d,e,h,g,k){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,d,e,h,g,k,j){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
+THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var m=Math.cos(e);e=Math.sin(e);var j=b*d,o=h*g;this.w=j*m-o*e;this.x=j*e+o*m;this.y=h*d*m+b*g*e;this.z=b*g*m-h*d*e;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,e=this.y,h=this.z,g=this.w,m=b.x,j=b.y,o=b.z;b=b.w;this.x=d*b+g*m+e*o-h*j;this.y=e*b+g*j+h*m-d*o;this.z=h*b+g*o+d*j-e*m;this.w=g*b-d*m-e*j-h*o;return this},
+multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,m=this.x,j=this.y,o=this.z,p=this.w,u=p*e+j*g-o*h,E=p*h+o*e-m*g,G=p*g+m*h-j*e;e=-m*e-j*h-o*g;d.x=u*p+e*-m+E*-o-G*-j;d.y=E*p+e*-j+G*-m-u*-o;d.z=G*p+e*-o+u*-j-E*-m;return d}};
+THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var m=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*m)/j;h=Math.sin(h*m)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,d,e,h,g,m){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,d,e,h,g,m,j){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
-e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,h,g,k,j,o=new THREE.Vector3,p=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){o.set(0,0,0);d=0;for(e=k.vertexNormals.length;d<e;d++)o.addSelf(k.vertexNormals[d]);o.divideScalar(3)}else{d=this.vertices[k.a];e=this.vertices[k.b];j=this.vertices[k.c];o.sub(j.position,e.position);p.sub(d.position,e.position);o.crossSelf(p)}o.isZero()||
-o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var b,d,e,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)h[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{h=
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,h,g,m,j,o=new THREE.Vector3,p=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){m=this.faces[h];if(b&&m.vertexNormals.length){o.set(0,0,0);d=0;for(e=m.vertexNormals.length;d<e;d++)o.addSelf(m.vertexNormals[d]);o.divideScalar(3)}else{d=this.vertices[m.a];e=this.vertices[m.b];j=this.vertices[m.c];o.sub(j.position,e.position);p.sub(d.position,e.position);o.crossSelf(p)}o.isZero()||
+o.normalize();m.normal.copy(o)}},computeVertexNormals:function(){var b,d,e,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)h[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{h=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)h[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal);h[e.d].addSelf(e.normal)}}b=0;for(d=this.vertices.length;b<d;b++)h[b].normalize();b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(h[e.a]);
-e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,pa,fa,qa,Z,ua,oa){o=aa.vertices[pa].position;p=aa.vertices[fa].position;u=aa.vertices[qa].position;D=j[Z];F=j[ua];I=j[oa];G=p.x-o.x;L=u.x-o.x;M=p.y-o.y;Y=u.y-o.y;O=p.z-o.z;ca=u.z-o.z;ma=F.u-D.u;wa=I.u-D.u;$=F.v-D.v;J=I.v-D.v;xa=1/(ma*
-J-wa*$);U.set((J*G-$*L)*xa,(J*M-$*Y)*xa,(J*O-$*ca)*xa);V.set((ma*L-wa*G)*xa,(ma*Y-wa*M)*xa,(ma*ca-wa*O)*xa);ea[pa].addSelf(U);ea[fa].addSelf(U);ea[qa].addSelf(U);c[pa].addSelf(V);c[fa].addSelf(V);c[qa].addSelf(V)}var d,e,h,g,k,j,o,p,u,D,F,I,G,L,M,Y,O,ca,ma,wa,$,J,xa,ta,ea=[],c=[],U=new THREE.Vector3,V=new THREE.Vector3,na=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
-e;d++){k=this.faces[d];j=this.faceVertexUvs[0][d];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){k=this.faces[d];for(h=0;h<k.vertexNormals.length;h++){Ga.copy(k.vertexNormals[h]);g=k[ya[h]];ta=ea[g];na.copy(ta);na.subSelf(Ga.multiplyScalar(Ga.dot(ta))).normalize();Fa.cross(k.vertexNormals[h],ta);g=Fa.dot(c[g]);g=g<0?-1:1;k.vertexTangents[h]=new THREE.Vector4(na.x,
+e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,pa,fa,qa,Z,ua,oa){o=aa.vertices[pa].position;p=aa.vertices[fa].position;u=aa.vertices[qa].position;E=j[Z];G=j[ua];I=j[oa];H=p.x-o.x;L=u.x-o.x;M=p.y-o.y;Y=u.y-o.y;O=p.z-o.z;ca=u.z-o.z;ma=G.u-E.u;wa=I.u-E.u;$=G.v-E.v;J=I.v-E.v;xa=1/(ma*
+J-wa*$);U.set((J*H-$*L)*xa,(J*M-$*Y)*xa,(J*O-$*ca)*xa);V.set((ma*L-wa*H)*xa,(ma*Y-wa*M)*xa,(ma*ca-wa*O)*xa);ea[pa].addSelf(U);ea[fa].addSelf(U);ea[qa].addSelf(U);c[pa].addSelf(V);c[fa].addSelf(V);c[qa].addSelf(V)}var d,e,h,g,m,j,o,p,u,E,G,I,H,L,M,Y,O,ca,ma,wa,$,J,xa,ta,ea=[],c=[],U=new THREE.Vector3,V=new THREE.Vector3,na=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
+e;d++){m=this.faces[d];j=this.faceVertexUvs[0][d];if(m instanceof THREE.Face3)b(this,m.a,m.b,m.c,0,1,2);else if(m instanceof THREE.Face4){b(this,m.a,m.b,m.c,0,1,2);b(this,m.a,m.b,m.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){m=this.faces[d];for(h=0;h<m.vertexNormals.length;h++){Ga.copy(m.vertexNormals[h]);g=m[ya[h]];ta=ea[g];na.copy(ta);na.subSelf(Ga.multiplyScalar(Ga.dot(ta))).normalize();Fa.cross(m.vertexNormals[h],ta);g=Fa.dot(c[g]);g=g<0?-1:1;m.vertexTangents[h]=new THREE.Vector4(na.x,
 na.y,na.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
-{radius:b}},computeEdgeFaces:function(){function b(p,u){return Math.min(p,u)+"_"+Math.max(p,u)}function d(p,u,D){if(p[u]===undefined){p[u]={set:{},array:[]};p[u].set[D]=1;p[u].array.push(D)}else if(p[u].set[D]===undefined){p[u].set[D]=1;p[u].array.push(D)}}var e,h,g,k,j,o={};e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.a,j.c);d(o,g,e)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(o,g,e);g=b(j.a,j.b);d(o,g,e);
-g=b(j.a,j.d);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.c,j.d);d(o,g,e)}}e=0;for(h=this.edges.length;e<h;e++){j=this.edges[e];g=j.vertexIndices[0];k=j.vertexIndices[1];j.faceIndices=o[b(g,k)].array;for(g=0;g<j.faceIndices.length;g++){k=j.faceIndices[g];j.faces.push(this.faces[k])}}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var k=0;k<b.length;k++)b[k].update(g)};e.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};e.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};e.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var k=0;k<g.hierarchy.length;k++){for(var j=0;j<g.hierarchy[k].keys.length;j++){if(g.hierarchy[k].keys[j].time<
-0)g.hierarchy[k].keys[j].time=0;if(g.hierarchy[k].keys[j].rot!==undefined&&!(g.hierarchy[k].keys[j].rot instanceof THREE.Quaternion)){var o=g.hierarchy[k].keys[j].rot;g.hierarchy[k].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(g.hierarchy[k].keys[0].morphTargets!==undefined){o={};for(j=0;j<g.hierarchy[k].keys.length;j++)for(var p=0;p<g.hierarchy[k].keys[j].morphTargets.length;p++){var u=g.hierarchy[k].keys[j].morphTargets[p];o[u]=-1}g.hierarchy[k].usedMorphTargets=o;for(j=0;j<g.hierarchy[k].keys.length;j++){var D=
-{};for(u in o){for(p=0;p<g.hierarchy[k].keys[j].morphTargets.length;p++)if(g.hierarchy[k].keys[j].morphTargets[p]===u){D[u]=g.hierarchy[k].keys[j].morphTargetsInfluences[p];break}p===g.hierarchy[k].keys[j].morphTargets.length&&(D[u]=0)}g.hierarchy[k].keys[j].morphTargetsInfluences=D}}for(j=1;j<g.hierarchy[k].keys.length;j++)if(g.hierarchy[k].keys[j].time===g.hierarchy[k].keys[j-1].time){g.hierarchy[k].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[k].keys.length;j++)g.hierarchy[k].keys[j].index=j}j=parseInt(g.length*
-g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(k=0;k<g.hierarchy.length;k++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};e.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};e.parse=function(g){var k=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)k.push(g.bones[j]);else h(g,k);return k};var h=function(g,k){k.push(g);for(var j=0;j<g.children.length;j++)h(g.children[j],k)};e.LINEAR=
+{radius:b}},computeEdgeFaces:function(){function b(p,u){return Math.min(p,u)+"_"+Math.max(p,u)}function d(p,u,E){if(p[u]===undefined){p[u]={set:{},array:[]};p[u].set[E]=1;p[u].array.push(E)}else if(p[u].set[E]===undefined){p[u].set[E]=1;p[u].array.push(E)}}var e,h,g,m,j,o={};e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.a,j.c);d(o,g,e)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(o,g,e);g=b(j.a,j.b);d(o,g,e);
+g=b(j.a,j.d);d(o,g,e);g=b(j.b,j.c);d(o,g,e);g=b(j.c,j.d);d(o,g,e)}}e=0;for(h=this.edges.length;e<h;e++){j=this.edges[e];g=j.vertexIndices[0];m=j.vertexIndices[1];j.faceIndices=o[b(g,m)].array;for(g=0;g<j.faceIndices.length;g++){m=j.faceIndices[g];j.faces.push(this.faces[m])}}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var m=0;m<b.length;m++)b[m].update(g)};e.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};e.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};e.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var m=0;m<g.hierarchy.length;m++){for(var j=0;j<g.hierarchy[m].keys.length;j++){if(g.hierarchy[m].keys[j].time<
+0)g.hierarchy[m].keys[j].time=0;if(g.hierarchy[m].keys[j].rot!==undefined&&!(g.hierarchy[m].keys[j].rot instanceof THREE.Quaternion)){var o=g.hierarchy[m].keys[j].rot;g.hierarchy[m].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(g.hierarchy[m].keys[0].morphTargets!==undefined){o={};for(j=0;j<g.hierarchy[m].keys.length;j++)for(var p=0;p<g.hierarchy[m].keys[j].morphTargets.length;p++){var u=g.hierarchy[m].keys[j].morphTargets[p];o[u]=-1}g.hierarchy[m].usedMorphTargets=o;for(j=0;j<g.hierarchy[m].keys.length;j++){var E=
+{};for(u in o){for(p=0;p<g.hierarchy[m].keys[j].morphTargets.length;p++)if(g.hierarchy[m].keys[j].morphTargets[p]===u){E[u]=g.hierarchy[m].keys[j].morphTargetsInfluences[p];break}p===g.hierarchy[m].keys[j].morphTargets.length&&(E[u]=0)}g.hierarchy[m].keys[j].morphTargetsInfluences=E}}for(j=1;j<g.hierarchy[m].keys.length;j++)if(g.hierarchy[m].keys[j].time===g.hierarchy[m].keys[j-1].time){g.hierarchy[m].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[m].keys.length;j++)g.hierarchy[m].keys[j].index=j}j=parseInt(g.length*
+g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(m=0;m<g.hierarchy.length;m++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};e.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};e.parse=function(g){var m=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)m.push(g.bones[j]);else h(g,m);return m};var h=function(g,m){m.push(g);for(var j=0;j<g.children.length;j++)h(g.children[j],m)};e.LINEAR=
 0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=2;return e}();THREE.Animation=function(b,d,e,h){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=e!==undefined?e:THREE.AnimationHandler.LINEAR;this.JITCompile=h!==undefined?h:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var e,h=this.hierarchy.length,g;for(e=0;e<h;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
-g instanceof THREE.Bone?g.skinMatrix:g.matrix}var k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+g instanceof THREE.Bone?g.skinMatrix:g.matrix}var m=g.animationCache.prevKey;g=g.animationCache.nextKey;m.pos=this.data.hierarchy[e].keys[0];m.rot=this.data.hierarchy[e].keys[0];m.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,k,j,o,p,u,D=this.data.JIT.hierarchy,F,I;this.currentTime+=b*this.timeScale;I=this.currentTime;F=this.currentTime%=this.data.length;u=parseInt(Math.min(F*this.data.fps,this.data.length*this.data.fps),10);for(var G=0,L=this.hierarchy.length;G<L;G++){b=this.hierarchy[G];p=b.animationCache;if(this.JITCompile&&D[G][u]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=D[G][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=D[G][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var M=0;M<3;M++){e=d[M];j=p.prevKey[e];o=p.nextKey[e];if(o.time<=I){if(F<I)if(this.loop){j=this.data.hierarchy[G].keys[0];for(o=this.getNextKeyWith(e,G,1);o.time<F;){j=o;o=this.getNextKeyWith(e,G,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(e,G,o.index+1)}while(o.time<
-F)}p.prevKey[e]=j;p.nextKey[e]=o}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(F-j.time)/(o.time-j.time);g=j[e];k=o[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+G);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",G,j.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",G,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e===
-"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&D[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(G=0;G<this.hierarchy.length;G++)D[G][u]=this.hierarchy[G]instanceof THREE.Bone?this.hierarchy[G].skinMatrix.clone():this.hierarchy[G].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,k,j,o,p,u;g=(b.length-1)*d;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];o=b[e[1]];p=b[e[2]];u=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(k[0],o[0],p[0],u[0],g,e,j);h[1]=this.interpolate(k[1],o[1],p[1],u[1],g,e,j);h[2]=this.interpolate(k[2],o[2],p[2],u[2],g,e,j);return h};
-THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*k+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e<h.length-1?e:h.length-1;else e%=h.length;for(;e<h.length;e++)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[0]};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,m,j,o,p,u,E=this.data.JIT.hierarchy,G,I;this.currentTime+=b*this.timeScale;I=this.currentTime;G=this.currentTime%=this.data.length;u=parseInt(Math.min(G*this.data.fps,this.data.length*this.data.fps),10);for(var H=0,L=this.hierarchy.length;H<L;H++){b=this.hierarchy[H];p=b.animationCache;if(this.JITCompile&&E[H][u]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=E[H][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=E[H][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var M=0;M<3;M++){e=d[M];j=p.prevKey[e];o=p.nextKey[e];if(o.time<=I){if(G<I)if(this.loop){j=this.data.hierarchy[H].keys[0];for(o=this.getNextKeyWith(e,H,1);o.time<G;){j=o;o=this.getNextKeyWith(e,H,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(e,H,o.index+1)}while(o.time<
+G)}p.prevKey[e]=j;p.nextKey[e]=o}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(G-j.time)/(o.time-j.time);g=j[e];m=o[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+H);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(m[0]-g[0])*h;e.y=g[1]+(m[1]-g[1])*h;e.z=g[2]+(m[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",H,j.index-1).pos;this.points[1]=g;this.points[2]=m;this.points[3]=this.getNextKeyWith("pos",H,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e===
+"rot")THREE.Quaternion.slerp(g,m,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(m[0]-g[0])*h;e.y=g[1]+(m[1]-g[1])*h;e.z=g[2]+(m[2]-g[2])*h}}}}if(this.JITCompile&&E[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(H=0;H<this.hierarchy.length;H++)E[H][u]=this.hierarchy[H]instanceof THREE.Bone?this.hierarchy[H].skinMatrix.clone():this.hierarchy[H].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,m,j,o,p,u;g=(b.length-1)*d;m=Math.floor(g);g-=m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>b.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];o=b[e[1]];p=b[e[2]];u=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(m[0],o[0],p[0],u[0],g,e,j);h[1]=this.interpolate(m[1],o[1],p[1],u[1],g,e,j);h[2]=this.interpolate(m[2],o[2],p[2],u[2],g,e,j);return h};
+THREE.Animation.prototype.interpolate=function(b,d,e,h,g,m,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*m+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e<h.length-1?e:h.length-1;else e%=h.length;for(;e<h.length;e++)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;for(e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+h.length;e>=0;e--)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[h.length-1]};
 THREE.Camera=function(b,d,e,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
@@ -105,7 +105,7 @@ THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this
 THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:
 0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==
 undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
-THREE.Texture=function(b,d,e,h,g,k){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=k!==undefined?k: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.Texture=function(b,d,e,h,g,m){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=m!==undefined?m: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.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;var Uniforms={clone:function(b){var d,e,h,g={};for(d in b){g[d]={};for(e in b[d]){h=b[d][e];g[d][e]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return g},merge:function(b){var d,e,h,g={};for(d=0;d<b.length;d++){h=this.clone(b[d]);for(e in h)g[e]=h[e]}return g}};
 THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
@@ -115,12 +115,12 @@ this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}}}};THREE.Mesh.
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;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(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}}else for(h=0;h<g;h++)this.children[h].update(this.skinMatrix,
 d,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,h,g,k,j,o;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];k=g.pos;j=g.rotq;o=g.scl;h=this.addBone();h.name=g.name;h.position.set(k[0],k[1],k[2]);h.quaternion.set(j[0],j[1],j[2],j[3]);h.useQuaternion=!0;o!==undefined?h.scale.set(o[0],o[1],o[2]):h.scale.set(1,1,1)}for(e=0;e<this.bones.length;e++){g=this.geometry.bones[e];
+THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,h,g,m,j,o;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];m=g.pos;j=g.rotq;o=g.scl;h=this.addBone();h.name=g.name;h.position.set(m[0],m[1],m[2]);h.quaternion.set(j[0],j[1],j[2],j[3]);h.useQuaternion=!0;o!==undefined?h.scale.set(o[0],o[1],o[2]):h.scale.set(1,1,1)}for(e=0;e<this.bones.length;e++){g=this.geometry.bones[e];
 h=this.bones[e];g.parent===-1?this.addChild(h):this.bones[g.parent].addChild(h)}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(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e)}e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
 d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,d=[],e=0;e<this.bones.length;e++){b=this.bones[e];d.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var h;for(b=0;b<this.geometry.skinIndices.length;b++){e=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;
-h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(h));h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[k].multiplyVector3(h));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=e;this.geometry.skinWeights[b].y+=e}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,d=[],e=0;e<this.bones.length;e++){b=this.bones[e];d.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var h;for(b=0;b<this.geometry.skinIndices.length;b++){e=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,m=this.geometry.skinIndices[b].y;
+h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(h));h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[m].multiplyVector3(h));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=e;this.geometry.skinWeights[b].y+=e}}}};
 THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Sound=function(b,d,e,h){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=d!==undefined?Math.abs(d):100;this.volume=Math.min(1,Math.max(0,e!==undefined?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=h!==undefined?h:!0;this.sources=b instanceof Array?b:[b];var g;e=this.sources.length;for(b=0;b<e;b++){d=this.sources[b];d.toLowerCase();if(d.indexOf(".mp3")!==-1)g=
 "audio/mpeg";else if(d.indexOf(".ogg")!==-1)g="audio/ogg";else d.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);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;
@@ -131,21 +131,21 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var h=1;h<this.LODs.length;h++)if(b>=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible=
 !1;this.LODs[h].object3D.visible=!0}else break;for(;h<this.LODs.length;h++)this.LODs[h].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,j,o,p,u,D,F=["a","b","c","d"];for(p=0;p<k;p++){o=d.length;j=g[p];if(j instanceof THREE.Face4){u=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{u=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);e.push(o);for(o=
-0;o<u;o++){D=b[j[F[o]]];d.push(new THREE.Vertex(D.position.clone()))}}for(k=0;k<g.length-1;k++){b=e[k];for(j=k+1;j<g.length;j++){o=e[j];o=this.facesShareEdge(d,b,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);h.push(o)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,k,j,o,p,u,D,F,I,G,L,M,Y=0,O=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[O[L]];o=b[k];for(M=0;M<g;M++){j=e[O[M]];p=b[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){Y++;if(Y===1){u=o;D=p;F=k;I=j;G=O[L]}if(Y===2){G+=O[L];return G==="ad"||G==="ac"?{faces:[d,e],vertices:[u,D,p,o],indices:[F,
-I,j,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[u,o,p,D],indices:[F,k,j,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var m=g.length,j,o,p,u,E,G=["a","b","c","d"];for(p=0;p<m;p++){o=d.length;j=g[p];if(j instanceof THREE.Face4){u=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{u=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);e.push(o);for(o=
+0;o<u;o++){E=b[j[G[o]]];d.push(new THREE.Vertex(E.position.clone()))}}for(m=0;m<g.length-1;m++){b=e[m];for(j=m+1;j<g.length;j++){o=e[j];o=this.facesShareEdge(d,b,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);h.push(o)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,m,j,o,p,u,E,G,I,H,L,M,Y=0,O=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){m=d[O[L]];o=b[m];for(M=0;M<g;M++){j=e[O[M]];p=b[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){Y++;if(Y===1){u=o;E=p;G=m;I=j;H=O[L]}if(Y===2){H+=O[L];return H==="ad"||H==="ac"?{faces:[d,e],vertices:[u,E,p,o],indices:[G,
+I,j,m],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[u,o,p,E],indices:[G,m,j,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
 THREE.Projector=function(){function b(){var U=p[o]=p[o]||new THREE.RenderableVertex;o++;return U}function d(U,V){return V.z-U.z}function e(U,V){var na=0,Fa=1,Ga=U.z+U.w,ya=V.z+V.w,aa=-U.z+U.w,pa=-V.z+V.w;if(Ga>=0&&ya>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&pa<0)return!1;else{if(Ga<0)na=Math.max(na,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)na=Math.max(na,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(Fa<na)return!1;else{U.lerpSelf(V,na);V.lerpSelf(U,1-Fa);return!0}}}
-var h,g,k=[],j,o,p=[],u,D,F=[],I,G=[],L,M,Y=[],O,ca,ma=[],wa=new THREE.Vector4,$=new THREE.Vector4,J=new THREE.Matrix4,xa=new THREE.Matrix4,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(U,V){J.multiply(V.projectionMatrix,V.matrixWorldInverse);J.multiplyVector3(U);return U};this.unprojectVector=function(U,V){J.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
-J.multiplyVector3(U);return U};this.projectObjects=function(U,V,na){V=[];var Fa,Ga,ya;g=0;Ga=U.objects;U=0;for(Fa=Ga.length;U<Fa;U++){ya=Ga[U];var aa;if(!(aa=!ya.visible))if(aa=ya instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ya.matrixWorld,fa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),qa=0;qa<6;qa++){aa=ta[qa].x*pa.n14+ta[qa].y*pa.n24+ta[qa].z*pa.n34+ta[qa].w;if(aa<=fa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=k[g]=k[g]||new THREE.RenderableObject;g++;
-h=aa;wa.copy(ya.position);J.multiplyVector3(wa);h.object=ya;h.z=wa.z;V.push(h)}}na&&V.sort(d);return V};this.projectScene=function(U,V,na){var Fa=[],Ga=V.near,ya=V.far,aa,pa,fa,qa,Z,ua,oa,Ca,za,ga,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=D=0;V.matrixAutoUpdate&&V.updateMatrix();U.update(undefined,!1,V);J.multiply(V.projectionMatrix,V.matrixWorldInverse);ta[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);ta[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);ta[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+
+var h,g,m=[],j,o,p=[],u,E,G=[],I,H=[],L,M,Y=[],O,ca,ma=[],wa=new THREE.Vector4,$=new THREE.Vector4,J=new THREE.Matrix4,xa=new THREE.Matrix4,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(U,V){J.multiply(V.projectionMatrix,V.matrixWorldInverse);J.multiplyVector3(U);return U};this.unprojectVector=function(U,V){J.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
+J.multiplyVector3(U);return U};this.projectObjects=function(U,V,na){V=[];var Fa,Ga,ya;g=0;Ga=U.objects;U=0;for(Fa=Ga.length;U<Fa;U++){ya=Ga[U];var aa;if(!(aa=!ya.visible))if(aa=ya instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ya.matrixWorld,fa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),qa=0;qa<6;qa++){aa=ta[qa].x*pa.n14+ta[qa].y*pa.n24+ta[qa].z*pa.n34+ta[qa].w;if(aa<=fa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=m[g]=m[g]||new THREE.RenderableObject;g++;
+h=aa;wa.copy(ya.position);J.multiplyVector3(wa);h.object=ya;h.z=wa.z;V.push(h)}}na&&V.sort(d);return V};this.projectScene=function(U,V,na){var Fa=[],Ga=V.near,ya=V.far,aa,pa,fa,qa,Z,ua,oa,Ca,za,ga,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=E=0;V.matrixAutoUpdate&&V.updateMatrix();U.update(undefined,!1,V);J.multiply(V.projectionMatrix,V.matrixWorldInverse);ta[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);ta[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);ta[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+
 J.n23,J.n44+J.n24);ta[3].set(J.n41-J.n21,J.n42-J.n22,J.n43-J.n23,J.n44-J.n24);ta[4].set(J.n41-J.n31,J.n42-J.n32,J.n43-J.n33,J.n44-J.n34);ta[5].set(J.n41+J.n31,J.n42+J.n32,J.n43+J.n33,J.n44+J.n34);for(aa=0;aa<6;aa++){za=ta[aa];za.divideScalar(Math.sqrt(za.x*za.x+za.y*za.y+za.z*za.z))}za=this.projectObjects(U,V,!0);U=0;for(aa=za.length;U<aa;U++){ga=za[U].object;if(ga.visible){Pa=ga.matrixWorld;Ua=ga.matrixRotationWorld;Va=ga.materials;hb=ga.overdraw;o=0;if(ga instanceof THREE.Mesh){Sa=ga.geometry;qa=
 Sa.vertices;fb=Sa.faces;Sa=Sa.faceVertexUvs;pa=0;for(fa=qa.length;pa<fa;pa++){j=b();j.positionWorld.copy(qa[pa].position);Pa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);J.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ga&&j.positionScreen.z<ya}qa=0;for(pa=fb.length;qa<pa;qa++){fa=fb[qa];if(fa instanceof THREE.Face3){Z=p[fa.a];ua=p[fa.b];oa=p[fa.c];if(Z.visible&&ua.visible&&oa.visible&&
-(ga.doubleSided||ga.flipSided!=(oa.positionScreen.x-Z.positionScreen.x)*(ua.positionScreen.y-Z.positionScreen.y)-(oa.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0)){Ca=F[D]=F[D]||new THREE.RenderableFace3;D++;u=Ca;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa)}else continue}else if(fa instanceof THREE.Face4){Z=p[fa.a];ua=p[fa.b];oa=p[fa.c];Ca=p[fa.d];if(Z.visible&&ua.visible&&oa.visible&&Ca.visible&&(ga.doubleSided||ga.flipSided!=((Ca.positionScreen.x-Z.positionScreen.x)*
-(ua.positionScreen.y-Z.positionScreen.y)-(Ca.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0||(ua.positionScreen.x-oa.positionScreen.x)*(Ca.positionScreen.y-oa.positionScreen.y)-(ua.positionScreen.y-oa.positionScreen.y)*(Ca.positionScreen.x-oa.positionScreen.x)<0))){Ya=G[I]=G[I]||new THREE.RenderableFace4;I++;u=Ya;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa);u.v4.copy(Ca)}else continue}u.normalWorld.copy(fa.normal);Ua.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);
+(ga.doubleSided||ga.flipSided!=(oa.positionScreen.x-Z.positionScreen.x)*(ua.positionScreen.y-Z.positionScreen.y)-(oa.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0)){Ca=G[E]=G[E]||new THREE.RenderableFace3;E++;u=Ca;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa)}else continue}else if(fa instanceof THREE.Face4){Z=p[fa.a];ua=p[fa.b];oa=p[fa.c];Ca=p[fa.d];if(Z.visible&&ua.visible&&oa.visible&&Ca.visible&&(ga.doubleSided||ga.flipSided!=((Ca.positionScreen.x-Z.positionScreen.x)*
+(ua.positionScreen.y-Z.positionScreen.y)-(Ca.positionScreen.y-Z.positionScreen.y)*(ua.positionScreen.x-Z.positionScreen.x)<0||(ua.positionScreen.x-oa.positionScreen.x)*(Ca.positionScreen.y-oa.positionScreen.y)-(ua.positionScreen.y-oa.positionScreen.y)*(Ca.positionScreen.x-oa.positionScreen.x)<0))){Ya=H[I]=H[I]||new THREE.RenderableFace4;I++;u=Ya;u.v1.copy(Z);u.v2.copy(ua);u.v3.copy(oa);u.v4.copy(Ca)}else continue}u.normalWorld.copy(fa.normal);Ua.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);
 Pa.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);J.multiplyVector3(u.centroidScreen);oa=fa.vertexNormals;Z=0;for(ua=oa.length;Z<ua;Z++){Ca=u.vertexNormalsWorld[Z];Ca.copy(oa[Z]);Ua.multiplyVector3(Ca)}Z=0;for(ua=Sa.length;Z<ua;Z++)if(Ya=Sa[Z][qa]){oa=0;for(Ca=Ya.length;oa<Ca;oa++)u.uvs[Z][oa]=Ya[oa]}u.meshMaterials=Va;u.faceMaterials=fa.materials;u.overdraw=hb;u.z=u.centroidScreen.z;Fa.push(u)}}else if(ga instanceof THREE.Line){xa.multiply(J,Pa);qa=ga.geometry.vertices;Z=
 b();Z.positionScreen.copy(qa[0].position);xa.multiplyVector4(Z.positionScreen);pa=1;for(fa=qa.length;pa<fa;pa++){Z=b();Z.positionScreen.copy(qa[pa].position);xa.multiplyVector4(Z.positionScreen);ua=p[o-2];ea.copy(Z.positionScreen);c.copy(ua.positionScreen);if(e(ea,c)){ea.multiplyScalar(1/ea.w);c.multiplyScalar(1/c.w);Pa=Y[M]=Y[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(ea);L.v2.positionScreen.copy(c);L.z=Math.max(ea.z,c.z);L.materials=ga.materials;Fa.push(L)}}}else if(ga instanceof
 THREE.Particle){$.set(ga.position.x,ga.position.y,ga.position.z,1);J.multiplyVector4($);$.z/=$.w;if($.z>0&&$.z<1){Pa=ma[ca]=ma[ca]||new THREE.RenderableParticle;ca++;O=Pa;O.x=$.x/$.w;O.y=$.y/$.w;O.z=$.z;O.rotation=ga.rotation.z;O.scale.x=ga.scale.x*Math.abs(O.x-($.x+V.projectionMatrix.n11)/($.w+V.projectionMatrix.n14));O.scale.y=ga.scale.y*Math.abs(O.y-($.y+V.projectionMatrix.n22)/($.w+V.projectionMatrix.n24));O.materials=ga.materials;Fa.push(O)}}}}na&&Fa.sort(d);return Fa}};
@@ -176,108 +176,108 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(f,s,n){var m,r,A,v=f.vertices,x=v.length,z=f.colors,t=z.length,w=f.__vertexArray,y=f.__colorArray,H=f.__sortArray,C=f.__dirtyVertices,N=f.__dirtyColors;if(n.sortParticles){ga.multiplySelf(n.matrixWorld);for(m=0;m<x;m++){r=v[m].position;Va.copy(r);ga.multiplyVector3(Va);H[m]=[Va.z,m]}H.sort(function(W,P){return P[0]-W[0]});for(m=0;m<x;m++){r=v[H[m][1]].position;A=m*3;w[A]=r.x;w[A+1]=r.y;w[A+2]=r.z}for(m=0;m<t;m++){A=m*3;color=z[H[m][1]];y[A]=color.r;y[A+1]=
-color.g;y[A+2]=color.b}}else{if(C)for(m=0;m<x;m++){r=v[m].position;A=m*3;w[A]=r.x;w[A+1]=r.y;w[A+2]=r.z}if(N)for(m=0;m<t;m++){color=z[m];A=m*3;y[A]=color.r;y[A+1]=color.g;y[A+2]=color.b}}if(C||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}if(N||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}}function e(f,s,n,m,r){m.program||ya.initMaterial(m,s,n,r);var A=m.program,v=A.uniforms,x=m.uniforms;
-if(A!=na){c.useProgram(A);na=A}c.uniformMatrix4fv(v.projectionMatrix,!1,Pa);if(n&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial||m.fog)){x.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){x.fogNear.value=n.near;x.fogFar.value=n.far}else if(n instanceof THREE.FogExp2)x.fogDensity.value=n.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof
-THREE.MeshLambertMaterial||m.lights){var z,t,w=0,y=0,H=0,C,N,W,P,T=hb,Ha=T.directional.colors,R=T.directional.positions,Q=T.point.colors,S=T.point.positions,ra=T.point.distances,q=0,E=0;n=t=P=0;for(z=s.length;n<z;n++){t=s[n];C=t.color;N=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){w+=C.r;y+=C.g;H+=C.b}else if(t instanceof THREE.DirectionalLight){P=q*3;Ha[P]=C.r*W;Ha[P+1]=C.g*W;Ha[P+2]=C.b*W;R[P]=N.x;R[P+1]=N.y;R[P+2]=N.z;q+=1}else if(t instanceof THREE.PointLight){t=E*
-3;Q[t]=C.r*W;Q[t+1]=C.g*W;Q[t+2]=C.b*W;S[t]=N.x;S[t+1]=N.y;S[t+2]=N.z;ra[E]=P;E+=1}}for(n=q*3;n<Ha.length;n++)Ha[n]=0;for(n=E*3;n<Q.length;n++)Q[n]=0;T.point.length=E;T.directional.length=q;T.ambient[0]=w;T.ambient[1]=y;T.ambient[2]=H;n=hb;x.enableLighting.value=n.directional.length+n.point.length;x.ambientLightColor.value=n.ambient;x.directionalLightColor.value=n.directional.colors;x.directionalLightDirection.value=n.directional.positions;x.pointLightColor.value=n.point.colors;x.pointLightPosition.value=
-n.point.positions;x.pointLightDistance.value=n.point.distances}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity;x.map.texture=m.map;x.lightMap.texture=m.lightMap;x.envMap.texture=m.envMap;x.reflectivity.value=m.reflectivity;x.refractionRatio.value=m.refractionRatio;x.combine.value=m.combine;x.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof
-THREE.LineBasicMaterial){x.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(m.color.r,m.color.g,m.color.b);x.opacity.value=m.opacity;x.size.value=m.size;x.scale.value=U.height/2;x.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);x.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);x.shininess.value=m.shininess}else if(m instanceof
-THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)x.opacity.value=m.opacity;for(var i in x)if(y=A.uniforms[i]){z=x[i];w=z.type;n=z.value;if(w=="i")c.uniform1i(y,n);else if(w=="f")c.uniform1f(y,n);else if(w=="fv1")c.uniform1fv(y,n);else if(w=="fv")c.uniform3fv(y,n);else if(w=="v2")c.uniform2f(y,n.x,n.y);else if(w=="v3")c.uniform3f(y,n.x,n.y,n.z);else if(w=="v4")c.uniform4f(y,n.x,n.y,n.z,n.w);else if(w=="c")c.uniform3f(y,
+THREE.WebGLRenderer=function(b){function d(f,s,n){var k,q,A,v=f.vertices,x=v.length,z=f.colors,t=z.length,w=f.__vertexArray,y=f.__colorArray,D=f.__sortArray,B=f.__dirtyVertices,N=f.__dirtyColors;if(n.sortParticles){ga.multiplySelf(n.matrixWorld);for(k=0;k<x;k++){q=v[k].position;Va.copy(q);ga.multiplyVector3(Va);D[k]=[Va.z,k]}D.sort(function(W,P){return P[0]-W[0]});for(k=0;k<x;k++){q=v[D[k][1]].position;A=k*3;w[A]=q.x;w[A+1]=q.y;w[A+2]=q.z}for(k=0;k<t;k++){A=k*3;color=z[D[k][1]];y[A]=color.r;y[A+1]=
+color.g;y[A+2]=color.b}}else{if(B)for(k=0;k<x;k++){q=v[k].position;A=k*3;w[A]=q.x;w[A+1]=q.y;w[A+2]=q.z}if(N)for(k=0;k<t;k++){color=z[k];A=k*3;y[A]=color.r;y[A+1]=color.g;y[A+2]=color.b}}if(B||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}if(N||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}}function e(f,s,n,k,q){k.program||ya.initMaterial(k,s,n,q);var A=k.program,v=A.uniforms,x=k.uniforms;
+if(A!=na){c.useProgram(A);na=A}c.uniformMatrix4fv(v.projectionMatrix,!1,Pa);if(n&&(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial||k instanceof THREE.LineBasicMaterial||k instanceof THREE.ParticleBasicMaterial||k.fog)){x.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){x.fogNear.value=n.near;x.fogFar.value=n.far}else if(n instanceof THREE.FogExp2)x.fogDensity.value=n.density}if(k instanceof THREE.MeshPhongMaterial||k instanceof
+THREE.MeshLambertMaterial||k.lights){var z,t,w=0,y=0,D=0,B,N,W,P,T=hb,Ha=T.directional.colors,R=T.directional.positions,Q=T.point.colors,S=T.point.positions,ra=T.point.distances,r=0,F=0;n=t=P=0;for(z=s.length;n<z;n++){t=s[n];B=t.color;N=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){w+=B.r;y+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){P=r*3;Ha[P]=B.r*W;Ha[P+1]=B.g*W;Ha[P+2]=B.b*W;R[P]=N.x;R[P+1]=N.y;R[P+2]=N.z;r+=1}else if(t instanceof THREE.PointLight){t=F*
+3;Q[t]=B.r*W;Q[t+1]=B.g*W;Q[t+2]=B.b*W;S[t]=N.x;S[t+1]=N.y;S[t+2]=N.z;ra[F]=P;F+=1}}for(n=r*3;n<Ha.length;n++)Ha[n]=0;for(n=F*3;n<Q.length;n++)Q[n]=0;T.point.length=F;T.directional.length=r;T.ambient[0]=w;T.ambient[1]=y;T.ambient[2]=D;n=hb;x.enableLighting.value=n.directional.length+n.point.length;x.ambientLightColor.value=n.ambient;x.directionalLightColor.value=n.directional.colors;x.directionalLightDirection.value=n.directional.positions;x.pointLightColor.value=n.point.colors;x.pointLightPosition.value=
+n.point.positions;x.pointLightDistance.value=n.point.distances}if(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(k.color.r,k.color.g,k.color.b);x.opacity.value=k.opacity;x.map.texture=k.map;x.lightMap.texture=k.lightMap;x.envMap.texture=k.envMap;x.reflectivity.value=k.reflectivity;x.refractionRatio.value=k.refractionRatio;x.combine.value=k.combine;x.useRefract.value=k.envMap&&k.envMap.mapping instanceof THREE.CubeRefractionMapping}if(k instanceof
+THREE.LineBasicMaterial){x.diffuse.value.setRGB(k.color.r,k.color.g,k.color.b);x.opacity.value=k.opacity}else if(k instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(k.color.r,k.color.g,k.color.b);x.opacity.value=k.opacity;x.size.value=k.size;x.scale.value=U.height/2;x.map.texture=k.map}else if(k instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(k.ambient.r,k.ambient.g,k.ambient.b);x.specular.value.setRGB(k.specular.r,k.specular.g,k.specular.b);x.shininess.value=k.shininess}else if(k instanceof
+THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=k.opacity}else if(k instanceof THREE.MeshNormalMaterial)x.opacity.value=k.opacity;for(var i in x)if(y=A.uniforms[i]){z=x[i];w=z.type;n=z.value;if(w=="i")c.uniform1i(y,n);else if(w=="f")c.uniform1f(y,n);else if(w=="fv1")c.uniform1fv(y,n);else if(w=="fv")c.uniform3fv(y,n);else if(w=="v2")c.uniform2f(y,n.x,n.y);else if(w=="v3")c.uniform3f(y,n.x,n.y,n.z);else if(w=="v4")c.uniform4f(y,n.x,n.y,n.z,n.w);else if(w=="c")c.uniform3f(y,
 n.r,n.g,n.b);else if(w=="t"){c.uniform1i(y,n);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(w=0;w<6;++w)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+w,0,0,0,c.RGBA,c.UNSIGNED_BYTE,z.image[w])}else{z.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube);for(w=0;w<6;++w)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
-w,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,z.image[w]);z.__webglInit=!0}wa(c.TEXTURE_CUBE_MAP,z,z.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube)}}else $(z,n)}}c.uniformMatrix4fv(v.modelViewMatrix,!1,r._modelViewMatrixArray);c.uniformMatrix3fv(v.normalMatrix,!1,r._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&c.uniform3f(v.cameraPosition,
-f.position.x,f.position.y,f.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&c.uniformMatrix4fv(v.objectMatrix,!1,r._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&c.uniformMatrix4fv(v.viewMatrix,!1,Ua);if(m instanceof THREE.ShadowVolumeDynamicMaterial){f=x.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(v.directionalLightDirection,
-f);c.uniformMatrix4fv(v.objectMatrix,!1,r._objectMatrixArray);c.uniformMatrix4fv(v.viewMatrix,!1,Ua)}if(m.skinning){c.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ua);c.uniformMatrix4fv(v.boneGlobalMatrices,!1,r.boneMatrices)}return A}function h(f,s,n,m,r,A){if(m.opacity!=0){var v;f=e(f,s,n,m,A).attributes;if(m.morphTargets){s=m.program.attributes;A.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[A.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,r.__webglVertexBuffer);c.vertexAttribPointer(s.position,
-3,c.FLOAT,!1,0,0);if(A.morphTargetForcedOrder.length){n=0;for(var x=A.morphTargetForcedOrder,z=A.morphTargetInfluences;n<m.numSupportedMorphTargets&&n<x.length;){c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[x[n]]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=z[x[n]];n++}}else{x=[];var t=-1,w=0;z=A.morphTargetInfluences;var y,H=z.length;n=0;for(A.morphTargetBase!==-1&&(x[A.morphTargetBase]=!0);n<m.numSupportedMorphTargets;){for(y=0;y<H;y++)if(!x[y]&&
-z[y]>t){w=y;t=z[w]}c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[w]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;x[w]=1;t=-1;n++}}c.uniform1fv(m.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,r.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(r.__webglCustomAttributes)for(v in r.__webglCustomAttributes)if(f[v]>=0){s=r.__webglCustomAttributes[v];c.bindBuffer(c.ARRAY_BUFFER,
-s.buffer);c.vertexAttribPointer(f[v],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(r.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,r.__webglUVBuffer);c.vertexAttribPointer(f.uv,
-2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(r.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,r.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(m.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
-r.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(m.wireframe){c.lineWidth(m.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);c.drawElements(c.LINES,r.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-r.__webglFaceBuffer);c.drawElements(c.TRIANGLES,r.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(m.linewidth);c.drawArrays(A,0,r.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,r.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,r.__webglVertexCount)}}function g(f,s){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=
-c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,
-0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=f.flipSided}}function j(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(f){za[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);za[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);za[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);za[3].set(f.n41-
-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);za[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);za[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=za[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function p(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),m=0;m<6;m++){f=za[m].x*s.n14+za[m].y*s.n24+za[m].z*s.n34+za[m].w;if(f<=n)return!1}return!0}function u(f,s){f.list[f.count]=s;f.count+=
-1}function D(f){var s,n,m=f.object,r=f.opaque,A=f.transparent;A.count=0;f=r.count=0;for(s=m.materials.length;f<s;f++){n=m.materials[f];n.transparent?u(A,n):u(r,n)}}function F(f){var s,n,m,r,A=f.object,v=f.buffer,x=f.opaque,z=f.transparent;z.count=0;f=x.count=0;for(m=A.materials.length;f<m;f++){s=A.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=v.materials.length;s<n;s++)(r=v.materials[s])&&(r.transparent?u(z,r):u(x,r))}else(r=s)&&(r.transparent?u(z,r):u(x,r))}}function I(f,s){return s.z-
-f.z}function G(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,m,r=f.lights,A=[],v,x,z,t,w,y=f.__webglShadowVolumes.length;for(s=0;s<n;s++){m=f.lights[s];if(m instanceof THREE.DirectionalLight){A[0]=-m.position.x;A[1]=-m.position.y;A[2]=-m.position.z;
-for(w=0;w<y;w++){m=f.__webglShadowVolumes[w].object;v=f.__webglShadowVolumes[w].buffer;x=m.materials[0];x.program||ya.initMaterial(x,r,undefined,m);x=x.program;z=x.uniforms;t=x.attributes;if(na!==x){c.useProgram(x);na=x;c.uniformMatrix4fv(z.projectionMatrix,!1,Pa);c.uniformMatrix4fv(z.viewMatrix,!1,Ua);c.uniform3fv(z.directionalLightDirection,A)}m.matrixWorld.flattenToArray(m._objectMatrixArray);c.uniformMatrix4fv(z.objectMatrix,!1,m._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,v.__webglVertexBuffer);
-c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,v.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);
-c.disable(c.DEPTH_TEST);fa="";na=X.program;c.useProgram(X.program);c.uniformMatrix4fv(X.projectionLocation,!1,Pa);c.uniform1f(X.darknessLocation,X.darkness);c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.vertexAttribPointer(X.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(X.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);
-c.depthMask(Ga)}function L(f,s){var n,m,r,A=f.__webglLensFlares.length,v,x,z;v=new THREE.Vector3;var t=Ca/oa;x=oa*0.5;z=Ca*0.5;var w=16/Ca,y=[w*t,w],H=[1,1,0];w=[1,1];var C,N=K.readBackPixels,W,P,T=K.uniforms;n=K.attributes;c.useProgram(K.program);na=K.program;fa="";c.uniform1i(T.map,0);c.activeTexture(c.TEXTURE0);c.uniform1f(T.opacity,1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,y);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,
-2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(r=0;r<A;r++){n=f.__webglLensFlares[r].object;v.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(v);m=v.z;s.projectionMatrix.multiplyVector3(v);H[0]=v.x;H[1]=v.y;H[2]=v.z;w[0]=H[0]*x+x;w[1]=H[1]*z+z;c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,w[0]-8,w[1]-8,16,16);c.uniform3fv(T.screenPosition,H);c.uniform1i(T.renderPink,
-1);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);try{c.readPixels(w[0]-8,w[1]-8,16,16,c.RGBA,c.UNSIGNED_BYTE,K.readBackPixels)}catch(Ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}c.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-m,s.far))/s.far),10)+2;m=sampleDistance*4;C=sampleDistance*64;P=0;W=28-m+(448-C);K.readBackPixels[W+0]===255&&K.readBackPixels[W+1]===0&&K.readBackPixels[W+
-2]===255&&(P+=0.2);W=28+m+(448-C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28+m+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28-m+(448+C);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=476;N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);n.positionScreen.x=H[0];n.positionScreen.y=H[1];n.positionScreen.z=H[2];n.customUpdateCallback?n.customUpdateCallback(P,n):n.updateLensFlares(P);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
-0)}for(r=0;r<A;r++){n=f.__webglLensFlares[r].object;v=0;for(x=n.lensFlares.length;v<x;v++){z=n.lensFlares[v];if(z.opacity>0.0010&&z.scale>0.0010){H[0]=z.x;H[1]=z.y;H[2]=z.z;w=z.size*z.scale/Ca;y[0]=w*t;y[1]=w;c.uniform3fv(T.screenPosition,H);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,
-f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,m,r,A;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];A=!1;for(r in m.__webglCustomAttributes)if(m.__webglCustomAttributes[r].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var v=void 0,
-x=void 0,z=void 0,t=void 0;z=void 0;var w=void 0,y=void 0,H=void 0,C=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;H=void 0;t=void 0;C=void 0;t=void 0;var q=void 0,E=void 0;y=void 0;q=void 0;E=void 0;var i=void 0,Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;t=void 0;C=void 0;w=void 0;z=void 0;z=void 0;q=void 0;E=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=
-0,va=0,B=0,Ba=0;E=q=0;var Da=m.__vertexArray,ib=m.__uvArray,jb=m.__uv2Array,Qa=m.__normalArray,ha=m.__tangentArray,Ea=m.__colorArray,ia=m.__skinVertexAArray,ja=m.__skinVertexBArray,ka=m.__skinIndexArray,la=m.__skinWeightArray,kb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;i=void 0;var Na=m.__faceArray,Oa=m.__lineArray,rb=m.__needsSmoothNormals;W=m.__vertexColorType;N=m.__uvType;P=m.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,
-ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=m.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}v=0;for(x=sb.length;v<x;v++){z=sb[v];t=wb[z];tb&&(T=tb[z]);ub&&(Ha=ub[z]);z=t.vertexNormals;w=t.normal;y=t.vertexColors;H=t.color;C=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=
-bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;E=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[E];i.array[q+1]=i.value[E];i.array[q+2]=i.value[E];i.offsetSrc++}else if(i.boundTo===
-"faceVertices"){i.array[q+0]=i.value[E+0];i.array[q+1]=i.value[E+1];i.array[q+2]=i.value[E+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[E];Q=i.value[E];S=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[E+0];Q=i.value[E+1];S=i.value[E+2];i.offsetSrc+=3}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+
-5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z}i.offset+=9}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;
-i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.offset+=12}}}}if(qb){q=0;for(E=Ta.length;q<E;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;i=kb[q];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z}Ba+=9}if(Xa.length){q=Xa[t.a];E=Xa[t.b];i=Xa[t.c];la[B]=q.x;la[B+1]=q.y;la[B+2]=q.z;la[B+3]=q.w;la[B+4]=E.x;la[B+5]=E.y;la[B+6]=E.z;la[B+7]=E.w;la[B+8]=i.x;
-la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;q=eb[t.a];E=eb[t.b];i=eb[t.c];ka[B]=q.x;ka[B+1]=q.y;ka[B+2]=q.z;ka[B+3]=q.w;ka[B+4]=E.x;ka[B+5]=E.y;ka[B+6]=E.z;ka[B+7]=E.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;q=cb[t.a];E=cb[t.b];i=cb[t.c];ia[B]=q.x;ia[B+1]=q.y;ia[B+2]=q.z;ia[B+3]=1;ia[B+4]=E.x;ia[B+5]=E.y;ia[B+6]=E.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;q=db[t.a];E=db[t.b];i=db[t.c];ja[B]=q.x;ja[B+1]=q.y;ja[B+2]=q.z;ja[B+3]=1;ja[B+4]=E.x;ja[B+5]=E.y;ja[B+6]=E.z;ja[B+7]=1;ja[B+
-8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;B+=12}if(pb&&W){if(y.length==3&&W==THREE.VertexColors){t=y[0];q=y[1];E=y[2]}else E=q=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=q.r;Ea[va+4]=q.g;Ea[va+5]=q.b;Ea[va+6]=E.r;Ea[va+7]=E.g;Ea[va+8]=E.b;va+=9}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;da+=12}if(nb&&P)if(z.length==3&&rb)for(C=0;C<3;C++){w=
-z[C];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(C=0;C<3;C++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<3;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<3;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+2;Ja+=3;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+2;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Ma+=6;sa+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;
-ra=bb[t.d].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Da[Aa+9]=ra.x;Da[Aa+10]=ra.y;Da[Aa+11]=ra.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;E=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c];i.array[q+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[E];i.array[q+1]=i.value[E];
-i.array[q+2]=i.value[E];i.array[q+2]=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+0]=i.value[E+0];i.array[q+1]=i.value[E+1];i.array[q+2]=i.value[E+2];i.array[q+2]=i.value[E+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];ra=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[E];Q=i.value[E];S=i.value[E];ra=i.value[E];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[E+0];Q=i.value[E+
-1];S=i.value[E+2];ra=i.value[E+3];i.offsetSrc+=4}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.array[q+6]=ra.x;i.array[q+7]=ra.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b;i.array[q+9]=ra.r;i.array[q+10]=ra.g;i.array[q+11]=ra.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+
-2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z;i.array[q+9]=ra.x;i.array[q+10]=ra.y;i.array[q+11]=ra.z}i.offset+=12}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.array[q+12]=ra.x;i.array[q+13]=ra.y;i.array[q+14]=ra.z;i.array[q+15]=ra.w;i.offset+=16}}}}if(qb){q=0;for(E=Ta.length;q<
-E;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;ra=Ta[q].vertices[t.d].position;i=kb[q];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z;i[Ba+9]=ra.x;i[Ba+10]=ra.y;i[Ba+11]=ra.z}Ba+=12}if(Xa.length){q=Xa[t.a];E=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[B]=q.x;la[B+1]=q.y;la[B+2]=q.z;la[B+3]=q.w;la[B+4]=E.x;la[B+5]=E.y;la[B+6]=E.z;la[B+7]=E.w;la[B+8]=i.x;la[B+9]=i.y;la[B+10]=i.z;la[B+11]=i.w;la[B+12]=
-Ka.x;la[B+13]=Ka.y;la[B+14]=Ka.z;la[B+15]=Ka.w;q=eb[t.a];E=eb[t.b];i=eb[t.c];Ka=eb[t.d];ka[B]=q.x;ka[B+1]=q.y;ka[B+2]=q.z;ka[B+3]=q.w;ka[B+4]=E.x;ka[B+5]=E.y;ka[B+6]=E.z;ka[B+7]=E.w;ka[B+8]=i.x;ka[B+9]=i.y;ka[B+10]=i.z;ka[B+11]=i.w;ka[B+12]=Ka.x;ka[B+13]=Ka.y;ka[B+14]=Ka.z;ka[B+15]=Ka.w;q=cb[t.a];E=cb[t.b];i=cb[t.c];Ka=cb[t.d];ia[B]=q.x;ia[B+1]=q.y;ia[B+2]=q.z;ia[B+3]=1;ia[B+4]=E.x;ia[B+5]=E.y;ia[B+6]=E.z;ia[B+7]=1;ia[B+8]=i.x;ia[B+9]=i.y;ia[B+10]=i.z;ia[B+11]=1;ia[B+12]=Ka.x;ia[B+13]=Ka.y;ia[B+14]=
-Ka.z;ia[B+15]=1;q=db[t.a];E=db[t.b];i=db[t.c];t=db[t.d];ja[B]=q.x;ja[B+1]=q.y;ja[B+2]=q.z;ja[B+3]=1;ja[B+4]=E.x;ja[B+5]=E.y;ja[B+6]=E.z;ja[B+7]=1;ja[B+8]=i.x;ja[B+9]=i.y;ja[B+10]=i.z;ja[B+11]=1;ja[B+12]=t.x;ja[B+13]=t.y;ja[B+14]=t.z;ja[B+15]=1;B+=16}if(pb&&W){if(y.length==4&&W==THREE.VertexColors){t=y[0];q=y[1];E=y[2];y=y[3]}else y=E=q=t=H;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=q.r;Ea[va+4]=q.g;Ea[va+5]=q.b;Ea[va+6]=E.r;Ea[va+7]=E.g;Ea[va+8]=E.b;Ea[va+9]=y.r;Ea[va+10]=y.g;Ea[va+11]=y.b;va+=
-12}if(ob&&Ia.hasTangents){y=C[0];H=C[1];t=C[2];C=C[3];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=H.x;ha[da+5]=H.y;ha[da+6]=H.z;ha[da+7]=H.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;ha[da+12]=C.x;ha[da+13]=C.y;ha[da+14]=C.z;ha[da+15]=C.w;da+=16}if(nb&&P)if(z.length==4&&rb)for(C=0;C<4;C++){w=z[C];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(C=0;C<4;C++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(C=0;C<4;C++){z=T[C];ib[$a]=z.u;ib[$a+1]=
-z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(C=0;C<4;C++){z=Ha[C];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+3;Na[Ja+3]=sa+1;Na[Ja+4]=sa+2;Na[Ja+5]=sa+3;Ja+=6;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+3;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Oa[Ma+6]=sa+2;Oa[Ma+7]=sa+3;Ma+=8;sa+=4}}}if(Za){v=0;for(x=Za.length;v<x;v++){Na[Ja]=Za[v].a;Na[Ja+1]=Za[v].b;Na[Ja+2]=Za[v].c;Na[Ja+3]=Za[v].a;Na[Ja+4]=Za[v].c;Na[Ja+5]=Za[v].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);
-c.bufferData(c.ARRAY_BUFFER,Da,A)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,A);i.needsUpdate=!1}}if(qb){q=0;for(E=Ta.length;q<E;q++){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[q]);c.bufferData(c.ARRAY_BUFFER,kb[q],A)}}if(pb&&va>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&&
-Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(B>
-0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=
-!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;A=m.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;r=x*3;T[r]=N.x;T[r+1]=N.y;T[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=m[x];r=x*3;v[r]=color.r;v[r+1]=color.g;v[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);
-c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;A=m.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;r=x*3;T[r]=N.x;T[r+1]=N.y;T[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=m[x];r=x*3;v[r]=
-color.r;v[r+1]=color.g;v[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function O(f){function s(H){var C=[];n=0;for(m=H.length;n<m;n++)H[n]==undefined?C.push("undefined"):C.push(H[n].id);return C.join("_")}var n,m,r,A,v,x,z,t,w={},y=f.morphTargets!==
-undefined?f.morphTargets.length:0;f.geometryGroups={};r=0;for(A=f.faces.length;r<A;r++){v=f.faces[r];x=v.materials;z=s(x);w[z]==undefined&&(w[z]={hash:z,counter:0});t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,numMorphTargets:y});v=v instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+v>65535){w[z].counter+=1;t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,
-numMorphTargets:y})}f.geometryGroups[t].faces.push(r);f.geometryGroups[t].vertices+=v}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);
-break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function wa(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);
-c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ta(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ta(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}wa(c.TEXTURE_2D,
-f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function J(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));
-c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height,0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&
-!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,
-null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=oa;f=Ca}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(Z,ua,n,f);Fa=s}}function xa(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);
-return null}return n}function ta(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ea(f){switch(f){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.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 c,U=document.createElement("canvas"),V=[],na=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,Z=0,ua=0,oa=0,Ca=0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,
-hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context.";
-}catch(r){console.error(r)}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.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=
--1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=c.createBuffer();X.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,X.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X.faces,c.STATIC_DRAW);X.program=c.createProgram();c.attachShader(X.program,
-xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(X.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(X.program);X.vertexLocation=c.getAttribLocation(X.program,"position");X.projectionLocation=c.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=c.getUniformLocation(X.program,"darkness")}var K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);K.transparency=0.5;b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;
-K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=c.createBuffer();K.elementBuffer=c.createBuffer();K.tempTexture=c.createTexture();K.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);
-c.bufferData(c.ARRAY_BUFFER,K.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,K.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
-c.NEAREST);K.program=c.createProgram();c.attachShader(K.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(K.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.vertex=c.getAttribLocation(K.program,"position");K.attributes.uv=c.getAttribLocation(K.program,"UV");K.uniforms.map=c.getUniformLocation(K.program,"map");K.uniforms.opacity=c.getUniformLocation(K.program,"opacity");K.uniforms.scale=c.getUniformLocation(K.program,
-"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink");this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,m){Z=f;ua=s;oa=n;Ca=m;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};
-this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,m){var r,A,v;if(f instanceof THREE.MeshDepthMaterial)v="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)v=
-"shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)v="normal";else if(f instanceof THREE.MeshBasicMaterial)v="basic";else if(f instanceof THREE.MeshLambertMaterial)v="lambert";else if(f instanceof THREE.MeshPhongMaterial)v="phong";else if(f instanceof THREE.LineBasicMaterial)v="basic";else f instanceof THREE.ParticleBasicMaterial&&(v="particle_basic");if(v){var x=THREE.ShaderLib[v];f.uniforms=Uniforms.clone(x.uniforms);f.vertexShader=x.vertexShader;f.fragmentShader=x.fragmentShader}var z,
-t,w;z=w=x=0;for(t=s.length;z<t;z++){A=s[z];A instanceof THREE.DirectionalLight&&w++;A instanceof THREE.PointLight&&x++}if(x+w<=4)s=w;else{s=Math.ceil(4*w/(x+w));x=4-s}A={directional:s,point:x};w=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)w=m.bones.length;var y;a:{z=f.fragmentShader;t=f.vertexShader;x=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,
-maxMorphTargets:this.maxMorphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:w};var H;A=[];if(v)A.push(v);else{A.push(z);A.push(t)}for(H in n){A.push(H);A.push(n[H])}v=A.join();H=0;for(A=V.length;H<A;H++)if(V[H].code==v){y=V[H].program;break a}H=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
-"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":
-"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-c.attachShader(H,xa("fragment",prefix_fragment+z));c.attachShader(H,xa("vertex",prefix_vertex+t));c.linkProgram(H);c.getProgramParameter(H,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(H,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");H.uniforms={};H.attributes={};var C;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in x)z.push(C);
-C=z;x=0;for(z=C.length;x<z;x++){t=C[x];H.uniforms[t]=c.getUniformLocation(H,t)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<n.maxMorphTargets;C++)z.push("morphTarget"+C);for(y in s)z.push(y);y=z;C=0;for(s=y.length;C<s;C++){n=y[C];H.attributes[n]=c.getAttribLocation(H,n)}V.push({program:H,code:v});y=H}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
-0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(r in f.attributes)y[r]>=0&&c.enableVertexAttribArray(y[r]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0);
+w,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,z.image[w]);z.__webglInit=!0}wa(c.TEXTURE_CUBE_MAP,z,z.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube)}}else $(z,n)}}c.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);c.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(k instanceof THREE.MeshShaderMaterial||k instanceof THREE.MeshPhongMaterial||k.envMap)&&c.uniform3f(v.cameraPosition,
+f.position.x,f.position.y,f.position.z);(k instanceof THREE.MeshShaderMaterial||k.envMap||k.skinning)&&c.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshShaderMaterial||k.skinning)&&c.uniformMatrix4fv(v.viewMatrix,!1,Ua);if(k instanceof THREE.ShadowVolumeDynamicMaterial){f=x.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(v.directionalLightDirection,
+f);c.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);c.uniformMatrix4fv(v.viewMatrix,!1,Ua)}if(k.skinning){c.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ua);c.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return A}function h(f,s,n,k,q,A){if(k.opacity!=0){var v;f=e(f,s,n,k,A).attributes;if(k.morphTargets){s=k.program.attributes;A.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[A.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(s.position,
+3,c.FLOAT,!1,0,0);if(A.morphTargetForcedOrder.length){n=0;for(var x=A.morphTargetForcedOrder,z=A.morphTargetInfluences;n<k.numSupportedMorphTargets&&n<x.length;){c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[x[n]]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=z[x[n]];n++}}else{x=[];var t=-1,w=0;z=A.morphTargetInfluences;var y,D=z.length;n=0;for(A.morphTargetBase!==-1&&(x[A.morphTargetBase]=!0);n<k.numSupportedMorphTargets;){for(y=0;y<D;y++)if(!x[y]&&
+z[y]>t){w=y;t=z[w]}c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;x[w]=1;t=-1;n++}}c.uniform1fv(k.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(q.__webglCustomAttributes)for(v in q.__webglCustomAttributes)if(f[v]>=0){s=q.__webglCustomAttributes[v];c.bindBuffer(c.ARRAY_BUFFER,
+s.buffer);c.vertexAttribPointer(f[v],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(q.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webglUVBuffer);c.vertexAttribPointer(f.uv,
+2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(q.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(k.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
+q.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(k.wireframe){c.lineWidth(k.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer);c.drawElements(c.LINES,q.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+q.__webglFaceBuffer);c.drawElements(c.TRIANGLES,q.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(k.linewidth);c.drawArrays(A,0,q.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,q.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,q.__webglVertexCount)}}function g(f,s,n){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=
+c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(n==THREE.FlatShading){var k,q,A,v,x,z,t,w,y,D,B=f.count*3;for(D=0;D<B;D+=9){n=f.normalArray;k=n[D];q=n[D+1];A=n[D+2];v=n[D+3];z=n[D+4];w=n[D+5];x=n[D+6];t=n[D+7];y=n[D+8];k=(k+v+x)/
+3;q=(q+z+t)/3;A=(A+w+y)/3;n[D]=k;n[D+1]=q;n[D+2]=A;n[D+3]=k;n[D+4]=q;n[D+5]=A;n[D+6]=k;n[D+7]=q;n[D+8]=A}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function m(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=
+f.flipSided}}function j(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(f){za[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);za[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);za[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);za[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);za[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);za[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=za[f];s.divideScalar(Math.sqrt(s.x*
+s.x+s.y*s.y+s.z*s.z))}}function p(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),k=0;k<6;k++){f=za[k].x*s.n14+za[k].y*s.n24+za[k].z*s.n34+za[k].w;if(f<=n)return!1}return!0}function u(f,s){f.list[f.count]=s;f.count+=1}function E(f){var s,n,k=f.object,q=f.opaque,A=f.transparent;A.count=0;f=q.count=0;for(s=k.materials.length;f<s;f++){n=k.materials[f];n.transparent?u(A,n):u(q,n)}}function G(f){var s,n,k,q,A=f.object,v=f.buffer,x=f.opaque,
+z=f.transparent;z.count=0;f=x.count=0;for(k=A.materials.length;f<k;f++){s=A.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=v.materials.length;s<n;s++)(q=v.materials[s])&&(q.transparent?u(z,q):u(x,q))}else(q=s)&&(q.transparent?u(z,q):u(x,q))}}function I(f,s){return s.z-f.z}function H(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,
+c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,k,q=f.lights,A=[],v,x,z,t,w,y=f.__webglShadowVolumes.length;for(s=0;s<n;s++){k=f.lights[s];if(k instanceof THREE.DirectionalLight){A[0]=-k.position.x;A[1]=-k.position.y;A[2]=-k.position.z;for(w=0;w<y;w++){k=f.__webglShadowVolumes[w].object;v=f.__webglShadowVolumes[w].buffer;x=k.materials[0];x.program||ya.initMaterial(x,q,undefined,k);x=x.program;z=x.uniforms;t=x.attributes;if(na!==x){c.useProgram(x);na=
+x;c.uniformMatrix4fv(z.projectionMatrix,!1,Pa);c.uniformMatrix4fv(z.viewMatrix,!1,Ua);c.uniform3fv(z.directionalLightDirection,A)}k.matrixWorld.flattenToArray(k._objectMatrixArray);c.uniformMatrix4fv(z.objectMatrix,!1,k._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,v.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,v.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);c.cullFace(c.FRONT);
+c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,v.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);fa="";na=X.program;c.useProgram(X.program);c.uniformMatrix4fv(X.projectionLocation,!1,Pa);c.uniform1f(X.darknessLocation,X.darkness);c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.vertexAttribPointer(X.vertexLocation,
+3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(X.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function L(f,s){var n,k,q,A=f.__webglLensFlares.length,v,x,z;v=new THREE.Vector3;var t=Ca/oa;x=oa*0.5;z=Ca*0.5;var w=16/Ca,y=[w*t,w],D=[1,1,0];w=[1,1];var B,N=K.readBackPixels,W,P,T=K.uniforms;n=K.attributes;
+c.useProgram(K.program);na=K.program;fa="";c.uniform1i(T.map,0);c.activeTexture(c.TEXTURE0);c.uniform1f(T.opacity,1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,y);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(q=0;q<A;q++){n=f.__webglLensFlares[q].object;v.set(n.matrixWorld.n14,
+n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(v);k=v.z;s.projectionMatrix.multiplyVector3(v);D[0]=v.x;D[1]=v.y;D[2]=v.z;w[0]=D[0]*x+x;w[1]=D[1]*z+z;c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,w[0]-8,w[1]-8,16,16);c.uniform3fv(T.screenPosition,D);c.uniform1i(T.renderPink,1);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);try{c.readPixels(w[0]-8,w[1]-8,16,16,c.RGBA,c.UNSIGNED_BYTE,K.readBackPixels)}catch(Ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}c.getError()&&
+console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-k,s.far))/s.far),10)+2;k=sampleDistance*4;B=sampleDistance*64;P=0;W=28-k+(448-B);K.readBackPixels[W+0]===255&&K.readBackPixels[W+1]===0&&K.readBackPixels[W+2]===255&&(P+=0.2);W=28+k+(448-B);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28+k+(448+B);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=28-k+(448+B);N[W+0]===255&&N[W+1]===0&&N[W+2]===255&&(P+=0.2);W=476;N[W+0]===255&&
+N[W+1]===0&&N[W+2]===255&&(P+=0.2);n.positionScreen.x=D[0];n.positionScreen.y=D[1];n.positionScreen.z=D[2];n.customUpdateCallback?n.customUpdateCallback(P,n):n.updateLensFlares(P);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}for(q=0;q<A;q++){n=f.__webglLensFlares[q].object;v=0;for(x=n.lensFlares.length;v<x;v++){z=n.lensFlares[v];if(z.opacity>0.0010&&z.scale>0.0010){D[0]=z.x;D[1]=z.y;D[2]=z.z;w=z.size*z.scale/Ca;y[0]=w*t;y[1]=w;c.uniform3fv(T.screenPosition,
+D);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,k,q,A;if(f instanceof THREE.Mesh){n=f.geometry;
+for(s in n.geometryGroups){k=n.geometryGroups[s];A=!1;for(q in k.__webglCustomAttributes)if(k.__webglCustomAttributes[q].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var v=void 0,x=void 0,z=void 0,t=void 0;z=void 0;var w=void 0,y=void 0,D=void 0,B=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;D=void 0;t=void 0;B=void 0;
+t=void 0;var r=void 0,F=void 0;y=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;t=void 0;B=void 0;w=void 0;z=void 0;z=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=0,va=0,C=0,Ba=0;F=r=0;var Da=k.__vertexArray,ib=k.__uvArray,jb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Ea=k.__colorArray,ia=k.__skinVertexAArray,ja=k.__skinVertexBArray,ka=k.__skinIndexArray,
+la=k.__skinWeightArray,kb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,rb=k.__needsSmoothNormals;W=k.__vertexColorType;N=k.__uvType;P=k.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=k.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,
+Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}v=0;for(x=sb.length;v<x;v++){z=sb[v];t=wb[z];tb&&(T=tb[z]);ub&&(Ha=ub[z]);z=t.vertexNormals;w=t.normal;y=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=
+i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];
+S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=S.x;i.array[r+5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[r+0]=R.r;i.array[r+1]=R.g;i.array[r+2]=R.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=S.r;i.array[r+7]=S.g;i.array[r+
+8]=S.b}else{i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=R.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=S.x;i.array[r+7]=S.y;i.array[r+8]=S.z}i.offset+=9}else{i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=R.z;i.array[r+3]=R.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=S.x;i.array[r+9]=S.y;i.array[r+10]=S.z;i.array[r+11]=S.w;i.offset+=12}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){R=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;
+S=Ta[r].vertices[t.c].position;i=kb[r];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z}Ba+=9}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;
+ka[C+11]=i.w;r=cb[t.a];F=cb[t.b];i=cb[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;r=db[t.a];F=db[t.b];i=db[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(pb&&W){if(y.length==3&&W==THREE.VertexColors){t=y[0];r=y[1];F=y[2]}else F=r=t=D;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=r.r;Ea[va+4]=r.g;
+Ea[va+5]=r.b;Ea[va+6]=F.r;Ea[va+7]=F.g;Ea[va+8]=F.b;va+=9}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=D.x;ha[da+5]=D.y;ha[da+6]=D.z;ha[da+7]=D.w;ha[da+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;da+=12}if(nb&&P)if(z.length==3&&rb)for(B=0;B<3;B++){w=z[B];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(B=0;B<3;B++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(B=0;B<3;B++){z=T[B];ib[$a]=z.u;ib[$a+1]=z.v;$a+=
+2}if(gb&&Ha!==undefined&&N)for(B=0;B<3;B++){z=Ha[B];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+2;Ja+=3;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+2;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Ma+=6;sa+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;ra=bb[t.d].position;Da[Aa]=R.x;Da[Aa+1]=R.y;Da[Aa+2]=R.z;Da[Aa+3]=Q.x;Da[Aa+4]=Q.y;Da[Aa+5]=Q.z;Da[Aa+6]=S.x;Da[Aa+7]=S.y;Da[Aa+8]=S.z;Da[Aa+9]=ra.x;Da[Aa+10]=ra.y;Da[Aa+11]=ra.z;
+Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c];i.array[r+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];
+i.array[r+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];ra=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];ra=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];ra=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=S.x;i.array[r+5]=S.y;i.array[r+
+6]=ra.x;i.array[r+7]=ra.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[r+0]=R.r;i.array[r+1]=R.g;i.array[r+2]=R.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=S.r;i.array[r+7]=S.g;i.array[r+8]=S.b;i.array[r+9]=ra.r;i.array[r+10]=ra.g;i.array[r+11]=ra.b}else{i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=R.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=S.x;i.array[r+7]=S.y;i.array[r+8]=S.z;i.array[r+9]=ra.x;i.array[r+10]=ra.y;i.array[r+11]=ra.z}i.offset+=
+12}else{i.array[r+0]=R.x;i.array[r+1]=R.y;i.array[r+2]=R.z;i.array[r+3]=R.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=S.x;i.array[r+9]=S.y;i.array[r+10]=S.z;i.array[r+11]=S.w;i.array[r+12]=ra.x;i.array[r+13]=ra.y;i.array[r+14]=ra.z;i.array[r+15]=ra.w;i.offset+=16}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){R=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;S=Ta[r].vertices[t.c].position;ra=Ta[r].vertices[t.d].position;i=kb[r];i[Ba+0]=R.x;i[Ba+1]=R.y;i[Ba+
+2]=R.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=S.x;i[Ba+7]=S.y;i[Ba+8]=S.z;i[Ba+9]=ra.x;i[Ba+10]=ra.y;i[Ba+11]=ra.z}Ba+=12}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];Ka=eb[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=
+F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=cb[t.a];F=cb[t.b];i=cb[t.c];Ka=cb[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=db[t.a];F=db[t.b];i=db[t.c];t=db[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+
+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(pb&&W){if(y.length==4&&W==THREE.VertexColors){t=y[0];r=y[1];F=y[2];y=y[3]}else y=F=r=t=D;Ea[va]=t.r;Ea[va+1]=t.g;Ea[va+2]=t.b;Ea[va+3]=r.r;Ea[va+4]=r.g;Ea[va+5]=r.b;Ea[va+6]=F.r;Ea[va+7]=F.g;Ea[va+8]=F.b;Ea[va+9]=y.r;Ea[va+10]=y.g;Ea[va+11]=y.b;va+=12}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];B=B[3];ha[da]=y.x;ha[da+1]=y.y;ha[da+2]=y.z;ha[da+3]=y.w;ha[da+4]=D.x;ha[da+5]=D.y;ha[da+6]=D.z;ha[da+7]=D.w;ha[da+
+8]=t.x;ha[da+9]=t.y;ha[da+10]=t.z;ha[da+11]=t.w;ha[da+12]=B.x;ha[da+13]=B.y;ha[da+14]=B.z;ha[da+15]=B.w;da+=16}if(nb&&P)if(z.length==4&&rb)for(B=0;B<4;B++){w=z[B];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(B=0;B<4;B++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(gb&&T!==undefined&&N)for(B=0;B<4;B++){z=T[B];ib[$a]=z.u;ib[$a+1]=z.v;$a+=2}if(gb&&Ha!==undefined&&N)for(B=0;B<4;B++){z=Ha[B];jb[ab]=z.u;jb[ab+1]=z.v;ab+=2}if(mb){Na[Ja]=sa;Na[Ja+1]=sa+1;Na[Ja+2]=sa+3;Na[Ja+3]=sa+1;Na[Ja+4]=sa+2;
+Na[Ja+5]=sa+3;Ja+=6;Oa[Ma]=sa;Oa[Ma+1]=sa+1;Oa[Ma+2]=sa;Oa[Ma+3]=sa+3;Oa[Ma+4]=sa+1;Oa[Ma+5]=sa+2;Oa[Ma+6]=sa+2;Oa[Ma+7]=sa+3;Ma+=8;sa+=4}}}if(Za){v=0;for(x=Za.length;v<x;v++){Na[Ja]=Za[v].a;Na[Ja+1]=Za[v].b;Na[Ja+2]=Za[v].c;Na[Ja+3]=Za[v].a;Na[Ja+4]=Za[v].c;Na[Ja+5]=Za[v].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Da,A)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,A);i.needsUpdate=
+!1}}if(qb){r=0;for(F=Ta.length;r<F;r++){c.bindBuffer(c.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,kb[r],A)}}if(pb&&va>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&&Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,
+ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER,
+k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;P=W.length;A=k.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;
+if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;q=x*3;T[q]=N.x;T[q+1]=N.y;T[q+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=k[x];q=x*3;v[q]=color.r;v[q+1]=color.g;v[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;
+k=f.colors;P=W.length;A=k.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x<P;x++){N=W[x].position;q=x*3;T[q]=N.x;T[q+1]=N.y;T[q+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,s)}if(Ha){for(x=0;x<A;x++){color=k[x];q=x*3;v[q]=color.r;v[q+1]=color.g;v[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,v,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=
+f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function O(f){function s(D){var B=[];n=0;for(k=D.length;n<k;n++)D[n]==undefined?B.push("undefined"):B.push(D[n].id);return B.join("_")}var n,k,q,A,v,x,z,t,w={},y=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};q=0;for(A=f.faces.length;q<A;q++){v=f.faces[q];x=v.materials;z=s(x);w[z]==undefined&&(w[z]={hash:z,counter:0});t=w[z].hash+"_"+w[z].counter;
+f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,numMorphTargets:y});v=v instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+v>65535){w[z].counter+=1;t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,numMorphTargets:y})}f.geometryGroups[t].faces.push(q);f.geometryGroups[t].vertices+=v}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!=
+fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function wa(f,s,n){if((n.width&n.width-1)==0&&(n.height&
+n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ta(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ta(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,
+f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}wa(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function J(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===
+undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height,
+0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,
+c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=oa;f=Ca}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(Z,ua,n,f);Fa=s}}function xa(f,s){var n;if(f=="fragment")n=
+c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function ta(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ea(f){switch(f){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.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 c,U=document.createElement("canvas"),V=[],na=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,Z=
+0,ua=0,oa=0,Ca=0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);
+if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,k){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(q){console.error(q)}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.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
+c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=c.createBuffer();X.elementBuffer=c.createBuffer();
+c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,X.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X.faces,c.STATIC_DRAW);X.program=c.createProgram();c.attachShader(X.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(X.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(X.program);X.vertexLocation=c.getAttribLocation(X.program,"position");X.projectionLocation=
+c.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=c.getUniformLocation(X.program,"darkness")}var K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);K.transparency=0.5;b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=
+0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=c.createBuffer();K.elementBuffer=c.createBuffer();K.tempTexture=c.createTexture();K.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,K.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,K.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,
+16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);K.program=c.createProgram();c.attachShader(K.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(K.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(K.program);K.attributes=
+{};K.uniforms={};K.attributes.vertex=c.getAttribLocation(K.program,"position");K.attributes.uv=c.getAttribLocation(K.program,"UV");K.uniforms.map=c.getUniformLocation(K.program,"map");K.uniforms.opacity=c.getUniformLocation(K.program,"opacity");K.uniforms.scale=c.getUniformLocation(K.program,"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink");
+this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,k){Z=f;ua=s;oa=n;Ca=k;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,k){c.scissor(f,s,n,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,
+f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,k){var q,A,v;if(f instanceof THREE.MeshDepthMaterial)v="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)v="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)v="normal";else if(f instanceof THREE.MeshBasicMaterial)v="basic";else if(f instanceof THREE.MeshLambertMaterial)v="lambert";
+else if(f instanceof THREE.MeshPhongMaterial)v="phong";else if(f instanceof THREE.LineBasicMaterial)v="basic";else f instanceof THREE.ParticleBasicMaterial&&(v="particle_basic");if(v){var x=THREE.ShaderLib[v];f.uniforms=Uniforms.clone(x.uniforms);f.vertexShader=x.vertexShader;f.fragmentShader=x.fragmentShader}var z,t,w;z=w=x=0;for(t=s.length;z<t;z++){A=s[z];A instanceof THREE.DirectionalLight&&w++;A instanceof THREE.PointLight&&x++}if(x+w<=4)s=w;else{s=Math.ceil(4*w/(x+w));x=4-s}A={directional:s,
+point:x};w=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)w=k.bones.length;var y;a:{z=f.fragmentShader;t=f.vertexShader;x=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:w};var D;A=[];if(v)A.push(v);else{A.push(z);A.push(t)}for(D in n){A.push(D);A.push(n[D])}v=
+A.join();D=0;for(A=V.length;D<A;D++)if(V[D].code==v){y=V[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+c.attachShader(D,xa("fragment",prefix_fragment+z));c.attachShader(D,xa("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in x)z.push(B);
+B=z;x=0;for(z=B.length;x<z;x++){t=B[x];D.uniforms[t]=c.getUniformLocation(D,t)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<n.maxMorphTargets;B++)z.push("morphTarget"+B);for(y in s)z.push(y);y=z;B=0;for(s=y.length;B<s;B++){n=y[B];D.attributes[n]=c.getAttribLocation(D,n)}V.push({program:D,code:v});y=D}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
+0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(q in f.attributes)y[q]>=0&&c.enableVertexAttribArray(y[q]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0);
 f.numSupportedMorphTargets++}if(y.morphTarget1>=0){c.enableVertexAttribArray(y.morphTarget1);f.numSupportedMorphTargets++}if(y.morphTarget2>=0){c.enableVertexAttribArray(y.morphTarget2);f.numSupportedMorphTargets++}if(y.morphTarget3>=0){c.enableVertexAttribArray(y.morphTarget3);f.numSupportedMorphTargets++}if(y.morphTarget4>=0){c.enableVertexAttribArray(y.morphTarget4);f.numSupportedMorphTargets++}if(y.morphTarget5>=0){c.enableVertexAttribArray(y.morphTarget5);f.numSupportedMorphTargets++}if(y.morphTarget6>=
-0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}m.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(r=this.maxMorphTargets;f<r;f++)m.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,m){var r,A,v,x,z,t,w,y,H=f.lights,C=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ua);s.projectionMatrix.flattenToArray(Pa);
-ga.multiply(s.projectionMatrix,s.matrixWorldInverse);o(ga);this.initWebGLObjects(f);J(n);(this.autoClear||m)&&this.clear();z=f.__webglObjects.length;for(m=0;m<z;m++){r=f.__webglObjects[m];w=r.object;if(w.visible)if(!(w instanceof THREE.Mesh)||p(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);F(r);r.render=!0;if(this.sortObjects){Va.copy(w.position);ga.multiplyVector3(Va);r.z=Va.z}}else r.render=!1;else r.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
-for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);D(r)}}ma(THREE.NormalBlending);for(m=0;m<z;m++){r=f.__webglObjects[m];if(r.render){w=r.object;y=r.buffer;v=r.opaque;k(w);for(r=0;r<v.count;r++){x=v.list[r];j(x.depthTest);h(s,H,C,x,y,w)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){v=r.opaque;k(w);for(r=0;r<v.count;r++){x=v.list[r];j(x.depthTest);A=e(s,H,C,x,w);w.render(function(N){g(N,
-A)})}}}for(m=0;m<z;m++){r=f.__webglObjects[m];if(r.render){w=r.object;y=r.buffer;v=r.transparent;k(w);for(r=0;r<v.count;r++){x=v.list[r];ma(x.blending);j(x.depthTest);h(s,H,C,x,y,w)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];w=r.object;if(w.visible){v=r.transparent;k(w);for(r=0;r<v.count;r++){x=v.list[r];ma(x.blending);j(x.depthTest);A=e(s,H,C,x,w);w.render(function(N){g(N,A)})}}}Sa&&f.__webglShadowVolumes.length&&f.lights.length&&G(f);f.__webglLensFlares.length&&L(f,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(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,m=void 0,r=void 0,A=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);
-s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){r=s.geometry;r.geometryGroups==undefined&&O(r);for(m in r.geometryGroups){A=r.geometryGroups[m];if(!A.__webglVertexBuffer){var v=A;v.__webglVertexBuffer=c.createBuffer();v.__webglNormalBuffer=c.createBuffer();v.__webglTangentBuffer=c.createBuffer();v.__webglColorBuffer=c.createBuffer();v.__webglUVBuffer=c.createBuffer();v.__webglUV2Buffer=
-c.createBuffer();v.__webglSkinVertexABuffer=c.createBuffer();v.__webglSkinVertexBBuffer=c.createBuffer();v.__webglSkinIndicesBuffer=c.createBuffer();v.__webglSkinWeightsBuffer=c.createBuffer();v.__webglFaceBuffer=c.createBuffer();v.__webglLineBuffer=c.createBuffer();if(v.numMorphTargets){var x=void 0,z=void 0;v.__webglMorphTargetsBuffers=[];x=0;for(z=v.numMorphTargets;x<z;x++)v.__webglMorphTargetsBuffers.push(c.createBuffer())}v=A;x=s;var t=void 0,w=void 0,y=void 0;y=void 0;var H=void 0,C=void 0,
-N=void 0,W=N=z=0;w=void 0;y=void 0;var P=void 0;t=void 0;w=void 0;H=x.geometry;P=H.faces;C=v.faces;t=0;for(w=C.length;t<w;t++){y=C[t];y=P[y];if(y instanceof THREE.Face3){z+=3;N+=1;W+=3}else if(y instanceof THREE.Face4){z+=4;N+=2;W+=4}}t=v;w=x;P=void 0;C=void 0;var T=void 0,Ha=void 0;T=void 0;y=[];P=0;for(C=w.materials.length;P<C;P++){T=w.materials[P];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=t.materials.length;T<l;T++)(Ha=t.materials[T])&&y.push(Ha)}else(Ha=T)&&y.push(Ha)}t=y;a:{w=void 0;
-P=void 0;C=t.length;for(w=0;w<C;w++){P=t[w];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){w=!0;break a}}w=!1}a:{P=void 0;C=void 0;y=t.length;for(P=0;P<y;P++){C=t[P];if(!(C instanceof THREE.MeshBasicMaterial&&!C.envMap||C instanceof THREE.MeshDepthMaterial)){P=C&&C.shading!=undefined&&C.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{C=void 0;y=void 0;T=t.length;for(C=0;C<T;C++){y=t[C];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}v.__vertexArray=
-new Float32Array(z*3);if(P)v.__normalArray=new Float32Array(z*3);if(H.hasTangents)v.__tangentArray=new Float32Array(z*4);if(y)v.__colorArray=new Float32Array(z*3);if(w){if(H.faceUvs.length>0||H.faceVertexUvs.length>0)v.__uvArray=new Float32Array(z*2);if(H.faceUvs.length>1||H.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(z*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(z*4);v.__skinVertexBArray=new Float32Array(z*4);v.__skinIndexArray=
-new Float32Array(z*4);v.__skinWeightArray=new Float32Array(z*4)}v.__faceArray=new Uint16Array(N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(W*2);if(v.numMorphTargets){v.__morphTargetsArrays=[];H=0;for(C=v.numMorphTargets;H<C;H++)v.__morphTargetsArrays.push(new Float32Array(z*3))}v.__needsSmoothNormals=P==THREE.SmoothShading;v.__uvType=w;v.__vertexColorType=y;v.__normalType=P;v.__webglFaceCount=N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0);v.__webglLineCount=
-W*2;H=0;for(C=t.length;H<C;H++)if(t[H].attributes){v.__webglCustomAttributes={};for(a in t[H].attributes){w=t[H].attributes[a];N=1;if(w.type==="v2")N=2;else if(w.type==="v3")N=3;else if(w.type==="v4")N=4;else w.type==="c"&&(N=3);w.size=N;w.needsUpdate=!0;w.array=new Float32Array(z*N);w.buffer=c.createBuffer();v.__webglCustomAttributes[a]=w}}r.__dirtyVertices=!0;r.__dirtyMorphTargets=!0;r.__dirtyElements=!0;r.__dirtyUvs=!0;r.__dirtyNormals=!0;r.__dirtyTangents=!0;r.__dirtyColors=!0}s instanceof THREE.ShadowVolume?
-ca(n.__webglShadowVolumes,A,s):ca(n.__webglObjects,A,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__webglVertexCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.Line){r=
-s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__webglLineCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.ParticleSystem){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;A=m.vertices.length;m.__vertexArray=
-new Float32Array(A*3);m.__colorArray=new Float32Array(A*3);m.__sortArray=[];m.__webglParticleCount=A;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];n=f;r=void 0;m=void 0;for(r=n.__webglObjects.length-1;r>=0;r--){m=n.__webglObjects[r].object;
-s==m&&n.__webglObjects.splice(r,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)Y(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)Y(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)Y(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};
+0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(q=this.maxMorphTargets;f<q;f++)k.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,k){var q,A,v,x,z,t,w,y,D=f.lights,B=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ua);s.projectionMatrix.flattenToArray(Pa);
+ga.multiply(s.projectionMatrix,s.matrixWorldInverse);o(ga);this.initWebGLObjects(f);J(n);(this.autoClear||k)&&this.clear();z=f.__webglObjects.length;for(k=0;k<z;k++){q=f.__webglObjects[k];w=q.object;if(w.visible)if(!(w instanceof THREE.Mesh)||p(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);G(q);q.render=!0;if(this.sortObjects){Va.copy(w.position);ga.multiplyVector3(Va);q.z=Va.z}}else q.render=!1;else q.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
+for(k=0;k<t;k++){q=f.__webglObjectsImmediate[k];w=q.object;if(w.visible){w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray);M(w,s);E(q)}}ma(THREE.NormalBlending);for(k=0;k<z;k++){q=f.__webglObjects[k];if(q.render){w=q.object;y=q.buffer;v=q.opaque;m(w);for(q=0;q<v.count;q++){x=v.list[q];j(x.depthTest);h(s,D,B,x,y,w)}}}for(k=0;k<t;k++){q=f.__webglObjectsImmediate[k];w=q.object;if(w.visible){v=q.opaque;m(w);for(q=0;q<v.count;q++){x=v.list[q];j(x.depthTest);A=e(s,D,B,x,w);w.render(function(N){g(N,
+A,x.shading)})}}}for(k=0;k<z;k++){q=f.__webglObjects[k];if(q.render){w=q.object;y=q.buffer;v=q.transparent;m(w);for(q=0;q<v.count;q++){x=v.list[q];ma(x.blending);j(x.depthTest);h(s,D,B,x,y,w)}}}for(k=0;k<t;k++){q=f.__webglObjectsImmediate[k];w=q.object;if(w.visible){v=q.transparent;m(w);for(q=0;q<v.count;q++){x=v.list[q];ma(x.blending);j(x.depthTest);A=e(s,D,B,x,w);w.render(function(N){g(N,A,x.shading)})}}}Sa&&f.__webglShadowVolumes.length&&f.lights.length&&H(f);f.__webglLensFlares.length&&L(f,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(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,k=void 0,q=void 0,A=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=
+new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){q=s.geometry;q.geometryGroups==undefined&&O(q);for(k in q.geometryGroups){A=q.geometryGroups[k];if(!A.__webglVertexBuffer){var v=A;v.__webglVertexBuffer=c.createBuffer();v.__webglNormalBuffer=c.createBuffer();v.__webglTangentBuffer=c.createBuffer();v.__webglColorBuffer=c.createBuffer();v.__webglUVBuffer=c.createBuffer();
+v.__webglUV2Buffer=c.createBuffer();v.__webglSkinVertexABuffer=c.createBuffer();v.__webglSkinVertexBBuffer=c.createBuffer();v.__webglSkinIndicesBuffer=c.createBuffer();v.__webglSkinWeightsBuffer=c.createBuffer();v.__webglFaceBuffer=c.createBuffer();v.__webglLineBuffer=c.createBuffer();if(v.numMorphTargets){var x=void 0,z=void 0;v.__webglMorphTargetsBuffers=[];x=0;for(z=v.numMorphTargets;x<z;x++)v.__webglMorphTargetsBuffers.push(c.createBuffer())}v=A;x=s;var t=void 0,w=void 0,y=void 0;y=void 0;var D=
+void 0,B=void 0,N=void 0,W=N=z=0;w=void 0;y=void 0;var P=void 0;t=void 0;w=void 0;D=x.geometry;P=D.faces;B=v.faces;t=0;for(w=B.length;t<w;t++){y=B[t];y=P[y];if(y instanceof THREE.Face3){z+=3;N+=1;W+=3}else if(y instanceof THREE.Face4){z+=4;N+=2;W+=4}}t=v;w=x;P=void 0;B=void 0;var T=void 0,Ha=void 0;T=void 0;y=[];P=0;for(B=w.materials.length;P<B;P++){T=w.materials[P];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=t.materials.length;T<l;T++)(Ha=t.materials[T])&&y.push(Ha)}else(Ha=T)&&y.push(Ha)}t=
+y;a:{w=void 0;P=void 0;B=t.length;for(w=0;w<B;w++){P=t[w];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){w=!0;break a}}w=!1}a:{P=void 0;B=void 0;y=t.length;for(P=0;P<y;P++){B=t[P];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){P=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{B=void 0;y=void 0;T=t.length;for(B=0;B<T;B++){y=t[B];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}v.__vertexArray=
+new Float32Array(z*3);if(P)v.__normalArray=new Float32Array(z*3);if(D.hasTangents)v.__tangentArray=new Float32Array(z*4);if(y)v.__colorArray=new Float32Array(z*3);if(w){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)v.__uvArray=new Float32Array(z*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(z*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(z*4);v.__skinVertexBArray=new Float32Array(z*4);v.__skinIndexArray=
+new Float32Array(z*4);v.__skinWeightArray=new Float32Array(z*4)}v.__faceArray=new Uint16Array(N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(W*2);if(v.numMorphTargets){v.__morphTargetsArrays=[];D=0;for(B=v.numMorphTargets;D<B;D++)v.__morphTargetsArrays.push(new Float32Array(z*3))}v.__needsSmoothNormals=P==THREE.SmoothShading;v.__uvType=w;v.__vertexColorType=y;v.__normalType=P;v.__webglFaceCount=N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0);v.__webglLineCount=
+W*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){v.__webglCustomAttributes={};for(a in t[D].attributes){w=t[D].attributes[a];N=1;if(w.type==="v2")N=2;else if(w.type==="v3")N=3;else if(w.type==="v4")N=4;else w.type==="c"&&(N=3);w.size=N;w.needsUpdate=!0;w.array=new Float32Array(z*N);w.buffer=c.createBuffer();v.__webglCustomAttributes[a]=w}}q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}s instanceof THREE.ShadowVolume?
+ca(n.__webglShadowVolumes,A,s):ca(n.__webglObjects,A,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){q=s.geometry;if(!q.__webglVertexBuffer){k=q;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=q;A=k.vertices.length;k.__vertexArray=new Float32Array(A*3);k.__colorArray=new Float32Array(A*3);k.__webglVertexCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else if(s instanceof THREE.Line){q=
+s.geometry;if(!q.__webglVertexBuffer){k=q;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=q;A=k.vertices.length;k.__vertexArray=new Float32Array(A*3);k.__colorArray=new Float32Array(A*3);k.__webglLineCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else if(s instanceof THREE.ParticleSystem){q=s.geometry;if(!q.__webglVertexBuffer){k=q;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=q;A=k.vertices.length;k.__vertexArray=
+new Float32Array(A*3);k.__colorArray=new Float32Array(A*3);k.__sortArray=[];k.__webglParticleCount=A;q.__dirtyVertices=!0;q.__dirtyColors=!0}ca(n.__webglObjects,q,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];n=f;q=void 0;k=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){k=n.__webglObjects[q].object;
+s==k&&n.__webglObjects.splice(q,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)Y(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)Y(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)Y(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="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}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==
 undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};

+ 42 - 20
examples/webgl_collisions_box.html

@@ -1,8 +1,7 @@
-
 <html> 
  
 <head> 
-<title>threej.s webgl - intersection: ray with box</title> 
+<title>three.js webgl - intersection: ray with box</title> 
 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
 <style type="text/css"> 
 
@@ -17,7 +16,7 @@ body {
 
 #info {
 	position: absolute;
-	top: 30px; left: 10px; width: 800px;
+	top: 30px; left: 150px; width: 800px;
 	color: #000000;
 	padding: 5px;
 	font-family: Monospace;
@@ -41,10 +40,11 @@ body {
 
 <script type="text/javascript" src="../build/Three.js"></script> 
 <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+<script type="text/javascript" src="js/Stats.js"></script>
 
-<script type="text/javascript"> 
+<script type="text/javascript">
 
-var scene, camera, renderer, info, mouse2d, sun, cube, ghostCube;
+var scene, camera, renderer, info, mouse2d, sun, cube;
 
 var bounce = 0;
 
@@ -72,50 +72,67 @@ function init() {
 	sun.position = camera.position.clone();
 	scene.addLight( sun );
 	
-	createCube(200, new THREE.Vector3(0,0,0) );
+	createCube( 200, new THREE.Vector3( 0,0,0 ) );
+
+	stats = new Stats();
+	stats.domElement.style.position = 'absolute';
+	stats.domElement.style.top = '0px';
+	container.appendChild( stats.domElement );
 
 	container.onmousemove = onDocumentMouseMove;
 	animate();
+
 }
 
-function createCube(s, p) {
+function createCube( s, p ) {
 	
 	cube = new THREE.Mesh ( 	
-		new Cube(s,s,s,1,1,1), 
+		new Cube( s,s,s, 1,1,1 ), 
 		new THREE.MeshLambertMaterial( { color: 0x003300 })
 	);
 
 	cube.position = p;
 	scene.addObject( cube );
-	THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) );
-}
+
+	THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB( cube ) );
+
+};
 
 function onDocumentMouseMove( event ) {
+
 	event.preventDefault();	
 	mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
 	mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 	mouse2d.z = 1;
-}
+
+};
 
 function animate() {
+
 	requestAnimationFrame( animate );
 	
 	var r = new THREE.Ray();
-	r.origin = mouse2d.clone();
+	r.origin.copy( mouse2d );
+
 	var matrix = camera.matrixWorld.clone();
 	matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
 	matrix.multiplyVector3( r.origin );
-	r.direction = r.origin.clone().subSelf(camera.position);
+	r.direction = r.origin.clone().subSelf( camera.position );
 
 	info.innerHTML = "";
 
-	var c = THREE.Collisions.rayCastNearest(r);
-	if(c) {
-		info.innerHTML += "Found @ distance " + c.distance;
-		c.mesh.materials[0].color = new THREE.Color(0xaa0000);
+	var c = THREE.Collisions.rayCastNearest( r );
+
+	if( c ) {
+	
+		info.innerHTML += "Found @ distance " + c.distance.toFixed(2);
+		c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+
 	} else {
+
 		info.innerHTML += "No intersection";
-		cube.materials[0].color = new THREE.Color(0x003300);
+		cube.materials[0].color.setHex( 0x003300 );
+
 	}
 	
 	
@@ -125,12 +142,17 @@ function animate() {
 	bounce += 0.01;
 
 	renderer.render( scene, camera );
-}
+	
+	stats.update();
+
+};
 
 function vts(v) {
+
 	if(!v) return "undefined<br>";
 	else return v.x + " , " + v.y + " , " + v.z + "<br>";
-}
+
+};
 
 </script>
 

+ 65 - 28
examples/webgl_collisions_mesh.html

@@ -41,10 +41,11 @@ body {
  
 <script type="text/javascript" src="../build/Three.js"></script> 
 <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+<script type="text/javascript" src="js/Stats.js"></script>
 
 <script type="text/javascript"> 
 
-var scene, camera, renderer, info, mouse2d, sun, loader;
+var scene, camera, renderer, info, mouse2d, sun, loader, stats;
 var meshes = [];
 
 var theta = 0;
@@ -53,7 +54,12 @@ var camdist = 1500;
 var totalFaces = 0;
 var totalColliders = 0;
 
+var ray = new THREE.Ray();
+var matrix = new THREE.Matrix4(),
+	matrix2 = new THREE.Matrix4();
+
 function init() {
+
 	container = document.createElement( 'div' );
 	document.body.appendChild( container );
 	
@@ -69,7 +75,7 @@ function init() {
 
 	renderer = new THREE.WebGLRenderer();
 	renderer.setSize( window.innerWidth, window.innerHeight );
-	container.appendChild(renderer.domElement);
+	container.appendChild( renderer.domElement );
 	
 	var ambientLight = new THREE.AmbientLight( 0x606060 );
 	scene.addLight( ambientLight );
@@ -80,12 +86,20 @@ function init() {
 	
 	loadCube();
 
+	stats = new Stats();
+	stats.domElement.style.position = 'absolute';
+	stats.domElement.style.top = '0px';
+	container.appendChild( stats.domElement );
+
 	container.onmousemove = onDocumentMouseMove;
 	animate();
+
 }
 
 function loadCube(p) {
-	var onGeometry = function( geometry ) {		
+
+	var onGeometry = function( geometry ) {	
+	
 		var sx = 300;
 		var sy = 240;
 		var sz = 300;
@@ -138,7 +152,7 @@ function loadCube(p) {
 		addCube( new THREE.Vector3(	0, -sy,	-sz*2), geometry );
 		addCube( new THREE.Vector3( sx,-sy,	-sz*2), geometry );
 		
-		info.innerHTML = "Total colliders: " + totalColliders + " (Faces: " + totalFaces + ")<br>";
+		//info.innerHTML = "Total colliders: " + totalColliders + " (Faces: " + totalFaces + ")<br>";
 	
 	};
 
@@ -146,9 +160,11 @@ function loadCube(p) {
 	loader.load( { model: "obj/suzanne/suzanneHi.js", callback: onGeometry } );
 }
 
-function addCube(p, g){
+function addCube( p, g) {
+
 	totalFaces += g.faces.length;
 	totalColliders++;
+
 	var mesh = new THREE.Mesh( g, new THREE.MeshLambertMaterial( { color: 0x003300 } ) );
 	mesh.position = p;
 	
@@ -163,57 +179,78 @@ function addCube(p, g){
 	scene.addObject( mesh );
 	var mc = THREE.CollisionUtils.MeshColliderWBox(mesh);
 	THREE.Collisions.colliders.push( mc );
-	meshes.push(mesh);
-}
+	meshes.push( mesh );
+
+};
 
 function onDocumentMouseMove( event ) {
+
 	event.preventDefault();	
 	mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
 	mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 	mouse2d.z = 1;
-}
+
+};
+
 
 function animate() {
+
 	requestAnimationFrame( animate );
 	
-	var r = new THREE.Ray();
-	r.origin = mouse2d.clone();
-	var matrix = camera.matrixWorld.clone();
-	matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
-	matrix.multiplyVector3( r.origin );
-	r.direction = r.origin.clone().subSelf(camera.position);
+	ray.origin.copy( mouse2d );
+
+	matrix.copy( camera.matrixWorld );
+	matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix, matrix2 ) );
+	matrix.multiplyVector3( ray.origin );
+	
+	ray.direction.copy( ray.origin );
+	ray.direction.subSelf( camera.position );
 	
-	if(meshes.length == 0) return;
+	if( meshes.length == 0 ) return;
 	
-	for (var i = 0; i < meshes.length; i++) {
-		meshes[i].materials[0].color = new THREE.Color(0x003300);
-	}
+	var i, l = meshes.length;
 	
-	info.innerHTML = "";
+	for ( i = 0; i < l; i++ ) {
 
-	var c = THREE.Collisions.rayCastNearest(r);
+		meshes[ i ].materials[ 0 ].color.setHex( 0x003300 );
+
+	}
+
+
+	var c = THREE.Collisions.rayCastNearest( ray );
+	
+	if( c ) {
 	
-	if(c) {
 		//info.innerHTML += "Found @ distance " + c.distance;
-		c.mesh.materials[0].color = new THREE.Color(0xbb0000);
+		c.mesh.materials[ 0 ].color.setHex( 0xbb0000 );
+
 	} else {
+	
 		//info.innerHTML += "No intersection";
+
 	}
 
-	camera.position.x = camdist * Math.cos(theta);
-	camera.position.z = camdist * Math.sin(theta);
-	camera.position.y = camdist/2 * Math.sin(theta * 2);
-	sun.position = camera.position.clone();
+	camera.position.x = camdist * Math.cos( theta );
+	camera.position.z = camdist * Math.sin( theta );
+	camera.position.y = camdist/2 * Math.sin( theta * 2) ;
+
+	sun.position.copy( camera.position );
 	sun.position.normalize();
+
 	theta += 0.005;		
 
 	renderer.render( scene, camera );
-}
+	
+	stats.update();
+	
+};
 
 function vts(v) {
+
 	if(!v) return "undefined<br>";
 	else return v.x + " , " + v.y + " , " + v.z + "<br>";
-}
+
+};
 
 </script>
 

+ 45 - 21
examples/webgl_collisions_primitives.html

@@ -18,7 +18,7 @@
             #info {
                 position: absolute;
                 top: 30px;
-                left: 10px;
+                left: 150px;
                 width: 800px;
                 color: #000000;
                 padding: 5px;
@@ -31,7 +31,7 @@
             #options {
                 position: absolute;
                 top: 10px;
-                left: 10px;
+                left: 150px;
                 width: 800px;
                 color: #000000;
                 padding: 5px;
@@ -42,10 +42,10 @@
             }
             
         </style>
-        <script type="text/javascript" src="../build/Three.js">
-        </script>
-        <script type="text/javascript" src="js/RequestAnimationFrame.js">
-        </script>
+        <script type="text/javascript" src="../build/Three.js"></script>
+        <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+		
         <script type="text/javascript">
             
             var scene, camera, renderer, info, mouse2d, sun;
@@ -97,8 +97,14 @@
                 cplane.mesh = plane;
                 THREE.Collisions.colliders.push(cplane);
                 
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+				
                 container.onmousemove = onDocumentMouseMove;
                 animate();
+
             }
             
             function makeWall(z){
@@ -157,33 +163,49 @@
                     geoms[i].materials[0].color = new THREE.Color(0x007700);
                 }
                 
-                if (!document.getElementById("nearest").checked) {
+                if ( !document.getElementById( "nearest" ).checked ) {
+
                     // Raycast all
+
                     ts = new Date().getTime();
-                    var cs = THREE.Collisions.rayCastAll(r);
+                    var cs = THREE.Collisions.rayCastAll( r );
                     tt = new Date().getTime() - ts;
-                    if (cs.length > 0) {
+
+                    if ( cs.length > 0 ) {
+
                         info.innerHTML = cs.length + " colliders found in " + tt;
-                        for (var i = 0; i < cs.length; i++) {
-                            cs[i].mesh.materials[0].color = new THREE.Color(0xaa0000);
+
+                        for ( var i = 0; i < cs.length; i++ ) {
+						
+                            cs[ i ].mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+
                         }
-                    }
-                    else {
+
+                    } else {
+
                         info.innerHTML = "No intersection";
+
                     }
-                }
-                else {
+
+                } else {
+				
                     // Raycast nearest
+
                     ts = new Date().getTime();
-                    var c = THREE.Collisions.rayCastNearest(r);
+                    var c = THREE.Collisions.rayCastNearest( r );
                     tt = new Date().getTime() - ts;
-                    if (c) {
+
+                    if ( c ) {
+
                         info.innerHTML = "Found in " + tt + " @ distance " + c.distance;
-                        c.mesh.materials[0].color = new THREE.Color(0xaa0000);
-                    }
-                    else {
+                        c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
+
+                    } else {
+
                         info.innerHTML = "No intersection";
+
                     }
+
                 }
                 
                 camera.position.x = camdist * Math.cos(theta);
@@ -193,7 +215,9 @@
                 sun.position.normalize();
                 theta += 0.005;
                 
-                renderer.render(scene, camera);
+                renderer.render( scene, camera );
+				
+				stats.update();
             }
             
             function vts(v){

+ 7 - 4
src/extras/objects/MarchingCubes.js

@@ -603,12 +603,14 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 	this.generateGeometry = function() {
 		
 		var start = 0, geo = new THREE.Geometry();
+		var normals = [];
 		
 		var geo_callback = function( object ) {
 			
 			var i, x, y, z, vertex, position, normal, 
 				face, a, b, c, na, nb, nc;
 			
+			
 			for( i = 0; i < object.count; i++ ) {
 				
 				a = i * 3;
@@ -626,9 +628,10 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 				normal = new THREE.Vector3( x, y, z );
 				normal.normalize();
 				
-				vertex = new THREE.Vertex( position, normal );
+				vertex = new THREE.Vertex( position );
 				
 				geo.vertices.push( vertex );
+				normals.push( normal );
 				
 			}
 			
@@ -640,9 +643,9 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 				b = a + 1;
 				c = a + 2;
 
-				na = geo.vertices[ a ].normal;
-				nb = geo.vertices[ b ].normal;
-				nc = geo.vertices[ c ].normal;
+				na = normals[ a ];
+				nb = normals[ b ];
+				nc = normals[ c ];
 				
 				face = new THREE.Face3( a, b, c, [ na, nb, nc ] );
 				

+ 1 - 1
src/objects/Mesh.js

@@ -23,7 +23,7 @@ THREE.Mesh = function ( geometry, materials ) {
 
 		if( !this.geometry.boundingSphere ) {
 
-			 this.geometry.computeBoundingSphere();
+			this.geometry.computeBoundingSphere();
 
 		}
 

+ 46 - 31
src/physics/Collisions.js

@@ -2,19 +2,19 @@
  * @author drojdjou / http://everyday3d.com/
  */
 
-THREE.PlaneCollider = function( pt, nor ) {
+THREE.PlaneCollider = function( point, normal ) {
 
-	this.point = pt;
-	this.normal = nor;
+	this.point = point;
+	this.normal = normal;
 
 };
 
 
-THREE.SphereCollider = function( cen, rad ) {
+THREE.SphereCollider = function( center, radius ) {
 
-	this.center = cen;
-	this.radius = rad;
-	this.radiusSq = rad * rad;
+	this.center = center;
+	this.radius = radius;
+	this.radiusSq = radius * radius;
 
 };
 
@@ -45,25 +45,29 @@ THREE.CollisionSystem = function() {
 
 THREE.Collisions = new THREE.CollisionSystem();
 
-THREE.CollisionSystem.prototype.rayCastAll = function( r ) {
+THREE.CollisionSystem.prototype.rayCastAll = function( ray ) {
 
-	r.direction.normalize();
+	ray.direction.normalize();
 
-	var ld = 0;	
 	this.hits.length = 0;
+
+	var i, l, d, collider,
+		ld = 0;	
 	
-	for ( var i = 0; i < this.colliders.length; i++ ) {
+	for ( i = 0, l = this.colliders.length; i < l; i++ ) {
 
-		var d = this.rayCast( r, this.colliders[ i ] );	
+		collider = this.colliders[ i ];
+		
+		d = this.rayCast( ray, collider );	
 		
 		if ( d < Number.MAX_VALUE ) {
 
-			this.colliders[ i ].distance = d;
+			collider.distance = d;
 
 			if ( d > ld ) 
-				this.hits.push( this.colliders[ i ] );
+				this.hits.push( collider );
 			else 
-				this.hits.unshift( this.colliders[ i ] );
+				this.hits.unshift( collider );
 
 			ld = d;
 
@@ -75,17 +79,17 @@ THREE.CollisionSystem.prototype.rayCastAll = function( r ) {
 
 };
 
-THREE.CollisionSystem.prototype.rayCastNearest = function( r ) {
+THREE.CollisionSystem.prototype.rayCastNearest = function( ray ) {
 
-	var cs = this.rayCastAll( r );
+	var cs = this.rayCastAll( ray );
 	
 	if( cs.length == 0 ) return null;
 	
 	var i = 0;
 
-	while( cs[i] instanceof THREE.MeshCollider ) {
+	while( cs[ i ] instanceof THREE.MeshCollider ) {
 
-		var d = this.rayMesh( r, cs[ i ] );
+		var d = this.rayMesh( ray, cs[ i ] );
 
 		if( d < Number.MAX_VALUE ) {
 
@@ -143,26 +147,32 @@ THREE.CollisionSystem.prototype.rayMesh = function( r, me ) {
 
 };
 
-THREE.CollisionSystem.prototype.rayTriangle = function( r, p0, p1, p2, n, mind ) {
-
-	//if (!n) {
-		var e1 = new THREE.Vector3().sub( p1, p0 );
-		var e2 = new THREE.Vector3().sub( p2, p1 );
-		n = new THREE.Vector3().cross( e1, e2 );
-	//}
+THREE.CollisionSystem.prototype.rayTriangle = function( ray, p0, p1, p2, n, mind ) {
+	
+	var e1 = THREE.CollisionSystem.__v1, 
+		e2 = THREE.CollisionSystem.__v2;
+	
+	e1.sub( p1, p0 );
+	e2.sub( p2, p1 );
+	n.cross( e1, e2 )
 	
-	var dot = n.dot( r.direction );
+	var dot = n.dot( ray.direction );
 	if ( !( dot < 0 ) ) return Number.MAX_VALUE;
 
 	var d = n.dot( p0 );
-	var t = d - n.dot( r.origin );
+	var t = d - n.dot( ray.origin );
 	
 	if ( !( t <= 0 ) ) return Number.MAX_VALUE;
 	if ( !( t >= dot * mind ) ) return Number.MAX_VALUE;
 	
 	t = t / dot;
 
-	var p = r.origin.clone().addSelf( r.direction.clone().multiplyScalar( t ) );
+	var p = THREE.CollisionSystem.__v3;
+
+	p.copy( ray.direction );
+	p.multiplyScalar( t );
+	p.addSelf( ray.origin );
+	
 	var u0, u1, u2, v0, v1, v2;
 
 	if ( Math.abs( n.x ) > Math.abs( n.y ) ) {
@@ -236,9 +246,9 @@ THREE.CollisionSystem.prototype.rayTriangle = function( r, p0, p1, p2, n, mind )
 
 };
 
-THREE.CollisionSystem.prototype.makeRayLocal = function( r, m ) {
+THREE.CollisionSystem.prototype.makeRayLocal = function( ray, m ) {
 
-	var rt = new THREE.Ray( r.origin.clone(), r.direction.clone() );
+	var rt = new THREE.Ray( ray.origin.clone(), ray.direction.clone() );
 	var mt = THREE.Matrix4.makeInvert( m.matrixWorld );
 
 	mt.multiplyVector3( rt.origin );
@@ -404,6 +414,11 @@ THREE.CollisionSystem.prototype.raySphere = function( r, s ) {
 
 };
 
+THREE.CollisionSystem.__v1 = new THREE.Vector3();
+THREE.CollisionSystem.__v2 = new THREE.Vector3();
+THREE.CollisionSystem.__v3 = new THREE.Vector3();
+
+
 
 
 

+ 47 - 3
src/renderers/WebGLRenderer.js

@@ -2630,7 +2630,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	}
 
 
-	function renderBufferImmediate( object, program ) {
+	function renderBufferImmediate( object, program, shading ) {
 
 		if ( ! object.__webglVertexBuffer ) object.__webglVertexBuffer = _gl.createBuffer();
 		if ( ! object.__webglNormalBuffer ) object.__webglNormalBuffer = _gl.createBuffer();
@@ -2647,6 +2647,50 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( object.hasNormal ) {
 
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglNormalBuffer );
+
+			if ( shading == THREE.FlatShading ) {
+
+				var nx, ny, nz,
+					nax, nbx, ncx, nay, nby, ncy, naz, nbz, ncz,
+					normalArray,
+					i, il = object.count * 3;
+
+				for( i = 0; i < il; i += 9 ) {
+
+					normalArray = object.normalArray;
+
+					nax  = normalArray[ i ];
+					nay  = normalArray[ i + 1 ];
+					naz  = normalArray[ i + 2 ];
+
+					nbx  = normalArray[ i + 3 ];
+					nby  = normalArray[ i + 4 ];
+					nbz  = normalArray[ i + 5 ];
+
+					ncx  = normalArray[ i + 6 ];
+					ncy  = normalArray[ i + 7 ];
+					ncz  = normalArray[ i + 8 ];
+
+					nx = ( nax + nbx + ncx ) / 3;
+					ny = ( nay + nby + ncy ) / 3;
+					nz = ( naz + nbz + ncz ) / 3;
+
+					normalArray[ i ] 	 = nx; 
+					normalArray[ i + 1 ] = ny;
+					normalArray[ i + 2 ] = nz;
+
+					normalArray[ i + 3 ] = nx; 
+					normalArray[ i + 4 ] = ny;
+					normalArray[ i + 5 ] = nz;
+
+					normalArray[ i + 6 ] = nx; 
+					normalArray[ i + 7 ] = ny;
+					normalArray[ i + 8 ] = nz;
+
+				}
+
+			}
+
 			_gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW );
 			_gl.enableVertexAttribArray( program.attributes.normal );
 			_gl.vertexAttribPointer( program.attributes.normal, 3, _gl.FLOAT, false, 0, 0 );
@@ -2968,7 +3012,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					setDepthTest( material.depthTest );
 
 					program = setProgram( camera, lights, fog, material, object );
-					object.render( function( object ) { renderBufferImmediate( object, program ); } );
+					object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
 
 				}
 
@@ -3026,7 +3070,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					setDepthTest( material.depthTest );
 
 					program = setProgram( camera, lights, fog, material, object );
-					object.render( function( object ) { renderBufferImmediate( object, program ); } );
+					object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
 
 				}
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä